Modern OpenGl 3.0+ Tutorial "Model Loading" Error.

  • Agnasius
    Likes 0

    Problem Description

    Hello, I have a problem.
    I watched the (btw great) tutorial series about Modern OpenGl 3.0+ and until now, there was nothing I couldn’t fix so far (or I made a mistake :) ).

    But now, in part 16, I have a problem which I probably can’t fix by myself. Even though I copied all the original code from the tutorial (and of course edited things like filenames etc.)

    When I actually try to load the model, the window keeps white (which is normal, because it’s loading the stuff), but closes shortly after it with no errors in the console.
    I went into debug mode and saw that at the point in the method “processMesh” when ‘vector.x = mesh->mNormals[i].x;’ is called, there is an access violation reading location error, and when I look down at the value list from the debug mode, the mesh->mNormals has the value 0x00000000 <NULL> and mesh->mNormals[i] is <Struktur bei NULL>, so something like <structure to NULL> (sorry I’m not the best translator :) ). If I comment out that section within this method, no error occurs but, of course, the model doesn’t show up. The full error is: “Ausgelöste Ausnahme: Lesezugriffsverletzung "mesh->**mNormals**" war "0x1110112". “, which means something like: “Triggered exception: read access violation "mesh -> ** mNormals **" was "0x1110112".”” (I’m German btw :D)
    The debug mode also stops at this point (seems ok to me because there was an exception).

    I’m working on Microsoft Visual Studio 2017 Community Edition,  glew-2.1.0, glfw-3.2.1, the latest glm version and ASSIMP-4.1.0
    Like I said, until now, everything went fine, so it can’t be glew or something.
    Please let me know if you need more information. 


    Thanks in advance and yours sincerely,

    Agnasius

  • Sonar Systems admin
    Likes 0

    What model are you using?

  • Agnasius
    Likes 0

    I’m using a simple Model of a (green) Sphere with a (yellow) 4-sided pyramid on it which I made with the Windows App 3D Builder. If I wasn’t too stupid to put the model with this post, I’d do it, but it’s just a “test.obj” with a “test.mtl”, so nothing special.

    3D Builder and 3D Paint open it without trouble, so it’s not the model.

    Thanks for the reply :)

  • Sonar Systems admin
    Likes 0

    Try using blender or maya to create the model or get one from online.

  • Agnasius
    Likes 0

    Ok, now I did one with blender (a cube with a cone which is surrounded by a torus), the program doesn’t crash (I don’t know why it does’nt crash now) but the model isn’t shown in the 3D space.

  • Sonar Systems admin
    Likes 0

    Any errors/warnings?

  • Agnasius
    Likes 0

    Errors: None
    Warnings: Only those “double in GLfloat (or similar): possible Data loss” warnings.

  • Sonar Systems admin
    Likes 0

                            

  • Sonar Systems admin
    Likes 0

    Try the model I used.

  • Agnasius
    Likes 0

    I built it again with Blender (from the attached .blend file), doesn’t show up either (no Errors / Warnings).
    I tried to attach my project, but I don’t know if it worked :) If not, please tell me how to do it, because I don’t get what to put into the link field :D

    Excuse me for being so irritated laugh

  • Sonar Systems admin
    Likes 0

    Have you tried the example code from GitHub?

  • Agnasius
    Likes 0

    OK, Now I’m confused. I copied the example code more than enough times (like three or four times) and never did it work…
    NOW, It works, but everything above the waist and hands is black. (Yes, I’ve downloaded every texture.) I’m really confused now…
    My CubeConeTorus is also just black (There is a fitting .mtl file).

    (I swear I used the code from GitHub multiple times...)


  • Sonar Systems admin
    Likes 0

    Any errors/warnings?

  • Agnasius
    Likes 0

    Nope. No errors, no important warnings. (again only double in float conversion stuff)

  • Sonar Systems admin
    Likes 0

    You try the model from the GitHub page?


    This reply has been verified.
  • Agnasius
    Likes 0

    Yeah, like I said, above the waist and hands, everything is black. Below that, the colour is normal.

  • Sonar Systems admin
    Likes 0

    This is weird, what are the versions of everything are you using?

  • Agnasius
    Likes 0

    glew-2.1.0
    glfw-3.2.1
    glm-0.9.9.0
    latest SOIL2
    assimp-4.1.0

    Actually everything should be the latest stuff.
    I created a GitHub repositrory and put my project inside, so you can look if there’s something wrong.
    https://github.com/Agnasius/MyOpenGLStuff/tree/master/openGLGraphics

  • Sonar Systems admin
    Likes 0

    Did every other tutorial work fine?

  • Agnasius
    Likes 0

    Yes. Otherwise, I would’ve stopped at a tutorial where it didn’t work anymore and tried to solve that :)

  • Agnasius
    Likes 0

    By the way, I noticed that in Blender, the model doesn’t have any textures. (The .blend file is in the same folder as the textures)
    I don’t know if this is an issue :/

    I also tried to load it with OpenGL 3D Model Viewer and it doesn’t look normal at all. More like ripped.


  • Sonar Systems admin
    Likes 0

    It would be, try a model that you definitely knows has correct textures applied.

  • Agnasius
    Likes 0

    Okay, did a sphere in Blender (with a rainbow texture), saved it as .obj with a .mtl file. The texture is in the same folder.
    Still black.
    Tried to add directional light again (thought it didn’t show because it’s dark).
    Nothing happens. (No errors, could of course be that I did something wrong so the light doesn’t work)

     


  • Sonar Systems admin
    Likes 0

    Try going through all the tutorials again and using the source code provided, as you said it could be an issue related to another part of the application.

  • Agnasius
    Likes 0

    Hey, 
    I went through the whole series again with no issues at any point.
    For the grand final, I let the different lights on from tutorial 14 I think (where all lights are combined), downloaded the model with textures and everything again, built it again with Blender aaaaaaaannnnnnddddddddddd…

    The head and torso are still black, but now, the Arms and shoulders load properly xD
    I put a screenshot of this at https://github.com/Agnasius/MyOpenGLStuff/tree/master/openGLGraphics, called nanosuit.PNG.

  • Sonar Systems admin
    Likes 0

    Great to hear it works now.

Login to reply