I can’t get point stripes to work at the same time as textured polygons. When I draw the textured polygons,
the point stripes looses its textures. What I am doing wrong?
The call glDrawArrays(GL_TRIANGLE_STRIP, 1, 900); makes the point stripes loose its textures. When I remove that call the point stripes get back its texture. So it must be this that messes it up.This is my code:
void CParticles::DrawParticles(TReal aTime)
{
// Move the viewer away from the particles
glLoadIdentity();
glTranslatef( 0, 0, -5 );
glRotatef( aTime, 0, 1, 0 );
// Enable vertex and color arrays.
//draw background:
glEnable( GL_TEXTURE_2D );
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState( GL_VERTEX_ARRAY );//**
glEnableClientState( GL_COLOR_ARRAY );
//ddrawing of backgrund-------------->
glBindTexture(GL_TEXTURE_2D, iBackgroundTexture.iID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32,
32, 0, GL_RGBA, GL_UNSIGNED_BYTE, ParticleBackground);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_REPEAT glTexEnvx( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
glVertexPointer(3, GL_BYTE, 0, ParticleBackground);
glTexCoordPointer(2, GL_BYTE, 0, backgroundCoords);
glDrawArrays(GL_TRIANGLE_STRIP, 1, 900);
//end draw background<--
glVertexPointer( 3, GL_FIXED, 0, iParticleCoords );
glColorPointer( 4, GL_FIXED, 0, iParticleColors );
// Use the particle texture
glBindTexture( GL_TEXTURE_2D, iParticleTexture.iID );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// Draw the array of particles
glTexEnvi( GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, GL_TRUE );
glDrawArrays( GL_POINTS, 0, iParticleCount );
glTexEnvi( GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, GL_FALSE );
glDisableClientState( GL_VERTEX_ARRAY );
glDisableClientState( GL_COLOR_ARRAY );
}