50 #include "NormalRenderer.hh" 54 #include <ACG/GL/ShaderCache.hh> 67 _shader->
addDefine(
"SG_REQUEST_NORMALOS");
72 _code->push_back(
"#ifdef SG_INPUT_NORMALOS");
73 _code->push_back(
"outFragment = vec4(normalize(SG_INPUT_NORMALOS) * 0.5 + vec3(0.5, 0.5, 0.5),1.0);");
74 _code->push_back(
"#endif ");
85 NormalRenderer::NormalRenderer()
91 NormalRenderer::~NormalRenderer()
96 void NormalRenderer::initializePlugin()
102 std::vector<ACG::ShaderModifier*> modifiers;
103 modifiers.push_back(&NormalFragmentModifier::instance);
104 return dumpCurrentRenderObjectsToString(&sortedObjects_[0], _outputShaderInfo, &modifiers);
113 for (
int i = 0; i < getNumRenderObjects(); ++i) {
117 renderObject(sortedObjects_[i],prog);
122 finishRenderingPipeline();
125 QString NormalRenderer::checkOpenGL()
128 return QString(
"Insufficient OpenGL Version! OpenGL 3.2 or higher required");
132 missing +=
"GL_ARB_vertex_buffer_object extension missing\n";
136 missing +=
"GL_ARB_vertex_program extension missing\n";
142 #if QT_VERSION < 0x050000 static void setShaderDir(QString _dir)
void modifyVertexIO(ACG::ShaderGenerator *_shader)
Add your own inputs/outputs to the vertex shader.
static ShaderCache * getInstance()
Return instance of the ShaderCache singleton.
bool openGLVersion(const int _major, const int _minor)
void modifyFragmentEndCode(QStringList *_code)
Append code the the fragment shader.
QString renderObjectsInfo(bool _outputShaderInfo)
Return a qstring of the current render objects.
GLSL::Program * getProgram(const ShaderGenDesc *_desc, const std::vector< unsigned int > &_mods)
Query a dynamically generated program from cache.
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.
bool checkExtensionSupported(const std::string &_extension)
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
static unsigned int registerModifier(ShaderModifier *_modifier)
Shader modifiers have to be registered before they can be used. They also must remain allocated for t...