Commit 8cb0d143 authored by sylvain thery's avatar sylvain thery

GLbug on intel HD4400

parent 329e575f
...@@ -73,7 +73,32 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map) ...@@ -73,7 +73,32 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
const MapParameters& p = h_viewParameterSet[view][map]; const MapParameters& p = h_viewParameterSet[view][map];
if(p.positionVBO) if(p.positionVBO)
{ {
if(p.renderVertices) if(p.renderFaces)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_LIGHTING);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0f, 1.0f);
switch(p.faceStyle)
{
case MapParameters::FLAT :
m_flatShader->setAttributePosition(p.positionVBO);
m_flatShader->setDiffuse(p.diffuseColor);
map->draw(m_flatShader, CGoGN::Algo::Render::GL2::TRIANGLES);
break;
case MapParameters::PHONG :
if(p.normalVBO != NULL)
{
m_phongShader->setAttributePosition(p.positionVBO);
m_phongShader->setAttributeNormal(p.normalVBO);
m_phongShader->setDiffuse(p.diffuseColor);
map->draw(m_phongShader, CGoGN::Algo::Render::GL2::TRIANGLES);
}
break;
}
glDisable(GL_POLYGON_OFFSET_FILL);
}
if(p.renderVertices)
{ {
m_pointSprite->setSize(map->getBBdiagSize() / 200.0f * p.verticesScaleFactor); m_pointSprite->setSize(map->getBBdiagSize() / 200.0f * p.verticesScaleFactor);
m_pointSprite->setAttributePosition(p.positionVBO); m_pointSprite->setAttributePosition(p.positionVBO);
...@@ -89,31 +114,7 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map) ...@@ -89,31 +114,7 @@ void Surface_Render_Plugin::drawMap(View* view, MapHandlerGen* map)
m_simpleColorShader->setColor(p.simpleColor); m_simpleColorShader->setColor(p.simpleColor);
map->draw(m_simpleColorShader, CGoGN::Algo::Render::GL2::LINES); map->draw(m_simpleColorShader, CGoGN::Algo::Render::GL2::LINES);
} }
if(p.renderFaces)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_LIGHTING);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0f, 1.0f);
switch(p.faceStyle)
{
case MapParameters::FLAT :
m_flatShader->setAttributePosition(p.positionVBO);
m_flatShader->setDiffuse(p.diffuseColor);
map->draw(m_flatShader, CGoGN::Algo::Render::GL2::TRIANGLES);
break;
case MapParameters::PHONG :
if(p.normalVBO != NULL)
{
m_phongShader->setAttributePosition(p.positionVBO);
m_phongShader->setAttributeNormal(p.normalVBO);
m_phongShader->setDiffuse(p.diffuseColor);
map->draw(m_phongShader, CGoGN::Algo::Render::GL2::TRIANGLES);
}
break;
}
glDisable(GL_POLYGON_OFFSET_FILL);
}
if(p.renderBoundary) if(p.renderBoundary)
{ {
glLineWidth(5.0f); glLineWidth(5.0f);
......
...@@ -65,8 +65,8 @@ std::string GLSLShader::DEFINES_GL3=\ ...@@ -65,8 +65,8 @@ 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 out\n"
"#define VARYING_FRAG smooth in\n" "#define VARYING_FRAG in\n"
"#define FRAG_OUT_DEF out vec4 outFragColor\n" "#define FRAG_OUT_DEF out vec4 outFragColor\n"
"#define FRAG_OUT outFragColor\n" "#define FRAG_OUT outFragColor\n"
"#define INVARIANT_POS invariant gl_Position\n"; "#define INVARIANT_POS invariant gl_Position\n";
...@@ -134,8 +134,8 @@ std::string GLSLShader::defines_Geom(const std::string& primitivesIn, const std: ...@@ -134,8 +134,8 @@ std::string GLSLShader::defines_Geom(const std::string& primitivesIn, const std:
ss << maxVert; ss << maxVert;
str.append(ss.str()); str.append(ss.str());
str.append(") out;\n"); str.append(") out;\n");
str.append("#define VARYING_IN smooth in\n"); str.append("#define VARYING_IN in\n");
str.append("#define VARYING_OUT smooth out\n"); str.append("#define VARYING_OUT 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"); str.append("#define NBVERTS_IN gl_in.length()\n");
return str; return str;
...@@ -1177,9 +1177,9 @@ void GLSLShader::enableVertexAttribs(unsigned int stride, unsigned int begin) ...@@ -1177,9 +1177,9 @@ void GLSLShader::enableVertexAttribs(unsigned int stride, unsigned int begin)
if (CURRENT_OGL_VERSION>=3) if (CURRENT_OGL_VERSION>=3)
{ {
if (m_vao!=0) if (m_vao!=0)
glDeleteVertexArrays(1, &m_vao); glDeleteVertexArrays(1, &m_vao);
glGenVertexArrays(1, &m_vao); glGenVertexArrays(1, &m_vao);
glBindVertexArray(m_vao); glBindVertexArray(m_vao);
for (std::vector<Utils::GLSLShader::VAStr>::const_iterator it = m_va_vbo_binding.begin(); it != m_va_vbo_binding.end(); ++it) for (std::vector<Utils::GLSLShader::VAStr>::const_iterator it = m_va_vbo_binding.begin(); it != m_va_vbo_binding.end(); ++it)
......
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