Problem while working through learnopengl.com - Why does the rest of the scene turn b

Hi!
I’m currently working my way through the tutorials at learnopengl.com. Everything went relatively smoothly up until now.
I created a scene with two textured boxes, a floor and a single light source - Everything is working as expected.
Next, I tried to load a model using the provided model.h class from learnopengl.com, which utilizes ASSIMP. Unfortunately, the rest of the scene now turns black when I render the model :frowning:

I’ve uploaded my main.cpp, vertex shader, fragment shader, and model.h+mesh.h here: basicShader.frag · GitHub

Can somebody shed some light on what I’m doing wrong?

Thanks!

EDIT: Here is a screenshot of the Scene without and with the model:
[ATTACH=CONFIG]1465[/ATTACH]

EDIT2: I got the suggestion that I’m probably not resetting all state information after drawing my objects. So I set a breakpoint at the end of the main loop and as it turns out, the first frame is rendered correctly, all subsequent frame fail.
I have now added a call to glBindTexture(GL_TEXTURE_2D, 0) and glBindVertexArray(0) after every draw() call, but the result stays the same. I also checked the model loader, it too unbinds all textures after the draw call :confused:

Which other state information is there to reset?

Lots.

You don’t want to just start guessing and trying state. What I’d recommend is to capture a GL call trace of your application. Then you can look and see what state the third party library is setting. apitrace is one easy to use tool that will capture a GL call trace. From that you can dump it to text format, or you can bring it up in a GUI browser, and even replay it.

[QUOTE=Dark Photon;1286868]Lots.

You don’t want to just start guessing and trying state. What I’d recommend is to capture a GL call trace of your application. Then you can look and see what state the third party library is setting. apitrace is one easy to use tool that will capture a GL call trace. From that you can dump it to text format, or you can bring it up in a GUI browser, and even replay it.[/QUOTE]

Thanks for your reply, I tried using apitrace, when I look at the frames I get a single white box.
One of the error messages read:

major shader compiler error 1: SHADER_ID_LINK error has been generated. GLSL link failed for program 3, "": ERROR: Definition for "void main()" not found.

When I run my application directly, at least the first frame is rendering correctly, therefore I’m not clear why there is a problem linking and compiling my shaders…

[QUOTE=Dark Photon;1286868]Lots.

You don’t want to just start guessing and trying state. What I’d recommend is to capture a GL call trace of your application. Then you can look and see what state the third party library is setting. apitrace is one easy to use tool that will capture a GL call trace. From that you can dump it to text format, or you can bring it up in a GUI browser, and even replay it.[/QUOTE]

I tried using apitrace to debug my program, but unfortunately it doesn’t show me a single correct frame. One of the first errors is:

major shader compiler error 1: SHADER_ID_LINK error has been generated. GLSL link failed for program 3, "": ERROR: Definition for "void main()" not found.

As I said, when I’m running my program directly, it at least renders the first frame directly, therefore I’m not sure why running with apitrace produces shader linking errors all of a sudden.

Very confusing!

EDIT: I already checked the paths and set the working directory in Visual Studio to the location of the executable, and subsequently adjusted the paths in my program so that starting from within VS and starting the exe directly reference the same working directory.

I just solved my problem - I was missing a call to glActiveTexture() prior to rendering my objects :slight_smile: