Skip to main content
gamedev.net
🔒 Locked

Question about DrawElement()

Started by RoyHsu2001 Oct 17, 2003 at 6:24 AM 0 replies 300+ views
Original Post
RoyHsu2001
RoyHsu2001
Hello, everyone, I have a one question about glArrayElemnet() or glDrawElemnt(). If I use glDrawElemnt() to do only one index on Vertex coordination Array, Normal vector Array, Texture coordination Array and so on... I think it lacks flexibilty of possible combinations among those Arrays, so I only can increase the amount of Arrays among them to record some different combinations to accommodate the job of only one index. For example, Vertex[3]={3.0, 3.0, 5.0} might have Normal[3]={1.0, 0.0, 0.0} and TextureCoord[3]={0.7, 0.8}, but this Vertex[3] also could have another combination as Normal[4]={0.3, 0.5, 0.0} and TextureCoord[4]={0.3, 0.2}, so, for the job of only one index, I only could add one more element of those Array as Vertex[4]={3.0, 3.0, 5.0}, Normal[4]={0.3, 0.5, 0.0} and TextureCoord[4]={0.3, 0.2} to call, but actually, if glDrawElemnt() could point out which Array it was dealing with and combinate different glDrawElemnt() to work together, so I could have less Arrays' amount and save memory for putting into AGP or video memory. For example, the above situation : glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer( 3, GL_FLOAT, 0, Vertex ); glNormalPointer( GL_FLOAT, 0, Normal ); glTexCoordPointer( 2,GL_FLOAT, 0, TextureCoord ); instead calling by one Index: glDrawElements( GL_QUADS, Toatal_Faces, GL_UNSIGNED_INT, Face_Index ); Could I call as: glDrawElements( GL_QUADS, Toatal_Vertexs, GL_UNSIGNED_INT, Vertex_Index ); glDrawElements( GL_QUADS, Toatal_Normals, GL_UNSIGNED_INT, Normal_Index ); glDrawElements( GL_QUADS, Toatal_TextureCoords, GL_UNSIGNED_INT, TextureCoord_Index ); Each Array has it's own Index array to make different combination among those Arrays. In this way, it's the same data structure as VRML. I couldn't do that, right? Is there any way to do the same currently? [edited by - Royhsu2001 on October 17, 2003 7:28:46 AM] [edited by - Royhsu2001 on October 18, 2003 4:49:17 AM]
ShlomiSteinberg
ShlomiSteinberg
you cud

"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
Member of the Shove Pouya Off A Cliff club, SPOAC. (If you wish to join, add this line to your signature.)Member of "Un-Ban nes8bit" association, UNA (to join put this in your sig)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.