Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Display lists suck


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 NewDeal   Members   -  Reputation: 134

Like
Likes
Like

Posted 12 July 2001 - 12:13 PM

Hey, Im having some problems getting my display lists working. The problem lies in the call to glGenList() i think. At least the msg box pops up when i run the function CreateDisplayList()
    
class MS3DModel
{
private:
	
	Mesh *MeshList;
	Material *MaterialList;
	int numVertices, numMeshes, numNormals, numTriangles, numMaterials;
public:
	GLuint listthingy;

	MS3DModel();
	MS3DModel(char *filename);
	~MS3DModel();
	bool LoadFromFile(char *filename);
	void Print(); // for debugging

	void Render();
	void CreateDisplayList();
	void RenderFromDisplayList();
};

void MS3DModel::CreateDisplayList()
{
	listthingy = glGenLists(1);

	if (listthingy == 0) 
	{
		MessageBox(NULL,"FUCK!!","ERROR",MB_OK|MB_ICONEXCLAMATION);
	}

	glNewList(listthingy, GL_COMPILE);
	glBegin(GL_TRIANGLE_STRIP);
	for (int m=0; m<numMeshes; m++)
	{
		
		for (int t=0; t<numTriangles; t++)
		{
			glTexCoord2f(MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[0]].u, 
MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[0]].v);
			glVertex3f(MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[0]].location[0] , 
					   MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[0]].location[1],  
					   MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[0]].location[2]);
			
			glTexCoord2f(MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[1]].u, 
MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[1]].v);
			glVertex3f(MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[1]].location[0] , 
					   MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[1]].location[1],  
					   MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[1]].location[2]);
			
			glTexCoord2f(MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[2]].u, 
MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[2]].v);
			glVertex3f(MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[2]].location[0] , 
			     	   MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[2]].location[1],  
					   MeshList[m].VerticesList[MeshList[m].TrianglesList[t].VertexIndices[2]].location[2]);

		}
		
	}
	glEnd();
	glEndList();
}
    
I got another function called Render() which has pretty much the same code as CreateDisplayList() except the list commands ofcourse, and that function works like a charm. BTW glGenLists() return 0 if an error occurs. Can figure out what goes wrong though. Hope you can help me out. Thanks in advance Edited by - newdeal on July 12, 2001 7:17:14 PM

Sponsor:

#2 NewDeal   Members   -  Reputation: 134

Like
Likes
Like

Posted 12 July 2001 - 12:30 PM

Well, just found this in some developers journal. Too bad i have no clue what the guy''s saying . Maybe you do.

quote:

"Well, that certainly sucked. Just spent the last two days tracking down why glGenLists() kept returning 0 and all display lists weren''t working. I came to the conclusion that it had to do with GL context init - the ortho views share the same display lists as the perspective view, but they are created before the context is initialized. Theoretically, it was Qt''s fault. I''ve got to organize the GL stuff, though."



#3 Aldacron   GDNet+   -  Reputation: 3278

Like
Likes
Like

Posted 12 July 2001 - 01:14 PM

The first place to look is glGetError(). If the return value of glGetError() == GL_NO_ERROR, then you''re really going to have fun . There are only a few errors defined in OpenGL, and some of them, such as GL_STACK_OVERFLOW, have no effect on the program other than to set the error flag. Check out the Blue Book for a complete list of the error defines (or gl.h).

#4 Krippy2k   Members   -  Reputation: 134

Like
Likes
Like

Posted 12 July 2001 - 04:20 PM

There are 2 things that I would make sure of. First make sure that you are generating your lists AFTER you initialize OpenGL. And make sure that you are not calling glBegin before generating the display list. Either of those situations would cause glGenLists to fail and return GL_INVALID_OPERATION from glGetError.

Seeya
Krippy

#5 NewDeal   Members   -  Reputation: 134

Like
Likes
Like

Posted 13 July 2001 - 03:51 AM

Problem solved! I was creating the lists before OpenGL was properly initialized.

Thanks guys




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS