-
Point Sprite Texture Problem
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);
-
Super Moderator
OpenGL Guru
Re: Point Sprite Texture Problem
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.
-
Junior Member
Regular Contributor
Re: Point Sprite Texture Problem
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules