Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. int main(){
  2. mainWindow = Window(800, 600);
  3. mainWindow.Initialise();
  4.  
  5. //CreateObject();
  6. CrearCubo();
  7. cubo->bindVAO();
  8. CreateShaders();
  9.  
  10. GLuint uniformProjection = 0;
  11. GLuint uniformModel = 0;
  12. GLuint uniformView = 0;
  13.  
  14. glm::mat4 projection = glm::perspective(glm::radians(60.0f) , mainWindow.getBufferWidth() / mainWindow.getBufferHeight(), 0.1f, 100.0f);
  15.  
  16. //Loop mientras no se cierra la ventana
  17. while (!mainWindow.getShouldClose())
  18. {
  19. //Recibir eventos del usuario
  20. glfwPollEvents();
  21.  
  22. glm::mat4 view = glm::lookAt(glm::vec3(mainWindow.ejeX , mainWindow.ejeY, mainWindow.ejeZ),
  23. glm::vec3(mainWindow.viewX, mainWindow.viewY, mainWindow.viewZ),
  24. glm::vec3(0.0f, 1.0f, 0.0f));
  25.  
  26. //Limpiar la ventana
  27. glClearColor(0.0f,0.0f,0.0f,1.0f);
  28.  
  29. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Se agrega limpiar el buffer de profundidad
  30.  
  31. shaderList[0].useShader();
  32.  
  33. uniformModel = shaderList[0].getModelLoaction();
  34.  
  35. uniformProjection = shaderList[0].getProjectLocation();
  36. uniformView = shaderList[0].getViewLocation();
  37.  
  38. //model = glm::mat4(1.0);
  39. glm::mat4 model(1.0);
  40. model = glm::translate(model, glm::vec3(0.0f, 0.0f, -2.5f));
  41.  
  42.  
  43. glUniformMatrix4fv(uniformModel, 1, GL_FALSE, glm::value_ptr(model));//FALSE ES PARA QUE NO SEA TRANSPUESTA
  44. glUniformMatrix4fv(uniformProjection, 1, GL_FALSE, glm::value_ptr(projection));
  45. glUniformMatrix4fv(uniformView, 1, GL_FALSE, glm::value_ptr(view));
  46.  
  47. meshList[0]->RenderMesh();
  48.  
  49. glUseProgram(0);
  50. mainWindow.swapBuffers();
  51. }
  52. return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement