View Full Version : Need of an advice related to transformations
06-30-2010, 10:16 AM
I am starting with glsl and OpenGL 3.30 and so far I have implemented rotation, traslation and perspective (like in OpenGL 2.0).
My question is this. Should I calculate the vertex transformation out of the vertex shader or in the vertex shader? (give the shader rotation, traslation and projection).
Thanks in advice.
06-30-2010, 10:23 AM
How frequently do You change the data?
If your data is static (transformation remains the same most of the time) then do it once out of shader,
or in shader and store result somewhere for later use (transform-feedback).
If your data has differrent transformation in each frame do it in vertex shader
(that's what vertex shaders are supposed to do)
06-30-2010, 03:03 PM
If you move your camera, transformation will change anyway from frame to frame so you should do it in your vertex shader.
If I'm wrong and even the camera is at fixed position all the time then you can do it as a preprocessing.
06-30-2010, 07:53 PM
Thanks for your fast reply, they helped a lot
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.