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

Thread: glDrawElements()

  1. #1

    glDrawElements()

    Hi,

    if you go:

    EnableTexturePointer()
    EnableVertexPointer()
    setvertexpointer(vert)
    settexpointer(tex)

    glDrawElements(..., indices);

    do vert and tex have to be the same number of elements?

    Thanks

    P.S. I know its not proper syntax

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Feb 2000
    Location
    France
    Posts
    1,118

    Re: glDrawElements()

    I believe you can use different sizes but when it come to use them, they SHOULD be the same size !

    Say you have 6 vertices and 6 texture coords. You can draw the triangle formed by v1,v2,v3 by passing 1,2,3 for your indices to glDrawElements. The function will then take t1,t2,t3 for your texcoords.

    Now imagine you have 6 vertices and 3 texcoords and you want to draw the triangle formed by v4,v5,v6. The function will try to use texcoords t4,t5 and t6 ! In this case, I believe you might meet a giant bug in your program !!!

    Well, anyway, why would you have different sizes ??? If you have more elements in one of your arrays, it simply means that your array is too big and that you could be able to save memory !!!

    Regards.

    Eric

Posting Permissions

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