How to get point stripes function to with textured polygons?

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 );
}

I only see one glTexture2D call, and that’s for glBindTexture(GL_TEXTURE_2D, iBackgroundTexture.iID);
I don’t see any glTexture2D call for glBindTexture( GL_TEXTURE_2D, iParticleTexture.iID ); so I don’t think that texture has been defined.

I made a new version of the method with 2 calls to glTexImage2D, with the same result as before. Do you have any idea why the point stripes are not being shown? They are white as it is now. This the code:

void CParticles::DrawParticles(TReal aTime)
{
// Move the viewer away from the particles
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0, 0, -5);
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glBindTexture(GL_TEXTURE_2D, im31.iID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA,
GL_BYTE, backgroundCoords);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glVertexPointer(3, GL_FIXED, 0, ParticleBackground);

glTexCoordPointer(2, GL_BYTE, 0, backgroundCoords);
glDrawArrays(GL_TRIANGLE_STRIP, 1, 900);
//end draw background    
glVertexPointer(3, GL_FIXED, 0, iParticleCoords);
// Use the particle texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
		GL_RGBA, GL_UNSIGNED_BYTE, ParticleBackground);
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);
}

I got this to work after making a new project.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.