I wanna split a quad with a texture into particles.By using point sprite,every particle’s texture becomes same color,like mosaic.How can i get the right texture for every particle?Thanks!
Some codes:
float quadratic[] = {1.0f, 0, 0.01f};
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic);
Are you sure you want COORD_REPLACE set to FALSE? That causes the same texture coordinate to be used for every fragment in the sprite. If I understand your description, you probably shouldn’t use point sprites at all. Just use regular points with a different color per point.
This should be pretty easy to do with VBOs. Just put the color data in one VBO that is STATIC_DRAW, and put the vertex data in another VBO that is STREAM_DRAW. Each frame use BufferData to send in the new point positions. Depending on what you’re doing exactly, you may even be able to keep the position data STATIC_DRAW and use a vertex program to update the positions each frame.