Driver problem?

hello all

I have a very easy to describe problem
the following code executes without problems and does what i expect to do in an old laptop of mine, runing win xp

When i run it in my new desktop pc (i7 win7 64bit 8Gb ram) with a NVIDIA Quadro FX 580 graphics card,
when executing glDrawArrays, i get
“0xC0000005: Access violation reading location 0x00000000.”

code:
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glBindTexture(GL_TEXTURE_2D,quadTexture);
glVertexPointer(3,GL_FLOAT,0,&quadVertexesArray[0]);
glNormalPointer(3,0,&quadNormalsArray[0]);
glTexCoordPointer(2,GL_FLOAT,0,&quadTexCoordArray[0]);
glDrawArrays(GL_QUADS,0,noOfQuads*4);//0xC0000005: Access violation reading location 0x00000000.

glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

the pointers where initialised using:
quadNormalsArray =(GLfloat *) malloc(sizeof(GLfloat)*quads.count()*3);
quadVertexesArray=(GLfloat *) malloc(sizeof(GLfloat)*quads.count()34);
quadTexCoordArray=(GLfloat *) malloc(sizeof(GLfloat)*quads.count()24);
and
quadNormalsArray=new GLfloat[quads.count()*3];
quadVertexesArray=new GLfloat[quads.count()34];
quadTexCoordArray=new GLfloat[quads.count()24];
with the same result (0xC0000005: Access violation reading location 0x00000000.)

i suspect a driver problem
i have downloaded the latest driver but i get the same…
any idea of what to look for?

i use the latest Qt library and the a QGLWidget (if this is relevant in any way)

thank you for your time
george

Check the first parameter:

http://www.opengl.org/sdk/docs/man/xhtml/glNormalPointer.xml

CatDog

Normals should be specified per-vertex instead of per-quad, even if the value is repeated over the whole quad, so instead of:

quadNormalsArray =(GLfloat *) malloc(sizeof(GLfloat)*quads.count()*3);

you should have:

quadNormalsArray =(GLfloat *) malloc(sizeof(GLfloat)*quads.count()*3*4);

And driver problems are fairly rare unless you’re using brand new functionality, or an infrequently used part of OpenGL.

If you use glGetError after the glNormalPointer it should be returning GL_INVALID_ENUM, because as CatDog said, “3” isn’t a valid value (you probably want to use GL_FLOAT instead)

If there’s a driver problem here then it’s on the old XP machine as this code should not have ran without problems - the behaviour you’re getting on the Windows 7 machine is actually correct (you told it to crash and it crashed).

the problem was solved
thank you all for your time

george

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