Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(){
- mainWindow = Window(800, 600);
- mainWindow.Initialise();
- //CreateObject();
- CrearCubo();
- cubo->bindVAO();
- CreateShaders();
- GLuint uniformProjection = 0;
- GLuint uniformModel = 0;
- GLuint uniformView = 0;
- glm::mat4 projection = glm::perspective(glm::radians(60.0f) , mainWindow.getBufferWidth() / mainWindow.getBufferHeight(), 0.1f, 100.0f);
- //Loop mientras no se cierra la ventana
- while (!mainWindow.getShouldClose())
- {
- //Recibir eventos del usuario
- glfwPollEvents();
- glm::mat4 view = glm::lookAt(glm::vec3(mainWindow.ejeX , mainWindow.ejeY, mainWindow.ejeZ),
- glm::vec3(mainWindow.viewX, mainWindow.viewY, mainWindow.viewZ),
- glm::vec3(0.0f, 1.0f, 0.0f));
- //Limpiar la ventana
- glClearColor(0.0f,0.0f,0.0f,1.0f);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Se agrega limpiar el buffer de profundidad
- shaderList[0].useShader();
- uniformModel = shaderList[0].getModelLoaction();
- uniformProjection = shaderList[0].getProjectLocation();
- uniformView = shaderList[0].getViewLocation();
- //model = glm::mat4(1.0);
- glm::mat4 model(1.0);
- model = glm::translate(model, glm::vec3(0.0f, 0.0f, -2.5f));
- glUniformMatrix4fv(uniformModel, 1, GL_FALSE, glm::value_ptr(model));//FALSE ES PARA QUE NO SEA TRANSPUESTA
- glUniformMatrix4fv(uniformProjection, 1, GL_FALSE, glm::value_ptr(projection));
- glUniformMatrix4fv(uniformView, 1, GL_FALSE, glm::value_ptr(view));
- meshList[0]->RenderMesh();
- glUseProgram(0);
- mainWindow.swapBuffers();
- }
- return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement