Results 1 to 3 of 3

Thread: Graphic card for stereo images!

  1. #1
    Member Newbie
    Join Date
    Feb 2004
    Posts
    41

    Graphic card for stereo images!

    Hi I am using a Nvidia Geforce4 MX440 64MB graphic card to dusplay stereo images. The program compiles well but when I try to execute it, it comes up with an error message saying - GLUT: Fatal error in H:\code\Debug\stereo.exe: pixel format with necessary capabilities not found.

    I was wondering if anyone could help me to solve this problem, whether there is somethins wrong with the code or I need to do enable some settings for the graphic card.

    Thanks alot
    Pran

  2. #2
    Member Newbie
    Join Date
    Feb 2004
    Posts
    41

    Re: Graphic card for stereo images!

    This is the code.. so I am wrong in the code !!!!!!!

    #include <glut.h>
    #include<stdlib.h>
    #include <math.h>

    #define KEY_ESC 27

    #define DTOR 0.0174532925 /* degree of radians*/


    /*
    Enumerations
    */
    typedef enum{LEFT,RIGHT} EyeMode;


    GLvoid drawScene( EyeMode eyeMode);

    void setStereoPerspective( GLdouble fovy, GLdouble aspect, GLdouble n, GLdouble f,
    GLdouble focalLenght, GLdouble eyeSep, EyeMode eyeMode);

    void setStereoLookAt( GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ,
    GLdouble centreX, GLdouble centreY, GLdouble centreZ,
    GLdouble upX, GLdouble upY, GLdouble upZ, GLdouble eyeSep,
    EyeMode eyeMode);
    GLvoid render(EyeMode eyeMode);
    GLvoid display(GLvoid);

    GLvoid keyboard (GLubyte key, GLint x, GLint y);


    /* Multiply the current matrix by a stereo perspective projection matrix.
    Parameteres are mostly the same as gluPerspective */

    void setStereoPerspective( GLdouble fovy, GLdouble aspect, GLdouble n, GLdouble f,
    GLdouble focalLenght, GLdouble eyeSep, EyeMode eyeMode)
    {
    /* The trick is to implement the " parallel axis asymmetric frustum perspective projection"
    */

    GLdouble left;
    GLdouble right;
    GLdouble stereoAdjustment;

    GLdouble top =n*tan(DTOR * fovy/2);
    GLdouble bottom = -top;

    GLdouble nearWidth =aspect*top;
    stereoAdjustment =eyeSep/2*n/focalLenght;

    if(RIGHT == eyeMode)
    {
    left = -nearWidth - stereoAdjustment;
    right = nearWidth - stereoAdjustment;
    }
    else
    {
    left = -nearWidth + stereoAdjustment;
    right = nearWidth + stereoAdjustment;
    }

    glFrustum(left, right, bottom, top, n, f);
    }

    /*
    Parameters are mostly the same as for gluLookAt.
    Notes:
    eye represents the centre of the left, right eye
    eyeSep is the distance between the left and right eye
    eyeMode is either LEFT (eye) of RIGHT (eye)
    */

    void setStereoLookAt( GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ,
    GLdouble centreX, GLdouble centreY, GLdouble centreZ,
    GLdouble upX, GLdouble upY, GLdouble upZ, GLdouble eyeSep,
    EyeMode eyeMode)
    {
    GLdouble inX = centreX - eyeX;
    GLdouble inY = centreY - eyeY;
    GLdouble inZ = centreZ - eyeZ;

    GLdouble factor = (eyeMode==RIGHT)?1:-1;

    GLdouble realEyeCorX = factor * (inY*upZ - upY*inZ);
    GLdouble realEyeCorY = factor * (inZ*upX - upZ*inX);
    GLdouble realEyeCorZ = factor * (inX*upY - upX*inY);

    GLdouble lenght = sqrt( realEyeCorX*realEyeCorX
    + realEyeCorY*realEyeCorY
    + realEyeCorZ*realEyeCorZ);

    gluLookAt( eyeX+realEyeCorX, eyeY+realEyeCorY, eyeZ+realEyeCorZ,centreX,centreY,centreZ,upX,upY,u pZ);
    }

    GLvoid drawScene( EyeMode eyeMode)
    {
    /*
    if(eyeMode== LEFT)
    {
    glColor3f(1.0,0.0,0.0);
    }
    else
    {
    glColor3f(0.0,1.0,0.0);
    }*/
    glPushMatrix();
    {
    glRotatef(-45.0,0.0,0.0,0.0);
    glutSolidTeapot(1.0);
    }
    glPopMatrix();
    }

    GLvoid render(EyeMode eyeMode)
    {
    double fovy = 50;
    double aspect = 4/3;
    double n = 1.0;
    double f = 5.0;
    double focalLenght = 1.5;
    double eyeSep = 0.03;

    double eyeX = 0.0;
    double eyeY = 0.0;
    double eyeZ = 4.0;
    double centreX = 0.0;
    double centreY = 0.0;
    double centreZ = -100;
    double upX = 0.0;
    double upY = 1.0;
    double upZ = 0.0;

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    setStereoPerspective(fovy, aspect, n, f, focalLenght, eyeSep, eyeMode);
    glMatrixMode(GL_MODELVIEW);

    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();
    {

    setStereoLookAt(eyeX,eyeY,eyeZ,centreX,centreY,cen treZ,upX,upY,upZ,eyeSep,eyeMode);
    drawScene(eyeMode);
    }
    glPopMatrix();
    }

    GLvoid display(GLvoid)
    {
    glDrawBuffer(GL_BACK);
    glClear(GL_COLOR_BUFFER_BIT);

    glDrawBuffer(GL_BACK_LEFT);
    render(LEFT);

    glDrawBuffer(GL_BACK_RIGHT);
    render(RIGHT);

    glutSwapBuffers();
    }

    GLvoid keyboard (GLubyte key, GLint x, GLint y)
    {
    switch(key)
    {
    case ' ':
    glutPostRedisplay();
    case KEY_ESC:
    exit(0);
    break;

    default:
    break;
    }
    }

    int main( int argc, char *argv[])
    {
    glutInit( &argc, argv);

    glutInitDisplayMode( GLUT_RGB|GLUT_DOUBLE|GLUT_STEREO);
    glutCreateWindow( argv[0]);

    glutKeyboardFunc(keyboard);
    glutDisplayFunc(display);

    glutMainLoop();

    return 0;
    }

  3. #3
    Senior Member Regular Contributor
    Join Date
    Mar 2004
    Posts
    143

    Re: Graphic card for stereo images!


Similar Threads

  1. Switchable Graphic Cards: Which Graphic card will OpenGL choose
    By harsha00790 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 02-09-2013, 06:28 AM
  2. Stereo Images @ 60Hz each
    By desiboy in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 04-14-2010, 02:16 PM
  3. Stereo images
    By vickmick in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 12-13-2003, 02:28 AM
  4. Need interlaced stereo images
    By Moz in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-05-2001, 03:56 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