Archived

This topic is now archived and is closed to further replies.

Yozh_Programmer

OpenGL Help with arrays routines in OpenGL

Recommended Posts

Here is types code class gl_vert_coord { public: float x, y, z; }; class gl_color { public: float r, g, b; }; class gl_vertex { public: gl_vert_coord coord; gl_color color; }; class gl_quad { public: gl_vertex verteces[ 4 ]; }; Here is initialization code glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_COLOR_ARRAY ); glVertexPointer( 3, GL_FLOAT, sizeof( gl_color ), &quads[ 0 ].verteces[ 0 ].coord ); glColorPointer( 3, GL_FLOAT, sizeof( gl_vert_coord ), &quads[ 0 ].verteces[ 0 ].color ); Here is drawing code glDrawArrays( GL_QUADS, 0, 24 ); I am trying to draw a cube (simple) Used array is also used in simple drawing glBegin/glEnd functions. Simple drawing works well, but when I try to draw by means of glDrawArrays nothing is drawn. Help, it seems that there is no errors in code. P.S. It would be better if you give me a link with code about arrays drawing, which uses grouped arrays (arrays where not only vertex data is placed). Thanx a lot for your attention!!!

Share this post


Link to post
Share on other sites