Jump to content
  • Advertisement
Sign in to follow this  
JDev

OpenGL Display List problems

This topic is 4350 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, I'm writting a game in C++ and opengl and I am trying to render some models using opengl display lists. I currently have code that can display the models without display lists however, I don't see anything when I render the same model with display lists. I have taken the sample NEHE code and added my model loading code for simplicity. When I add my drawing code to the existing NEHE code it adds the model to that display list just fine. When I try to create a separate list using a diffrent generated id, I get an ID but it doesn't draw. I also have glerror statements after the draw list function is called and no errors appear. Anybody else have a simular error...? URL: http://gaia.ecs.csus.edu/~sathrej/lesson12.zip thanks, JDev

Share this post


Link to post
Share on other sites
Advertisement
Generally if you have a function that displays the model then the following two functions will suffice. The first is for the creation of the display list and the second you use it to display the model within your draw function.
I suggest to use them in a model class.

GLuint ListName;

void ListLoad() {ListName = glGenLists(1); glNewList(ListName, GL_COMPILE); displayTheModel(); glEndList(); }

void displayViaList(int ListName) { glCallList(ListName); }

Share this post


Link to post
Share on other sites
I understand my naming convention is not correct. I still don't understand why when I create a display list in my own class it doesn't display, but when I attach the same draw code to the NEHE code it's display list displays just fine...?

Share this post


Link to post
Share on other sites
I bet you are declaring that class GLOBAL? If so don't or move the function you create the DL after you initialize GL...

Share this post


Link to post
Share on other sites
I tried adding the creation of the display list to the display function, but I still don't see anything...?

Share this post


Link to post
Share on other sites
Quote:
Original post by JDev
I tried adding the creation of the display list to the display function, but I still don't see anything...?


I hope you aren't calling the creation of the DL every frame? Post some code and you will have a better chance of getting help.

Share this post


Link to post
Share on other sites
Ok I solved my problem, thank you to all who tried to help me.

My problem was that I was loading the .mtl file (material file) first and then calling the draw routine without loading the .obj file with the VERTICIES!!! So basically I was drawing everything correctly, I just didn't have any verticies to draw.
thanks,
JDev

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!