Archived

This topic is now archived and is closed to further replies.

Display List

This topic is 5501 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

well, I''ve got a problem. I want to create a display list. All lists should be objects loaded from .3ds files. If I try to use this: GLvoid BuildLists() { DisplayList = glGenLists(1); glNewList(DisplayList,GL_COMPILE); for(int i = 0; i < g_3DModel.numOfObjects; i++) { if(g_3DModel.pObject.size() <= 0) break; t3DObject *pObject = &g_3DModel.pObject; if(pObject->bHasTexture) { glEnable(GL_TEXTURE_2D); glColor3ub(255, 255, 255); glBindTexture(GL_TEXTURE_2D, g_Texture[pObject->materialID]); } else { glDisable(GL_TEXTURE_2D); glColor3ub(255, 255, 255); } glBegin(g_ViewMode); for(int j = 0; j < pObject->numOfFaces; j++) { for(int whichVertex = 0; whichVertex < 3; whichVertex++) { int index = pObject->pFaces[j].vertIndex[whichVertex]; glNormal3f(pObject->pNormals[ index ].x, pObject->pNormals[ index ].y, pObject->pNormals[ index ].z); if(pObject->bHasTexture) { if(pObject->pTexVerts) { glTexCoord2f(pObject->pTexVerts[ index ].x, pObject->pTexVerts[ index ].y); } } else { if(g_3DModel.pMaterials.size() && pObject->materialID >= 0) { BYTE *pColor = g_3DModel.pMaterials[pObject->materialID].color; glColor3ub(pColor[0], pColor[1], pColor[2]); } } glVertex3f(pObject->pVerts[ index ].x, pObject->pVerts[ index ].y, pObject->pVerts[ index ].z); } } glEnd(); } glEndList(); } nothing appears on the screen. But when I draw a cube or sphere instead of reading the .3ds file, everything goes allright... Help pls.

Share this post


Link to post
Share on other sites
Have you tried manually putting the cube into the Model structure as if it had been loaded before running the BuildLists function to see if the problem isn''t in your loading routine.

Share this post


Link to post
Share on other sites
yes, I do that in my RenderScene() function, the glBuilList is in my Init() function... All I want to say is, that it works fine when I draw just a cube using glVertex3f in display list, but when I want to draw object from the .3ds file, nothing appears on the screen........
And the 3ds file loader works fine, because if I''m not using display list, everything appears on the screen....

Share this post


Link to post
Share on other sites