LWJGL
May 23, 2013, 02:03:00 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Help with understanding use of Matrix4f  (Read 676 times)
blindstone
Newbie
*
Posts: 1


« on: February 29, 2012, 19:10:58 »

Hey everyone, looking for a bit of guidance using matrix4f in a 3d environment.

i acknowledge (I believe so anyways) what matrices are and how to add/sub/multiple them properly, however I am having a hard time understanding how to use them properly.

As in when using matrix's should I ever have to use glTranslatef anymore? or is it all based off of calculating matrix's?

(sorry if this sounds dumb perhaps im not explaining it correctly or getting the full meaning behind them.)
Logged
spasi
Nerdus Imperius
*****
Posts: 752



WWW
« Reply #1 on: March 17, 2012, 06:08:35 »

In modern OpenGL all functions that manipulate the fixed function matrix stacks have been deprecated. In a core GL context there's no Translatef/Rotatef/MultMatrix/PopMatrix/etc. That means that the recommended way (and only possible way in GL core) is to build the transformation matrix client-side, then doing a single call to UniformMatrix4f to update the bound shader's MVP matrix uniform.

Even if we ignore GL core, it's still the preferred way of doing it. There's less overhead in doing it client-side (less JNI calls) and the GL driver has less state to track and update. In fixed function OpenGL you'd use glLoadMatrix instead of glUniformMatrix.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!