Skip to main content
gamedev.net
🔒 Locked

Platform Games

Started by unfinished Nov 27, 2004 at 11:31 AM 0 replies 500+ views
Original Post
unfinished
unfinished
I am look for some advice aboout the best way of creating the screen using OpenGL. I have written a quick program just to test how well it works, I am generating 20*15 quads and applying textures to them. I want to then add another layer infront, for things like platforms, I hope this will make collision easier? Am I just doing this the hard way. Can someone suggest a source for graphics/textures for games as I am no artist.

int LevelBoxDraw()
{
	int	n=0;
	
	glTranslatef(-42.0f,-28.0f,-74.0f);					// Move Left 
	glColor3f(1.0f,1.0f,1.0f);							// Set The Color To Blue One Time Only
	glBindTexture(GL_TEXTURE_2D, texture[0]);			// Select Our Texture
	

	for (float y = 0; y <= 14; y++)				//   Add one to take into account the loop
	{
		for (float x = 0; x <= 19; x++)
		{
//			glBindTexture(GL_TEXTURE_2D, texture[0]);			// Select Our Texture
			glBindTexture(GL_TEXTURE_2D, texture[LevelData[n++]-48]);			// Select Our Texture
			glTranslatef(4.0f,0.0f,0.0f);						// Move Right 3 Units
			glBegin(GL_QUADS);									// Draw A Quad
			glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.0f, -2.0f,  1.0f);	// Bottom Left Of The Texture and Quad
			glTexCoord2f(1.0f, 0.0f); glVertex3f( 2.0f, -2.0f,  1.0f);	// Bottom Right Of The Texture and Quad
			glTexCoord2f(1.0f, 1.0f); glVertex3f( 2.0f,  2.0f,  1.0f);	// Top Right Of The Texture and Quad
			glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.0f,  2.0f,  1.0f);	// Top Left Of The Texture and Quad
			glEnd();											// Done Drawing The Quad
		}
		glTranslatef(-x*4,4.0,0.0f);						// Move Right 3 Units
		glColor3f(1.0f,1.0f,1.0f);							// Set The Color
	}
	return	TRUE;
}

I took the original code form lesson3 and modified as I went. Question about textures what is the minimum size that be used, I know that the have to be a power of 2. thanxs

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.