Drawing a triangle in OpenGL fragment shader
问题 I'm trying to draw a triangle using an OpenGL fragment shader. I succeeded in drawing a circle but I have a problem with handling the equation/logic or the code to draw a triangle. draw_triangle(vec2 v1 , vec2 v2, vec2 v3) Here is the fragment shader: #version 330 core out vec4 frag_color; void draw_circle(vec2 shift_val, int radius,int color) { vec2 res = vec2(1280,720); vec2 norm_cord = gl_FragCoord.xy; float dist = length(norm_cord - (res*shift_val)); if( dist < radius ) { if( color ==1 )