Advertisement

Displaying a polygon in gametutorial #1?

Started by July 25, 2002 09:22 PM
1 comment, last by ZitherMan 22 years, 7 months ago
How would i display a polygon in gametutorial #1? I''ve tried a lot of things, including:

bool Game_Main(void)
	{
	sinput.DInput_Update();		//Update DirectInput to make sure it''s still alive
	if(KEY_DOWN(DIK_ESCAPE))	//Check to see if the user wants to quit
		PostQuitMessage(0);

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	//Clear screen and depth buffer
	glLoadIdentity();									//Reset the current modelview matrix

	glTranslatef(-1.5f,0.0f,-6.0f);
	glBegin(GL_TRIANGLES);						// Drawing Using Triangles
		glVertex3f( 0.0f, 1.0f, 0.0f);				// Top
		glVertex3f(-1.0f,-1.0f, 0.0f);				// Bottom Left
		glVertex3f( 1.0f,-1.0f, 0.0f);				// Bottom Right
	glEnd();							// Finished Drawing The Triangle

	//Get in Ortho View
	GetClientRect(hwnd,&window);					//Get the window''s dimensions
	glMatrixMode(GL_PROJECTION);					//Select the projection matrix
	glPushMatrix();									//Store the projection matrix
	glLoadIdentity();								//Reset the projection matrix
	glOrtho(0,window.right,0,window.bottom,-1,1);	//Set up an ortho screen
	glMatrixMode(GL_MODELVIEW);						//Select the modelview matrix

	glColor4f(1,1,1,1);
	//Game Title
	s3d.glPrint(240,450,"ShiningKnight");

	glMatrixMode(GL_PROJECTION);					//Select the projection matrix
	glPopMatrix();									//Restore the old projection matrix
	glMatrixMode(GL_MODELVIEW);						//Select the modelview matrix

	SwapBuffers(hdc);			//Finally, swap the buffers
	return true;
	}

 
does anyone know?
----------------------------
When hell freezes over it will be a pretty cool place to snowboard
Try disabling textures before drawing the polygon:
glDisable(GL_TEXTURE_2D);

Then enable it afterwards:
glEnable(GL_TEXTURE_2D);

EDIT: typo

[edited by - Erunama on July 25, 2002 10:33:09 PM]
Advertisement
It works!
Thanks dude!


I owe you one
----------------------------
When hell freezes over it will be a pretty cool place to snowboard

This topic is closed to new replies.

Advertisement