qvolray
diff src/demo.cc @ 24:c27ce79632db
builds on osx with -spec unsupported/macx-clang
added a configure script to handle that qmake invocation
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 14 Apr 2012 00:54:11 +0300 |
parents | 4c62be57fc1a |
children | 70b937008134 |
line diff
1.1 --- a/src/demo.cc Fri Apr 13 15:43:45 2012 +0300 1.2 +++ b/src/demo.cc Sat Apr 14 00:54:11 2012 +0300 1.3 @@ -1,3 +1,4 @@ 1.4 +#include <assert.h> 1.5 #include <GL/glew.h> 1.6 #include "demo.h" 1.7 #include "sdr.h" 1.8 @@ -19,18 +20,23 @@ 1.9 vol->create(SZ, SZ, SZ); 1.10 volray_setvolume(vol); 1.11 1.12 - glGenFramebuffers(1, &fbo); 1.13 - glBindFramebuffer(GL_FRAMEBUFFER, fbo); 1.14 - glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D, 1.15 + assert(glGenFramebuffersEXT); 1.16 + assert(glBindFramebufferEXT); 1.17 + assert(glFramebufferTexture3DEXT); 1.18 + assert(glCheckFramebufferStatusEXT); 1.19 + 1.20 + glGenFramebuffersEXT(1, &fbo); 1.21 + glBindFramebufferEXT(GL_FRAMEBUFFER, fbo); 1.22 + glFramebufferTexture3DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D, 1.23 vol->get_texture(), 0, 0); 1.24 1.25 - unsigned int stat = glCheckFramebufferStatus(GL_FRAMEBUFFER); 1.26 + unsigned int stat = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); 1.27 if(stat != GL_FRAMEBUFFER_COMPLETE) { 1.28 printf("incomplete framebuffer: %u\n", stat); 1.29 delete vol; 1.30 return false; 1.31 } 1.32 - glBindFramebuffer(GL_FRAMEBUFFER, 0); 1.33 + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); 1.34 1.35 return true; 1.36 } 1.37 @@ -44,11 +50,11 @@ 1.38 glPushAttrib(GL_VIEWPORT_BIT); 1.39 glViewport(0, 0, SZ, SZ); 1.40 1.41 - glBindFramebuffer(GL_FRAMEBUFFER, fbo); 1.42 + glBindFramebufferEXT(GL_FRAMEBUFFER, fbo); 1.43 bind_program(sdr_mballs); 1.44 1.45 for(int i=0; i<SZ; i++) { 1.46 - glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D, 1.47 + glFramebufferTexture3DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D, 1.48 vol->get_texture(), 0, i); 1.49 1.50 float z = (float)i / (float)SZ; 1.51 @@ -66,7 +72,7 @@ 1.52 } 1.53 1.54 bind_program(0); 1.55 - glBindFramebuffer(GL_FRAMEBUFFER, 0); 1.56 + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); 1.57 1.58 glPopAttrib(); 1.59 }