Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

glDrawArrays(GL_TRIANGLES, ......)

$
0
0
I'm creating some vertex data using a vector<GLfloat>: static vector<GLfloat> vertices = { // 3D position, 2D texture coordinate // card front -0.1, -0.1, 0.0, 1*0.125, 4*0.125, // vertex 0 0.1, -0.1, 0.0, 2*0.125, 4*0.125, // vertex 1 0.1, 0.1, 0.0, 2*0.125, 5*0.125, // vertex 2 -0.1, -0.1, 0.0, 1*0.125, 4*0.125, // vertex 0 0.1, 0.1, 0.0, 2*0.125, 5*0.125, // vertex 2 -0.1, 0.1, 0.0, 1*0.125, 5*0.125, // vertex 3 // card back 0.1, 0.1, 0.0, 4*0.125, 2*0.125, // vertex 2 0.1, -0.1, 0.0, 4*0.125, 1*0.125, // vertex 1 -0.1, -0.1, 0.0, 5*0.125, 1*0.125, // vertex 0 0.1, 0.1, 0.0, 4*0.125, 2*0.125, // vertex 2 -0.1, -0.1, 0.0, 5*0.125, 1*0.125, // vertex 0 -0.1, 0.1, 0.0, 5*0.125, 2*0.125 // vertex 3 }; Then I draw it: glDrawArrays(GL_TRIANGLES, 0, vertices.size()); What is the correct value for the final parameter of glDrawArrays()? vertices.size() or vertices.size()/5? Both appear to work.

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>