I am using PointSprites for Particle Systems. Now, I am trying to put the texture to be drawn in a TextureAtlas. (So far, each PointSprite consumes its own Texture)
Here are my questions:
Is storing point sprites in individual Textures suboptimal from a performance perspective, i.e. should I worry about it at all? I want to eliminate glBindTexture commands when switching to another particle system.
I tried to set texture coordinates when having GL_POINT_SPRITE_OES activated. Below is the code I am using. The glEnableClientState(GL_TEXTURE_COORD_ARRAY);glTexCoordPointer… commands dont seem to have any effect. Is there a way to set the 2D texture coordinates (i.e. the origin in the texture atlas) for point sprites?
glTexEnvi( GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, GL_TRUE );
glColorPointer(4, GL_FLOAT, sizeof(vertices),(GLvoid*) offsetof(ccPointSprite_T2F, colors) );
glPointSizePointerOES(GL_FLOAT,sizeof(vertices),(GLvoid*) offsetof(ccPointSprite_T2F, size) );
*glTexCoordPointer(2, GL_FLOAT, sizeof(vertices),(GLvoid) offsetof(ccPointSprite_T2F, texCoords) );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glDrawArrays(GL_POINTS, 0, particleIdx);
Basically it does not matter if I have the lines marked with (**) included or not.
Does someone know more about drawing PointSprites from a TextureAtlas? Thanks!