示例#1
0
文件: nRenderer.cpp 项目: gan74/nGine
void nRenderer::drawCone(nMatrix4 mat, double angle, double height) {
	nMatrix4 m = getObjectMatrix();
	setObjectMatrix(mat);

	gluCylinder(quadric, 0, tan(angle * RAD) * height, -height, 25, 1);

	setObjectMatrix(m);
}
示例#2
0
void display()
{
  // This function is called whenever it is time to render
  //  a new frame; due to the idle()-function below, this
  //  function will get called several times per second

  // Clear framebuffer & zbuffer
  glClearColor(0.3, 0, 0, 1);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  // Position lights
  setLightSources();

  // Setup projection matrix
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(90, 1, 0.01, 100);

  // Setup object matrix
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glMultMatrixd(getObjectMatrix());

  // Enable Z-buffering
  glEnable(GL_DEPTH_TEST);

  // Enable backface culling
  glEnable(GL_CULL_FACE);
  glCullFace(GL_BACK);

  glPushAttrib(GL_ALL_ATTRIB_BITS);
  glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS);

  // Activate shader program
  glUseProgram(shaderProgram);
  glUniform1f(shaderTimeLocation, getElapsedTime());
  
  // Draw mesh using array-based API
  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_NORMAL_ARRAY);
  glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  glVertexPointer(3, GL_FLOAT, 0, model->vertexArray);
  glNormalPointer(GL_FLOAT, 0, model->normalArray);
  glTexCoordPointer(2, GL_FLOAT, 0, model->texCoordArray);
  glDrawElements(GL_TRIANGLES, model->numIndices, GL_UNSIGNED_INT,
		 model->indexArray);

  // Deactivate shader program
  glUseProgram(0);

  glPopClientAttrib();
  glPopAttrib();

  renderLightSources();

  // Swap front- and backbuffers
  glutSwapBuffers();
}
示例#3
0
void display()
{
  // This function is called whenever it is time to render
  //  a new frame; due to the idle()-function below, this
  //  function will get called several times per second

  // Clear framebuffer & zbuffer
  glClearColor(0.3, 0, 0, 1);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  //glFrustum(-0.1, 0.1, -0.1, 0.1, 0.1, 100);
  //gluPerspective(36 * fmod(getElapsedTime(), 10), 1, 0.01, 100);
  gluPerspective(110, 1, 0.01, 100);
  glMatrixMode(GL_MODELVIEW);
  glEnable(GL_DEPTH_TEST);
  glLoadIdentity();

  glLoadMatrixd(getObjectMatrix());

  // Enable Gouraud shading
  glShadeModel(GL_SMOOTH);

  // Draw polygon
  glBegin(GL_POLYGON);
  glColor3f(1, 1, 1);
  glVertex3f(-0.5, 0.5, 0.0);
  glColor3f(0, 1, 1);
  glVertex3f(-0.5,-0.5, 0.0);
  glColor3f(1, 1, 0.3);
  glVertex3f( 0.5,-0.5, 0.0);
  glColor3f(1, 0, 1);
  glVertex3f( 0.5, 0.5, 0.0);
  glEnd();

  glBegin(GL_POLYGON);
  glColor3f(1, 0, 1);
  glVertex3f(-0.3, 0.3, 0.0);
  glColor3f(0, 0, 1);
  glVertex3f(-0.3,-0.3, 0.0);
  glColor3f(1, 0, 0.3);
  glVertex3f( 0.3,-0.3, 0.0);
  glColor3f(1, 0, 0);
  glVertex3f( 2, 2, -3.0);
  glEnd();

  // Swap front- and backbuffers
  glutSwapBuffers();
}
示例#4
0
void display()
{
  // This function is called whenever it is time to render
  //  a new frame; due to the idle()-function below, this
  //  function will get called several times per second

  // Clear framebuffer & zbuffer
  glClearColor(0.3, 0, 0, 1);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  // Position light 0
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  GLfloat light_position[] = { 0.0, 0.0, 1.0, 0.0 };
  glLightfv(GL_LIGHT0, GL_POSITION, light_position);

  // Enable lighting and light 0
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glEnable(GL_NORMALIZE);

  // Set default material properties
  GLfloat mat_shininess[] = { 50.0 };
  GLfloat mat_diffuseColor[] = { 1.0, 1.0, 1.0, 1.0 };
  GLfloat mat_specularColor[] = { 1.0, 1.0, 1.0, 1.0 };

  glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
  glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuseColor);
  glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specularColor);

  // Setup projection matrix
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(90, 1, 0.01, 100);

  // Setup object matrix
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glLoadMatrixd(getObjectMatrix());

  // Enable Z-buffering
  glEnable(GL_DEPTH_TEST);

  // Enable Gouraud shading
  glShadeModel(GL_SMOOTH);

  // Enable backface culling
  glEnable(GL_CULL_FACE);
  glCullFace(GL_BACK);

  // Enable texturing
  //glEnable(GL_TEXTURE_2D);
  //glBindTexture(GL_TEXTURE_2D, textureId);

  // Draw cube using array-based API
  glEnableClientState(GL_COLOR_ARRAY);
  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_NORMAL_ARRAY);
  //glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  glColorPointer(3, GL_FLOAT, 0, cubeColors);
  glVertexPointer(3, GL_FLOAT, 0, cubeVertices);
  glNormalPointer(GL_FLOAT, 0, cubeNormals);
  //glTexCoordPointer(2, GL_FLOAT, 0, cubeTexCoords);
  glDrawElements(GL_TRIANGLES, numCubeIndices, GL_UNSIGNED_INT, cubeIndices);

  // Swap front- and backbuffers
  glutSwapBuffers();
}
示例#5
0
文件: nRenderer.cpp 项目: gan74/nGine
void nRenderer::drawSphere(nVec3 position, double radius) {
	nMatrix4 m = getObjectMatrix();
	setObjectMatrix(nMatrix4::scaleMatrix(nVec3(radius, radius, radius)) * nMatrix4::translationMatrix(position));
	sphere->draw(nRenderable::NoMaterial);
	setObjectMatrix(m);
}
示例#6
0
void space_disp()
{
  // This function is called whenever it is time to render
  //  a new frame; due to the idle()-function below, this
  //  function will get called several times per second


  // Clear framebuffer & zbuffer
  glClearColor(0, 0, 0, 0);
  glClearDepth(1.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(90, 1, 0.01, 1500);
  glMatrixMode(GL_MODELVIEW);
  glEnable(GL_DEPTH_TEST);
  glLoadIdentity();
  //gluLookAt(0,0,0,getElapsedTime(),0,-1, 0, 1, 0); 
  glLoadMatrixd(getObjectMatrix());
  // Enable Gouraud shading
  glShadeModel(GL_SMOOTH);
  // Draw polygon
  glEnable(GL_CULL_FACE);
  glCullFace(GL_BACK);


  glPushMatrix();
glDisable(GL_TEXTURE_2D);
glTranslatef(-getElapsedTime()*400,0,0);
float wegg = 14000.0;
glBegin(GL_POLYGON);
glColor3f(1.0,1.0,1.0);
glVertex3f(wegg,-1000.0, -450);
glVertex3f(wegg, 1000, -450);
glVertex3f(wegg-1000.0f, 0.0,-450);
glEnd();


glBegin(GL_QUADS);
glVertex3f(wegg, -1000.0,-450);	// Bottom Left
glVertex3f(wegg+3000.0f,-1000.0,-450);	// Bottom Right
glVertex3f(wegg+3000.0f,1000.0,-450);	// Top Right
glVertex3f(wegg,1000,-450);	// Top Left
glEnd();
glPopMatrix();


  //load texture
  glEnable(GL_TEXTURE_2D);
  glBindTexture(GL_TEXTURE_2D, spacetextureId);
  glBegin(GL_POLYGON);
  
/*
  //size of wall
  float zdepth = 390.0;
  float xwidth = 600;
  float yheight = 300.0;


  //do the wall 
  glColor3f(1, 1, 1);
  glNormal3f(0,0,1);
  glTexCoord2f(0, 1);
  glVertex3f(-xwidth, yheight, -zdepth);
  glTexCoord2f(0, 0);
  glVertex3f(-xwidth,-yheight, -zdepth);
  glTexCoord2f(1, 0);
  glVertex3f(xwidth,-yheight, -zdepth);
  glTexCoord2f(1, 1);
  glVertex3f(xwidth, yheight, -zdepth);
  glEnd();
*/

//Scrolling through texcoords

  //size of wall
  zdepth = 590.0;
  xwidth = 600;
  yheight = 400.0;
  starDepth = zdepth-460;


  //do the wall 
  glColor3f(1, 1, 1);
  glNormal3f(0,0,1);
  glTexCoord2f(getElapsedTime()/200, 1);
  glVertex3f(-xwidth, yheight, -zdepth);
  glTexCoord2f(getElapsedTime()/200, 0);
  glVertex3f(-xwidth,-yheight, -zdepth);
  glTexCoord2f(0.3+getElapsedTime()/200, 0);
  glVertex3f(xwidth,-yheight, -zdepth);
  glTexCoord2f(0.3+getElapsedTime()/200, 1);
  glVertex3f(xwidth, yheight, -zdepth);
  glEnd();

glDisable(GL_TEXTURE_2D);
//Do the bioduk top and bot
  glBegin(GL_POLYGON);
 glColor3f(0.9,0.9,0.9);
  glVertex3f(-xwidth,yheight+5,-zdepth+1);
  glVertex3f(-xwidth,yheight,-zdepth+1);
  glVertex3f(xwidth,yheight,-zdepth+1);
  glVertex3f(xwidth,yheight+5,-zdepth+1);
  glEnd();

  glBegin(GL_POLYGON);
glColor3f(0.9,0.9,0.9);
  glVertex3f(-xwidth,-yheight,-zdepth+1);
  glVertex3f(-xwidth,-yheight-5,-zdepth+1);
  glVertex3f(xwidth,-yheight-5,-zdepth+1);
  glVertex3f(xwidth,-yheight,-zdepth+1);
  glEnd();

//the moving stuff :D
glPushMatrix();

glTranslatef(-getElapsedTime()*200,0,0);

float megaDepth = zdepth;
float megaheight = yheight;
float megaWidth = xwidth*5;
float textureStart =0.0;
float textureFinish =1.0;
float tS = textureStart;
float tF = textureFinish;
float xXx = 0.072;
float fixit = 0.07;

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mixedtextureId);
glBegin(GL_QUADS);				// Start Drawing A Textured Quad
glTexCoord2f(-fixit+tS, tF);
glVertex3f(megaWidth, -megaheight-200.0f,-megaDepth);	// Bottom Left
glTexCoord2f(-fixit+tF, tF);
glVertex3f(megaWidth+2000.0f,-megaheight-200.0f,-megaDepth);	// Bottom Right
glTexCoord2f(-fixit+tF+xXx, tS);
glVertex3f(megaWidth+2000.0f,-megaheight,-megaDepth);	// Top Right
 glTexCoord2f(-fixit+tS+xXx, tS);
glVertex3f(megaWidth,-megaheight,-megaDepth);	// Top Left
glEnd();



megaWidth = xwidth*3;

glBindTexture(GL_TEXTURE_2D, opentextureId);

glBegin(GL_QUADS);
glTexCoord2f(tS, tF);				// Start Drawing A Textured Quad
glVertex3f(megaWidth, megaheight,-megaDepth);	// Bottom Left
glTexCoord2f(tF, tF);
glVertex3f(megaWidth+650.0f,megaheight,-megaDepth);	// Bottom Right
 glTexCoord2f(tF, tS);
glVertex3f(megaWidth+650.0f,megaheight+160.0f,-megaDepth);	// Top Right
glTexCoord2f(tS, tS);
glVertex3f(megaWidth,megaheight+160.0f,-megaDepth);	// Top Left
glEnd();


//************************STAR START************************************//
/*
glDisable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);  
glBlendFunc(GL_DST_COLOR,GL_ZERO);
float megaDepth = zdepth;
float megaheight = yheight;
float megaWidth = xwidth;
float textureStart =0.0;
float textureFinish =1.0;
float tS = textureStart;
float tF = textureFinish;

glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_CLAMP);
glBindTexture(GL_TEXTURE_2D, megatextureId[0]);		// Select The First Mask Texture
glBegin(GL_QUADS);				// Start Drawing A Textured Quad
glTexCoord2f(xXx+tF, tF);
glVertex3f(megaWidth, -megaheight,-megaDepth);	// Bottom Left
glTexCoord2f(xXx+tS, tF);
glVertex3f(megaWidth+160.0f, -megaheight,-megaDepth);	// Bottom Right
glTexCoord2f(xXx+tS+0.5, tS);
glVertex3f(megaWidth+160.0f,  -megaheight+160.0f,-megaDepth);	// Top Right
 glTexCoord2f(xXx+tF+0.5, tS);
glVertex3f(megaWidth,  -megaheight+160.0f,-megaDepth);	// Top Left
glEnd();

*/

/*Again we enable blending and select our texture for scene 1. We map this texture on top of it's mask. */
	/*	
glBlendFunc(GL_ONE, GL_ONE);			// Copy Image 1 Color To The Screen
glBindTexture(GL_TEXTURE_2D, megatextureId[1]);	// Select The First Image Texture
glBegin(GL_QUADS);				// Start Drawing A Textured Quad
glTexCoord2f(xXx+tF, tF);
glVertex3f(megaWidth, -megaheight,-megaDepth);	// Bottom Left
glTexCoord2f(xXx+tS, tF);
glVertex3f(megaWidth+160.0f, -megaheight,-megaDepth);	// Bottom Right
glTexCoord2f(xXx+tS+0.5, tS);
glVertex3f(megaWidth+160.0f,  -megaheight+160.0f,-megaDepth);	// Top Right
 glTexCoord2f(xXx+tF+0.5, tS);
glVertex3f(megaWidth,  -megaheight+160.0f,-megaDepth);	// Top Left
glEnd();

glDisable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST); 
glDisable(GL_BLEND);
*/
//************************STAR END************************************//

glPopMatrix();



  // Swap front- and backbuffers
  glutSwapBuffers();
}
示例#7
0
void display()
{
  // This function is called whenever it is time to render
  //  a new frame; due to the idle()-function below, this
  //  function will get called several times per second


  // Clear framebuffer & zbuffer
  glClearColor(0, 0, 0, 1);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(90, 1, 0.01, 1500);
  glMatrixMode(GL_MODELVIEW);
  glEnable(GL_DEPTH_TEST);
  glLoadIdentity();
  //gluLookAt(0,0,0,getElapsedTime(),0,-1, 0, 1, 0); 


  glLoadMatrixd(getObjectMatrix());
  // Enable Gouraud shading
  glShadeModel(GL_SMOOTH);
  
  // Draw polygon
  glEnable(GL_CULL_FACE);
  glCullFace(GL_BACK);
  //load texture
  glEnable(GL_TEXTURE_2D);
  glBindTexture(GL_TEXTURE_2D, textureId);
  glBegin(GL_POLYGON);
  
/*
  //size of wall
  float zdepth = 390.0;
  float xwidth = 600;
  float yheight = 300.0;


  //do the wall 
  glColor3f(1, 1, 1);
  glNormal3f(0,0,1);
  glTexCoord2f(0, 1);
  glVertex3f(-xwidth, yheight, -zdepth);
  glTexCoord2f(0, 0);
  glVertex3f(-xwidth,-yheight, -zdepth);
  glTexCoord2f(1, 0);
  glVertex3f(xwidth,-yheight, -zdepth);
  glTexCoord2f(1, 1);
  glVertex3f(xwidth, yheight, -zdepth);
  glEnd();
*/

//Scrolling through texcoords

  //size of wall
  zdepth = 590.0;
  xwidth = 600;
  yheight = 400.0;
  starDepth = zdepth-40;


  //do the wall 
  glColor3f(1, 1, 1);
  glNormal3f(0,0,1);
  glTexCoord2f(getElapsedTime()/200, 1);
  glVertex3f(-xwidth, yheight, -zdepth);
  glTexCoord2f(getElapsedTime()/200, 0);
  glVertex3f(-xwidth,-yheight, -zdepth);
  glTexCoord2f(0.3+getElapsedTime()/200, 0);
  glVertex3f(xwidth,-yheight, -zdepth);
  glTexCoord2f(0.3+getElapsedTime()/200, 1);
  glVertex3f(xwidth, yheight, -zdepth);
  glEnd();

glDisable(GL_TEXTURE_2D);
//Do the bioduk top and bot
  glBegin(GL_POLYGON);
 glColor3f(0.9,0.9,0.9);
  glVertex3f(-xwidth,yheight+5,-zdepth+1);
  glVertex3f(-xwidth,yheight,-zdepth+1);
  glVertex3f(xwidth,yheight,-zdepth+1);
  glVertex3f(xwidth,yheight+5,-zdepth+1);
  glEnd();

  glBegin(GL_POLYGON);
glColor3f(0.9,0.9,0.9);
  glVertex3f(-xwidth,-yheight,-zdepth+1);
  glVertex3f(-xwidth,-yheight-5,-zdepth+1);
  glVertex3f(xwidth,-yheight-5,-zdepth+1);
  glVertex3f(xwidth,-yheight,-zdepth+1);
  glEnd();


//make megaman :D
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);  
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_DST_COLOR,GL_ZERO);
float textureStart =0.0;
float textureFinish =1.0;
float tS = textureStart;
float tF = textureFinish;
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_CLAMP);
glBindTexture(GL_TEXTURE_2D, megatextureId[0]);		// Select The First Mask Texture
  glBegin(GL_QUADS);					// Start Drawing A Textured Quad
glTexCoord2f(tS+0.5, tS); 
glVertex3f(0.0, 0.0,  -2.0);	// Bottom Left
glTexCoord2f(tF+0.5, tS); 
glVertex3f(1.45, 0.0,  -2.0);	// Bottom Right
glTexCoord2f(tF, tF); 
glVertex3f(1.45,  1.0,  -2.0);// Top Right
glTexCoord2f(tS, tF); 
glVertex3f(0.0,  1.0,  -2.0);	// Top Left
glEnd();						// Done Drawing The Quad

/*Again we enable blending and select our texture for scene 1. We map this texture on top of it's mask. */
		
glBlendFunc(GL_ONE, GL_ONE);			// Copy Image 1 Color To The Screen
glBindTexture(GL_TEXTURE_2D, megatextureId[1]);	// Select The First Image Texture
  glBegin(GL_QUADS);				// Start Drawing A Textured Quad
glTexCoord2f(tS, tS); glVertex3f(0.0f, 0.0f,  -2.0f);	// Bottom Left
glTexCoord2f(tF, tS); glVertex3f( 1.45f, 0.0f,  -2.0f);	// Bottom Right
glTexCoord2f(tF, tF); glVertex3f( 1.45f,  1.0f,  -2.0f);	// Top Right
glTexCoord2f(tS, tF); glVertex3f(0.0f,  1.0f,  -2.0f);	// Top Left
	
//glBegin(GL_QUADS);
glEnd();							// Done Drawing The Quad

glDisable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST); 
glDisable(GL_BLEND);



//the moving stuff :D
glPushMatrix();

glTranslatef(-getElapsedTime()*50,0,0);
//glRotatef(45,0,0,1);

starsize = 15;
  starOffsetX = 0;
  starOffsetY = 0;
//Layer 1 :D

makeEmStars();


//Layer 2 :D
//xwidth = 380;
//yheight =100;
//zdepth = 300;
//makeEmStars(xwidth, yheight, zdepth, starsize);


//Layer 3 :D
//xwidth = 380;
//yheight =100;
//zdepth = 300;
//makeEmStars(xwidth, yheight, zdepth);

glPopMatrix();
  // Swap front- and backbuffers
  glutSwapBuffers();
}
示例#8
0
void display()
{
  // This function is called whenever it is time to render
  //  a new frame; due to the idle()-function below, this
  //  function will get called several times per second

  // Clear framebuffer & zbuffer
  glClearColor(0.3, 0, 0, 1);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(90, 1, 0.01, 100);
  glMatrixMode(GL_MODELVIEW);
  glEnable(GL_DEPTH_TEST);
  glLoadIdentity();
   glEnable(GL_TEXTURE_2D);
  glLoadMatrixd(getObjectMatrix());
  // Enable Gouraud shading
  glShadeModel(GL_SMOOTH);

  // Draw polygon
  //glEnable(GL_CULL_FACE);
  //glCullFace(GL_BACK);

float depth = -5;
int z = 1;
int zstep = 1;
float ztexstep = 0.01;
float hyp = 5;
float textint = 0;
glBindTexture(GL_TEXTURE_2D, tunnelTexture);


float ztexphase = 0;
for (;z <= 100; z++) {
  glRotatef(getElapsedTime(), 0, 0, 1);
  int i = 1;
  for(;i <= 360; i++) {
	//printf("fiskapa %d - ", z);
	//printf("%d", i);
	//printf("\n");

	float x = cos(i*PI/180) * hyp;
	float y = sin(i*PI/180) * hyp;
	glNormal3f(0, 1, 0);
	float xplusone = cos((i+1)*PI/180) * hyp;
	float yplusone = sin((i+1)*PI/180) * hyp;
  	glBegin(GL_POLYGON);
        glTexCoord2f(ztexphase, textint);
	glVertex3f(x, y, z);

        glTexCoord2f(ztexphase+ztexstep, textint);	
	glVertex3f(x, y, z + zstep);

        glTexCoord2f(ztexphase+ztexstep, textint+10/360);
	glVertex3f(xplusone, yplusone, z + zstep);

        glTexCoord2f(ztexphase, textint+10/360); 	
	glVertex3f(xplusone, yplusone, z);
  	glEnd();
	textint = (textint+10/360);
	ztexphase += ztexstep;
  }
}
/*
glBegin(GL_POLYGON);
  glColor3f(1, 0, 0);
  glVertex3f(-4.5, 0.5, 0.0);
  glColor3f(0, 1, 0);
  glVertex3f(-5,0.0, 0.0);
  glColor3f(0, 0, 1);
  glVertex3f(-5,0.0, -10.0);
  glColor3f(1, 0, 1);  
  glVertex3f(-4.5, 0.5, -10.0);

  glColor3f(0,0.4,0.7);
  glVertex3f(-4.0,1.0,0.0);
  glColor3f(0.6,0.3,0.0);
  glVertex3f(-3.5,1.5,0.0);
  glColor3f(0.2,1.0,0.0);
  glVertex3f(-3.5,1.50,-10.0);
  glColor3f(1.0,0.4,0.4);
  glVertex3f(-4,1.0,-10.0);

  glEnd();
/*
 
  glBegin(GL_POLYGON);
  glColor3f(0,0.9,0.3);
  glVertex3f(0.1,0.1,-0.2);
  glColor3f(0.2,0.4,0.7);
  glVertex3f(0.1,0.1,0.0);
  glColor3f(0.5,0,0.7);
  glVertex3f(0.1,-0.1,0.0);
  glColor3f(0,0.3,0.8);
  glVertex3f(0.1,-0.1,-0.2);

  glColor3f(1,0.2,0.7);
  glVertex3f(0.1,0.1,-0.2);
  glColor3f(1,0.5,0.3);
  glVertex3f(0.1,-0.1,-0.2);
  glColor3f(0,0.9,0.7);
  glVertex3f(-0.1,-0.1,-0.2);
  glColor3f(0,0.1,0.7);
  glVertex3f(-0.1,0.1,-0.2);

  glEnd();

 
  glBegin(GL_POLYGON);
  glColor3f(0.2,0.8,0.7);
  glVertex3f(-0.1,-0.1,0.0);
  glColor3f(0.6,0.1,0.2);
  glVertex3f(-0.1,-0.1,-0.2);
  glColor3f(1,0.4,0.2);
  glVertex3f(0.1,-0.1,-0.2);
  glColor3f(0.1,0.4,1);
  glVertex3f(0.1,-0.1,0.0);
*/

/*
  glBegin(GL_POLYGON);

  //framsida
  glColor3f(1, 0, 0);
  glVertex3f(-0.1, 0.1, 0.0);
  glColor3f(0, 1, 0);
  glVertex3f(-0.1,-0.1, 0.0);
  glColor3f(0, 0, 1);
  glVertex3f(0.1,-0.1, 0.0);
  glColor3f(1, 0, 1);  
  glVertex3f(0.1, 0.1, 0.0);

  //TOP
  glColor3f(0, 1, 1);
  glVertex3f(-0.1, 0.1, 0.0);
  glColor3f(1, 1, 0);
  glVertex3f(0.1, 0.1, 0.0);
  glColor3f(1, 1, 1);
  glVertex3f(0.1,0.1,-0.2);
  glColor3f(0.3, 0.6, 1);
  glVertex3f(-0.1,0.1,-0.2);

  //left
  glColor3f(0,0.4,0.7);
  glVertex3f(-0.1,0.1,0.0);
  glColor3f(0.6,0.3,0.0);
  glVertex3f(-0.1,0.1,-0.2);
  glColor3f(0.2,1.0,0.0);
  glVertex3f(-0.1,-0.1,-0.2);
  glColor3f(1.0,0.4,0.4);
  glVertex3f(-0.1,-0.1,0.0);

  glEnd();
  glBegin(GL_POLYGON);
  //right
  glColor3f(0,0.9,0.3);
  glVertex3f(0.1,0.1,-0.2);
  glColor3f(0.2,0.4,0.7);
  glVertex3f(0.1,0.1,0.0);
  glColor3f(0.5,0,0.7);
  glVertex3f(0.1,-0.1,0.0);
  glColor3f(0,0.3,0.8);
  glVertex3f(0.1,-0.1,-0.2);

  //background
  glColor3f(1,0.2,0.7);
  glVertex3f(0.1,0.1,-0.2);
  glColor3f(1,0.5,0.3);
  glVertex3f(0.1,-0.1,-0.2);
  glColor3f(0,0.9,0.7);
  glVertex3f(-0.1,-0.1,-0.2);
  glColor3f(0,0.1,0.7);
  glVertex3f(-0.1,0.1,-0.2);

  glEnd();
  glBegin(GL_POLYGON);
  //bottom
  glColor3f(0.2,0.8,0.7);
  glVertex3f(-0.1,-0.1,0.0);
  glColor3f(0.6,0.1,0.2);
  glVertex3f(-0.1,-0.1,-0.2);
  glColor3f(1,0.4,0.2);
  glVertex3f(0.1,-0.1,-0.2);
  glColor3f(0.1,0.4,1);
  glVertex3f(0.1,-0.1,0.0);





  glEnd();
*/


  // Swap front- and backbuffers
  glutSwapBuffers();
}