Results 1 to 2 of 2

Thread: Vincent Perspective View

  1. #1
    Junior Member
    Join Date
    Feb 2005
    Posts
    3

    Vincent Perspective View

    Hi,

    I am trying to get a perspective view to work with Vincent.

    I have set it up as follows :

    -------------------------------
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glViewport(0, 0, width, height);
    ugluPerspectivef(45.0f, (float)(width / height), 0.1f, 20.0f);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    --------------------------------

    My display code is as follows. I have enabled depth testing and have cleared the depth buffer and set the depth function to GL_LEQUAL.

    -----------------------

    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
    ugSolidCubef(0.5f);

    glColor4f(0.0f, 1.0f, 0.0f, 1.0f);
    glTranslatef(-0.25f, 0.0f, -1.0f);
    ugSolidCubef(0.5f);

    glFlush ();
    ugSwapBuffers(uwin);

    --------------------------------------

    This renders a red square and a green square in front of the red square.

    First of all, shouldn't the translation of -1.0f in the z axis move the green square behind the red one, not the other way around.

    Second of all, the squares are the same size. Shouldn't they be different sizes considering that they are not in the same place in the z axis.

    Any ideas of what could be wrong.

    Thanks,
    Zeus

  2. #2
    Junior Member
    Join Date
    Feb 2005
    Posts
    3

    Re: Vincent Perspective View

    Hi,

    Nevermind. I found that I was actually using the wrong depth parameters.

    Thanks

Similar Threads

  1. Shpere get distorted in perspective projection view, why
    By yinyuanqings in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 12-13-2011, 08:38 PM
  2. Perspective View
    By thesidisticme in forum OpenVG and VGU
    Replies: 3
    Last Post: 05-12-2010, 11:00 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
  •