Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: driver problem?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2012
    Posts
    2

    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()*3*4);
    quadTexCoordArray=(GLfloat *) malloc(sizeof(GLfloat)*quads.count()*2*4);
    and
    quadNormalsArray=new GLfloat[quads.count()*3];
    quadVertexesArray=new GLfloat[quads.count()*3*4];
    quadTexCoordArray=new GLfloat[quads.count()*2*4];
    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

  2. #2
    Junior Member Regular Contributor CatDog's Avatar
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    227
    Quote Originally Posted by george View Post
    glNormalPointer(3,0,&quadNormalsArray[0]);
    Check the first parameter:

    http://www.opengl.org/sdk/docs/man/x...malPointer.xml

    CatDog

  3. #3
    Member Regular Contributor
    Join Date
    Aug 2008
    Posts
    381
    Normals should be specified per-vertex instead of per-quad, even if the value is repeated over the whole quad, so instead of:
    Code :
    quadNormalsArray =(GLfloat *) malloc(sizeof(GLfloat)*quads.count()*3);
    you should have:
    Code :
    [COLOR=#333333]quadNormalsArray =(GLfloat *) malloc(sizeof(GLfloat)*quads.count()*3*4);[/COLOR]

    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)
    Last edited by Dan Bartlett; 06-04-2012 at 08:20 AM.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Jan 2007
    Posts
    965
    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).

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2012
    Posts
    2

    solved

    the problem was solved
    thank you all for your time

    george

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •