Some question of "TextureFromFile()" (IN CHAPTER 'MODEL')
HuajiKojima opened this issue · 3 comments
Hi, I have been following your tutorials on loading models but when process this function "TextureFromFile()", my IDE break my debug and return this error information:
It means the question is from the "glGenTextures()", cause this function is visit the null pointer
I want to trace debugging but I am a noob
Thank you and I am looking forward to your reply.
It's probably because you haven't initialized OpenGL/GLAD yet. Make sure TextureFromFile is called after OpenGL/GLAD/GLFW have been initialized. Maybe you're calling TextureFromFile from some object's constructor that's called before main() hit?
It's probably because you haven't initialized OpenGL/GLAD yet. Make sure TextureFromFile is called after OpenGL/GLAD/GLFW have been initialized. Maybe you're calling TextureFromFile from some object's constructor that's called before main() hit?
Yes, you are right, it is my bad, I used to think the "Model" object is a global object and I forget it. And it's constructor called "TextureFromFile()" before "main()" hit. Thank you for solve my rookie question.
Yep ahah, glad it helped! And no worries, reason I recognize this being the case is that I've frequently made the same mistake myself ;)