double[] Vertices = { 0.0,0.0, 0.0,1.0, 0.5,0.5, 1.0,1.0, 1.0,0.0 };
double[] Indices = { 0,1,2 };
glColor3f(255.0f,0.0f,0.0f);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0,0.0,1.0);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer( 2, GL_DOUBLE , 0 , Vertices );
glBegin(GL_POLYGON); //Line A
for( int i = 0; i< 3; i++)
glArrayElement((int)Indices);
glEnd(); //Line B
regarding glDrawElements() .... i use TAO library in C#
hi, i am an OpenGL Newbie and am learning stuff. I tried the following code
and it draws the a triangle as expected. But when i use
glDrawElements( GL_POLYGON , 3 , GL_DOUBLE , Indices ); in place of Lines A to B it does nothing.
any idea why?
thanx
mishal
Check the documentation for glDrawElements (yes, that link is python documentation, but only the Python Specification and Python Sample Code sections are python specific). In particular, note the requirements on the type parameter:
Enigma
Quote:glDrawElements documentation:
type
Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.
Enigma
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement