Results 1 to 7 of 7

Thread: how do I use glDrawPrimitive ?

  1. #1
    Senior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Årsunda,gästrikland,Sweden
    Posts
    113

    how do I use glDrawPrimitive ?

    Can anyone explane how to use glDrawPrimitive ?? or where I can find a tutorial about it

    Thanks for your answer

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 1969
    Location
    Munich,Germany
    Posts
    227

    Re: how do I use glDrawPrimitive ?

    hmmm never heard read oer saw anything about that. You sure it is existing?
    yes

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: how do I use glDrawPrimitive ?

    Looks like someone had D3D on their mind as it does have a DrawPrimitive command.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Dec 1969
    Location
    Munich,Germany
    Posts
    227

    Re: how do I use glDrawPrimitive ?

    geee I should have known, that i have to learn something about 3D3 to answer and post questions in here



    [This message has been edited by DaViper (edited 09-03-2001).]
    yes

  5. #5
    Senior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Årsunda,gästrikland,Sweden
    Posts
    113

    Re: how do I use glDrawPrimitive ?

    ops.. it should be glDrawElement

  6. #6
    Junior Member Newbie
    Join Date
    Sep 2001
    Posts
    9

    Re: how do I use glDrawPrimitive ?

    You specify your vertex arrays as you normally would, but making sure that all are the same size. For example, if you are using color, texture coordinate, and vertex arrays, then the color specified at color array entry x will be applied to the vertex in vertex array slot x, and the texture coordinate will come from the 'x'th element of your texture coordinate array.

    That much is simple.

    Now you create another array, this one of an integer data type (usually GLuint). Each entry in it is an array index in your vertex, color, and texture arrays. So if your index array looks like this:

    Code :
    GLuint index[] = {0, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 7, 11};
    Then it will draw the vertex in vertexarray[0] with texture coordinate of texcoord[0] and color of colorarry[0]. And then it'll do the same thing with, but with the array data at index 4 of each array, and then 1, and then 5, and so on.

    You can also use interleaved arrays. They work the same way.

    The advantage to using GLDrawElements is that each vertex is transformed once. So, as you saw in my example array of indices, I had several verteces referenced twice. But one of them would only need to be transformed once.

    Hope that helps.

    [This message has been edited by TerranFury (edited 09-04-2001).]

  7. #7
    Member Newbie
    Join Date
    Dec 2000
    Location
    Donetsk, Ukraine
    Posts
    48

    Re: how do I use glDrawPrimitive ?

    I can add also, that you should use glEnableClientState(xxxx) and then glXXXXPointer() functions if you wanna render primitive from separate arrays, or glInterleavedArrays() function if you wanna d3d-like non-strided primitive rendering.

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