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

Thread: OUT_OF_MEMORY error on glDrawArrays

  1. #1
    Intern Contributor
    Join Date
    Sep 2013
    Posts
    70

    OUT_OF_MEMORY error on glDrawArrays

    Hi there.

    I know, this is not supposed to happen, but for some reason I get an OUT_OF_MEMORY error when calling glDrawArrays. Yes I know, it doesnt say anything about that in the reference pages...

    I am checking for gl errors each frame (for debugging purposes) just in case I missed to check after any openGL command. There are no errors at all, unless I insert this line in my program:
    Code :
    glDrawArrays(GL_QUADS, 0, 4);
    If I comment that line out nothing happens, everything works fine. But when its uncommented I get the error.

    Can anybody explain to me why this could happen? Its not even a heavy application or anything, its just a small little test program doing almost nothing.

    Thanks in advance.

  2. #2
    Intern Contributor
    Join Date
    Nov 2011
    Posts
    50
    Does this problem occurs even at FIRST function call or only after few/many of these calls? I'm asking this because if you pass ARRAY(s) by value (and not by reference, to a sub function which will execute glDrawArrays) in some languages it could generates out_of_memory error.

    However please check OpenGL reference: http://www.opengl.org/sdk/docs/man4/...DrawArrays.xml GL_QUADS is not more a supported value. Triangles are always preferred for the most of VGA/GPU architectures....

  3. #3
    Intern Contributor
    Join Date
    Sep 2013
    Posts
    70
    Thank you for the reply. The error is generated the very first time I called glDrawArrays.
    It has been fixed by now, but I did change quite a bit about the program, so I can not tell for sure what change fixed this behavior.
    But I know for sure, that the error was only generated after the call to glDrawArrays since I was checking for errors after each and every gl method call.

    When I use GL_QUADS the driver automatically splits the quad into 2 triangles. I know it would be better to use triangles directly, but this was just a short test program so I didnt care much about the performance.

  4. #4
    Intern Contributor
    Join Date
    Nov 2011
    Posts
    50
    I think it would be useful to read more lines of code, especially those concerning VBO/Array creation.

    Are you using VBOs? If yes: are you using interleaved vertices attributes (PositionNormalTexcoordColor|PositionNormalTextureColor|....etc...) in one single Array or one array for each attrib (Position, Normals, etc)?

    Using VBO it's easy to get errors during glDraw*() functions if attrib arrays have different lengths/counts or if glVertexAttribPointer points to a null/invalid buffer position...

Posting Permissions

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