Results 1 to 3 of 3

Thread: camera problem

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    2

    camera problem

    Hi
    I am new to opengl and i am trying to draw a triangle on the ZY plane. I am using gluLookAt to view my model but i am seeing only part of it. Everytime i put a value greater than 1 in the eye coordinates i get a black screen. Please help!!!
    Here are my codes:


    # include <iostream>
    # include <GL/glut.h>

    using namespace std;



    void draw()
    {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();




    gluLookAt(1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0);
    glBegin(GL_TRIANGLES);


    glVertex3f(0.0,0.0,0.0);
    glVertex3f(0.0,2.0,2.0);
    glVertex3f(0.0,0.0,4.0);


    glEnd();

    glutSwapBuffers();
    }

    int main(int argc, char **argv)
    {
    glutInit(&amp;argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPT H);
    glutInitWindowSize(400,400);
    glutCreateWindow("Theory");

    glutDisplayFunc(draw);

    glutMainLoop();
    return 0;
    }

  2. #2
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,214

    Re: camera problem

    Projection transformation is missing. Please, take a look at the third chapter of the Red book (or similar stuff about Viewing in 3D).

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    2

    Re: camera problem

    thanks for the help!!
    got it working!!

    I just didn't know where to look for an answer

Similar Threads

  1. camera problem
    By cod999 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-04-2014, 11:27 AM
  2. Camera problem!
    By hannahbanana in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-25-2013, 06:26 PM
  3. The FPS Camera problem
    By kamimail in forum OpenGL: General
    Replies: 0
    Last Post: 05-10-2010, 07:12 AM
  4. Problem with Camera ?
    By Ngoc Sang in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-11-2008, 10:53 AM
  5. Camera's problem
    By hendra.o in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-27-2000, 10:15 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