mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Updates
This commit is contained in:
@@ -34,6 +34,14 @@ class IMICFPS
|
||||
create_screen_vbo
|
||||
end
|
||||
|
||||
def width
|
||||
window.width
|
||||
end
|
||||
|
||||
def height
|
||||
window.height
|
||||
end
|
||||
|
||||
def create_framebuffer
|
||||
buffer = ' ' * 8
|
||||
glGenFramebuffers(1, buffer)
|
||||
@@ -78,7 +86,7 @@ class IMICFPS
|
||||
@textures[@buffers[i]] = texture_id
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture_id)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, window.width, window.height, 0, GL_RGB, GL_FLOAT, nil)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, width, height, 0, GL_RGB, GL_FLOAT, nil)
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, texture_id, 0)
|
||||
end
|
||||
|
||||
@@ -88,7 +96,7 @@ class IMICFPS
|
||||
@textures[:depth] = texture_id
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture_id)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, window.width, window.height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, nil)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, nil)
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, texture_id, 0)
|
||||
|
||||
draw_buffers = [ GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 ]
|
||||
|
||||
@@ -82,6 +82,12 @@ class IMICFPS
|
||||
end
|
||||
|
||||
def lighting(lights)
|
||||
@g_buffer.bind_for_reading
|
||||
|
||||
@g_buffer.set_read_buffer(:diffuse)
|
||||
glBlitFramebuffer(0, 0, @g_buffer.width, @g_buffer.height,
|
||||
0, 0, @g_buffer.width / 2, @g_buffer.height / 2,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR)
|
||||
end
|
||||
|
||||
def post_processing
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
@include "light_struct"
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
// layout(location = 0) out vec4 fragColor;
|
||||
layout (location = 1) out vec3 fragColor;
|
||||
|
||||
in vec3 outPosition;
|
||||
in vec3 outColor;
|
||||
@@ -98,5 +99,5 @@ void main() {
|
||||
}
|
||||
}
|
||||
|
||||
fragColor = vec4(result, 1.0);
|
||||
fragColor = vec3(1,1,1);//result;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version 330 core
|
||||
layout (location = 0) in vec2 inPosition;
|
||||
layout (location = 0) in vec3 inPosition;
|
||||
layout (location = 1) in vec2 inTexCoords;
|
||||
|
||||
out vec2 outTexCoords;
|
||||
|
||||
Reference in New Issue
Block a user