Help with arrays routines in OpenGL
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!!!
I believe you need to use sizeof( gl_vertex ) as the strides.
You have to remember that you''re unique, just like everybody else.
You have to remember that you''re unique, just like everybody else.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement