#include<iostream>
#include"Glew\glew.h"
#include"freeGlut\freeglut.h"
using namespace std;
int main(int argc, char* argv[])
{
GLint ExtensionCount;
glGetIntegerv(GL_NUM_EXTENSIONS, &ExtensionCount);
cout << ExtensionCount << endl;
return 0;
}
The output of this program is, -858993460
. Why? It should return the number of extensions supported.
If I remove the freeglut.h
header file, the program doesn't run and throws an error message,
error LNK2019: unresolved external symbol __imp__glGetIntegerv@8 referenced in function _main
But, glGetIntegerv
is inside glew.h
. Why removing freeglut.h
would cause an unresolved external error?
EDIT I have OpenGL 3.3 support. Using Radeon 4670 with catalyst 11.6.
@mario & @Banthar yes, thanks. I have to create a context first to use the any Opengl functionality.(yes, even for Opengl 1.1 which comes default with windows.)
glGetIntegerv is not returning garbage. glGetIntegerv returns either a good value, or it does not touch the pointed to address at all. The reason why you see garbage is because the variable is not initialized. This seems like a pedantic comment, but it is actually important to know that glGetIntegerv does not touch the variable if it fails. Thanks @Damon
This bare bone works fine.
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitContextVersion(3,3);
glutInitContextProfile(GLUT_FORWARD_COMPATIBLE);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutCreateWindow("Test");
GLint ExtensionCount;
glGetIntegerv(GL_NUM_EXTENSIONS, &ExtensionCount);
cout << ExtensionCount << endl;
return 0;
}
Are you sure you have opengl 3.0? AFAIK, GL_NUM_EXTENSIONS was added in OpenGL 3.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With