EndDrawParticles(){ glDrawArrays()ERROR!!}

All information about Magic Particles: news, question, comments, etc.

EndDrawParticles(){ glDrawArrays()ERROR!!}

Postby tall_tree » 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;
tall_tree
 
Posts: 11
Joined: Fri Jun 07, 2013 1:40 pm

Re: EndDrawParticles(){ glDrawArrays()ERROR!!}

Postby Odin_KG » Tue Jun 18, 2013 3:40 pm

Not all versions of OpenGL work with GL_QUADS. Some versions work with triangles only.
User avatar
Odin_KG
Administrator
Administrator
 
Posts: 255
Joined: Sat May 09, 2009 10:53 pm

Re: EndDrawParticles(){ glDrawArrays()ERROR!!}

Postby tall_tree » Mon Jul 01, 2013 6:41 am

I use glgeterror() and the return value is GL_INVALID_VALUE. If I use particle and MS3D in the same game, the error will happen.If I use them separately,that will be OK! :?:
tall_tree
 
Posts: 11
Joined: Fri Jun 07, 2013 1:40 pm

Re: EndDrawParticles(){ glDrawArrays()ERROR!!}

Postby Odin_KG » Mon Jul 01, 2013 2:23 pm

Unfortunately, I do not understand your problem. If you have got the problem with the line glDrawArrays(GL_QUADS,0,k_particles*4), I can remake the wrapper of OpenGL for triangles.
User avatar
Odin_KG
Administrator
Administrator
 
Posts: 255
Joined: Sat May 09, 2009 10:53 pm


Return to Magic Particles

Who is online

Users browsing this forum: No registered users and 3 guests