Re: [osg-users] Migrate shaders to glsl 4.1

2016-11-17 Thread Sebastian Messerschmidt


Hi Bruno,


In order to use core-profile you need to setup the aliasing:

viewer->getCamera()->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true);
		 
viewer->getCamera()->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true);


After this you'll have all matrices and vertex attributes with an osg_ 
instead of gl_ available. There is even some automatic replacement 
happening, so basically the gl_ are replaced by OSG.


If I understood Robert correctly he is currently working on advanced 
mechanisms to transport the osg::Material ect. values automatically via 
Uniforms. If you cannot wait, you might want to consider writing some 
visitors translating fixed function data into uniforms on your own.


The osgsimplegl3 is btw. a good starting point.


Cheers
Sebastian





I've been trying to migrate my shaders to OpenGL 4.1.

What is the alternative to the fixed pipeline code, of the vertex shader:

gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_Position = ftransform();


I know I have ot create my own out vector, like "out vec4 texcoord", but
where do I get OSG's View, Model, etc matrices?

Thanks


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Migrate shaders to glsl 4.1

2016-11-17 Thread Bruno Oliveira
I've been trying to migrate my shaders to OpenGL 4.1.

What is the alternative to the fixed pipeline code, of the vertex shader:

gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_Position = ftransform();


I know I have ot create my own out vector, like "out vec4 texcoord", but
where do I get OSG's View, Model, etc matrices?

Thanks
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org