Attempt to disable multisampling (glTexImage2D instead of glTexImage2DMultisample), but nothing shows up
This commit is contained in:
parent
08e5c8df24
commit
5b972cb3ec
|
@ -41,9 +41,6 @@ use std::thread;
|
||||||
|
|
||||||
const ATLAS_SIZE: usize = 1024;
|
const ATLAS_SIZE: usize = 1024;
|
||||||
|
|
||||||
// TEMP
|
|
||||||
const NUM_SAMPLES: i32 = 2;
|
|
||||||
|
|
||||||
pub struct Camera {
|
pub struct Camera {
|
||||||
pub pos: cgmath::Point3<f64>,
|
pub pos: cgmath::Point3<f64>,
|
||||||
pub yaw: f64,
|
pub yaw: f64,
|
||||||
|
@ -777,7 +774,6 @@ init_shader! {
|
||||||
required accum => "taccum",
|
required accum => "taccum",
|
||||||
required revealage => "trevealage",
|
required revealage => "trevealage",
|
||||||
required color => "tcolor",
|
required color => "tcolor",
|
||||||
required samples => "samples",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -850,35 +846,37 @@ impl TransInfo {
|
||||||
main.bind();
|
main.bind();
|
||||||
|
|
||||||
let fb_color = gl::Texture::new();
|
let fb_color = gl::Texture::new();
|
||||||
fb_color.bind(gl::TEXTURE_2D_MULTISAMPLE);
|
fb_color.bind(gl::TEXTURE_2D);
|
||||||
fb_color.image_2d_sample(
|
fb_color.image_2d(
|
||||||
gl::TEXTURE_2D_MULTISAMPLE,
|
gl::TEXTURE_2D,
|
||||||
NUM_SAMPLES,
|
0,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
gl::RGBA8,
|
gl::RGBA,
|
||||||
false,
|
gl::UNSIGNED_BYTE,
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
main.texture_2d(
|
main.texture_2d(
|
||||||
gl::COLOR_ATTACHMENT_0,
|
gl::COLOR_ATTACHMENT_0,
|
||||||
gl::TEXTURE_2D_MULTISAMPLE,
|
gl::TEXTURE_2D,
|
||||||
&fb_color,
|
&fb_color,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
let fb_depth = gl::Texture::new();
|
let fb_depth = gl::Texture::new();
|
||||||
fb_depth.bind(gl::TEXTURE_2D_MULTISAMPLE);
|
fb_depth.bind(gl::TEXTURE_2D);
|
||||||
fb_depth.image_2d_sample(
|
fb_depth.image_2d(
|
||||||
gl::TEXTURE_2D_MULTISAMPLE,
|
gl::TEXTURE_2D,
|
||||||
NUM_SAMPLES,
|
0,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
gl::DEPTH_COMPONENT24,
|
gl::DEPTH_COMPONENT,
|
||||||
false,
|
gl::UNSIGNED_BYTE,
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
main.texture_2d(
|
main.texture_2d(
|
||||||
gl::DEPTH_ATTACHMENT,
|
gl::DEPTH_ATTACHMENT,
|
||||||
gl::TEXTURE_2D_MULTISAMPLE,
|
gl::TEXTURE_2D,
|
||||||
&fb_depth,
|
&fb_depth,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
|
@ -925,13 +923,12 @@ impl TransInfo {
|
||||||
gl::active_texture(1);
|
gl::active_texture(1);
|
||||||
self.revealage.bind(gl::TEXTURE_2D);
|
self.revealage.bind(gl::TEXTURE_2D);
|
||||||
gl::active_texture(2);
|
gl::active_texture(2);
|
||||||
self.fb_color.bind(gl::TEXTURE_2D_MULTISAMPLE);
|
self.fb_color.bind(gl::TEXTURE_2D);
|
||||||
|
|
||||||
shader.program.use_program();
|
shader.program.use_program();
|
||||||
shader.accum.set_int(0);
|
shader.accum.set_int(0);
|
||||||
shader.revealage.set_int(1);
|
shader.revealage.set_int(1);
|
||||||
shader.color.set_int(2);
|
shader.color.set_int(2);
|
||||||
shader.samples.set_int(NUM_SAMPLES);
|
|
||||||
self.array.bind();
|
self.array.bind();
|
||||||
gl::draw_arrays(gl::TRIANGLES, 0, 6);
|
gl::draw_arrays(gl::TRIANGLES, 0, 6);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
uniform sampler2D taccum;
|
uniform sampler2D taccum;
|
||||||
uniform sampler2D trevealage;
|
uniform sampler2D trevealage;
|
||||||
uniform sampler2DMS tcolor;
|
uniform sampler2D tcolor;
|
||||||
|
|
||||||
uniform int samples;
|
|
||||||
|
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
@ -12,11 +10,6 @@ void main() {
|
||||||
float aa = texelFetch(trevealage, C, 0).r;
|
float aa = texelFetch(trevealage, C, 0).r;
|
||||||
vec4 col = texelFetch(tcolor, C, 0);
|
vec4 col = texelFetch(tcolor, C, 0);
|
||||||
|
|
||||||
for (int i = 1; i < samples; i++) {
|
|
||||||
col += texelFetch(tcolor, C, i);
|
|
||||||
}
|
|
||||||
col /= float(samples);
|
|
||||||
|
|
||||||
float r = accum.a;
|
float r = accum.a;
|
||||||
accum.a = aa;
|
accum.a = aa;
|
||||||
if (r >= 1.0) {
|
if (r >= 1.0) {
|
||||||
|
@ -25,4 +18,5 @@ void main() {
|
||||||
vec3 alp = clamp(accum.rgb / clamp(accum.a, 1e-4, 5e4), 0.0, 1.0);
|
vec3 alp = clamp(accum.rgb / clamp(accum.a, 1e-4, 5e4), 0.0, 1.0);
|
||||||
fragColor = vec4(col.rgb * r + alp * (1.0 - r), 0.0);
|
fragColor = vec4(col.rgb * r + alp * (1.0 - r), 0.0);
|
||||||
}
|
}
|
||||||
|
//fragColor = vec4(0.0, 1.0, 0.0, 0.0); // green test - fragment shader
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue