Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Point Sprite Texture Problem

  1. #1

    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);

  2. #2
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    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.

  3. #3
    Junior Member Regular Contributor
    Join Date
    May 2002
    Location
    Portland, OR
    Posts
    223

    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
  •