<html>
<head>
</head>
<body>Have you tried to use the gl_ModelviewProjectionMatrix? I don't have seen any reference to enableVertexAttributeAliasing.<br>
<br>
Cheers <br>
Sebastian<br>
--<br><br><div class="gmail_quote"><br>
<br>
Alexander Wieser <<a href="http://alexander.wieser">alexander.wieser</a>@crystalbyte.de>schrieb:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br/>
<br/>
I am currently working on my bachelor thesis which involves the OpenSceneGraph. One task is to apply a distortion shader to a rendered texture.<br/>
<br/>
Unfortunately I am failing in getting any shader to work at all.<br/>
After spending the last couple of days researching and reading books, I managed to get several shaders running in other libraries, be it online using WebGL or directly using OpenGL. I simply can't get it running using OSG.<br/>
<br/>
The code initializing the program is this.<br/>
<br/>
<br/>
Code:<br/>
<br/>
// A simple 4 vertex rectangular geometry drawable.<br/>
Plane* plane = new Plane(40);<br/>
this->addDrawable(plane);<br/>
<br/>
osg::Program* program = new osg::Program();<br/>
program->setName("Debug Shader");<br/>
<br/>
// This refers to a Geode.<br/>
osg::StateSet& state = *this->getOrCreateStateSet();<br/>
state.setAttributeAndModes(program, osg::StateAttribute::ON);<br/>
<br/>
boost::filesystem::path currentPath(boost::filesystem::current_path());<br/>
<br/>
// Init vertex shader.<br/>
RTT::log(RTT::Debug) << "Loading vertex shader."<< RTT::endlog();<br/>
osg::Shader* vertexShader = new osg::Shader(osg::Shader::VERTEX);<br/>
vertexShader->loadShaderSourceFromFile(currentPath.string() + "/../resources/shaders/debug.vert");<br/>
program->addShader(vertexShader);<br/>
<br/>
// Init fragment shader.<br/>
RTT::log(RTT::Debug) << "Loading fragment shader."<< RTT::endlog();<br/>
osg::Shader* fragmentShader = new osg::Shader(osg::Shader::FRAGMENT);<br/>
fragmentShader->loadShaderSourceFromFile(currentPath.string() + "/../resources/shaders/debug.frag");<br/>
program->addShader(fragmentShader);<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
Vertex Shader<br/>
<br/>
Code:<br/>
<br/>
#version 430<br/>
<br/>
uniform mat4 osg_ModelViewProjectionMatrix;<br/>
in vec4 osg_Vertex;<br/>
<br/>
void main() {<br/>
gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;<br/>
}<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
Fragment Shader<br/>
<br/>
Code:<br/>
<br/>
#version 430<br/>
<br/>
layout(location = 0) out vec4 FragColor;<br/>
<br/>
void main() {<br/>
FragColor = vec4(1.0, 0.0, 0.0, 1.0);<br/>
}<br/>
<br/>
<br/>
<br/>
<br/>
As you can see, the program is not that complicated and does compile fine.<br/>
Unfortunately I don't see anything on the screen. There is no model.<br/>
If I remove the program and simply use the built in lighting, coloring and texturing support it renders fine.<br/>
<br/>
Any help is greatly appreciated.<br/>
<br/>
<br/>
Thank you!<br/>
<br/>
Cheers,<br/>
Alexander<br/>
<br/>
------------------<br/>
Read this topic online here:<br/>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=63328#63328" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=63328#63328</a><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
_______________________________________________<br/>
osg-users mailing list<br/>
osg-users@lists.openscenegraph.org<br/>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br/>
</blockquote></div></body>
</html>