Commit 2ed45ce1 authored by Christopher Tenter's avatar Christopher Tenter
Browse files

Added check for geometry shader support.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13021 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 1176841a
......@@ -660,6 +660,7 @@ void DepthPeelingPlugin::generatePeelingShaders(GLSL::StringList* _strVertexShad
if (!_flatShaded)
{
_strFragmentShaderOut->push_back(" vec3 normal = normalize(vNormal);\n");
// _strFragmentShaderOut->push_back(" vec3 normal = normalize(cross(dFdx(vPosVS.xyz), dFdy(vPosVS.xyz)));\n");
_strFragmentShaderOut->push_back(" vec4 color = vec4(gl_FrontMaterial.emission.rgb, gl_FrontMaterial.ambient.a);\n");
if (_textured)
_strFragmentShaderOut->push_back(" vec4 diffColor = texture2D(DiffuseTex, vTexCoord); color.a *= diffColor.a;\n");
......@@ -1020,11 +1021,22 @@ void DepthPeelingPlugin::updatePeelingShaderSet()
if (phongDrawMode + flatDrawMode + gouraudDrawMode == 0) continue;
}
if (flatDrawMode)
{
// replace flat shading with gouraud, if geometry shaders are not supported
if (!ACG::checkExtensionSupported("GL_ARB_geometry_shader4") && !ACG::checkExtensionSupported("GL_EXT_geometry_shader4"))
{
flatDrawMode = 0;
gouraudDrawMode = 1;
}
}
GLSL::StringList strVertexShader, strFragmentShader, strGeometryShader;
generatePeelingShaders(&strVertexShader, &strFragmentShader, &strGeometryShader, texturedDrawMode != 0, flatDrawMode != 0, phongDrawMode != 0, vertexColorDrawMode != 0, i == PEEL_SHADER_WIREFRAME);
peelProgs_[i] = new GLSL::Program();
GLSL::VertexShader* pVertexSh = new GLSL::VertexShader();
pVertexSh->setSource(strVertexShader);
......
Supports Markdown
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