Results 1 to 3 of 3

Thread: Appropriate way to moving camera

  1. #1
    Junior Member
    Join Date
    Oct 2011

    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) ?

  2. #2

    Re: Appropriate way to moving camera

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

  3. #3
    Junior Member
    Join Date
    Jul 2011

    Re: Appropriate way to moving camera

    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.

Similar Threads

  1. [Camera] Can't make the camera move appropriately
    By onion_bread in forum OpenGL ES
    Replies: 0
    Last Post: 12-01-2011, 06:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean