Results 1 to 7 of 7

Thread: VBO, array indices and mapping

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2003
    Location
    Grenoble, France
    Posts
    8

    VBO, array indices and mapping

    Hi!

    I have a strange problem with VBO, making my openGL library to crash.

    What I want to do is to map into the client's address space an "array indices".

    Here is my code:
    glGenBuffersARB(1,&data);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB,&data);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, bufferData, GL_DYNAMIC_DRAW_ARB);

    pData = glMapBufferARB(GL_ARRAY_BUFFER_ARB,GL_READ_WRITE_A RB);
    // Everything is fine!
    glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
    glBindBufferARB(GL_ARRAY_BUFFER_ARB,0);

    glGenBuffersARB(1,&index);
    glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,&index );
    glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 100, bufferIndex, GL_DYNAMIC_DRAW_ARB);

    // Here I have a crash
    pIndices = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,GL_READ _WRITE_ARB);
    //

    What am I doing wrong? Is there a bug in my driver?

    Thanks

  2. #2
    Senior Member Frequent Contributor
    Join Date
    May 2001
    Location
    France
    Posts
    765

    Re: VBO, array indices and mapping

    Originally posted by Evan Meakyl:
    What am I doing wrong?
    When you declare something like :
    GLuint data;
    the value of this data is 'data' and the pointer is '&data', right ?

    So, what you wrote here is correct :
    glGenBuffersARB(1,&data);

    But what you wrote here is NOT correct :
    glBindBufferARB(GL_ARRAY_BUFFER_ARB,&data);

    You may write instead :
    glBindBufferARB(GL_ARRAY_BUFFER_ARB,data);

    Note that you've done the same mistake in both vertex buffer objects. If it works for the first and crashes for the second, it's just a matter of chance because both is incorrect.

    [This message has been edited by vincoof (edited 09-03-2003).]

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2003
    Location
    Grenoble, France
    Posts
    8

    Re: VBO, array indices and mapping

    You're right - but it is a typo mistake in the example I gave you (It's not my real program...)

    I found that when I do a
    glGetBufferParameterivARB( GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &Size );
    just after the glBufferDataARB, the size is 0...

    But in the registry we can read:
    "BufferDataARB returns no value and sets OUT_OF_MEMORY if the buffer could not be created".

    In this case, I think the buffer isn't created, because its size is 0 which is a bit different from what I wanted... but I have no OpenGL error (I've checked).

    Am I misinterpreting?

  4. #4
    Senior Member Frequent Contributor
    Join Date
    May 2001
    Location
    France
    Posts
    765

    Re: VBO, array indices and mapping

    Aren't you using the linux NVIDIA driver on GF2 or GF4MX ? I've seen exactly the same problem on this configuration.

  5. #5
    Junior Member Newbie
    Join Date
    Sep 2003
    Location
    Grenoble, France
    Posts
    8

    Re: VBO, array indices and mapping

    Not really ... I am using ATI openGL library on Windows, with my All In Wonder Radeon 32 Mo ddr.

    For me, it was a bug in the driver, but if you've got the same result with another implementation, it looks like it's us who are doing something wrong...

    I have also found a program which uses VBO and GL_ELEMENT_ARRAY ( on Codesampler : http://www.codesampler.com/source/ogl_vertex_buffer_objects.zip )
    and I also have an error!


    [This message has been edited by Evan Meakyl (edited 09-03-2003).]

  6. #6
    Senior Member Frequent Contributor
    Join Date
    May 2001
    Location
    France
    Posts
    765

    Re: VBO, array indices and mapping

    This example works on my Radeon8500 with the latest drivers, under Win2000.
    I get no error, no crash, no problem of any kind.

  7. #7
    Junior Member Newbie
    Join Date
    Sep 2003
    Location
    Grenoble, France
    Posts
    8

    Re: VBO, array indices and mapping

    ok I will report to ATI... (I have the latest drivers installed)

    Thanks a lot vincoof!

    [This message has been edited by Evan Meakyl (edited 09-04-2003).]

Similar Threads

  1. Generate Indices array from Vertex array
    By VirtualMan in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-28-2013, 02:51 AM
  2. build indices array at runtime
    By airtruk in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-23-2011, 08:57 PM
  3. Using attributes as indices into a matrix array
    By Jan in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 08-04-2004, 12:01 PM
  4. non-constant array indices for uniforms...
    By Jixer in forum OpenGL: GLSL
    Replies: 7
    Last Post: 03-24-2004, 02:36 PM
  5. What's the formula for number of indices for a vertex array?
    By swiych in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-16-2003, 05:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean