dungeon_crawler
diff prototype/src/renderer.cc @ 78:12a1dcfe91fa
gamma correct rendering
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 26 Oct 2012 21:22:14 +0300 |
parents | 5981917093ff |
children |
line diff
1.1 --- a/prototype/src/renderer.cc Fri Oct 26 03:03:52 2012 +0300 1.2 +++ b/prototype/src/renderer.cc Fri Oct 26 21:22:14 2012 +0300 1.3 @@ -1,4 +1,5 @@ 1.4 #include <limits.h> 1.5 +#include <assert.h> 1.6 #include "opengl.h" 1.7 #include "renderer.h" 1.8 #include "level.h" 1.9 @@ -53,6 +54,10 @@ 1.10 return false; 1.11 } 1.12 1.13 + if(GLEW_ARB_framebuffer_sRGB) { 1.14 + glEnable(GL_FRAMEBUFFER_SRGB); 1.15 + } 1.16 + 1.17 rend = this; 1.18 return true; 1.19 } 1.20 @@ -79,7 +84,7 @@ 1.21 1.22 // ... resize the render target 1.23 glBindTexture(GL_TEXTURE_2D, rend_tex); 1.24 - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_xsz, tex_ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1.25 + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, tex_xsz, tex_ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1.26 1.27 // ... resize the depth buffer 1.28 glBindRenderbufferEXT(GL_RENDERBUFFER, rend_depth); 1.29 @@ -177,7 +182,7 @@ 1.30 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, clamp); 1.31 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 1.32 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 1.33 - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_xsz, tex_ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1.34 + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, tex_xsz, tex_ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1.35 1.36 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rend_tex, 0); 1.37