Jump to content
  • Advertisement
Sign in to follow this  
Vereor

OpenGL Shaders and matrix usage, best practice

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

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
Advertisement
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

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.


Thanks, much appreciated :)

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!