Results 1 to 2 of 2

Thread: GLM beginning

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2008
    Posts
    4

    GLM beginning

    Hi..I am new to opengl and glut..

    below is the piece of code to import and display an object titled f-16.obj...the code compiles and an empty window appears but the object doesnot load.Can u tell me what i am doing wrong.

    Thanks..



    int
    main(int argc, char** argv)
    {
    glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    GLMmodel* pmodel = NULL;
    int models;

    glutInitWindowSize(600, 600);
    glutInit(&argc, argv);

    glutCreateWindow("TeSt");
    //glutReshapeFunc(reshape);
    //glutDisplayFunc(display);
    //printf("Here i Am!!!");
    pmodel = glmReadOBJ("f-16.obj");
    //if (!pmodel) exit(0);
    glmUnitize(pmodel);
    glmFacetNormals(pmodel);
    glmVertexNormals(pmodel, 90.0);


    glmDraw(pmodel, GLM_SMOOTH | GLM_MATERIAL);
    glutMainLoop();
    }

  2. #2
    Senior Member Regular Contributor trinitrotoluene's Avatar
    Join Date
    Sep 2008
    Location
    Montérégie,Québec
    Posts
    362

    Re: GLM beginning

    My guess is that your camera is not set to be able to view the model. What is the parameter of gluPerspective or glFrustum you give. Take care of znear and zfar. Do you use gluLookAt? Blank screen happen often when these parameter are incorrect.

    Try to draw a simple geometry like a triangle around the origin and adjust your projection matrix and modelview matrix to be able to see it.

    I don't use glut but to be able to view something you should at least use

    glViewport and (gluPerspective or glFrustum or glOrtho, etc)
    for setting the projection matrix

    gluLookAt or (glTranslate,glRotate) to modify the modelview matrix but these are not obligatory.

    Try to find tutorial for learning how to set the projection and the modelview matrix correctly.

    hope it help.

Similar Threads

  1. beginning
    By franciscoBiaso in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 05-28-2012, 06:53 PM
  2. Beginning OpenGLSL
    By Songoku in forum OpenGL: GLSL
    Replies: 46
    Last Post: 03-26-2004, 11:37 AM
  3. Beginning Advanced?
    By Lurking in forum OpenGL: Advanced Coding
    Replies: 12
    Last Post: 06-10-2002, 05:37 AM
  4. Beginning
    By KraKRaZoR in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-09-2002, 11:56 PM
  5. beginning
    By mathlf in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-22-2001, 11:50 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