mirror of
https://github.com/kuhyx/engineer-thesis-WUT.git
synced 2026-07-04 13:03:07 +02:00
feat: put awesome face over container
This commit is contained in:
parent
8b1b1bd28c
commit
7dbd77117e
@ -1,9 +1,16 @@
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec3 ourColor;
|
||||
in vec2 TexCoord;
|
||||
uniform sampler2D ourTexture;
|
||||
|
||||
// texture samplers
|
||||
uniform sampler2D texture1;
|
||||
uniform sampler2D texture2;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = texture(ourTexture, TexCoord);
|
||||
}
|
||||
// linearly interpolate between both textures (80% container, 20% awesomeface)
|
||||
FragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);
|
||||
}
|
||||
|
||||
|
||||
@ -10,5 +10,5 @@ void main()
|
||||
{
|
||||
gl_Position = vec4(aPos, 1.0);
|
||||
ourColor = aColor;
|
||||
TexCoord = aTexCoord;
|
||||
TexCoord = vec2(aTexCoord.x, aTexCoord.y);
|
||||
}
|
||||
@ -179,20 +179,19 @@ drawFigureReturn drawDebilMode(const char* vertexPath, const char* fragmentPath,
|
||||
|
||||
configureVertexAttribute(true, true);
|
||||
|
||||
unsigned int texture1 = loadAndCreateTexture("assets/Preview.png", GL_RGBA, true);
|
||||
// unsigned int texture2 = loadAndCreateTexture("assets/awesomeface.png", GL_RGBA, false);
|
||||
|
||||
|
||||
activateAndBindTextures(texture1, GL_TEXTURE0);
|
||||
// activateAndBindTextures(texture2, GL_TEXTURE1);
|
||||
|
||||
unsigned int texture1 = loadAndCreateTexture("assets/container.png", GL_RGB, true);
|
||||
unsigned int texture2 = loadAndCreateTexture("assets/awesomeface.png", GL_RGBA, false);
|
||||
|
||||
ourShader.use(); // don't forget to activate/use the shader before setting uniforms!
|
||||
// either set it manually like so:
|
||||
glUniform1i(glGetUniformLocation(ourShader.ID, "texture1"), 0);
|
||||
ourShader.setInt("texture1", 0);
|
||||
// or set it via the texture class
|
||||
ourShader.setInt("texture2", 1);
|
||||
|
||||
|
||||
activateAndBindTextures(texture1, GL_TEXTURE0);
|
||||
activateAndBindTextures(texture2, GL_TEXTURE1);
|
||||
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||
|
||||
drawFigureReturn newReturn;
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user