Esempio n. 1
0
/*********************************************************
**********************************************************
**********************************************************

    PROC: display()
    DOES: this gets called by the event handler to draw
          the scene, so this is where you need to build
          your ROBOT --  
      
        MAKE YOUR CHANGES AND ADDITIONS HERE

    Add other procedures if you like.

**********************************************************
**********************************************************
**********************************************************/
void display(void)
{
    // Clear the screen with the background colour (set in myinit)
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    model_view = mat4(1.0f);
    
    model_view *= Translate(0.0f, -5.0f, -15.0f);
    HMatrix r;
    Ball_Value(Arcball,r);

    mat4 mat_arcball_rot(
        r[0][0], r[0][1], r[0][2], r[0][3],
        r[1][0], r[1][1], r[1][2], r[1][3],
        r[2][0], r[2][1], r[2][2], r[2][3],
        r[3][0], r[3][1], r[3][2], r[3][3]);
    model_view *= mat_arcball_rot;
        
    glUniformMatrix4fv( uView, 1, GL_TRUE, model_view );


    // Previously glScalef(Zoom, Zoom, Zoom);
    model_view *= Scale(Zoom);

    //draw objects
    drawGround();
    drawBee();
    drawFlower();

    glutSwapBuffers();
    if(Recording == 1)
        FrSaver.DumpPPM(Width, Height);
}
//Start drawing the bees
void beesFlight(bool pCheckSerial){
	//while not touched, animate...
	while(!gettouch() && (!pCheckSerial || Serial.available() == 0)){
		for(int i=0; i < BEES_COUNT; i++){
			mBees[i].x = newRandBees(mBees[i].x, BEE_RAYON, 320-BEE_RAYON);
			mBees[i].y = newRandBees(mBees[i].y, BEE_RAYON, 240-BEE_RAYON); 
			
			drawBee(mBees[i]);
		}

		delay(50);
	}
}
Esempio n. 3
0
File: anim.cpp Progetto: 4solo/cs174
/*********************************************************
**********************************************************
**********************************************************
 
    PROC: display()
    DOES: this gets called by the event handler to draw
          the scene, so this is where you need to build
          your ROBOT --  
      
        MAKE YOUR CHANGES AND ADDITIONS HERE
 
    Add other procedures if you like.
 
**********************************************************
**********************************************************
**********************************************************/
void display(void)
{
	// Clear the screen with the background colour (set in myinit)
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	mat4 model_trans(1.0f);
	mat4 view_trans(1.0f);

	view_trans *= Translate(0.0f, 0.0f, -15.0f);
	HMatrix r;
	Ball_Value(Arcball, r);

	mat4 mat_arcball_rot(
		r[0][0], r[0][1], r[0][2], r[0][3],
		r[1][0], r[1][1], r[1][2], r[1][3],
		r[2][0], r[2][1], r[2][2], r[2][3],
		r[3][0], r[3][1], r[3][2], r[3][3]);
	view_trans *= mat_arcball_rot;
	view_trans *= Scale(Zoom);

	glUniformMatrix4fv(uView, 1, GL_TRUE, model_view);

	model_view = view_trans;

	mvstack.push(model_view);
	drawGround(view_trans);
	model_view = mvstack.top();
	mvstack.pop();

	model_view *= Translate(0, -10, 0);

	drawFlower();
	drawBee();
	glutSwapBuffers();
	if (Recording == 1)
		FrSaver.DumpPPM(Width, Height);
}