Jump to content
  • Advertisement
Sign in to follow this  
Headkaze

OpenGL Particle from texture atlas

This topic is 3031 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm writing a particle system for an OpenGL ES 1.1 game and am using point sprites. At the moment I'm using a single 64x64 texture which is bound each time particles need to render. Is it possible to place the particle image inside a texture atlas so I don't need to bind another texture? How can I set texture coordinates for the point sprites without setting the s/t for each vertex? Is it possible to set the s/t for all point sprites? Is it possible perhaps by using the texture matrix? What's the best way? I am drawing them like so
	glEnable(GL_POINT_SPRITE_OES);
	glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, GL_TRUE);
	
	glBindBuffer(GL_ARRAY_BUFFER, m_verticesID);
	glBufferData(GL_ARRAY_BUFFER, sizeof(PointSprite2D) * m_maxParticles, m_vertices, GL_DYNAMIC_DRAW);
	
	glEnableClientState(GL_VERTEX_ARRAY);	
	glVertexPointer(2, GL_FLOAT, sizeof(PointSprite2D), 0);
	
	glEnableClientState (GL_COLOR_ARRAY);
	glColorPointer(4, GL_FLOAT, sizeof(PointSprite2D), (GLvoid*) sizeof(m_vertices[0].position));
	
	glEnableClientState(GL_POINT_SIZE_ARRAY_OES);
	glPointSizePointerOES(GL_FLOAT, sizeof(PointSprite2D), (GLvoid*) (sizeof(m_vertices[0].position) + sizeof(m_vertices[0].color)));

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!