Jump to content

  • Log In with Google      Sign In   
  • Create Account


Is gluPerspective deprecated?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 proanim   Members   -  Reputation: 440

Like
0Likes
Like

Posted 01 December 2012 - 06:08 PM

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?

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 29302

Like
1Likes
Like

Posted 01 December 2012 - 06:35 PM

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, 02 December 2012 - 07:25 PM.


#3 proanim   Members   -  Reputation: 440

Like
0Likes
Like

Posted 01 December 2012 - 06:46 PM

ok thanks

#4 mhagain   Crossbones+   -  Reputation: 7802

Like
2Likes
Like

Posted 01 December 2012 - 06:52 PM

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.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#5 proanim   Members   -  Reputation: 440

Like
0Likes
Like

Posted 02 December 2012 - 11:21 AM

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.

#6 Aks9   Members   -  Reputation: 811

Like
0Likes
Like

Posted 02 December 2012 - 11:36 AM

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.

#7 Aks9   Members   -  Reputation: 811

Like
0Likes
Like

Posted 02 December 2012 - 11:37 AM

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.

#8 proanim   Members   -  Reputation: 440

Like
0Likes
Like

Posted 02 December 2012 - 12:01 PM

i just tried this with GLFW and gluPerspective works in core profile

#9 Brother Bob   Moderators   -  Reputation: 8010

Like
1Likes
Like

Posted 02 December 2012 - 12:38 PM

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.

#10 mhagain   Crossbones+   -  Reputation: 7802

Like
0Likes
Like

Posted 02 December 2012 - 01:55 PM

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.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#11 L. Spiro   Crossbones+   -  Reputation: 13168

Like
2Likes
Like

Posted 02 December 2012 - 02:06 PM

In OpenGL 4.0, the entire fixed-function pipeline (used by glu*) is deprecated. This is exactly why I never use helper libraries—the core moves on but the helper libraries don’t.
If you are using shaders as you should be (in OpenGL 4.0, not using shaders is deprecated) then there is no way glu* can help you. The matrices you want to create will be used by you manually in your shaders.

This is actually a good thing honestly because OpenGL was originally not created for games and had some quirks in it that made it more of a nuisance than anything else (for example, lights were originally multiplied by the current model-view matrix, so you had to constantly update their positions every frame and in a very inefficient manner).
With shaders nothing is done for you. You have to write your own shaders and thus, by definition, you have to handle the primitive pipeline manually.

glu* and friends no longer have meaning because they set a bunch of states that you aren’t (shouldn’t be) using.
In OpenGL 4.0, you need to have your own matrix math library, calculate your own model, view, and projection matrices, and send them to your shaders manually.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#12 TheChubu   Crossbones+   -  Reputation: 4062

Like
1Likes
Like

Posted 02 December 2012 - 02:35 PM

... like a real programmer :P

Spoiler

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS