Jump to content
  • Advertisement
Sign in to follow this  
proanim

OpenGL Is gluPerspective deprecated?

This topic is 2147 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

I am currently using gluPerspective to setup my perspective projection. Since I want to use OpenGL 4.0 I have substitute code to setup perspective. Should I avoid using gluPerspective? What can happen in the long run if I use deprecated functions?

Share this post


Link to post
Share on other sites
Advertisement
glu* can't be deprecated, because glu* functions aren't part of OpenGL to begin with, they're part of a GL utility library that has many alternatives.

[edit]n.b. this doesn't mean you should be using it -- it's just a wrapper around other GL functions, which may themselves be deprecated[/edit] Edited by Hodgman

Share this post


Link to post
Share on other sites
It's true that gluPerspective is just a software helper function, but -- it will most likely call either glFrustum or glLoad/MultMatrix internally (haven't checked and would be implementation-dependent anyway - although glLoadMatrix would violate spec) and those calls ARE deprecated.

Share this post


Link to post
Share on other sites
i looked around the web on this there is some conflicting information stating 'opengl 3+ doesn't support gluPerspective' and there are the once that state like Hodgman said 'glu is not part of opengl so it is still valid'. I checked opengl spec file i found on opengl.org it seems that it is not deprecated after all.

Share this post


Link to post
Share on other sites
Lets solve it in the simplest way. Create a core GL context and call the function you want. If it works, it is not deprecated. glu is not the part of the core functionality, so it cannot be deprecated directly, but it uses deprecated (legacy) commands, so it cannot be executed in the core profile. In short, it is not deprecated since it has never been the part of the core, but it cannot execute in core context now.

Share this post


Link to post
Share on other sites
Sorry for this post. Combination of Android, Opera Mobile and scripts on this page generated two identical posts. Since there is no way to delete a post (reqest for the administrator/web master), I had to modify it.

Share this post


Link to post
Share on other sites
And what do you expect to happen when you call it, even if there is no error reported? The function operates on the current matrix stack, but there is no such thing in a core context.

Share this post


Link to post
Share on other sites

And what do you expect to happen when you call it, even if there is no error reported? The function operates on the current matrix stack, but there is no such thing in a core context.


Yup, this basically.

If gluPerspective works in your tests, all that means is that your GL implementation is not fully conformant in that it's allowing you to do things in a core profile that you should not be allowed to do. So the fact that it works is something you should most definitely not be relying on, because a future driver revision, or other hardware, could quite easily break it.

If you want to construct a perspective matrix there is a much easier way that will work in all cases. Just grab a sample implementation of gluPerspective from something like Mesa and re-implement it in a conformant manner. Or better yet, use a tried and trusted matrix library that will already contain a routine for constructing a perspective matrix.

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!