Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float vertices[] = {
- // posistions // normals // texture coords
- -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
- 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,
- 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,
- 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,
- -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,
- -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
- }
- #version 330 core
- in vec3 frag_pos;
- in vec3 frag_nor;
- in vec2 frag_tex;
- out vec4 frag_color;
- void main()
- {
- vec2 origin = vec2(0.01, 0.01);
- float width = 1.0 - origin.x * 2.0;
- float height = 1.0 - origin.y * 2.0;
- if( (frag_tex.x >= origin.x && frag_tex.x < origin.x + width) &&
- (frag_tex.y >= origin.y && frag_tex.y < origin.y + height) )
- {
- frag_color = vec4(0.0);
- }
- else
- {
- frag_color = vec4(0.0, 1.0, 0.0, 0.0);
- }
- }
- glDisable(GL_DEPTH_TEST);
- glBindVertexArray(vao);
- glDrawArrays(GL_TRIANGLES, 0, 6);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement