Appropriate way to moving camera

I recently start useing OpenGL ES 2.0, earlier I used 1.0 version.
I porting my small game from 1.0 to 2.0 version with shaders, and I have one question. In my game I moving camera useing gluLookAt(…) in fuction to draw actual frame. To gluLookAt I pass position coordinate my camera. Which way is most appropriate, moving camera in source code (in my case, java) or in shaders (by translate View camera) ?

The “translate View camera” is the natural way to go. Let us know how it goes or if you have still some problem. 8)

No, the natural way would be to have the camera movement code on your CPU, in this case in Java.

Imagine you rendering millions of triangles/second, doing your camera code for each of them every time in a shader. That is not a good idea if the same variable can be calculated once on the CPU and then passed down.

Not only that, but imagine you want to construct your camera perspective and modelview matrices on the GPU, as suggested, you would have to give the camera coordinates, aspect ratio, angle of view, directional etc… All these variable would need to be passed as uniform variables. Thus having the same or even more variables that have to be passed down to the GPU. Remember that the pipeline between CPU and GPU is often the bottleneck of any graphics application.

It is true however, that GPUs are much much faster than CPUs doing floating point operations, but in this case, going from a single operations to many more thousands, wont make your application faster, even though the GPU is fast.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.