Commit 3038537a authored by Martin Schultz's avatar Martin Schultz
Browse files

use shadergenerator to load picking shaders for better compatibility

parent ea4eb2dd
......@@ -1675,12 +1675,19 @@ bool ACG::DrawMeshT<Mesh>::supportsPickingVertices_opt()
// else
// pickVertexShader_ = GLSL::loadProgram("Picking/vertex.glsl", "Picking/pick_vertices_fs2.glsl");
// }
static ShaderGenDesc desc;
// load from cache
if (pickVertexMethod_ == 0)
pickVertexShader_ = ShaderCache::getInstance()->getProgram("Picking/pick_vertices_vs.glsl", "Picking/pick_vertices_fs.glsl", 0, false);
{
desc.fragmentTemplateFile = "Picking/pick_vertices_fs.glsl";
desc.vertexTemplateFile = "Picking/pick_vertices_vs.glsl";
}
else
pickVertexShader_ = ShaderCache::getInstance()->getProgram("Picking/vertex.glsl", "Picking/pick_vertices_fs2.glsl", 0, false);
{
desc.fragmentTemplateFile = "Picking/pick_vertices_fs2.glsl";
desc.vertexTemplateFile = "Picking/vertex.glsl";
}
pickVertexShader_ = ShaderCache::getInstance()->getProgram(&desc,nullptr);
// check link status
return pickVertexShader_ && pickVertexShader_->isLinked();
......@@ -1959,7 +1966,10 @@ template <class Mesh>
bool ACG::DrawMeshT<Mesh>::supportsPickingEdges_opt()
{
// fetch picking shader from cache (edge picking uses same shader as vertex picking)
pickEdgeShader_ = ShaderCache::getInstance()->getProgram("Picking/vertex.glsl", "Picking/pick_vertices_fs2.glsl", 0, false);
static ShaderGenDesc desc;
desc.vertexTemplateFile = "Picking/vertex.glsl" ;
desc.fragmentTemplateFile = "Picking/pick_vertices_fs2.glsl" ;
pickEdgeShader_ = ShaderCache::getInstance()->getProgram(&desc, nullptr);
// check link status
return pickEdgeShader_ && pickEdgeShader_->isLinked();
......@@ -2088,7 +2098,10 @@ bool ACG::DrawMeshT<Mesh>::supportsPickingFaces_opt()
return false;
// fetch picking shader from cache
pickFaceShader_ = ShaderCache::getInstance()->getProgram("Picking/vertex.glsl", "Picking/pick_face.glsl", 0, false);
static ShaderGenDesc desc;
desc.vertexTemplateFile = "Picking/vertex.glsl";
desc.fragmentTemplateFile = "Picking/pick_face.glsl";
pickFaceShader_ = ShaderCache::getInstance()->getProgram(&desc, nullptr);
// check link status
return pickFaceShader_ && pickFaceShader_->isLinked();
......
......@@ -697,7 +697,10 @@ CoordsysNode::pick(GLState& _state, PickTarget _target)
GLSL::Program* pickShader = 0;
if (!fixedFunctionGL)
{
pickShader = ShaderCache::getInstance()->getProgram("Picking/vertex.glsl", "Picking/single_color_fs.glsl");
static ShaderGenDesc desc;
desc.fragmentTemplateFile = "Picking/single_color_fs.glsl";
desc.vertexTemplateFile = "Picking/vertex.glsl";
pickShader = ShaderCache::getInstance()->getProgram(&desc, nullptr);
if (!pickShader)
return;
......
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