Advertisement Jump to content
Sign in to follow this  

OpenGL regarding glDrawElements() .... i use TAO library in C#

This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, i am an OpenGL Newbie and am learning stuff. I tried the following code
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 };


glVertexPointer( 2, GL_DOUBLE , 0 , Vertices ); 

glBegin(GL_POLYGON);         //Line A

for( int i = 0; i< 3; i++)          
glEnd();                        //Line B

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

Share this post

Link to post
Share on other sites
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:
glDrawElements documentation:
Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.


Share this post

Link to post
Share on other sites
thanx. it works now.

(i had a book infron of me sayin the same thing but i guess i am blind !!! wasted good 30 minutes trying everything.....with eyes cloed obviously, bye)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!