Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Raw File Loader

  1. #1
    Intern Newbie
    Join Date
    Feb 2010
    Posts
    41

    Raw File Loader

    Hello, I'm fairly new to OpenGL, and I've been writing a .raw loader to import models from Blender. Here's my header file: http://docs.google.com/View?id=dd7xssbg_6d52d3qhb, and my source file: http://docs.google.com/View?id=dd7xssbg_7g28pqtd2. When I run this, I get an error saying "Unhandled exception at 0x00000000 in RawModel.exe: 0xC0000005: Access violation reading location 0x00000000." I use Visual C++ and I know that there isn't anything wrong with the .raw file (cube.raw), it's fairly simple. Does anyone know why I'm getting an error, and how I can fix it? Also, if anyone could give me any recommendations of how to write a 3d loader (of basically any format) for OpenGL, that would be great, because I just figured that .raw would be easiest and I don't really understand it very well. Thanks.
    "There is no path to peace. Peace is the path." -Gandhi

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: Raw File Loader

    For one thing, run your code on the debugger, so you can pin point the exact line of the segfault.
    Probable a too small or uninitialised array.

  3. #3
    Intern Newbie
    Join Date
    Feb 2010
    Posts
    41

    Re: Raw File Loader

    How do I find the error in the debugger?
    "There is no path to peace. Peace is the path." -Gandhi

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

    Re: Raw File Loader

    In your main function, you call OpenGL functions before you have a valid rendering context. Don't call OpenGL functions before glutInit.

  5. #5
    Intern Newbie
    Join Date
    Feb 2010
    Posts
    41

    Re: Raw File Loader

    Oh yeah, you're right. I fixed that, but it still gives the same error.
    "There is no path to peace. Peace is the path." -Gandhi

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

    Re: Raw File Loader

    I have run your code, but I don't have a 3d raw file to test with. So now, when I run the program, I got an infinite loop somewhere and the program is not responding. Often, when a program crash at address 0x00000000, you are dereferencing a null pointer. So check very carefully the way you create and destroy your memory with new and delete.

  7. #7
    Intern Newbie
    Join Date
    Feb 2010
    Posts
    41

    Re: Raw File Loader

    So you're getting the same error even without the file? I'll have to look back at my code.
    "There is no path to peace. Peace is the path." -Gandhi

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

    Re: Raw File Loader

    No , I have now an infinite loop in your model.render function because I don't have a 3D model to load and I cannot verify your code farther.

  9. #9
    Intern Newbie
    Join Date
    Feb 2010
    Posts
    41

    Re: Raw File Loader

    Hm...I think I might just get rid of this code and write a .obj loader or some other 3d format, because I actually don't understand .raw very well. Does anyone recommend a certain format or have a link to any tutorial for creating a loader?
    "There is no path to peace. Peace is the path." -Gandhi

  10. #10
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,052

    Re: Raw File Loader

    This contains an OBJ and TGA Loader. Feel free to use, modify, ignore, do whatever you want with it.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

Posting Permissions

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