Jump to content
  • Advertisement
Sign in to follow this  
Anbu

Changin points size according to distance

This topic is 3851 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I need to draw points on top of a surface, so that they get smaller and bigger according to the viewers distance from them. I've found this command glPointParameter, with parameter GL_POINT_DISTANCE_ATTENUATION. It seems that it could solve my problem, unfortunately the compiler says it can't find either glPointParameter nor GL_POINT_DISTANCE_ATTENUATION. (i have gl.h and glu.h includec). Have any of you ever used this command and could maybey tell me where I could get the file with this function's definition. Or maybey you know of some other way to achieve the same goal.

Share this post


Link to post
Share on other sites
Advertisement
Hi, glPointParameterX functions family (i,f,fv,iv variants) are a core feature of OpenGL v1.4 (but they where present in earlier versions as an extension: GL_ARB_point_parameters). Are you running the application under Windows? If so you need to:

1) Ensure your Graphic card OpenGL implementation is v1.4 or above (if not try update the driver).
2) Get glext.h (and optionally wglext.h) header file form here: http://opengl.org/registry/ and include it in your application. The prototypes of glPointParameterX functions and the definition of GL_POINT_DISTANCE_ATTENUATION are here.
3) Get the pointer to the glPointParameterX function you wish using wglGetProcAddress().

I hope this can help.

Share this post


Link to post
Share on other sites

Another suggestion : draw your points as polygons (quads). Disable depth testing, or offset the Z-coordinate, so they appear on top of the surface and use a specific modelview matrix so as to have them rendered flat. If you need a special shape (circle...), texture the quad with the corresponding alpha.

Share this post


Link to post
Share on other sites
The extension method is probably best for you.

Another alternative is to use glPointSize (float size); where size should be reduced with distance from camera.

Share this post


Link to post
Share on other sites
Thanks LordOrion for quick and very helpfull answer.

As for the other suggestions, changing point attenuation is a lot simpler than changing poligon into something circular. I also can't disable depth testing, as I can rotate the object, and I wouldn't like the points to be visible from both sides of the surface

And as far as glPointSize is concerned I'd have to test for the distance between the eye and the object. So all in all glPointParameter is the shortest/easiest solution.

Thanks for the effort guys.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anbu
...And as far as glPointSize is concerned I'd have to test for the distance between the eye and the object...


But that's how we did it on the Amiga...BOB ;) hehe, hey just don't rotate then you can just test the z-coord...ok ok extensions are good!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!