[osg-users] osg_MultiTexCoord0 on OpenGL 2 vs GLES2

Pierre-Jean Petitprez pierre-jean.petitprez at inria.fr
Wed Feb 10 01:12:32 PST 2016


Hi Sebastian,

Thank you. It works as expected. I was wondering what this method was 
doing, its name was not really helping me when I saw it while doing some 
research.

Thanks,

cheers,
Pierre-Jean
Le 10/02/2016 10:06, Sebastian Messerschmidt a écrit :
> Hi Pierre,
>
> In order to use the osg_XXX replacements outside of GLES/GL3 
> etc.-builds you need to inform the viewer to supply them:
>
> ...
> viewer->getCamera()->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true); 
> //you're doing this already
> viewer->getCamera()->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true); 
>
>
> cheers
> Sebastian
>> Hi,
>>
>> I am working on an application that has to work both on regular 
>> Ubuntu environment and on Android. So I have written a couple of 
>> shaders in order to comply with GLES2 specs.
>> The problem is, with regular OpenGL profile on Ubuntu, the same 
>> shader is not working properly: the osg_MultiTexCoord0 seems to not 
>> be working, while gl_MultiTexCoord0 works (but obviously noton GLES2 
>> of course).
>>
>> Here is my vertex shader:
>>
>> Code:
>>
>> attribute vec4 osg_Vertex;
>> uniform mat4 osg_ModelViewProjectionMatrix;
>> attribute vec4 osg_MultiTexCoord0;
>> varying vec4 texCoord;
>>
>> void main(void) {
>> gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
>> texCoord = osg_MultiTexCoord0;
>> }
>>
>>
>>
>>
>> The fragment shader is just applying the texture thanks to the 
>> texCoord variable.
>>
>> So on GLES2 this vertex shader works properly, but on OpenGL 2 I have 
>> to replace osg_MultiTexCoord0 by the old gl_MultiTexCoord0 in order 
>> to make it work.
>>
>> I have tried with OSG 3.2 (as apt packages on Ubuntu), 3.4 and 3.5 as 
>> sources, and I always get the same results.
>> I have applied setUseModelViewAndProjectionUniforms(true) on my 
>> graphics context state to enable osg_* matrices.  Is there a 
>> possibility to also enable other osg_* variables ?
>>
>> Thank you!
>>
>> Cheers,
>> Pierre-Jean
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=66255#66255
>>
>>
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
>>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list