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 10 of 10

Thread: glDrawElements access violation on AMD card, weird behavior

Threaded View

  1. #1
    Member Regular Contributor Nowhere-01's Avatar
    Join Date
    Feb 2011
    Location
    Novosibirsk
    Posts
    251

    Exclamation glDrawElements access violation on AMD card, weird behavior

    hey, yesterday i've finally got my AMD card for test(HD6670) and what a piece of crap it is... i'm talking mostly about drivers. i can't debug. almost everything doesn't work, but no OpenGL errors. best hint i can get - gDebugger catches access violation errors occasionally.

    configuration: win 7 x64, catalyst 13.1, Gigabyte HD 6670, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB.
    my application works flawlessly on my main nVidia card, gDebugger doesn't catch any errors. all deprecated stuff replaced.

    example of code, that doesn't work on AMD:

    //init quad
    Code :
       GLfloat quadVertices[] = {
       -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,         //bottom left corner
       -1.0f,  1.0f, 0.0f, 0.0f, 1.0f,         //top left corner
        1.0f,  1.0f, 0.0f, 1.0f, 1.0f,         //top right corner
        1.0f, -1.0f, 0.0f, 1.0f, 0.0f};      //bottom right corner
     
       GLubyte quadIndices[] = {2,1,0, // first triangle (bottom left - top left - top right)
        3,2,0};                                  // second triangle (bottom left - top right - bottom right)
     
       glGenVertexArrays(1, &quadVertexArrayObjectId);
        glBindVertexArray(quadVertexArrayObjectId);
     
        glGenBuffers(1, &quadVertexBufferId);
        glBindBuffer(GL_ARRAY_BUFFER, quadVertexBufferId); //Bind the vertex buffer
        glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 20, &quadVertices[0], GL_STATIC_DRAW);
     
        glGenBuffers(1, &quadIndexBufferId);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, quadIndexBufferId); //Bind the vertex buffer
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLubyte) * 6, &quadIndices[0], GL_STATIC_DRAW);
     
        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 5, BUFFER_OFFSET(0)); //vertex
        glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 5, BUFFER_OFFSET(12)); //tex coord
        glEnableVertexAttribArray(0);
        glEnableVertexAttribArray(1);
     
        glBindVertexArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, 0);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

    //render sprite for occlusion query:
    Code :
            glBindVertexArray(quadVertexArrayObjectId);
            SShader[3].applyProgram(8);
     
            glBeginQueryARB(GL_SAMPLES_PASSED_ARB, occQueryObject);
            modelViewMatrix = currentViewMatrix * modelMatrix;
            billBoard();
            modelViewMatrix = glm::scale(modelViewMatrix, glm::vec3(occluderScale * 3.0f, occluderScale* 3.0f, 1.0f));
     
            glUniformMatrix4fv(SShader[shaderId].shaderSet[programId].uniform_modelViewMatrix, 1, 0, glm::value_ptr(modelViewMatrix));
            glUniformMatrix4fv(SShader[shaderId].shaderSet[programId].uniform_projectionMatrix, 1, 0, glm::value_ptr(currentProjectionMatrix));
     
            glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0); //access violation with gDebugger
            glEndQueryARB(GL_SAMPLES_PASSED_ARB);

    there are several cases like that in my code. i've checked contents of Framebuffer, this code draws correctly without gDebugger. but conditional rendering doesn't work. neither for these sprites, neither for normal objects, which are not getting any errors on that stage and also draw correctly into occlusion query buffer and gbuffer.

    also, amd doesn't seem to like that:
    Code :
    glBindFramebuffer(GL_FRAMEBUFFER, lightBufferId);
        glBindFramebuffer(GL_READ_FRAMEBUFFER, gBufferId);
        glBlitFramebuffer(0, 0, gBufferWidth, gBufferHeight, 0, 0, screenw, screenh, GL_DEPTH_BUFFER_BIT, GL_NEAREST);

    althrough they don't explain why. just another access violation with gDebugger and nothing working in normal mode;
    maybe i'm doing something embarassing?
    Last edited by Nowhere-01; 02-13-2013 at 04:59 AM.

Posting Permissions

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