Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. float vertices[] = {
  2. // posistions // normals // texture coords
  3. -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
  4. 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,
  5. 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,
  6. 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,
  7. -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,
  8. -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
  9. }
  10.  
  11. #version 330 core
  12.  
  13. in vec3 frag_pos;
  14. in vec3 frag_nor;
  15. in vec2 frag_tex;
  16.  
  17. out vec4 frag_color;
  18.  
  19. void main()
  20. {
  21. vec2 origin = vec2(0.01, 0.01);
  22.  
  23. float width = 1.0 - origin.x * 2.0;
  24. float height = 1.0 - origin.y * 2.0;
  25.  
  26. if( (frag_tex.x >= origin.x && frag_tex.x < origin.x + width) &&
  27. (frag_tex.y >= origin.y && frag_tex.y < origin.y + height) )
  28. {
  29. frag_color = vec4(0.0);
  30. }
  31. else
  32. {
  33. frag_color = vec4(0.0, 1.0, 0.0, 0.0);
  34. }
  35. }
  36.  
  37. glDisable(GL_DEPTH_TEST);
  38. glBindVertexArray(vao);
  39. glDrawArrays(GL_TRIANGLES, 0, 6);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement