Sign in to follow this  
JDev

OpenGL Display List problems

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
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 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this