Exemple #1
0
void display()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	sfDrawString(100, 100, "abcdefghijklmnopqrstuvwxyz1234567890:;><=?");
	sfDrawString(100, 120, " !""#$%:;><=? '*+-.,()/&&");
	sfDrawString(20, 20, "Hey Leroy!");
	sfDrawString(-20, -20, "Your Mama's calling!");
	
	glutSwapBuffers();
}
Exemple #2
0
void display(void)
{
    //std::cout << "time boost = " << time_boost << std::endl;
    if (time_boost >= 1) {
        time_boost -= 1;
        if (time_boost < 1) {
            std::cout << "BOOST OFF!" << std::endl;
            game_->ball_speed = game_->ball_speed_global;
            game_->imortality = false;
        }
    }
    
    
    //printf("d1 \n");

    
    t += 0.005;
    game_->world_dir();
    // clear the screen
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    
    mat4 total, modelView, camMatrix;
    
    printError("pre display");
    
    glUseProgram(program);
    // Build matrix

    vec3 cam = vec3(0, 5, 8);
    vec3 lookAtPoint = vec3(2, 0, 2);
    camMatrix = lookAt(cam.x, cam.y, cam.z,
                       lookAtPoint.x, lookAtPoint.y, lookAtPoint.z,
                       0.0, 1.0, 0.0);
    modelView = IdentityMatrix();
    total = Mult(camMatrix, modelView);
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    glUniformMatrix4fv(glGetUniformLocation(program, "Camera"), 1, GL_TRUE, camera.m);
    
    // skybox
    
    // Disable Z-buffer to draw sky
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_CULL_FACE);
    
    // Use skytex as texture and switch to skyprogram
    glUseProgram(skyprogram);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, skytex);
    
    
    // Sky
    mat4 skylookAT = camera;
    skylookAT.m[3] = 0;
    skylookAT.m[7] = 0;
    skylookAT.m[11] = 0;
    
    skylookAT = Mult(T(-0.2,0,0), skylookAT);
    mat4 skyrot = Ry(game_->turn_angle*game_->pol_dir);
    skytot = Mult(skytot, skyrot);

    glUniformMatrix4fv(glGetUniformLocation(skyprogram, "lookAT"), 1, GL_TRUE, skylookAT.m);
    
    glUniformMatrix4fv(glGetUniformLocation(skyprogram, "mdlMatrix"),1, GL_TRUE, skytot.m);
    DrawModel(skybox, skyprogram, "in_Position", NULL, "in_TexCoord");
    printError("sky shader");
    
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
    glUseProgram(program);

    
    glBindTexture(GL_TEXTURE_2D, tex1);		// Bind Our Texture tex1
    glActiveTexture(GL_TEXTURE0);
    
    
    // game clock
    if (!game_->dead) {
        // game clock
        time_count += 0.02;
        snprintf(buffer, 50, "%f", time_count);
        sfDrawString(30, 30, "Elapsed Time:");
        sfDrawString(170, 30, buffer);
        if (game_->ball_speed_global < 5) {
            game_->ball_speed_global += 0.0002;
        }
        
    }
    
    
    
    //Current
    total = game_->maze->get_total();
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(game_->maze->track, program, "inPosition", "inNormal", "inTexCoord");
    
    //left
    total = game_->maze->left->get_total();
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(game_->maze->left->track, program, "inPosition", "inNormal", "inTexCoord");
    
    //left->left
    total = game_->maze->left->left->get_total();
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(game_->maze->left->left->track, program, "inPosition", "inNormal", "inTexCoord");
    
    //left->right
    total = game_->maze->left->right->get_total();
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(game_->maze->left->right->track, program, "inPosition", "inNormal", "inTexCoord");
    
    
    //right
    total = game_->maze->right->get_total();
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(game_->maze->right->track, program, "inPosition", "inNormal", "inTexCoord");
    //right->left
    total = game_->maze->right->left->get_total();
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(game_->maze->right->left->track, program, "inPosition", "inNormal", "inTexCoord");
    //right->right
    total = game_->maze->right->right->get_total();
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(game_->maze->right->right->track, program, "inPosition", "inNormal", "inTexCoord");
    
    
    


    //sphere
    glBindTexture(GL_TEXTURE_2D, tex2);
    glActiveTexture(GL_TEXTURE0);

    //    GLfloat y_pos_des = height_controll(x_pos, z_pos,&ttex,tm)+0.1;
    //    y_pos -= (y_pos - y_pos_des)/1*0.5;
    game_->update();
    if (game_->generate_terrain_bool) {
        NewTerrain(game_->x_pos);
        game_->generate_terrain_bool = false;
    }

    //trans = T(0,0,0); // <<< --  Vart spheren är
    //rot = Rx(0);
    //rot = Ry(M_PI_2/4);
    //total = game_->player_->total_pos();//Mult(game_->strans, rot);

    camera = game_->update_camera();
    
    //Body
    total = game_->player_->body_total;
    
    glBindTexture(GL_TEXTURE_2D, tex_body);
    glActiveTexture(GL_TEXTURE0);
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(Body,program,"inPosition","inNormal","inTexCoord");
    
    //Rest of player init tex
    glBindTexture(GL_TEXTURE_2D, tex_head);
    glActiveTexture(GL_TEXTURE0);
    
    total = game_->player_->head_total;
    
    //head
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(Body,program,"inPosition","inNormal","inTexCoord");
    
    //arms
    total = game_->player_->arm_total_l;
    //lsft
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(ArmL,program,"inPosition","inNormal","inTexCoord");
    
    total = game_->player_->arm_total_r;
    //right
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(ArmR,program,"inPosition","inNormal","inTexCoord");
    
    //legs
    total = game_->player_->leg_total_l;
    //Left
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(LegL,program,"inPosition","inNormal","inTexCoord");
    
    total = game_->player_->leg_total_r;
    //Right
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
    DrawModel(LegR,program,"inPosition","inNormal","inTexCoord");
    
    
    //Lava
    glBindTexture(GL_TEXTURE_2D, lavatex);
    glActiveTexture(GL_TEXTURE0);
    
    lavatot = Mult(T(0.0,(game_->y_pos_t),0.0),lavatot);
    lavatot = Mult(lavatot, skyrot);
    
    glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, lavatot.m);
    DrawModel(Lava,program,"inPosition","inNormal","inTexCoord");
    
    
    
    //BOOSTERS
    // ---------------------- ______________------------------
    //printf("b1 \n");
    
    bool b_col = game_->maze->b_collision;
    // printf("bool b_collision: %d \n", b_col );
    
    if (b_col == false){
        
        game_->boost_collision();
        draw_boost(game_->maze);
        b_col = game_->maze->b_collision;
        if (b_col == true) { // if collision give points
            time_count += 100;
            time_boost = (3*(1+game_->ball_speed))*(1/0.02);
            std::cout << "tB = " << time_boost << std::endl;
            if (game_->maze->boost == 1) { //if speed
                game_->ball_speed += 1;
            }
            else{ // if imortality
                game_->imortality = true;
            }
        }
        
    }

    draw_boost(game_->maze->right);
    draw_boost(game_->maze->left);
    
    

    
    //  printf("obstacle main%d \n", obstacle );
    //  printf("obstaclex main %d \n", obstacle_x_pos );

    draw_obsticle(game_->maze);
        draw_obsticle(game_->maze->left);
        draw_obsticle(game_->maze->right);
    
    
    if (game_->dead) {
        sfSetRasterSize(600, 200);
        sfDrawString(250, 90, "GAME OVER");
        
        GLfloat time_score = time_count;
        snprintf(buffer, 50, "%f", time_score);
        sfDrawString(220, 110, "Score: ");
        sfDrawString(290, 110, buffer);
    }

   
    printError("display 2");
    
    glutSwapBuffers();
}
Exemple #3
0
void display()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	sfDrawString(20, -20, "SELECT ZXCVBN");
	sfDrawString(-20, -20, "SELECT 123456");

	glUniform1i(glGetUniformLocation(program, "texRepeat"), texRepeat); // Texture repeat

	switch (leftSelection)
	{
	case kSingleNearest:
		sfDrawString(-20, 20, "Single texture, nearest");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		break;
	case kSingleLinear:
		sfDrawString(-20, 20, "Single texture, linear");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		break;
	case kMipmapNearestNearest:
		sfDrawString(-20, 20, "Mipmap, nearest level, nearest texel");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
		break;
	case kMipmapLinearNearest:
		sfDrawString(-20, 20, "Mipmap, linear level, nearest texel");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR);
		break;
	case kMipmapNearestLinear:
		sfDrawString(-20, 20, "Mipmap, nearest level, linear texel");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
		break;
	case kMipmapLinearLinear:
		sfDrawString(-20, 20, "Mipmap, linear level, linear texel");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
		break;
	}
	
	mat4 tr, rot, sc, m;
	Point3D axis = {1,1,1};
	
	glUseProgram(program); // Not really needed since simplefont restores the shader.
	
	glUniformMatrix4fv(glGetUniformLocation(program, "projMatrix"), 1, GL_TRUE, projectionMatrix.m);
	
	tr = T(1, 0, 0);
	rot = ArbRotate(axis, myTime*M_PI/180);
	m = Mult(worldToViewMatrix, tr);
	m = Mult(m, rot);
	glUniformMatrix4fv(glGetUniformLocation(program, "modelviewMatrix"), 1, GL_TRUE, m.m);
	glBindVertexArray(vertexArrayObjID);	// Select VAO
	glDrawArrays(GL_TRIANGLES, 0, 36*3);	// draw object
	
	rot = Ry(myTime*M_PI/180);
	tr = T(1, 0, 0);
	sc = S(0.5, 0.5, 0.5);
	m = Mult(m, rot);
	m = Mult(m, tr);
	m = Mult(m, sc);
	glUniformMatrix4fv(glGetUniformLocation(program, "modelviewMatrix"), 1, GL_TRUE, m.m);
	glBindVertexArray(vertexArrayObjID);	// Select VAO
	glDrawArrays(GL_TRIANGLES, 0, 36*3);	// draw object
	
	switch (rightSelection)
	{
	case kSingleNearest:
		sfDrawString(20, 40, "Single texture, nearest");
		glBindTexture(GL_TEXTURE_2D, miptex); // singletex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		break;
	case kSingleLinear:
		sfDrawString(20, 40, "Single texture, linear");
		glBindTexture(GL_TEXTURE_2D, miptex); // singletex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		break;
	case kMipmapNearestNearest:
		sfDrawString(20, 40, "Mipmap, nearest level, nearest texel");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
		break;
	case kMipmapLinearNearest:
		sfDrawString(20, 40, "Mipmap, linear level, nearest texel");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR);
		break;
	case kMipmapNearestLinear:
		sfDrawString(20, 40, "Mipmap, nearest level, linear texel");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
		break;
	case kMipmapLinearLinear:
		sfDrawString(20, 40, "Mipmap, linear level, linear texel");
		glBindTexture(GL_TEXTURE_2D, miptex);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
		break;
	}
	
	tr = T(-1, 0, 0);
	rot = ArbRotate(axis, myTime*M_PI/180);
	m = Mult(worldToViewMatrix, tr);
	m = Mult(m, rot);
	glUniformMatrix4fv(glGetUniformLocation(program, "modelviewMatrix"), 1, GL_TRUE, m.m);
	glBindVertexArray(vertexArrayObjID);	// Select VAO
	glDrawArrays(GL_TRIANGLES, 0, 36*3);	// draw object

	rot = Ry(myTime*M_PI/180);
	tr = T(1, 0, 0);
	sc = S(0.5, 0.5, 0.5);
	m = Mult(m, rot);
	m = Mult(m, tr);
	m = Mult(m, sc);
	glUniformMatrix4fv(glGetUniformLocation(program, "modelviewMatrix"), 1, GL_TRUE, m.m);
	glBindVertexArray(vertexArrayObjID);	// Select VAO
	glDrawArrays(GL_TRIANGLES, 0, 36*3);	// draw object

	glutSwapBuffers();
}
Exemple #4
0
void display(void)
{

  // Clear the screen____________________________________


if((cam.x < goalx + 2 && cam.x > goalx - 2) && (cam.z < goalz + 2 && cam.z > goalz - 2))
{
	
	third_person = true;

}
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);



  // Variables
    
  mat4 total, modelView, camMatrix;
  GLfloat t =(GLfloat)glutGet(GLUT_ELAPSED_TIME)/1000; //Scale with constant to make animation slower.
 


  //Read input_____________________________________________
  if (third_person)
    {

	goal_found = true;

      if (glutKeyIsDown('t'))
	{ 
	  third_person = false;  
	}
  
  vec3 pos =  {200, 200, 150};// SetVector(keyx,keyy,keyz);
      //Mouse control_____________________________________________
      //fmin and fmax doesn't really make sense but looks good. 
      GLfloat mousexlocal = 0;
      GLfloat mouseylocal = 0;

      if (mousex < 350 ||  mousex > 250)
	{
	  mousexlocal = 300-mousex;
	}
      else
	{
	  mousexlocal = 0;
	}

      deltaphi = deltaphi + deltaphi*-mousexlocal;
      deltaphi = fmin(0.0001,deltaphi);
      deltaphi = fmax(deltaphi,2 * PI - 0.0001);
      forward = MultVec3(Ry(deltaphi*-mousexlocal), forward);

      vec3 crossvec = CrossProduct(forward,up);

      if (mousey < 350 || mousey > 250)
	{
	  mouseylocal = 300-mousey;
	}  
      else
	{
	  mouseylocal = 0;
	}

      deltatheta = deltatheta + deltatheta* -mouseylocal;
      deltatheta = fmin(0.0001,deltatheta);
      deltatheta = fmax(deltatheta,2*PI - 0.0001);
      forward = MultVec3( ArbRotate(crossvec,deltatheta*-mouseylocal), forward);

      //Create camera matrix_____________________________________________
      camMatrix = lookAtv(pos,VectorAdd(forward,pos),up);
    }




// FIRST PERSON VIEW --------------------------------------------------------
  else
    {
      
      vec3 moveVec;
      
      if (glutKeyIsDown('w')) // forwards, obviously
	{
	  vec3 oldcam = cam; //Save old position to check if its legal.
	  moveVec = ScalarMult(VectorSub(cam, SetVector(lookAtPoint.x, cam.y, lookAtPoint.z)), 0.1); // VectorSub makes a vector in the direction we're looking.
	  cam = VectorSub(cam, moveVec); // The new camera position is the old camera position + the move vector
	  cam.y = getHeight(&ttex,cam.x, cam.z)+2; // Get the correct height from the new position  
	  GLfloat maze_height = getHeight(&ttexm, cam.x, cam.z); // Get the height of the maze at the new (possible) camera position
	  GLfloat ground_height = getHeight(&ttex, cam.x, cam.z); // Get the height of the ground at the new (possible) camera position


	  //Check if the new position is legal
	    if ((ground_height - maze_height) < ground_height) // If 0, shouldn't move ever: OK!
						   // When does it start to move??
	      {
		printf("woot");
		cam = oldcam;
	      }
	}
       else if (glutKeyIsDown('t'))
	 {
	   third_person = true;
	 }

       GLfloat mousexlocal = 0;
      GLfloat mouseylocal = 0;

      if (mousex < 350 ||  mousex > 250)
	{
	  mousexlocal = 300-mousex;
	}
      else
	{
	  mousexlocal = 0;
	}

      deltaphi = deltaphi + deltaphi*-mousexlocal;
      deltaphi = fmin(0.0001,deltaphi);
      deltaphi = fmax(deltaphi,2 * PI - 0.0001);
      forward = MultVec3(Ry(deltaphi*-mousexlocal), forward);

      vec3 crossvec = CrossProduct(forward,up);

      if (mousey < 350 || mousey > 250)
	{
	  mouseylocal = 300-mousey;
	}  
      else
	{
	  mouseylocal = 0;
	}

      deltatheta = deltatheta + deltatheta* -mouseylocal;
      deltatheta = fmin(0.0001,deltatheta);
      deltatheta = fmax(deltatheta,2*PI - 0.0001);
      forward = MultVec3( ArbRotate(crossvec,deltatheta*-mouseylocal), forward);
      lookAtPoint = VectorAdd(forward,cam);
      //Create camera matrix_____________________________________________
      camMatrix = lookAtv(cam,lookAtPoint,up);

    }

  
  // --------------------------------------------------------//
  // SKYBOX
  // --------------------------------------------------------//

	glDisable(GL_DEPTH_TEST);
	glDisable(GL_CULL_FACE);

	glUseProgram(programSky);
	glActiveTexture(GL_TEXTURE2);
	//glBindTexture(GL_TEXTURE_2D, tex2);
	trans = T(0.0, 0.0, 0.0);

       	rot = Rx(0);
	total = Mult(trans, rot);
       	glUniformMatrix4fv(glGetUniformLocation(programSky, "mdlMatrix"), 1, GL_TRUE, total.m);

	lookSky = camMatrix;

	lookSky.m[3] = 0;
	lookSky.m[7] = 0;
	lookSky.m[11] = 0;

	glUniformMatrix4fv(glGetUniformLocation(programSky, "lookMatrix"), 1, GL_TRUE, lookSky.m);
	glUniformMatrix4fv(glGetUniformLocation(programSky, "projectionMatrix"), 1, GL_TRUE, projectionMatrix.m);

	glUniform1i(glGetUniformLocation(programSky, "texUnit2"), 2); // Texture unit 2
	DrawModel(skybox, programSky, "in_Position", NULL, "inTexCoord");


	glUseProgram(program);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);

	//------------------------------------------------------//
	//------------------------------------------------------//



 
  modelView = IdentityMatrix();
  total = Mult(camMatrix, modelView);

  glActiveTexture(GL_TEXTURE1);
  glUseProgram(program);
  glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
  glBindTexture(GL_TEXTURE_2D, tex2);		// Bind Our Texture tex1
  DrawModel(tm, program,"inPosition", "inNormal", "inTexCoord");

  glUseProgram(program);
  glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 0, GL_TRUE, total.m);
  glBindTexture(GL_TEXTURE_2D, tex1);		// Bind Our Texture tex1
  DrawModel(mm, program,"inPosition", "inNormal", "inTexCoord");

  GLfloat y = getHeight(&ttexm, 200, 147);
  mat4 trans = T(goalx, 2, goalz);
  mat4 scale = S(1, 1, 1);
 total = Mult(total, trans);
 total = Mult(total, scale);

 
 if (goal_found)
{
	char* string = "GOOD JOB!! You won :D";
	sfDrawString(100, 100, string);
	//while(true){};
}



  glUniformMatrix4fv(glGetUniformLocation(program, "mdlMatrix"), 1, GL_TRUE, total.m);
  glBindTexture(GL_TEXTURE_2D, tex3);		// Bind Our Texture tex1


  DrawModel(goal, program,"inPosition", "inNormal", "inTexCoord");


  



  printError("display 2");
	
  glutSwapBuffers();
  printf("x %f\n", cam.x);
  printf("y %f\n", cam.y);
  printf("z %f\n", cam.z);
  
  /* if ( (cam.x < 95) && (cam.x > 85) && */
  /*      (cam.z < 85) && (cam.z > 75)) */

  
}