Click here to Skip to main content
15,894,017 members
Articles / Mobile Apps / Windows Mobile

A Cessna Skyhawk Skeleton for Further Development in OpenGL (GLUT)

Rate me:
Please Sign up or sign in to vote.
4.07/5 (11 votes)
29 May 2010CPOL2 min read 39.3K   2.4K   12  
A Cessna Skyhawk Skeleton for further development in OpenGL (GLUT) using a Win32 Console
// *********************************************************************
// *     This software is made available only to individuals and only  *
// *     for educational purposes. Any and all commercial use is       *
// *     stricly prohibited.                                           *
// *********************************************************************
//**********************************************************************
//* Disclaimer: Any borrowed code used in this                         *
//*             program is the property of the                         *
//*             code originator. credit to them.                       *
//*                                                                    *
//*                                                                    *
//*   Unfinished                                                       *
//*   WARNING:                                                         *
//*                                                                    *
//*                                                                    *
//*                                                                    *
//**********************************************************************
#ifndef CESSNASKYHAWK_H_MATERIALS
#define CESSNASKYHAWK_H_MATERIALS

#include  "globals.h"
namespace nsCessna
{



//material default values set so that they replace the color created with commented line that appears before it by a material.
//Key to material variable names:  [color]mat_[type]

	//	glColor3f(0.6,0.1,0.1); the color of the bricks
		GLfloat redmat_specular[]={0.6, 0.1, 0.1, 1.0};
        GLfloat redmat_diffuse[]={0.1, 0.1, 0.1, 1.0};
        GLfloat redmat_ambient[]={0.2, 0.3, 0.4, 1.0};
        GLfloat redmat_shininess={0.0};

	//glColor3f(0.25,0.25,0.25); whitish color for plane features

		GLfloat whitemat_specular[]={0.5, 0.5, 0.5, 1.0};
        GLfloat whitemat_diffuse[]={0.85, 0.85, 0.85, 1.0};
        GLfloat whitemat_ambient[]={0.5, 0.5, 0.5, 1.0};
        GLfloat whitemat_shininess={32.0};

	//	glColor3f(0.8,0.8,0.8); the color of the grey used for cement stairs

		GLfloat tanmat_specular[]={0.1, 0.1, 0.1, 1.0};
        GLfloat tanmat_diffuse[]={0.85, 0.85, 0.8, 1.0};
        GLfloat tanmat_ambient[]={0.65, 0.65, 0.6, 1.0};
        GLfloat tanmat_shininess={2.0};

	//	glColor3f(0.0,0.5,1.0); blue for plane features

		GLfloat bluemat_specular[]={0.0, 0.25, 0.5, 1.0};
        GLfloat bluemat_diffuse[]={0.0, 0.5, 1.0, 1.0};
        GLfloat bluemat_ambient[]={0.6, 0.6, 0.6, 1.0};
        GLfloat bluemat_shininess={32.0};

	// ground color
		GLfloat grassmat_specular[]={0.2, 0.2, 0.2, 1.0};
        GLfloat grassmat_diffuse[]={0.2, 1.0, 0.2, 1.0};
        GLfloat grassmat_ambient[]={0.1, 0.8, 0.1, 1.0};
        GLfloat grassmat_shininess={0.0};

	// color for the roofs of buildings very dark
		GLfloat roofmat_specular[]={0.2, 0.2, 0.2, 1.0};
        GLfloat roofmat_diffuse[]={0.2, 0.2, 0.2, 1.0};
        GLfloat roofmat_ambient[]={0.2, 0.2, 0.2, 1.0};
        GLfloat roofmat_shininess={100.0};


	// color for Hinsdale bricks
		GLfloat brownmat_specular[]={215.0/256.0, 172.0/256.0, 0.0, 1.0};
        GLfloat brownmat_diffuse[]={215.0/256.0, 172.0/256.0, 0.0, 1.0};
        GLfloat brownmat_ambient[]={0.2, 0.2, 0.2, 1.0};
        GLfloat brownmat_shininess={100.0};


// **********************************************************************
// *                                                                    *
// **********************************************************************

	// The following are the various functions to easily change between colors while rendering.
	// Key to function names:  [color]material()
// **********************************************************************
// *                                                                    *
// **********************************************************************



// **********************************************************************
// *                                                                    *
// **********************************************************************


		void brownmaterial(){
			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, brownmat_specular);
			glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, brownmat_ambient);
			glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, brownmat_diffuse);
			glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, brownmat_shininess);
		}

// **********************************************************************
// *                                                                    *
// **********************************************************************

		void redmaterial(){
			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, redmat_specular);
			glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, redmat_ambient);
			glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, redmat_diffuse);
			glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, redmat_shininess);
		}
// **********************************************************************
// *                                                                    *
// **********************************************************************
		void whitematerial(){
			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, whitemat_specular);
			glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, whitemat_ambient);
			glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, whitemat_diffuse);
			glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, whitemat_shininess);
		}
// **********************************************************************
// *                                                                    *
// **********************************************************************
		void tanmaterial(){
			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, tanmat_specular);
			glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, tanmat_ambient);
			glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, tanmat_diffuse);
			glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, tanmat_shininess);
		}
// **********************************************************************
// *                                                                    *
// **********************************************************************
		void bluematerial(){
			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, bluemat_specular);
			glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, bluemat_ambient);
			glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, bluemat_diffuse);
			glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, bluemat_shininess);
		}

// **********************************************************************
// *                                                                    *
// **********************************************************************

		void grassmaterial(){
			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, grassmat_specular);
			glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, grassmat_ambient);
			glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, grassmat_diffuse);
			glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, grassmat_shininess);
		}

// **********************************************************************
// *                                                                    *
// **********************************************************************


		void roofmaterial(){
			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, roofmat_specular);
			glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, roofmat_ambient);
			glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, roofmat_diffuse);
			glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, roofmat_shininess);
		}



}

#endif CESSNASKYHAWK_H_MATERIALS

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Sweden Sweden
About me:
I attended programming college and I have a degree in three most famous and successful programming languages. C/C++, Visual Basic and Java. So i know i can code. And there is a diploma hanging on my wall to prove it.
.
I am a professional, I am paid tons of cash to teach or do software development. I am roughly 30 years old .

I hold lectures in programming. I have also coached students in C++, Java and Visual basic.

In my spare time i do enjoy developing computer games, and i am developing a rather simple flight simulator game
in the c++ programming language using the openGL graphics libray.

I've written hundreds of thousands of code syntax lines for small simple applications and games.

Comments and Discussions