Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > OpenGL 3D API > glDrawArrays, s...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 4754 of 4908
Post > Topic >>

glDrawArrays, seems to ignore stride parameter?

by sheam <shea08@[EMAIL PROTECTED] > May 18, 2008 at 10:52 PM

The following works, to draw a square:
		float a[] = {
				   	  -1, 1, 0,
			          1, 1, 0,
					  -1,-1, 0,
					  1,1,0,
					  -1,-1,0,
					  1,-1,0,
		};
		glVertexPointer( 3, GL_FLOAT, 0, a );
		glDrawArrays( GL_TRIANGLES, 0, 6 );

The following code has the same logic, but I have inserted an extra 
float between each vertex.  I tell opengl by setting the stride to be 
sizeof(float).  But the following make square scrambled.
		float a[] = {
				   	  -1, 1, 0,
			99,
			          1, 1, 0,
			99,
					  -1,-1, 0,
			99,
					  1,1,0,
			99,
					  -1,-1,0,
			99,
					  1,-1,0,
			99,
		};
		glVertexPointer( 3, GL_FLOAT, sizeof(float), a );
		glDrawArrays( GL_TRIANGLES, 0, 6 );

Thanks,
~S
 




 3 Posts in Topic:
glDrawArrays, seems to ignore stride parameter?
sheam <shea08@[EMAIL P  2008-05-18 22:52:14 
Re: glDrawArrays, seems to ignore stride parameter?
sheam <shea08@[EMAIL P  2008-05-18 22:54:40 
Re: glDrawArrays, seems to ignore stride parameter?
crjjrc <crjjrc@[EMAIL   2008-05-19 05:26:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Sep 5 23:24:29 CDT 2008.