I am trying to render an image in the viewPort using symmetry_create = 1
and binding texture to it.
static const GLfloat vertices[] = {
//vertexdata
-symmetry_create,
symmetry_create,
0.0f,
//uv
0.0f, 1.0f,
symmetry_create,
symmetry_create,
0.0f,
//uv
1.0f, 1.0f,
symmetry_create,
-symmetry_create,
0.0f,
//uv
1.0f, 0.0f,
-symmetry_create,
-symmetry_create,
0.0f,
//uv
0.0f, 0.0f};
My vertex shader looks like
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 texCoord;
out vec2 TexCoord;
void main()
{
gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);
TexCoord = texCoord;
}
And fragment shader looks like
#version 330 core
in vec2 TexCoord;
out vec4 frag_color;
uniform sampler2D myTexture;
void main()
{
frag_color = texture(myTexture, TexCoord);
}
I have setup my vao, vbo and indices correctly and thus I am getting the result as expected (ie: A provided image on the display screen).
Now I would like to draw 'n' number of transparent polygons on the image generated.For each polygon, I have thought of achieving using mouse cursor positions and clicks and render using glDrawArrays(GL_TRIANGLE_FAN, 0, n);
.
If I use the same vertex and fragment shaders my result now is black opaque polygons on top of the image. How to achieve transparency and color in the polygons. Do I need to another set of shaders(vertex and frag)?