qvolray

changeset 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 53aca4775514
children 63bc059778d0
files configure qvolray.pro src/demo.cc
diffstat 3 files changed, 32 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/configure	Sat Apr 14 00:54:11 2012 +0300
     1.3 @@ -0,0 +1,9 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +sys=`uname -s`
     1.7 +
     1.8 +if [ "$sys" = Darwin ]; then
     1.9 +	spec='-spec unsupported/macx-clang'
    1.10 +fi
    1.11 +
    1.12 +qmake $spec
     2.1 --- a/qvolray.pro	Fri Apr 13 15:43:45 2012 +0300
     2.2 +++ b/qvolray.pro	Sat Apr 14 00:54:11 2012 +0300
     2.3 @@ -9,9 +9,18 @@
     2.4  	QMAKE_CXXFLAGS += -std=c++0x -pedantic
     2.5  }
     2.6  
     2.7 +contains(QMAKE_CXX, clang++) {
     2.8 +	QMAKE_CXXFLAGS += -std=c++0x -pedantic
     2.9 +}
    2.10 +
    2.11  unix:LIBS += -lGLEW -limago -lvmath
    2.12  win32:LIBS += -lglew32 -llibimago2 -llibvmath -llibpng -lzlib -ljpeglib
    2.13  
    2.14 +macx {
    2.15 +	INCLUDEPATH += /opt/local/include
    2.16 +	QMAKE_LIBDIR += /opt/local/lib
    2.17 +}
    2.18 +
    2.19  # Input
    2.20  HEADERS += src/sdr.h src/volray.h src/volume.h src/ui.h
    2.21  SOURCES += src/main.cc src/sdr.c src/volray.cc src/volume.cc src/ui.cc src/demo.cc
     3.1 --- a/src/demo.cc	Fri Apr 13 15:43:45 2012 +0300
     3.2 +++ b/src/demo.cc	Sat Apr 14 00:54:11 2012 +0300
     3.3 @@ -1,3 +1,4 @@
     3.4 +#include <assert.h>
     3.5  #include <GL/glew.h>
     3.6  #include "demo.h"
     3.7  #include "sdr.h"
     3.8 @@ -19,18 +20,23 @@
     3.9  	vol->create(SZ, SZ, SZ);
    3.10  	volray_setvolume(vol);
    3.11  
    3.12 -	glGenFramebuffers(1, &fbo);
    3.13 -	glBindFramebuffer(GL_FRAMEBUFFER, fbo);
    3.14 -	glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D,
    3.15 +	assert(glGenFramebuffersEXT);
    3.16 +	assert(glBindFramebufferEXT);
    3.17 +	assert(glFramebufferTexture3DEXT);
    3.18 +	assert(glCheckFramebufferStatusEXT);
    3.19 +
    3.20 +	glGenFramebuffersEXT(1, &fbo);
    3.21 +	glBindFramebufferEXT(GL_FRAMEBUFFER, fbo);
    3.22 +	glFramebufferTexture3DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D,
    3.23  			vol->get_texture(), 0, 0);
    3.24  
    3.25 -	unsigned int stat = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    3.26 +	unsigned int stat = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);
    3.27  	if(stat != GL_FRAMEBUFFER_COMPLETE) {
    3.28  		printf("incomplete framebuffer: %u\n", stat);
    3.29  		delete vol;
    3.30  		return false;
    3.31  	}
    3.32 -	glBindFramebuffer(GL_FRAMEBUFFER, 0);
    3.33 +	glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
    3.34  
    3.35  	return true;
    3.36  }
    3.37 @@ -44,11 +50,11 @@
    3.38  	glPushAttrib(GL_VIEWPORT_BIT);
    3.39  	glViewport(0, 0, SZ, SZ);
    3.40  
    3.41 -	glBindFramebuffer(GL_FRAMEBUFFER, fbo);
    3.42 +	glBindFramebufferEXT(GL_FRAMEBUFFER, fbo);
    3.43  	bind_program(sdr_mballs);
    3.44  
    3.45  	for(int i=0; i<SZ; i++) {
    3.46 -		glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D,
    3.47 +		glFramebufferTexture3DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D,
    3.48  				vol->get_texture(), 0, i);
    3.49  
    3.50  		float z = (float)i / (float)SZ;
    3.51 @@ -66,7 +72,7 @@
    3.52  	}
    3.53  
    3.54  	bind_program(0);
    3.55 -	glBindFramebuffer(GL_FRAMEBUFFER, 0);
    3.56 +	glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
    3.57  
    3.58  	glPopAttrib();
    3.59  }