Jump to content
  • Advertisement


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


Displaying a polygon in gametutorial #1?

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

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

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

	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

	//Game Title

	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?

Share this post

Link to post
Share on other sites
Try disabling textures before drawing the polygon:

Then enable it afterwards:

EDIT: typo

[edited by - Erunama on July 25, 2002 10:33:09 PM]

Share this post

Link to post
Share on other sites

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