Advertisement
atm959

renderImagePart

Sep 1st, 2019
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. void Renderer::renderImagePart(float x, float y, float width, float height, float pX, float pY, float pX2, float pY2) {
  2. this->vertexCoords2[2] = (pX / 32);
  3. this->vertexCoords2[3] = (pY / 32);
  4. this->vertexCoords2[6] = (pX / 32);
  5. this->vertexCoords2[7] = (pY2 / 32);
  6. this->vertexCoords2[10] = (pX2 / 32);
  7. this->vertexCoords2[11] = (pY2 / 32);
  8. this->vertexCoords2[14] = (pX / 32);
  9. this->vertexCoords2[15] = (pY / 32);
  10. this->vertexCoords2[18] = (pX2 / 32);
  11. this->vertexCoords2[19] = (pY2 / 32);
  12. this->vertexCoords2[22] = (pX2 / 32);
  13. this->vertexCoords2[23] = (pY / 32);
  14. glBufferData(GL_ARRAY_BUFFER, sizeof(this->vertexCoords2), this->vertexCoords2, GL_DYNAMIC_DRAW);
  15.  
  16. this->model = glm::mat4(1.0f);
  17. this->model = glm::translate(this->model, glm::vec3(x, y, 0.0f));
  18. this->model = glm::scale(this->model, glm::vec3(width, height, 0.0f));
  19.  
  20. glUniformMatrix4fv(glGetUniformLocation(this->shader, "model"), 1, GL_FALSE, &this->model[0][0]);
  21.  
  22. glDrawArrays(GL_TRIANGLES, 0, 6);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement