dungeon_crawler
changeset 32:0cd55268eaf4
AAAAaaaarghhhh... forgot to request floating point pixel format for MRT textures...
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 28 Aug 2012 02:18:19 +0300 |
parents | ddb68dc4ba07 |
children | 0357994effe2 |
files | prototype/src/renderer.cc |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line diff
1.1 --- a/prototype/src/renderer.cc Mon Aug 27 04:14:04 2012 +0300 1.2 +++ b/prototype/src/renderer.cc Tue Aug 28 02:18:19 2012 +0300 1.3 @@ -40,8 +40,12 @@ 1.4 1.5 bool init_renderer(int xsz, int ysz) 1.6 { 1.7 + if(!GLEW_ARB_texture_float) { 1.8 + fprintf(stderr, "Error: OpenGL implementation doesn't support floating point textures\n"); 1.9 + return false; 1.10 + } 1.11 if(!GLEW_ARB_draw_buffers) { 1.12 - fprintf(stderr, "OpenGL implementation doesn't support multiple render targets\n"); 1.13 + fprintf(stderr, "Error: OpenGL implementation doesn't support multiple render targets\n"); 1.14 return false; 1.15 } 1.16 1.17 @@ -105,8 +109,7 @@ 1.18 1.19 for(int i=0; i<MRT_COUNT; i++) { 1.20 glBindTexture(GL_TEXTURE_2D, mrt_tex[i]); 1.21 - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_xsz, tex_ysz, 0, GL_RGBA, 1.22 - GL_UNSIGNED_BYTE, 0); 1.23 + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, tex_xsz, tex_ysz, 0, GL_RGBA, GL_FLOAT, 0); 1.24 } 1.25 1.26 glBindRenderbufferEXT(GL_RENDERBUFFER, rbuf_depth); 1.27 @@ -189,7 +192,7 @@ 1.28 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, clamp); 1.29 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 1.30 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 1.31 - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_xsz, tex_ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 1.32 + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, tex_xsz, tex_ysz, 0, GL_RGBA, GL_FLOAT, 0); 1.33 1.34 // attach to fbo 1.35 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i,