Another interesting GLEW error

Hello guys,

I have been having this error for several weeks now and have not found solution. I recompiled glew sources, added everything to correct folders and I am still getting this error:

The procedure entry point __glewBindVertexArray could not be located in the dynamic link library glew32.dll

Anyone ever had same problem ? Do you know what the solution might be?

Thanks a lot for your answers.

Btw my device is: Nvidia GT 240GM (OGL ver 3.30)

You need to give more precise information. Do you have a minimal code that demonstrates the problem? What exactly is the link error? Or is this a runtime error? What compiler?

This code runs OK in another PC and wherever I call glBindVertexArray or glGenVertexArrays program fails. It is a runtime error(or at least error shows up on start and program immediately crashes after clicking OK button), since I use MS visual studio 2010 ultimate it is their default compiler.

Could file glew32.dll be corrupted somehow?

I doubt glew32.dll is corrupted. Your clues actually sound like your openGL drivers may not be what you expect.

Since you compile glew … run “glewinfo.exe” and if I remember correctly on windows this will create a glewinfo.txt file.

What does the top few lines say


GLEW version 1.6.0
Reporting capabilities of display :0, visual 0x2b
Running on a GeForce GTX 465/PCI/SSE2 from NVIDIA Corporation
OpenGL version 4.2.0 NVIDIA 290.10 is supported

Also look for lines with glBindVertexArray and glGenVertexArrays.
Confirm it says “OK”. if it says “missing” then you have a driver problem


GL_ARB_vertex_array_object:                                    OK 
---------------------------
  glBindVertexArray:                                           OK
  glDeleteVertexArrays:                                        OK
  glGenVertexArrays:                                           OK
  glIsVertexArray:                                             OK

Post this information and that might help debug your problem.

One other thing to try, add just before initializing with glewInit


glewExperimental = GL_TRUE;
glewInit();

Thanks for your effort :slight_smile:


GLEW Extension Info

GLEW version 1.7.0
Reporting capabilities of pixelformat 1
Running on a GeForce GT 240M/PCI/SSE2 from NVIDIA Corporation
OpenGL version 3.3.0 is supported

GL_ARB_vertex_array_object: OK

glBindVertexArray: OK
glDeleteVertexArrays: OK
glGenVertexArrays: OK
glIsVertexArray: OK

Ok so this is what it spitted out. Everything seems to be normal. I also tried glewExperimental = GL_TRUE; and still nothing :stuck_out_tongue:

This result suggests that glew32.dll is not the problem. How are you getting GL contextx? Using freeglut/sdl/other?

Are you absolutely certain that you are calling glewInit before calling glBindVertexArray and glGenVertexArrays? Sometimes possible mistake. These will be NULL pointers until glewInit() is called.

Some more piece of information, can you report back what the following says if place in your code just after glewInit()


printf("OpenGL %s, GLSL %s
", 
                 glGetString(GL_VERSION),
                 glGetString(GL_SHADING_LANGUAGE_VERSION));

if (glBindVertexArray==NULL) {printf("glBindVertexArray==NULL
"); exit(-1);};
if (glGenVertexArrays==NULL) {printf("glGenVertexArrays==NULL
"); exit(-2);};

something like following should be reported?
OpenGL 4.1.0 NVIDIA 290.10, GLSL 4.10 NVIDIA via Cg compiler

You may want to temporarily put these above if-tests just before any call to glBindVertexArray and glGenVertexArrays as a definitive test. This is not something needed in normal practice but just a useful debug tool now.

I am using glut(http://www.opengl.org/resources/libraries/glut/glut_downloads.php). Interesting is that this code runs fine on another computer, so everything seems to be ok with code.

I am callin everything in order(a ssuming it would not be runable on different system). When i put

printf("OpenGL %s, GLSL %s
",glGetString(GL_VERSION),glGetString(GL_SHADING_LANGUAGE_VERSION)); 

i get

              
GLSL:3.30
OpenGL:3.3.0 NVIDIA via Cg compiler

after calling

 
if (glBindVertexArray==NULL) {printf("glBindVertexArray==NULL
"); exit(-1);};
if (glGenVertexArrays==NULL) {printf("glGenVertexArrays==NULL
"); exit(-2);};

it wont even show up in command line, because program immediately reports error and crashes. So i tried to put it into new code withou calling glGenVertexArrays(arr) and result is the same.

order of calling:


InitGlut(argc, argv);
	glewExperimental = GL_TRUE;
	glewInit();
	
	GLInit();

	CheckVersions();

	GlutCallbacks();

	CreateFirstShader();

	glutMainLoop();
	return 0;


void GLInit()
{
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glShadeModel(GL_FLAT);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_TEXTURE_2D);
	
	glGenVertexArrays(3, VAOHandle);
	
	objectLoad(VAOHandle[1], spheretNumVerts, spheretVerts, spheretNormals, spheretTexCoords);

	earthDayHandle = SOIL_load_OGL_texture
	(
		"earthday.png",
		SOIL_LOAD_RGB,
		SOIL_CREATE_NEW_ID,
		0
	);

	earthNightHandle = SOIL_load_OGL_texture
	(
		"earthnight.jpg",
		SOIL_LOAD_RGB,
		SOIL_CREATE_NEW_ID,
		0
	);
}


Maybe a silly question, but VAOHandle is an array of size 3 is it? And you’re not trying to access VAOHandle[3] anywhere?

No I am not :slight_smile: but thanks for question

Just had to double-check. :wink:

Ok, lets try a helloworld code that only depends on GL, GLUT, and GLEW. Does the following compile and run successfully on your troubled setup?

you should see some text to stdout and a blue rectangle


$ on my machine the console text result is: 
OpenGL 4.2.0 NVIDIA 290.10, GLSL 4.20 NVIDIA via Cg compiler
Quiting, so cleanup GL shader resources

p.s. I have stopped using glut from your referenced source ( it hasn’t been updated for multiple years) and have gone with freeglut instead … but don’t worry about that yet. Just try the following code with your current libraries.


#include <stdio.h>
#include <GL/glew.h>
#include <GL/glut.h>

GLuint program;
GLuint vao;
GLuint bon_vert; // buffer object name
size_t VertexArrayCount;

void cleanupGLshader(void) {
  printf("Quiting, so cleanup GL shader resources
");
  glDeleteBuffers(1,&bon_vert);
  glDeleteVertexArrays(1,&vao);
  glDeleteProgram(program);
}

void initGLshader(void) 
{
  //Create shaders for shader program
  GLuint vshader=glCreateShader(GL_VERTEX_SHADER);
  GLuint fshader=glCreateShader(GL_FRAGMENT_SHADER);

  const GLchar *vshader_source[] = 
  {
  "#version 150 core
"
  "
"
  "in vec3 vert;
"
  "
"
  "void main() {
"
  "  gl_Position=vec4(vert,1.);
"
  "}
"
  "
"
  };
  glShaderSource(vshader,1,vshader_source,NULL);

  const GLchar *fshader_source[] = 
  {
  "#version 150 core
"
  "out vec4 fragcolor;
"
  "
"
  "void main() {
"
  "
"
  "  fragcolor=vec4(0.0f,0.0f,1.0f,0.0f);
"
  "}
"
  "
"
  };
  glShaderSource(fshader,1,fshader_source,NULL);

  glCompileShader(vshader);
  glCompileShader(fshader);

  //Create shader program
  program=glCreateProgram();
  glAttachShader(program,vshader);
  glAttachShader(program,fshader);
  glLinkProgram(program);
  glUseProgram(program);

  //done with shader source
  glDeleteShader(fshader);
  glDeleteShader(vshader);

  //Get handles to shader uniforms
  //... none for this simple vert/frag shader

  //Datas destioned for video memory, can be local (and lost after bound to GPU!). 
  #define R 0.9
  GLfloat vertices[] = { // in vec3 vert;
    -R,  R, 0.0, // xyz 
    -R, -R, 0.0, 
     R,  R, 0.0,
     R, -R, 0.0
   };
   VertexArrayCount=sizeof(vertices)/(sizeof(GLfloat)*3); // 3 for {x y z}

  //Create geometry vertex array using Model definition
  //use global GLuint vao;
  glGenVertexArrays(1,&vao);
  glBindVertexArray(vao);

  //in vec3 vert;
  //use global GLuint bon_vert; // buffer object name
  glGenBuffers(1,&bon_vert);
  glBindBuffer(GL_ARRAY_BUFFER,bon_vert);
  glBufferData(GL_ARRAY_BUFFER,sizeof(GLfloat)*3*VertexArrayCount,vertices,GL_STATIC_DRAW);
  const GLint loc_vert(glGetAttribLocation(program,"vert"));
  glVertexAttribPointer(loc_vert,3,GL_FLOAT,GL_TRUE,0,NULL);
  glEnableVertexAttribArray(loc_vert);

  //when exiting delete shared GL resources
  atexit(cleanupGLshader);
}

void reshape(int w, int h)
{
  glViewport(0, 0, w, h);
}

void display()
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glBindVertexArray(vao);
  glDrawArrays(GL_TRIANGLE_STRIP,0,VertexArrayCount);

  glutSwapBuffers();
}

int main(int argc, char **argv)
{
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
  glutCreateWindow("glut glew HelloWorld");
  glutReshapeFunc(reshape);
  glutDisplayFunc(display);

  glewInit();
  printf("OpenGL %s, GLSL %s
", glGetString(GL_VERSION),
       glGetString(GL_SHADING_LANGUAGE_VERSION));

  initGLshader();

  glutMainLoop();
  return 0;
}


Hello,
After compiling your code (thanks for the effort btw :slight_smile: ) I get same error as before, but instead of __glewGenVertexArray it fails on __glewDeleteVertexArrays. Same as before - runtime error, same message.

I have not seen such a persistent error with glew before especially when glewinfo.exe reports these functions as “ok”.

One last long shot along lines of what I dismissed earlier - “Could file glew32.dll be corrupted somehow?” – search your hardrive for all instances of glew32*.dll and glew32*.lib … Is there some older version that is not your recently compiled 1.7 version that is getting used during runtime? Note this is assuming compile/installation of glew along lines of quick search result

Not sure if you have solved this problem or not. I have recently met the same problem, I solved it by just copying the glew32.dll and glew32mx.dll to the folder where my visual studio project is, that solved the problem. hope this helps.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.