PDA

View Full Version : Point Sprite Texture Problem



CGDeveloper
09-22-2004, 05:28 PM
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_ATTENUATIO N_ARB, quadratic);

float maxSize = 0;
glGetFloatv(GL_POINT_SIZE_MAX_ARB, &maxSize);
glPointSize(5.5);

glPointParameterfARB(GL_POINT_SIZE_MIN_ARB, 1.0f);
glPointParameterfARB(GL_POINT_SIZE_MAX_ARB, maxSize);
glPointParameterfARB( GL_POINT_FADE_THRESHOLD_SIZE_ARB, 60.0f );

glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_FALSE);

dorbie
09-23-2004, 08:53 AM
You should probably just use textured points, not point sprites, you don't have enough efficient control of sprites.

Just keep texture enabled and issue a texture coord for each point.

idr
09-23-2004, 12:38 PM
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.