Results 1 to 3 of 3

Thread: Zooming out

  1. #1
    Junior Member Newbie
    Join Date
    May 2008

    Zooming out


    I'm having a bit of trouble visualizing the whole camera thing. I get confused between changing the "view" using translatef and gluLookAt...

    Right now I'm just trying to draw a cube glWireCube(1.0);, and "zoom out" so that it looks farther away. From my textbook, I understood that if I used translatef(0.0,0.0,-0.5); the effect will be as though I move the cube 0.5 units (pixels?) down the negative z-axis.

    I tried the following:
    Code :
    #include <gl/glut.h> // GLUT header file
    #include <gl/gl.h> // OpenGL header file
    void display() {
    void main(int argc, char **argv) {
    glutInit(&amp;argc, argv);

    But it's cutting out the back of the cube. I don't understand why...

    Sorry for this ultra-newbie question. Hopefully, I'll get a feel for this soon enough.

    - Canadian0469

    Note: I know that I can just increase my viewing volume using
    glOrtho(-2, 2, -2, 2, -2, 2);
    for example, but I want to know why what I tried above doesn't work. Does it have to do with the initial viewing volume being too small?

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Apr 2004

    Re: Zooming out

    Part of your cube is most likely being clipped. If you don't specify the projection matrix it will use the default one which is an orthographic projection in the [-1,1]x[-1,1]x[-1,1] range.
    This means that your visible depth ranges from -1 to 1. Translating the cube towards the back causes part of the cube to fall outside of the depth range. These parts will get clipped
    and will therefore not be rasterized. Hope this helps.

  3. #3
    Junior Member Newbie
    Join Date
    May 2008

    Re: Zooming out

    Thank you so much -NiCo-! That's exactly what I wanted to know!

    - Canadian0469

Similar Threads

  1. zooming
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-10-2005, 11:29 AM
  2. zooming
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-14-2002, 10:47 PM
  3. Zooming in and out
    By SurGL in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-14-2001, 10:57 PM
  4. Zooming
    By KurtCob in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 09-18-2000, 05:26 AM
  5. zooming
    By Harry of DAIW in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 07-26-2000, 03:07 AM

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