44 #include "NormalRenderer.hh" 48 #include <ACG/GL/ShaderCache.hh> 61 _shader->
addDefine(
"SG_REQUEST_NORMALOS");
66 _code->push_back(
"#ifdef SG_INPUT_NORMALOS");
67 _code->push_back(
"outFragment = vec4(normalize(SG_INPUT_NORMALOS) * 0.5 + vec3(0.5, 0.5, 0.5),1.0);");
68 _code->push_back(
"#endif ");
79 NormalRenderer::NormalRenderer()
85 NormalRenderer::~NormalRenderer()
90 void NormalRenderer::initializePlugin()
96 std::vector<ACG::ShaderModifier*> modifiers;
97 modifiers.push_back(&NormalFragmentModifier::instance);
98 return dumpCurrentRenderObjectsToString(&sortedObjects_[0], _outputShaderInfo, &modifiers);
107 for (
int i = 0; i < getNumRenderObjects(); ++i) {
111 renderObject(sortedObjects_[i],prog);
116 finishRenderingPipeline();
119 QString NormalRenderer::checkOpenGL()
122 return QString(
"Insufficient OpenGL Version! OpenGL 3.2 or higher required");
129 missing +=
"GL_ARB_vertex_buffer_object extension missing\n";
134 missing +=
"GL_ARB_vertex_program extension missing\n";
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
void addDefine(const QString &_define)
Add one define.
void modifyFragmentEndCode(QStringList *_code)
Append code the the fragment shader.
static void setShaderDir(QString _dir)
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
GLSL::Program * getProgram(const ShaderGenDesc *_desc, const std::vector< unsigned int > &_mods)
Query a dynamically generated program from cache.
bool openGLVersion(const int _major, const int _minor, bool _verbose)
void modifyVertexIO(ACG::ShaderGenerator *_shader)
Add your own inputs/outputs to the vertex shader.
bool checkExtensionSupported(const std::string &_extension)
static unsigned int registerModifier(ShaderModifier *_modifier)
Shader modifiers have to be registered before they can be used. They also must remain allocated for t...
QString renderObjectsInfo(bool _outputShaderInfo)
Return a qstring of the current render objects.