Sign in to follow this  
Vereor

OpenGL Shaders and matrix usage, best practice

Recommended Posts

Coming from working with XNA for over a year I'm now starting a project using OpenTK and am after some advice on best practice regarding matrix usage in shaders.

In XNA, it's common to pass a complete set of World, View and Projection matrices into shaders and have them transform vertex positions by the WVP in the vertex function. I'm wondering if this is a good thing to do in OpenGL given the fact that it has the ability to use matrix stack? Are there any underlying performance benefits from using the OpenGL matrix stack VS passing in absolute WVP matrices into my shaders?

Thanks

Share this post


Link to post
Share on other sites
Nope no performance benefit, just use your own WVP matrices. The matrix stack is a relic of time long gone, it doesn't really serve a purpose anymore, so it's deprecated now. Uniform matrix uploads are what you want to be doing.

Share this post


Link to post
Share on other sites
[quote name='karwosts' timestamp='1298108952' post='4776265']
Nope no performance benefit, just use your own WVP matrices. The matrix stack is a relic of time long gone, it doesn't really serve a purpose anymore, so it's deprecated now. Uniform matrix uploads are what you want to be doing.
[/quote]

Thanks, much appreciated :)

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