EndDrawParticles(){ glDrawArrays()ERROR!!}
Posted: Tue Jun 18, 2013 1:47 pm
void MP_Atlas_WRAP::EndDrawParticles()
{
int k_particles=buffer.GetCount();
if (k_particles)
{
glBindTexture(GL_TEXTURE_2D,texture);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
OPENGL_VERTEX* ar=buffer.GetArray();
GLsizei step=sizeof(OPENGL_VERTEX);
float* first_x=&(ar->x);
#ifdef MAGIC_3D
glVertexPointer(3,GL_FLOAT,step,first_x);
#else
glVertexPointer(2,GL_FLOAT,step,first_x);
#endif
float* first_u=&(ar->u);
glTexCoordPointer(2,GL_FLOAT,step,first_u);
GLuint* first_color=&(ar->color);
glColorPointer(4,GL_UNSIGNED_BYTE,step,first_color);
glDrawArrays(GL_QUADS,0,k_particles*4);//ERROR
buffer.Clear();
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
}
C++ debug k_particles = 1109;
{
int k_particles=buffer.GetCount();
if (k_particles)
{
glBindTexture(GL_TEXTURE_2D,texture);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
OPENGL_VERTEX* ar=buffer.GetArray();
GLsizei step=sizeof(OPENGL_VERTEX);
float* first_x=&(ar->x);
#ifdef MAGIC_3D
glVertexPointer(3,GL_FLOAT,step,first_x);
#else
glVertexPointer(2,GL_FLOAT,step,first_x);
#endif
float* first_u=&(ar->u);
glTexCoordPointer(2,GL_FLOAT,step,first_u);
GLuint* first_color=&(ar->color);
glColorPointer(4,GL_UNSIGNED_BYTE,step,first_color);
glDrawArrays(GL_QUADS,0,k_particles*4);//ERROR
buffer.Clear();
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
}
C++ debug k_particles = 1109;