Results 1 to 5 of 5

Thread: make point-sprites quad compatible

  1. #1
    Member Contributor
    Join Date
    Feb 2000
    Location
    Germany
    Posts
    87

    make point-sprites quad compatible

    I have some problems getting my point-sprites behave like I want them to. Essentially I want to replace some quads by point-sprites.
    The list of quads is defined by the mid-points and the edge-size (real quads, not rectangles), always facing the viewer. Now I'm trying to figure out a glPointParameter configuration so I can takes those two values for point-vertex and point-size, and get a "compatible" output using point-sprites. Of course taking perspective projection into account.
    And that's the problem: I can't figure out what to feed into glPointParameter(GL_POINT_DISTANCE_ATTENUATION,... ) to get that working.
    Any hints are welcome. Thanks!

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    992

    Re: make point-sprites quad compatible

    To get perfectly the same results you have with quads you'd better use vertex shader to change the point size.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Member Contributor
    Join Date
    Feb 2000
    Location
    Germany
    Posts
    87

    Re: make point-sprites quad compatible

    yes, if I could. I'm on an iPod touch with OpenGL ES 1, so no shaders available.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    May 2006
    Posts
    701

    Re: make point-sprites quad compatible

    For a proper projection, an object that is twice as far away appears half as big in each dimension, so what you want is the size in pixels being the quad size multiplied by some constant, divided by the view space distance:
    size' = size * C / D

    C is the size in pixels of an object of size 1 at distance 1 in view space, and usually equals the (0,0) component of the projection matrix multiplied by half the screen width.

    The formula used for the attenuated point size is
    size' = size / sqrt(a + b * D + c * Dē)
    with (a, b, c) being the point distance attenuation parameters. With a = b = 0 you get this:
    size' = size / (sqrt(c) * D)

    So what's left to do is to figure out the value of c.
    C = 1 / sqrt(c)
    c = 1 / Cē

    And, as mentioned above, C is the first component of the projection matrix multiplied by half the screen width.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  5. #5
    Member Contributor
    Join Date
    Feb 2000
    Location
    Germany
    Posts
    87

    Re: make point-sprites quad compatible

    Thanks a lot, Xmas! That's exactly the explanation I was looking for!

Similar Threads

  1. point sprites, help please...
    By sandbucket in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-25-2013, 04:22 AM
  2. How do I make sure my code is backward compatible?
    By monkey in forum OpenGL: Windows
    Replies: 6
    Last Post: 10-06-2012, 01:04 PM
  3. Replies: 0
    Last Post: 02-07-2012, 09:39 AM
  4. point sprites
    By marksibly in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-06-2006, 10:59 PM
  5. Replies: 0
    Last Post: 08-08-2001, 11:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean