Results 1 to 3 of 3

Thread: Wavefront Object Loader Problem

  1. #1
    Newbie Newbie
    Join Date
    Dec 2012
    Posts
    1

    Wavefront Object Loader Problem

    Hey guys,

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

    http://openglsamples.sourceforge.net/files/glut_obj.cpp

    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
    Location
    Australia
    Posts
    1,117
    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
    Location
    Germany
    Posts
    1,135
    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 :
    glMatrixMode(GL_PROJECTION); 
    glViewport(0, 0, win.width, win.height); 
    GLfloat aspect = (GLfloat) win.width / win.height; 
    glMatrixMode(GL_PROJECTION); 
    glLoadIdentity(); 
    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.

Similar Threads

  1. Strange problem when drawing wavefront OBJ
    By Ruggero Visitnin in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 08-08-2014, 08:42 AM
  2. Wavefront obj loader material problem
    By lenka in forum OpenGL ES
    Replies: 0
    Last Post: 11-14-2010, 09:53 PM
  3. wavefront object terrains
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-30-2006, 05:50 AM
  4. problem with glm.c (nate robins wavefront)
    By in_crisis in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 02-08-2005, 03:54 AM
  5. object loader
    By sickCG in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-13-2002, 03:16 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