PDA

View Full Version : glVertexPointer question



Dratikus
12-04-2013, 04:12 PM
Does glVertexPointer take the same vertex array as Direct 3d?

For example, in direct 3d, to make a cube, I would use these vertices:


Vertex count: 36
-1.00000000 -1.00000000 -1.00000000
1.00000000 -1.00000000 -1.00000000
1.00000000 -1.00000000 1.00000000
1.00000000 -1.00000000 -1.00000000
1.00000000 -1.00000000 1.00000000
-1.00000000 -1.00000000 1.00000000
-1.00000000 -1.00000000 1.00000000
-1.00000000 1.00000000 1.00000000
-1.00000000 1.00000000 -1.00000000
-1.00000000 1.00000000 1.00000000
-1.00000000 1.00000000 -1.00000000
-1.00000000 -1.00000000 -1.00000000
-1.00000000 -1.00000000 1.00000000
1.00000000 -1.00000000 1.00000000
1.00000000 1.00000000 1.00000000
1.00000000 -1.00000000 1.00000000
1.00000000 1.00000000 1.00000000
-1.00000000 1.00000000 1.00000000
-1.00000000 1.00000000 -1.00000000
1.00000000 1.00000000 -1.00000000
1.00000000 -1.00000000 -1.00000000
1.00000000 1.00000000 -1.00000000
1.00000000 -1.00000000 -1.00000000
-1.00000000 -1.00000000 -1.00000000
-1.00000000 1.00000000 1.00000000
1.00000000 1.00000000 1.00000000
1.00000000 1.00000000 -1.00000000
1.00000000 1.00000000 1.00000000
1.00000000 1.00000000 -1.00000000
-1.00000000 1.00000000 -1.00000000
1.00000000 -1.00000000 -1.00000000
1.00000000 1.00000000 -1.00000000
1.00000000 1.00000000 1.00000000
1.00000000 1.00000000 -1.00000000
1.00000000 1.00000000 1.00000000
1.00000000 -1.00000000 1.00000000


Is that what I would also use for glVertexPointer to make a cube?

uwi2k2
12-04-2013, 10:30 PM
hi,

the answer ist mostly yesss ..
but the pointer may take every structure you define.
so it CAN be that structure .. but does not need to be.

cu
uwi

Dratikus
12-05-2013, 10:01 AM
I think I figured it out. in opengl, it seems that you can define the vertices in one array, then define an index array which describes your triangles. Brillaint! glVertexPointer() uses the vertices array and glDrawElements() uses the index array to draw the triangles. I like that more than the other way I mentioned above.