Can I draw PointSprites from a Texture Atlas


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:

  1. 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.

  2. 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?



glBindBuffer(GL_ARRAY_BUFFER, verticesID);


glColorPointer(4, GL_FLOAT, sizeof(vertices[0]),(GLvoid*) offsetof(ccPointSprite_T2F, colors) );

glPointSizePointerOES(GL_FLOAT,sizeof(vertices[0]),(GLvoid*) offsetof(ccPointSprite_T2F, size) );


*glTexCoordPointer(2, GL_FLOAT, sizeof(vertices[0]),(GLvoid) offsetof(ccPointSprite_T2F, texCoords) );

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!

well basically all point sprites use texture coordinates between 0 and 1, and that is unavoidable.
However there are some ways around it, you could perhaps use a texture matrix to change the shape and displacement of it, i am not 100% sure how it works with pointsprites without using shaders but it might work, and definitely will if your using shaders(if you do it in the fragment shader).

Another way when using shaders is to do those transformations by hand in the fragment shader

Thanks. I ll explore this option.

Does anybody has comments on the performance issue? I.e. is it worth it? Basically I want to avoid glBinTexture calls but I am not holding many textures in memory. Maybe 10. 2xTexture Atlas and the rest is individual Textures for PointSprites. These are very small, say 16 or 32 pixel…