Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Wavefront Object Loader Problem

  1. #1
    Newbie Newbie
    Join Date
    Dec 2012

    Wavefront Object Loader Problem

    Hey guys,

    I've been trying to implement this object loader to no avail.

    Right now I am just getting a blank screen and I am pretty sure I am copying it exactly! Advise anybody?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    try to break your problem up into small bits - for example make your render code can display a simple bounding box that you hard code then look at the .obj

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    1. Did you check for GL errors?
    2. If the GL code is clean, did you check your loaded data?

    One thing I saw in your code is this:

    Code :
    glViewport(0, 0, win.width, win.height); 
    GLfloat aspect = (GLfloat) win.width / win.height; 
    gluPerspective(win.field_of_view_angle, aspect, win.z_near, win.z_far);

    It's technically not an error but unnecessary and redundant. glViewport() does not alter the matrix stack. You need only change the current if you actually involve matrix manipulation functions, like gluPerspective(), glFrustum(), glOrtho(), glLoadIdentity() and so on. In any case, setting the matrix mode to GL_PROJECTION twice in a row without any switch to another matrix stack, like GL_MODELVIEW, is a redundant state change. In the init function it doesn't really make a difference but if this scheme becomes a habit and you introduce a lot of redundant state changes into performance critical code, you'll probably see performance drops. Remember that for the future.

    Finally, a little pedantry on the side: It's vertices not verteces.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts