Sign in to follow this  
shiqiu1105

I think using the old matrix set func can play well in gl3.0

Recommended Posts

I know the new version of gl has deprecated the matrix functions built in in older versions.

But I still find them useful especially when u are using CG as ur shading language.

Because in cg there are some built-in variable that can directly access to the state of GL, including matrix.

If I want to use the iverse of projection all I need to do is write
matrix projInv : state.matrix.projection.inverse;
which is really simple compared with using external matrix or math library..


Am I neglecting some performance issue?

Share this post


Link to post
Share on other sites
Quote:
Original post by shiqiu1105
I know the new version of gl has deprecated the matrix functions built in in older versions.

But I still find them useful especially when u are using CG as ur shading language.

Because in cg there are some built-in variable that can directly access to the state of GL, including matrix.

If I want to use the iverse of projection all I need to do is write
matrix projInv : state.matrix.projection.inverse;
which is really simple compared with using external matrix or math library..


Am I neglecting some performance issue?
For anything non-trivial, you're most likely going to want to use an external math library anyway, and once you have such a library available, acquiring the inverse of a matrix should be quite simple.

A math library is not a complexity or inconvenience; it's just a useful tool. Saying that using a math library makes things more complex is like saying that using a hammer makes pounding in a nail more complex. In other words, if it's the right tool for the job, it's the right tool for the job.

As far as the changes to OpenGL go, eliminating the functionality you mention makes the API simpler and cleaner, and, I imagine, simplifies the internal implementation as well.

Having to deal with 3-d math is par for the course when writing low-level graphics code. If you want to deal directly with OpenGL or Direct3D at that level, then you'll have to deal with the math. If you *don't* want to deal with them on that level, then you should use a game engine or graphics engine that hides the details from you.

But, that's just my view on it - YMMV :)

Share this post


Link to post
Share on other sites
It got killed off because the GPU doesn't execute those GL functions (glTranslate, glScale, glOrtho and all the rest). When OpenGL was first designed in 1992, it seemed like a good idea. It's time to move into 2005 or whatever year it is now.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this