Clamp NUM_SAMPLES glTexImage2DMultisample at GL_MAX_SAMPLES, since not all systems support >1 see https://github.com/iceiix/steven/issues/5#issuecomment-427669426
This commit is contained in:
parent
cceb1768b1
commit
ed5d48f136
|
@ -370,8 +370,18 @@ impl Texture {
|
||||||
format: TextureFormat,
|
format: TextureFormat,
|
||||||
fixed: bool) {
|
fixed: bool) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
let result: &mut [i32] = &mut [0; 1];
|
||||||
|
gl::GetIntegerv(gl::MAX_SAMPLES, &mut result[0]);
|
||||||
|
let use_samples =
|
||||||
|
if samples > result[0] {
|
||||||
|
println!("glTexImage2DMultisample: requested {} samples but GL_MAX_SAMPLES is {}", samples, result[0]);
|
||||||
|
result[0]
|
||||||
|
} else {
|
||||||
|
samples
|
||||||
|
};
|
||||||
|
|
||||||
gl::TexImage2DMultisample(target,
|
gl::TexImage2DMultisample(target,
|
||||||
samples,
|
use_samples,
|
||||||
format,
|
format,
|
||||||
width as i32,
|
width as i32,
|
||||||
height as i32,
|
height as i32,
|
||||||
|
|
Loading…
Reference in New Issue