コード例 #1
0
ファイル: loop.cpp プロジェクト: wilmerhenao/Loop-Scheme
void Draw() {
    glMatrixMode(GL_MODELVIEW); 
    glLoadIdentity();
    gluLookAt(CameraPosition.x(),CameraPosition.y(),CameraPosition.z(),0,0,0,0,1,0);
    glClearColor( 0.0, 0.0, 0.0,0);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);
    // enable automatic rescaling of normals to unit length
    glEnable(GL_NORMALIZE);
    // enable two lights
    glEnable(GL_LIGHT0);
    //glEnable(GL_LIGHT1);
    // directional lights (w=0) along z axis
    glLightfv(GL_LIGHT0,GL_DIFFUSE, Vec4f(1,  1, 1,1));
    glLightfv(GL_LIGHT0,GL_POSITION, Vec4f(0,  0, 1,0));
    glLightfv(GL_LIGHT1,GL_DIFFUSE,Vec4f(1,  1, 1,1));
    glLightfv(GL_LIGHT1,GL_POSITION, Vec4f(0,  0, -1,0));

    glPushMatrix();

    glMultMatrixf(ExaminerRotation);
    glColor3f(1.0,1.0,1.0);
    Makeillus();
    glutWireCube(1.3 * SphereRadius);	
    glPopMatrix();
    glutSwapBuffers();
}
コード例 #2
0
ファイル: ex7.c プロジェクト: JamesWP/UNI-Y1-2
void display(void) {
   glClear (GL_COLOR_BUFFER_BIT);
   glLoadIdentity ();
   gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
  
   glTranslatef(tx*5.0, ty*5.0, 0.0);
   glRotatef(r, 1, 0, 0);
   glRotatef(r, 0, 1, 0);
   glRotatef(r, 0, 0, 1);
     
   switch (object) {
   case 0: glColor3f (0.0, 1.0, 0.0);
           glutWireCube(2.0);
           break;
   case 1: glColor3f (0.0, 1.0, 1.0);   
           glutWireDodecahedron();
           break;
   case 2: glColor3f (1.0, 0.0, 0.0);
           glutWireIcosahedron();
           break;
   case 3: glColor3f (1.0, 1.0, 0.0);
           glutWireTeapot(1.5);
           break;
   }
   glutSwapBuffers();
}
コード例 #3
0
ファイル: main.cpp プロジェクト: shihyuli/stuff
void onDisplay(void){
	// Clear Color and Depth Buffers
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	//we must set the proper mode so that we are modifying the correct matrix stack
	glMatrixMode(GL_MODELVIEW);


	// Reset transformations
	glLoadIdentity();

	// Set the camera
	gluLookAt( 0.0f, 0.0f, 2.0f,     //The camera is 2 'units' behind the center of the scene.
			   0.0f, 0.0f, 0.0f,     //the center of the scene is at the origin.  This prolly is easiest way to do things...
			   0.0f, 1.0f, 0.0f);    // specifies that Y is the UP vector, and GL figures everything else out. 
	
	//rotations
	glRotatef(xRot, 1.0f, 0.0f, 0.0f);
	glRotatef(yRot, 0.0f, 1.0f, 0.0f);
	glRotatef(zRot, 0.0f, 0.0f, 1.0f);

	//translation
	glTranslatef(xTran, yTran, zTran);

	glutWireCube(.25);
	
	glPopMatrix();

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity(); //reloading identity to draw 

	glutSwapBuffers();
}
コード例 #4
0
void  RetryScreen::display_screen()
{
	glClearColor(0.0,0.0,0.0,1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();

	if(!sceneInit)
	{
		int w = glutGet(GLUT_WINDOW_WIDTH);
	    int h = glutGet(GLUT_WINDOW_HEIGHT);
		reshape(w,h);
		sceneInit = true;
	}

#pragma region Panel
	glScaled(1,1,1);
	Render::getRenderInstance()->drawHudText(Point(-0.42,0.62,0.0),"  V O Y A G E R ",WHITE_COLOR);
	Render::getRenderInstance()->drawSegment3d(Point(-0.55,0.55,0),Point(-0.1,0.55,0));
	Render::getRenderInstance()->drawSegment3d(Point(0.45,0.55,0),Point( 0.0,0.55,0));
	Render::getRenderInstance()->drawHudText(Point(-0.52,0.45,0.0),"    no man's space ",BLUE_AZUER_COLOR);
    
		//Under voyager
	glPushMatrix();//
    glTranslatef(-0.05f, 0.55f,0.0f);
    glColor3f(0.2,0.4,0.8);
    glRotatef(2.0f,1,0,0);
    glRotatef(45,0,1,0);
    glutSolidCube(0.03);
    glColor3f(1.0,1.0,1.0);
    glutWireCube(0.04);
	glPopMatrix();//
#pragma  endregion 

	 glutPostRedisplay();
}
コード例 #5
0
static void
draw_bvh_inner_nodes(int level, bvh_node* node)
{
    vec3    center, size;

    if (node->is_leaf)
        return;

    if (level == draw_bvh_mode)
    {
        center = v3_multiply(v3_add(node->bbox.min, node->bbox.max), 0.5);
        size = v3_subtract(node->bbox.max, node->bbox.min);

        glColor3f(1, 0, 0);
        glPushMatrix();
        glTranslatef(center.x, center.y, center.z);
        glScalef(size.x, size.y, size.z);
        glutWireCube(1.0);
        glPopMatrix();
    }
    else
    {
        draw_bvh_inner_nodes(level+1, node->u.inner.left_child);
        draw_bvh_inner_nodes(level+1, node->u.inner.right_child);
    }
}
コード例 #6
0
/*  Here is where the light position is reset after the modeling
 *  transformation (glRotated) is called.  This places the
 *  light at a new position in world coordinates.  The cube
 *  represents the position of the light.
 */
void display(void)
{
   GLfloat position[] = { 0.0, 0.0, 1.5, 1.0 };

   glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   glPushMatrix ();
   gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

   glPushMatrix ();
   glLightfv (GL_LIGHT0, GL_POSITION, position);

   glTranslated (0.0, 0.0, 1.5);
   glDisable (GL_LIGHTING);
   glColor3f (0.0, 1.0, 1.0);
   glutWireCube (0.1);
   glEnable (GL_LIGHTING);
   glPopMatrix ();

   glPushMatrix ();
   glRotated ((GLdouble) (spin), 1.0, 0.0, 0.0);
   glutSolidTorus (0.275, 0.85, 8, 15);
      glPopMatrix ();
   glPopMatrix ();
   glutSwapBuffers();
}
コード例 #7
0
void display (void) {
	keyOperations();

	glClearColor(1.0f, 0.0f, 0.0f, 1.0f); // Clear the background of our window to red
	glClear(GL_COLOR_BUFFER_BIT); //Clear the colour buffer (more buffers later on)
	glLoadIdentity(); // Load the Identity Matrix to reset our drawing locations

	glTranslatef(0.0f, 0.0f, -5.0f); // Push eveything 5 units back into the scene, otherwise we won't see the primitive

	glTranslatef(0.0f, yLocation, 0.0f); // Translate our object along the y axis

	glRotatef(yRotationAngle, 0.0f, 1.0f, 0.0f); // Rotate our object around the y axis

	glutWireCube(2.0f); // Render the primitive

	glutSwapBuffers(); // Swap our buffers

	if (movingUp) // If we are moving up
		yLocation -= 0.005f; // Move up along our yLocation
	else // Otherwise
		yLocation += 0.005f; // Move down along our yLocation

	if (yLocation < -3.0f) // If we have gone up too far
		movingUp = false; // Reverse our direction so we are moving down
	else if (yLocation > 3.0f) // Else if we have gone down too far
		movingUp = true; // Reverse our direction so we are moving up

	yRotationAngle += 0.1f; // Increment our rotation value

	if (yRotationAngle > 360.0f) // If we have rotated beyond 360 degrees (a full rotation)
		yRotationAngle -= 360.0f; // Subtract 360 degrees off of our rotation
}
コード例 #8
0
ファイル: game.cpp プロジェクト: peecky/teddy-block
void Game::DrawMap()
{
	glPushMatrix();
	glTranslatef(-(MAP_WIDTH * FIGURE_SIZE) / 2.0, -(MAP_HEIGHT * FIGURE_SIZE) / 2.0, 0);
	for(int i = 0; i < MAP_HEIGHT; i++) {
		for(int j = 0; j < MAP_WIDTH; j++) {
			glPushMatrix();
			setMatrixProperties(j, i);	// set the position and color
			switch(map.getTile(j, i)) {
			case Tile::SPHERE:
				glutWireSphere(FIGURE_SIZE/2.0, 10, 10);
				break;
			case Tile::CONE:
				glPushMatrix();
				glTranslatef(0, 0, -FIGURE_SIZE/2.0);
				glutWireCone(FIGURE_SIZE/2.0, FIGURE_SIZE, 10, 10);
				glPopMatrix();
				break;
			case Tile::CUBE:
				glutWireCube(FIGURE_SIZE);
				break;
			case Tile::EMPTY:
				glPushMatrix();
				glTranslatef(0, 0, -FIGURE_SIZE/8.0);
				glutSolidCube(FIGURE_SIZE/2.0);
				glPopMatrix();
				break;
			}
			glPopMatrix();
		}
	}
	glPopMatrix();
}
コード例 #9
0
ファイル: main.cpp プロジェクト: Mazorius/GRAP-P
void display() {
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers
	glMatrixMode(GL_MODELVIEW);     // To operate on model-view matrix
 
	GLfloat position[] = {0.0f, 0.0f, 1.5f, 1.0f};
	GLfloat ambient[] = {2, 2, 2, 1};
	GLfloat diffuse[] = {2, 2, 2, 1};
	GLfloat specular[] = {0, 0, 0, 1};
	
	glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
	glLightfv(GL_LIGHT0, GL_SPECULAR, specular);

	glPushMatrix(); // ISOLATE OTHER RENDERING
	
		glPushMatrix(); // red push/pop pair: ISOLATE LIGHT FROM CUBE
		glRotatef(spin, 1.0, 0.0, 0.0);
		// this rotates light position (x-axis) and translated
		// wirecube, which visualizes the lightposition
		glLightfv(GL_LIGHT0, GL_POSITION, position);
		glTranslated(0.0, 0.0, 1.5);
		glDisable(GL_LIGHTING); //do not want to light the cube itself
		glColor3f(0.0, 1.0, 1.0);
		glutWireCube(0.1);
		glEnable(GL_LIGHTING);
		glPopMatrix(); // red push/pop pair
		
		glPushMatrix();
		glTranslatef(0.0, 0.0, 0.0);
		GLfloat frontAmbientBrass[4] = {0.329412, 0.223529, 0.027451, 1.0};
		GLfloat frontDiffuseBrass[4] = {0.780392, 0.568627, 0.113725, 1.0};
		GLfloat frontSpecularBrass[4] = {0.992157, 0.941176, 0.807843, 1.0};
		GLfloat frontShininessBrass = 0.21794872;
		glMaterialfv(GL_FRONT, GL_AMBIENT, frontAmbientBrass);
		glMaterialfv(GL_FRONT, GL_DIFFUSE, frontDiffuseBrass);
		glMaterialfv(GL_FRONT, GL_SPECULAR, frontSpecularBrass);
		glMaterialf(GL_FRONT, GL_SHININESS, frontShininessBrass);
		glutSolidCone(0.5, 1.0, 100.0, 100.0);
		glPopMatrix();
		
		glPushMatrix();
		glTranslatef(0.0, 0.0, -2.0);
		GLfloat frontAmbientRed[4] = {0.0, 0.0, 0.0, 1.0};
		GLfloat frontDiffuseRed[4] = {0.5, 0.0, 0.0, 1.0};
		GLfloat frontSpecularRed[4] = {0.7, 0.6, 0.6, 1.0};
		GLfloat frontShininessRed = 0.25;
		glMaterialfv(GL_FRONT, GL_AMBIENT, frontAmbientRed);
		glMaterialfv(GL_FRONT, GL_DIFFUSE, frontDiffuseRed);
		glMaterialfv(GL_FRONT, GL_SPECULAR, frontSpecularRed);
		glMaterialf(GL_FRONT, GL_SHININESS, frontShininessRed);
		glutSolidCone(0.5, 1.0, 100.0, 100.0);
		glPopMatrix();

	glPopMatrix();

	glFlush();
	
	glutSwapBuffers();
}
コード例 #10
0
ファイル: template.cpp プロジェクト: baturalppppp/OpenGL
//
// To display onto window using OpenGL commands
//
void display()
{
	
	glClearColor( 0, 0 , 0 , 0 );
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

	glLoadIdentity();
	cam1.LookAt() ;
	
	glColor3f(1,1,0);
	glPushMatrix();
	glTranslatef( (current-1) * 5, 2, -10) ;
	glScalef(0.2, 0.2, 0.2) ;
	WireArrow() ;
	glPopMatrix();

	glColor3f( colors[0].r, colors[0].g, colors[0].b );
	glPushMatrix();
	glTranslatef(-5, 0, -10) ;
	glScalef( size[0], size[0], size[0] ); 
	glutWireTeapot(1) ;
	glPopMatrix();


	glColor3f( colors[1].r, colors[1].g, colors[1].b );
	glPushMatrix();
	glTranslatef(0, 0, -10) ;
	glRotatef( 45, 1,1,1 ) ;
	glScalef( size[1], size[1], size[1] ); 
	glutWireCube(1.5) ;
	glPopMatrix();

	glColor3f( colors[2].r, colors[2].g, colors[2].b );
	glPushMatrix();
	glTranslatef(5, 0, -10) ;
	glScalef( size[2], size[2], size[2] ); 
	glutWireCone(1, 1, 10, 10) ;
	glPopMatrix();

	glColor3f(1,1,1);
	// Text Part
	glPushMatrix();
	glTranslatef(-6, -2, -10) ;
	vprint2(0,0, 0.005, "Teapot");
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-1, -2, -10) ;
	vprint2(0,0, 0.005, "Cube");
	glPopMatrix();

	glPushMatrix();
	glTranslatef(4.5, -2, -10) ;
	vprint2(0,0, 0.005, "Cone");
	glPopMatrix();

	glutSwapBuffers();

}
コード例 #11
0
void displayFcn(void) {
	glClear(GL_COLOR_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(x0, yO, z0, 0, 0, 0, 0, 1, 0);
	glColor3f(color[0], color[1], color[2]);

	if (toggle)
		glRotatef(rotTheta += 3, 0.0, 1.0, 0.0);
	glScalef(scale, scale, scale);

	if (solid) {
		switch (poly) {
		case 1:
			glutSolidCube(1.0);
			break;
		case 2:
			glutSolidDodecahedron();
			break;
		case 3:
			glutSolidTetrahedron();
			break;
		case 4:
			glutSolidOctahedron();
			break;
		case 5:
			glutSolidIcosahedron();
			break;
		case 6:
			glutSolidIcosahedron();
			break;
		}
	}
	else {
		switch (poly) {
		case 1:
			glutWireCube(1.0);
			break;
		case 2:
			glutWireDodecahedron();
			break;
		case 3:
			glutWireTetrahedron();
			break;
		case 4:
			glutWireOctahedron();
			break;
		case 5:
			glutWireIcosahedron();
			break;
		case 6:
			glutWireIcosahedron();
			break;
		}
	}
	glPopMatrix();
	glutSwapBuffers();
	glFlush();
}
コード例 #12
0
/* /////////////////////////////////////////////////////////////////////////////////////// */
void Draw_Cube_Transl_Rot(int model)
{
    glColor3f(0.0,0.0,0.0) ;
    if (model == WIRE)
        glutWireCube(1.0) ;
    else
        glutSolidCube(1.0) ;
}
コード例 #13
0
ファイル: gravity3d.c プロジェクト: archoad/Gravity
void drawAxes(void) {
	glPushMatrix();
	glLineWidth(1.0);
	glTranslatef(0.0, 0.0, 0.0);
	glColor3f(1.0, 1.0, 1.0);
	glutWireCube(100.0/2.0);
	glPopMatrix();
}
コード例 #14
0
ファイル: Gl1_Primitives.cpp プロジェクト: DEMANY/trunk
void Gl1_Box::go(const shared_ptr<Shape>& cg, const shared_ptr<State>&,bool wire,const GLViewInfo&)
{
	glColor3v(cg->color);
	Vector3r &extents = (static_cast<Box*>(cg.get()))->extents;
	glScalef(2*extents[0],2*extents[1],2*extents[2]);
	if (wire) glutWireCube(1);
	else glutSolidCube(1);
}
コード例 #15
0
void VisualObject::Draw()
{
	glPushMatrix();
	glTranslatef(posX, posY, 0);
	glColor3f(0.0, 1.0, 0.0);
	glutWireCube(scaleZ);
	glPopMatrix();
}
コード例 #16
0
ファイル: Utils.cpp プロジェクト: rashikamishra/CS-6323
void drawWireBox(float xmin,float ymin,float zmin,float xmax,float ymax,float zmax) {
	glPushMatrix();
		glTranslatef(0.5f*(xmin+xmax),0.5f*(ymin+ymax),0.5f*(zmin+zmax));
		glScalef(xmax-xmin,ymax-ymin,zmax-zmin);
		glColor4f(1.0f,1.0f,1.0f,1.0f);
		glutWireCube(1.0f);
	glPopMatrix();
}
コード例 #17
0
ファイル: Objects.c プロジェクト: OS2World/DEV-UTIL-HUGS
static void hugsprim_glutWireCube_1(HugsStackPtr hugs_root)
{
    HsDouble arg1;
    arg1 = hugs->getDouble();
    glutWireCube(arg1);
    
    hugs->returnIO(hugs_root,0);
}
コード例 #18
0
void compoe_janelas_sol(void){
  GLUquadricObj *quadric;
  // inicia a composicao do computador
  janelas_sol = glGenLists(1);
  glNewList(janelas_sol, GL_COMPILE);
  quadric = gluNewQuadric();
  //gluQuadricTexture(quadric, GL_TRUE);

  GLfloat lado = 0.0;
  //compoe 5 janelas lado a lado 3 vezes
  for(int i = 0; i<3; i++){
    //5 janelas
    for(int j=0; j<5; j++){
      lado = lado + 3.0;

      //janelas menores sol
      glPushMatrix();
      //-tras/frente+ - -baixo/cima+ - -esquerda/direira+
      glTranslatef (-33.8, 8.2, -32.2+lado);
      //largura, altura, espessura
      glScalef (0.2, 1.5, 1.3);
      glutWireCube(2.0);
      glPopMatrix();

      //parede exterior sol - meio verical
      glPushMatrix();
      //tras/frente - cima/baixo - direita/esquerda
      glTranslatef (-33.8, 0.0, -33.7+lado);
      //espessura, altura, largura
      glScalef (0.1, 4.0, 0.1);
      glutSolidCube (5.0);
      glPopMatrix();

      //janelas sol
      glPushMatrix();
      //-tras/frente+ - -baixo/cima+ - -esquerda/direira+
      glTranslatef (-33.8, 2.7, -32.2+lado);
      //largura, altura, espessura
      glScalef (0.2, 3.5, 1.3);
      glutWireCube(2.0);
      glPopMatrix();

    }
    lado = lado + 1.7;
  }
}
コード例 #19
0
void drawCube(void){
	if (toggle){
		glutSolidCube(1.0);
	}
	else {
		glutWireCube(1.0);
	}
}
コード例 #20
0
void AABoundingBox::Render() const {
	glPushMatrix();
		glTranslatef(Center.x, Center.y, Center.z);
		glScalef(Dims.x, Dims.y, Dims.z);
		glColor3f(0.2f, 1, 0);
		glutWireCube(1);
	glPopMatrix();	
}
コード例 #21
0
ファイル: main.cpp プロジェクト: CogoDigitalLtd/FlockingFinal
void display(){
    float xRotTrad = (rotateX/180 * 3.141592654f);
    float yRotTrad = (rotateY/180 * 3.141592654f);
    if (moveForward) {
        cameraX -= float(sinf(yRotTrad));
        cameraY += float(sinf(xRotTrad));
        cameraZ += float(cosf(yRotTrad));
    }
    if (moveBack) {
        cameraX += float(sinf(yRotTrad));
        cameraY -= float(sinf(xRotTrad));
        cameraZ -= float(cosf(yRotTrad));
    }
    if (moveLeft) {
        cameraX += float(cosf(yRotTrad));
        cameraZ += float(sinf(yRotTrad));
    }
    if (moveRight) {
        cameraX -= float(cosf(yRotTrad));
        cameraZ -= float(sinf(yRotTrad));
    }

   // writeText();
    glLoadIdentity();
    initLight();

    glRotatef(rotateX, 1, 0, 0);
    glRotatef(rotateY, 0, 1, 0);

    //chase camera?
    glTranslatef(cameraX, 0, cameraZ);

    glClearColor(0, 0, 0, 1);
    
    glPushMatrix();
    boidsList->renderBoids();
    glPopMatrix();

    //draw boundary cube
    if(showCube){
        glColor3f(1, 1, 1);
        glutWireCube(boidsList->getBounds()*2);
    }

    //accumulation buffer, for fake motion blur
    if(pos == 0)
        glAccum(GL_LOAD, 1.0 / n);
    else
        glAccum(GL_ACCUM, 1.0 / n);
    pos++;
    if(pos >= n) {
        pos = 0;
        glAccum(GL_RETURN, 1.0);
        glutSwapBuffers();
        glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
    }

}
コード例 #22
0
void zeichneSzene(void)
{
	//Löschen des Framebuffers
	glClear(GL_COLOR_BUFFER_BIT);
	
	// Malfarbe ist Blau
	glColor3f(0.0, 0.0, 1.0);
	
	
	/*
		Sphere
	------------------------------------------------------ */
		// Festlegung, in welchen Festerabschnitt gemalt wird
		// params are (x, y, width, height). the origin is the lower left corner
		glViewport(0, 0, 200, 200);
	
		// Zeichnen des Glut-Grundkörpers Kugel
		// params are (radius, slices, stacks)
		glutWireSphere(70.0, 30, 30);
	
		// Rotation um die x- und y-Achse um jeweils 45 Grad
		// params are (angle, x, y, z). x/y/z defines a vector
		glRotatef(-5.0, 1.0, 1.0, 0.0);
	
	/*
		Cube
	 ------------------------------------------------------ */
		// Festlegung des neuen Festerabschnitts
		glViewport(200, 200, 200, 200);
	
		// Zeichnen des Glut-Grundkörpers Würfel
		// param is (size)
		glutWireCube(60.0);
	
	/*
		Cone
	 ------------------------------------------------------ */
		// Festlegung des neuen Festerabschnitts
		glViewport(0, 200, 200, 200);
	
		// Zeichnen des Glut-Grundkörpers Kegel
		// params are (base, height, slices, stacks)
		glutWireCone(30.0, 70.0, 30,30);
	
	/*
		Torus
	 ------------------------------------------------------ */
		// Festlegung des neuen Festerabschnitts
		glViewport(200, 0, 200, 200);
	
		// Zeichnen des Glut-Grundkörpers Ring
		// params are (innerRadius, outerRadius, sides, rings)
		glutWireTorus(30.0, 50.0, 30, 30);
	
	
	// Ausgabe auf dem Bildschirm
	glFlush();
}
コード例 #23
0
void desenha_img(){
     glColor3f(1,0,0);
    glLineWidth(2);
	//glTranslatef(0,30,0);
	//glRotatef(-90,1,0,0);
	glutWireCone(30, 30, 10, 8);
	//glTranslatef(0,-50,0);
	glutWireCube(30);
}
コード例 #24
0
ファイル: Source.cpp プロジェクト: AndroidHelen/Code_of_Robot
void drawbody(int armup, int armdown)//draawlimb为画手臂的方法,在display方法里被调用
{

	glPushMatrix();//矩阵入栈函数
	glTranslatef(0.0, -1.0, 0.0);//几何变换函数
	glRotatef((GLfloat)armup, 1.0, 0.0, 0.0);//几何变换函数(手臂
	glTranslatef(0.0, 1.0, 0.0);//几何变换函数
	glPushMatrix();//矩阵入栈函数
	glScalef(1.0, 2.0, 1.0);//几何变换函数
	glutWireCube(1.0);//绘制立方体
	glPopMatrix();//矩阵出栈函数
	glTranslatef(0.0, 1.0, 0.0);//几何变换函数
	glRotatef((GLfloat)armdown, 1.0, 0.0, 0.0);//几何变换函数(肘部)
	glTranslatef(0.0, 1.5, 0.0);//几何变换函数
	glScalef(0.9, 3.0, 0.9); //几何变换函数
	glutWireCube(1.0);//绘制立方体
	glPopMatrix();//矩阵出栈函数
}
コード例 #25
0
ファイル: 3dview.c プロジェクト: harisr92/cg
void display()
{
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(0.1,0.2,0.1,0,0,0,0,0,1);
	glClear(GL_COLOR_BUFFER_BIT);
	glutWireCube(0.9);
	glFlush();
}
コード例 #26
0
ファイル: Platform.cpp プロジェクト: dmazur/Arkanoid3D
void Platform::display(void)
{
	glPushMatrix();
    glColor3f(1.0f, 0.0f, 0.0f);
	glTranslatef(posX, posY, posZ);
	glScalef(1.0f, 1.0f, 0.10f);
    glutWireCube(size);
	glPopMatrix();
}
コード例 #27
0
ファイル: spacebert.c プロジェクト: phreaker2600/spacegame
void
tcube(double x, double y, double z, int s)
{
  	 glLoadIdentity();
	glRotated(45,1,1,0);
	glTranslatef(x,y,z);
    glutWireCube(s);

}
コード例 #28
0
ファイル: cube.c プロジェクト: slavablind91/code
void display(void){
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0, 1.0, 1.0);
	glLoadIdentity();
	gluLookAt(1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
	glRotatef(15.0, 1.0, 1.0, 0.0);
	glutWireCube(1.0);
	glFlush();
}
コード例 #29
0
void CCombatDrone::Rander()
{
	glPushMatrix();
	{
		glTranslatef(m_pt.x, m_pt.y, m_pt.z);
		glRotatef(m_angle,0,1,0);
		GLfloat gray[] = { m_gray.x, m_gray.y, m_gray.z, 1.0f };
		GLfloat specref[] = { m_specref.x, m_specref.y, m_specref.z, 1.0f };
		glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, gray);
		glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specref);
		glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 128);
		float angle = sin(m_gearangle*PI / 180.0)*m_size*0.1;

		
		
		glRotatef(m_gearangle,1,1,1);
		glutSolidSphere(m_size*0.1, 10, 12);
		glutWireSphere(m_size*0.2 + angle, 6, 6);
		glRotatef(-m_gearangle, 1, 1, 1);

		glutWireCube(m_size+angle);
		
		

		glPushMatrix();
		{
			glTranslatef(0, 0, m_size*0.5 + angle);
			RandArmor();
			glTranslatef(0, 0, -m_size - angle * 2);
			RandArmor();
		}
		glPopMatrix();
		
		/*
		glPushMatrix();
		{
			glTranslatef(m_size + angle, 0, 0);
			glRotatef(90,0,1,0);
			RandGear(m_size*0.5, m_gearangle);
			glRotatef(-90, 0, 1, 0);
			glTranslatef(-m_size*2 - angle * 2, 0,0 );
			glRotatef(90, 0, 1, 0);
			RandGear(m_size*0.5, m_gearangle);
			glRotatef(-90, 0, 1, 0);
		}
		glPopMatrix();
		*/
		






	}
	glPopMatrix();
}
コード例 #30
0
ファイル: myheader.hpp プロジェクト: BonnieBBS/CGAssignments
void drawWiredDoor()
{
    glPushMatrix();                   // door
    glTranslatef(0.35,-0.5,1);
    glColor3f(1,0,0);
    glScalef(0.5,1,0.05);
    glutWireCube(1);
    glPopMatrix();
}