Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Translation towards the camera.

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    26

    Translation towards the camera.

    I probably already have a solution to the math behind moving the scene towards the camera, but it stops rendering when translated much at all and never seems to get closer to the camera even when it is translating. When I was going with making the area larger in scale to make it look like one is zooming in, the clipping wasn't as much of a problem and the range was much greater, so I am extremely confused. I have tried changing glOrtho(0,640,0,WHEIGHT,-1000,1000); to glOrtho(0,640,0,WHEIGHT,-32768,32768); and other things, but the problem remains. How should I go about editing the limits so that I can translate it closer to the camera without it disappearing? Thanks!

  2. #2
    Intern Contributor uwi2k2's Avatar
    Join Date
    Mar 2011
    Posts
    98

    ortho may be the problem

    hi,

    the Orthographic Projection may be the probem.
    Because of its nature you will never get a object as close to the camera as with a Perspective projection.
    You should just try it with a perspective and and almost same parameters.

    cu
    uwi
    uwi2k2 - OpenGL Trainer: www.opengl-trainer.com
    ---------------------------------------------------------
    Free Programming Helpline: www.programming-hotline.com
    ---------------------------------------------------------
    A Friday Night Programmer: www.uwiworld.net

  3. #3
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    26
    Thank you for your response! I was using glFrustum(-320,320,-(WHEIGHT/2),WHEIGHT/2,-1000,1000);, but nothing was rendering. Using the glGetError() function resulted in an "Invalid Value" error which wasn't there until I started using glFrustum. After some Googling, I found that negative values cannot be used for the Z Values (even though I think I may need to use them).

    I changed the arguments and here is how it renders now:
    Click image for larger version. 

Name:	glFrustum0.jpg 
Views:	74 
Size:	9.7 KB 
ID:	1030

  4. #4
    Intern Contributor uwi2k2's Avatar
    Join Date
    Mar 2011
    Posts
    98
    hi,

    its hard to give you more hints without seeing the code.
    if you send me a priv-msg with the code i will change it for you so you see the difference.

    cu
    uwi
    uwi2k2 - OpenGL Trainer: www.opengl-trainer.com
    ---------------------------------------------------------
    Free Programming Helpline: www.programming-hotline.com
    ---------------------------------------------------------
    A Friday Night Programmer: www.uwiworld.net

  5. #5
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    26
    Thanks! I will send you the pieces of code that matter the most.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •