Question

I am using OpenGL 4.0, I have 3 things in my scene, they are-

1- VBO Plane
2- Cube maps
3- 3D models [3ds/obj]

I am using Assimp library to import 3D models, the code which I built to import models was done with the help of a tutorial on youtube from "TheCPlusPlusGuy".

Here is the issue I am facing, I can render the plane in my scene, I can render the cube maps, a.k.a. skyboxes, in my scene, I can render them together.
But When I am rendering any 3D model, be it .3ds or .obj, the screen doesn't update. Even if i resize the screen its not getting updated.
This only happens when I render a 3D model. I used flags and enabled drawing 3D models at runtime, the program runs fine until I render the models, once I render the models, the models itself do not appear on screen, but the screen again freezes.
I googled it, but no one else seems to be having an issue like this.

My primary diagnostic is because I am using VBO for planes, cubemaps, and 3D models I am having this issue.

Was it helpful?

Solution 3

I forgot to do this after rendering the plane->

glBindVertexArray(0);

After that the program was working like a charm.

OTHER TIPS

Here's a list of suggestions:

  • Using VBOs is not the problem. Nor is using Assimp.
  • Make sure you've specified the proper number of indices and primitives in your buffer and draw calls, and that they are properly formatted. The OpenGL docs can be vague on what these numbers need to be (bytes, indices, triangles?) so make sure that's done well. The Wiki does a better job of explaining this.
  • Does your model actually get past the loading stage? Have you tried a very simple model?
  • Make sure you are only loading the model once (ie not in the rendering loop, and if so, there's a mechanism to ensure that it only loads once). Repeatedly telling your program to load a model will make it run very slowly and runs the risk of eating up all your memory.
  • Make sure you've translated the model properly from Assimp's data structures to your own. Check that values are being set properly. Load an OBJ and print the values you're copying - do they line up with the .obj file?
  • Do you have a valid OpenGL context at the time you're loading the model? Loading from Assimp doesn't require one, but going from that data structure to a VBO does.

I'm sure you've done a number of these things but I've had tricky times doing this task, too. Going through step by step will help you narrow down the problem.

I am using Assimp to import models in my editor, but Assimp is only used to read models and mesh data and the values are stored in my own model/mesh format. I assume we all do this? I have had no problems with Assimp, and I am also led to believe that skyboxes etc should be rendered after all other opaque objects so you can do a few tricks to minimize rendering time (skyboxes are to be considered as one of the furthest distant objects).

I am inclined to agree with Bartek. Assimp seems to be irrelevant to the problem you are having, and I would consider redesigning your rendering methods.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top