mirror of
https://github.com/MartinOpat/cuda-based-raytrace.git
synced 2025-06-07 02:13:10 +02:00
feat (wip): real-time gui with rendering in opengl
This commit is contained in:
19
src/gui/shaders/rendertype_accumulate.frag
Normal file
19
src/gui/shaders/rendertype_accumulate.frag
Normal file
@@ -0,0 +1,19 @@
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D currentFrameTex;
|
||||
uniform sampler2D lastFrameTex;
|
||||
uniform int frameCount;
|
||||
|
||||
#define MAX_FRAMES 500.0f
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 col = texture(currentFrameTex, TexCoords).rgb;
|
||||
vec3 col2 = texture(lastFrameTex, TexCoords).rgb;
|
||||
|
||||
col = mix(col, col2, min(frameCount/MAX_FRAMES,1.0f));
|
||||
FragColor = vec4(col, 1.0);
|
||||
}
|
||||
11
src/gui/shaders/rendertype_accumulate.vert
Normal file
11
src/gui/shaders/rendertype_accumulate.vert
Normal file
@@ -0,0 +1,11 @@
|
||||
#version 330 core
|
||||
layout(location = 0) in vec2 aPos;
|
||||
layout(location = 1) in vec2 aTexCoords;
|
||||
|
||||
out vec2 TexCoords;
|
||||
|
||||
void main()
|
||||
{
|
||||
TexCoords = aTexCoords;
|
||||
gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
|
||||
}
|
||||
12
src/gui/shaders/rendertype_screen.frag
Normal file
12
src/gui/shaders/rendertype_screen.frag
Normal file
@@ -0,0 +1,12 @@
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D screenTexture;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 col = texture(screenTexture, TexCoords).rgb;
|
||||
FragColor = vec4(col, 1.0);
|
||||
}
|
||||
11
src/gui/shaders/rendertype_screen.vert
Normal file
11
src/gui/shaders/rendertype_screen.vert
Normal file
@@ -0,0 +1,11 @@
|
||||
#version 330 core
|
||||
layout(location = 0) in vec2 aPos;
|
||||
layout(location = 1) in vec2 aTexCoords;
|
||||
|
||||
out vec2 TexCoords;
|
||||
|
||||
void main()
|
||||
{
|
||||
TexCoords = aTexCoords;
|
||||
gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user