Commit f2cbc9f2 authored by Sylvain Thery's avatar Sylvain Thery

MAJ bug Mac OSX Lion

parent bbbb8e0f
...@@ -57,7 +57,11 @@ ...@@ -57,7 +57,11 @@
#include <zlib.h> #include <zlib.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <malloc.h> #ifdef __APPLE__
#include <sys/malloc.h>
#else
#include <malloc.h>
#endif
#include <string.h> #include <string.h>
#ifndef WIN32 #ifndef WIN32
#include <strings.h> #include <strings.h>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include <GL/gl.h> #include <GL/glew.h>
#include "Geometry/transfo.h" #include "Geometry/transfo.h"
namespace CGoGN namespace CGoGN
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#define __RENDER_FUNCTOR_GL_H #define __RENDER_FUNCTOR_GL_H
#include <vector> #include <vector>
#include <IL/ilut.h>
namespace CGoGN namespace CGoGN
{ {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <list> #include <list>
//#include <gmtl/VecOps.h> //#include <gmtl/VecOps.h>
//#include <gmtl/Output.h> //#include <gmtl/Output.h>
#include <GL/gl.h> #include <GL/glew.h>
#include "Topology/generic/functor.h" #include "Topology/generic/functor.h"
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef _EXPLODE_VOLUME_VBO_RENDER #ifndef _EXPLODE_VOLUME_VBO_RENDER
#define _EXPLODE_VOLUME_VBO_RENDER #define _EXPLODE_VOLUME_VBO_RENDER
#include <GL/gl.h> #include <GL/glew.h>
#include <vector> #include <vector>
#include <list> #include <list>
......
...@@ -165,7 +165,7 @@ protected: ...@@ -165,7 +165,7 @@ protected:
/** /**
* create the shader (attach and link shaders into program) * create the shader (attach and link shaders into program)
*/ */
bool create(GLint inputGeometryPrimitive=GL_TRIANGLES,GLint outputGeometryPrimitive=GL_TRIANGLES); bool create(GLint inputGeometryPrimitive=GL_TRIANGLES,GLint outputGeometryPrimitive=GL_TRIANGLES, int nb_max_vertices=16);
/** /**
* get log after compiling * get log after compiling
...@@ -235,7 +235,7 @@ public: ...@@ -235,7 +235,7 @@ public:
* @param inputGeometryPrimitive primitives used in geometry shader as input * @param inputGeometryPrimitive primitives used in geometry shader as input
* @param outputGeometryPrimitive primitives generated in geometry shader as output * @param outputGeometryPrimitive primitives generated in geometry shader as output
*/ */
bool loadShaders(const std::string& vs, const std::string& fs, const std::string& gs, GLint inputGeometryPrimitive=GL_TRIANGLES,GLint outputGeometryPrimitive=GL_TRIANGLE_STRIP); bool loadShaders(const std::string& vs, const std::string& fs, const std::string& gs, GLint inputGeometryPrimitive=GL_TRIANGLES,GLint outputGeometryPrimitive=GL_TRIANGLE_STRIP, int nb_max_vertices=16);
/** /**
* load shaders (compile and link) * load shaders (compile and link)
...@@ -254,7 +254,7 @@ public: ...@@ -254,7 +254,7 @@ public:
* @param inputGeometryPrimitive primitives used in geometry shader as input * @param inputGeometryPrimitive primitives used in geometry shader as input
* @param outputGeometryPrimitive primitives generated in geometry shader as output * @param outputGeometryPrimitive primitives generated in geometry shader as output
*/ */
bool loadShadersFromMemory(const char* vs, const char* fs, const char* gs, GLint inputGeometryPrimitive,GLint outputGeometryPrimitive); bool loadShadersFromMemory(const char* vs, const char* fs, const char* gs, GLint inputGeometryPrimitive,GLint outputGeometryPrimitive, int nb_max_vertices=16);
const char* getVertexShaderSrc() { return m_vertex_shader_source; } const char* getVertexShaderSrc() { return m_vertex_shader_source; }
const char* getFragmentShaderSrc() { return m_fragment_shader_source; } const char* getFragmentShaderSrc() { return m_fragment_shader_source; }
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
#define CGOGN_TEXTURES_H_ #define CGOGN_TEXTURES_H_
#include "Geometry/vector_gen.h" #include "Geometry/vector_gen.h"
#include <GL/glew.h>
#include <GL/gl.h>
#include <string> #include <string>
#include <QImage> #include <QImage>
......
...@@ -442,7 +442,7 @@ char* GLSLShader::getInfoLog( GLhandleARB obj ) ...@@ -442,7 +442,7 @@ char* GLSLShader::getInfoLog( GLhandleARB obj )
return info_log; return info_log;
} }
bool GLSLShader::create(GLint inputGeometryPrimitive,GLint outputGeometryPrimitive) bool GLSLShader::create(GLint inputGeometryPrimitive,GLint outputGeometryPrimitive, int nb_max_vertices)
{ {
int status; int status;
char *info_log; char *info_log;
...@@ -475,9 +475,7 @@ bool GLSLShader::create(GLint inputGeometryPrimitive,GLint outputGeometryPrimiti ...@@ -475,9 +475,7 @@ bool GLSLShader::create(GLint inputGeometryPrimitive,GLint outputGeometryPrimiti
glProgramParameteriEXT(m_program_object,GL_GEOMETRY_INPUT_TYPE_EXT,inputGeometryPrimitive); glProgramParameteriEXT(m_program_object,GL_GEOMETRY_INPUT_TYPE_EXT,inputGeometryPrimitive);
glProgramParameteriEXT(m_program_object,GL_GEOMETRY_OUTPUT_TYPE_EXT,outputGeometryPrimitive); glProgramParameteriEXT(m_program_object,GL_GEOMETRY_OUTPUT_TYPE_EXT,outputGeometryPrimitive);
int temp; glProgramParameteriEXT(m_program_object,GL_GEOMETRY_VERTICES_OUT_EXT,nb_max_vertices);
glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT,&temp);
glProgramParameteriEXT(m_program_object,GL_GEOMETRY_VERTICES_OUT_EXT,temp);
} }
/*** link program object ***/ /*** link program object ***/
...@@ -669,7 +667,7 @@ bool GLSLShader::loadShaders(const std::string& vs, const std::string& ps) ...@@ -669,7 +667,7 @@ bool GLSLShader::loadShaders(const std::string& vs, const std::string& ps)
return true; return true;
} }
bool GLSLShader::loadShaders(const std::string& vs, const std::string& ps, const std::string& gs, GLint inputGeometryPrimitive,GLint outputGeometryPrimitive) bool GLSLShader::loadShaders(const std::string& vs, const std::string& ps, const std::string& gs, GLint inputGeometryPrimitive,GLint outputGeometryPrimitive, int nb_max_vertices)
{ {
m_nameVS = vs; m_nameVS = vs;
m_nameFS = ps; m_nameFS = ps;
...@@ -689,7 +687,7 @@ bool GLSLShader::loadShaders(const std::string& vs, const std::string& ps, const ...@@ -689,7 +687,7 @@ bool GLSLShader::loadShaders(const std::string& vs, const std::string& ps, const
CGoGNerr << "Error while loading geometry shader" << CGoGNendl; CGoGNerr << "Error while loading geometry shader" << CGoGNendl;
} }
if(!create(inputGeometryPrimitive,outputGeometryPrimitive)) if(!create(inputGeometryPrimitive,outputGeometryPrimitive,nb_max_vertices))
{ {
CGoGNout << "Unable to create the shaders !" << CGoGNendl; CGoGNout << "Unable to create the shaders !" << CGoGNendl;
return false; return false;
...@@ -727,7 +725,7 @@ bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs) ...@@ -727,7 +725,7 @@ bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs)
return true; return true;
} }
bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs, const char* gs, GLint inputGeometryPrimitive,GLint outputGeometryPrimitive) bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs, const char* gs, GLint inputGeometryPrimitive,GLint outputGeometryPrimitive, int nb_max_vertices)
{ {
if (m_vertex_shader_source) if (m_vertex_shader_source)
delete [] m_vertex_shader_source; delete [] m_vertex_shader_source;
...@@ -759,7 +757,7 @@ bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs, const cha ...@@ -759,7 +757,7 @@ bool GLSLShader::loadShadersFromMemory(const char* vs, const char* fs, const cha
if(!loadGeometryShaderSourceString(gs)) if(!loadGeometryShaderSourceString(gs))
return false; return false;
if(!create(inputGeometryPrimitive,outputGeometryPrimitive)) if(!create(inputGeometryPrimitive,outputGeometryPrimitive,nb_max_vertices))
{ {
CGoGNout << "Unable to create the shaders !" << CGoGNendl; CGoGNout << "Unable to create the shaders !" << CGoGNendl;
return false; return false;
......
...@@ -99,7 +99,7 @@ ShaderFlat::ShaderFlat() ...@@ -99,7 +99,7 @@ ShaderFlat::ShaderFlat()
std::string glxfrag(*GLSLShader::DEFINES_GL); std::string glxfrag(*GLSLShader::DEFINES_GL);
glxfrag.append(fragmentShaderText); glxfrag.append(fragmentShaderText);
loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str(), glxgeom.c_str(), GL_TRIANGLES, GL_TRIANGLE_STRIP); loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str(), glxgeom.c_str(), GL_TRIANGLES, GL_TRIANGLE_STRIP,3);
getLocations(); getLocations();
......
...@@ -88,7 +88,7 @@ ShaderVectorPerVertex::ShaderVectorPerVertex() : ...@@ -88,7 +88,7 @@ ShaderVectorPerVertex::ShaderVectorPerVertex() :
std::string glxfrag(*GLSLShader::DEFINES_GL); std::string glxfrag(*GLSLShader::DEFINES_GL);
glxfrag.append(fragmentShaderText); glxfrag.append(fragmentShaderText);
loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str(), glxgeom.c_str(), GL_POINTS, GL_LINE_STRIP); loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str(), glxgeom.c_str(), GL_POINTS, GL_LINE_STRIP,2);
// get and fill uniforms // get and fill uniforms
bind(); bind();
......
...@@ -114,7 +114,7 @@ PointSprite::PointSprite(float radius) ...@@ -114,7 +114,7 @@ PointSprite::PointSprite(float radius)
std::string glxfrag(*GLSLShader::DEFINES_GL); std::string glxfrag(*GLSLShader::DEFINES_GL);
glxfrag.append(fragmentShaderText); glxfrag.append(fragmentShaderText);
loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str(), glxgeom.c_str(), GL_POINTS, GL_TRIANGLE_STRIP); loadShadersFromMemory(glxvert.c_str(), glxfrag.c_str(), glxgeom.c_str(), GL_POINTS, GL_TRIANGLE_STRIP,4);
bind(); bind();
m_uniform_size = glGetUniformLocation(program_handler(),"size"); m_uniform_size = glGetUniformLocation(program_handler(),"size");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment