Results 1 to 3 of 3

Thread: Can you help me with glortho and the camera ?

  1. #1
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    France
    Posts
    286

    Can you help me with glortho and the camera ?

    this is my program :

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

    #define X .525731112119133606
    #define Z .850650808352039932


    void display ()
    {
    static GLfloat tableau_entrelace [] = {1.0, 1.0, 1.0, -X, 0.0, Z, 1.0, 1.0, 1.0, X, 0.0, Z,
    1.0, 1.0, 1.0, -X, 0.0, -Z,1.0, 1.0, 1.0, X, 0.0, -Z, 1.0, 1.0, 1.0, 0.0, Z, X,
    1.0, 1.0, 1.0, 0.0, Z, -X, 1.0, 1.0, 1.0, 0.0, -Z, X, 1.0, 1.0, 1.0, 0.0, -Z, -X,
    1.0, 1.0, 1.0, Z, X, 0.0, 1.0, 1.0, 1.0, -Z, X, 0.0,1.0, 1.0, 1.0, Z, -X, 0.0,
    1.0, 1.0, 1.0, -Z, -X, 0.0} ;

    glInterleavedArrays (GL_C3F_V3F, 0, tableau_entrelace) ;

    static GLuint indices [20][3]= {1,4,0,4,9,0,4,5,9,8,5,4,1,8,4,1,10,8,10,3,8,8,3,5 ,3,2,5,
    3,7,2,3,10,7,10,6,7,6,11,7,6,0,11,6,1,0,10,1,6,11, 0,9,2,11,9,5,2,9,11,2,7};

    glPolygonMode (GL_FRONT, GL_LINE) ;
    glFrontFace (GL_CCW) ;
    glEnable (GL_CULL_FACE) ;
    glCullFace (GL_BACK) ;

    glDrawElements (GL_TRIANGLES, 60, GL_UNSIGNED_BYTE, indices) ;

    glutSwapBuffers() ;
    glFlush () ;
    }

    void main (int argc, char** argv)

    {
    glutInit (&argc, argv) ;
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) ;
    glutInitWindowSize (640, 480) ;
    glutInitWindowPosition (250,250) ;
    glutCreateWindow (argv [0]) ;

    glClearColor (0.0, 0.0, 0.0, 0.0) ;
    glClear (GL_COLOR_BUFFER_BIT) ;

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glOrtho(-10.0 , 10.0, -10.0, 10.0, -5.0, 20.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glutDisplayFunc (display) ;
    glutMainLoop () ;

    }

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    763

    Re: Can you help me with glortho and the camera ?

    y-e-s... that looks like a program to me! some dialect of C, if I'm not mistaken.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    France
    Posts
    286

    Re: Can you help me with glortho and the camera ?

    but i don't work, we don't see the whole object

Similar Threads

  1. World, camera, object coordinates in the glOrtho function
    By giorgik in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-28-2017, 11:24 AM
  2. How to set a camera for glOrtho?
    By neuormouse in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-15-2014, 02:17 AM
  3. glOrtho() and camera shaking magnitude
    By saucermancer in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-26-2011, 01:18 PM
  4. Problem with moving a camera in glortho
    By Kal Mar in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 09-02-2010, 07:56 AM
  5. Camera Position / Camera Angle / Camera Target Position
    By bobGL in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-02-2007, 09:28 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