• Drawing colored points/lines/triangles with vbo's ?

    From skybuck2000@hotmail.com@21:1/5 to All on Thu Feb 27 02:28:14 2020
    I just updated my opengl framework. What I am trying to do is something as follows:

    1. create color buffer object (vbo with gl_array_buffer)

    2. create position buffer object (vbo with gl_array_buffer)

    3. enable client state for gl_color_array

    4. enable client state for gl_vertex_array

    5. create these vbos and define them with bind and glColorPointer and glVertexPointer

    6. upload some data with glBufferData... first these are created with nil pointer and later updated with glSubBufferData

    Then during drawing

    bind both
    define both
    glDrawArrays

    swapbuffers and such is also used...

    Two vertex buffer objects are created.

    One contains color data, r,g,b,a, 1 byte each component.
    One contains position data, x,y 4 bytes each.

    Or x,y,z 4 bytes each, thus record size 12

    Now when glDrawArrays is called with mode GL_LINES I do see some lines on the screen but just a few, there should be many more.

    It seems the lines go to the upper left corner.

    These are randomized lines based on width and height and such.

    Any idea what could be wrong ?

    I assume one color buffer and one position buffer, thus two vbo's should be enough for points,lines, triangles and so forth ?

    Now I am a little bit wondering if maybe two positions vbos need to be used, for each line vertex, probably not though... so something else must be wrong.

    Anyway tomorrow I will check booleans/return codes some more and maybe make easier example to see if problem remains.

    I am a little bit fuzy about which api's to call in which order ?

    For example:

    glBind
    glEnableClientSTate
    glVertexPointer
    glColorPointer
    glDrawArrays
    glFlush
    SwapBuffers


    Hmm

    Bye,
    Skybuck.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)