Commit dfe12705 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

MAJ bug de compilation GLSL sur mac

parent 0603269f
...@@ -62,7 +62,7 @@ AttributeHandler<Geom::Vec4f> color ; ...@@ -62,7 +62,7 @@ AttributeHandler<Geom::Vec4f> color ;
void MyQT::cb_initGL() void MyQT::cb_initGL()
{ {
// choose to use GL version 2 // choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(3); Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render // create the render
m_render = new Algo::Render::GL2::MapRender(); m_render = new Algo::Render::GL2::MapRender();
......
...@@ -41,22 +41,22 @@ unsigned int GLSLShader::CURRENT_OGL_VERSION=2; ...@@ -41,22 +41,22 @@ unsigned int GLSLShader::CURRENT_OGL_VERSION=2;
std::string GLSLShader::DEFINES_GL2=\ std::string GLSLShader::DEFINES_GL2=\
"#version 110\n" "#version 110\n"
"#define PRECISON\n" "#define PRECISON float pipo_PRECISION\n"
"#define ATTRIBUTE attribute\n" "#define ATTRIBUTE attribute\n"
"#define VARYING_VERT varying\n" "#define VARYING_VERT varying\n"
"#define VARYING_FRAG varying\n" "#define VARYING_FRAG varying\n"
"#define FRAG_OUT_DEF \n" "#define FRAG_OUT_DEF float pipo_FRAGDEF\n"
"#define INVARIANT_POS \n"; "#define INVARIANT_POS float pipo_INVARIANT\n";
std::string GLSLShader::DEFINES_GL3=\ std::string GLSLShader::DEFINES_GL3=\
"#version 150\n" "#version 150\n"
"#define PRECISON precision highp float;\n" "#define PRECISON precision highp float\n"
"#define ATTRIBUTE in\n" "#define ATTRIBUTE in\n"
"#define VARYING_VERT smooth out\n" "#define VARYING_VERT smooth out\n"
"#define VARYING_FRAG smooth in\n" "#define VARYING_FRAG smooth in\n"
"#define FRAG_OUT_DEF out vec4 gl_FragColor\n" "#define FRAG_OUT_DEF out vec4 gl_FragColor\n"
"#define INVARIANT_POS \n"; "#define INVARIANT_POS invariant gl_Position\n";
std::string* GLSLShader::DEFINES_GL =NULL; std::string* GLSLShader::DEFINES_GL =NULL;
...@@ -113,6 +113,7 @@ std::string GLSLShader::defines_Geom(const std::string& primitivesIn, const std: ...@@ -113,6 +113,7 @@ std::string GLSLShader::defines_Geom(const std::string& primitivesIn, const std:
str.append("#define VARYING_IN in\n"); str.append("#define VARYING_IN in\n");
str.append("#define VARYING_OUT smooth out\n"); str.append("#define VARYING_OUT smooth out\n");
str.append("#define POSITION_IN(X) gl_in[X].gl_Position\n"); str.append("#define POSITION_IN(X) gl_in[X].gl_Position\n");
str.append("#define NBVERTS_IN gl_in.length()\n");
return str; return str;
} }
else else
...@@ -123,6 +124,7 @@ std::string GLSLShader::defines_Geom(const std::string& primitivesIn, const std: ...@@ -123,6 +124,7 @@ std::string GLSLShader::defines_Geom(const std::string& primitivesIn, const std:
str.append("#define VARYING_IN varying in\n"); str.append("#define VARYING_IN varying in\n");
str.append("#define VARYING_OUT varying out\n"); str.append("#define VARYING_OUT varying out\n");
str.append("#define POSITION_IN(X) gl_PositionIn[X]\n"); str.append("#define POSITION_IN(X) gl_PositionIn[X]\n");
str.append("#define NBVERTS_IN gl_VerticesIn\n");
return str; return str;
} }
} }
......
...@@ -66,7 +66,7 @@ std::string ShaderFlat::geometryShaderText = ...@@ -66,7 +66,7 @@ std::string ShaderFlat::geometryShaderText =
" if(lambertTerm > 0.0)\n" " if(lambertTerm > 0.0)\n"
" ColorFS += diffuse * lambertTerm;\n" " ColorFS += diffuse * lambertTerm;\n"
" int i;\n" " int i;\n"
" for(i=0; i< gl_in.length(); i++)\n" " for(i=0; i< NBVERTS_IN; i++)\n"
" {\n" " {\n"
" vec4 pos = explode * POSITION_IN(i) + (1.0-explode)* vec4(center,1.0);\n" " vec4 pos = explode * POSITION_IN(i) + (1.0-explode)* vec4(center,1.0);\n"
" gl_Position = ModelViewProjectionMatrix * pos;\n" " gl_Position = ModelViewProjectionMatrix * pos;\n"
......
...@@ -33,7 +33,7 @@ namespace Utils ...@@ -33,7 +33,7 @@ namespace Utils
std::string ShaderSimpleColor::vertexShaderText = std::string ShaderSimpleColor::vertexShaderText =
"ATTRIBUTE vec3 VertexPosition, VertexNormal;\n" "ATTRIBUTE vec3 VertexPosition, VertexNormal;\n"
"uniform mat4 ModelViewProjectionMatrix;\n" "uniform mat4 ModelViewProjectionMatrix;\n"
"INVARIANT_POS;\n" // "INVARIANT_POS;\n"
"void main ()\n" "void main ()\n"
"{\n" "{\n"
" gl_Position = ModelViewProjectionMatrix * vec4 (VertexPosition, 1.0);\n" " gl_Position = ModelViewProjectionMatrix * vec4 (VertexPosition, 1.0);\n"
......
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