[osg-users] geometry shader with opengles

Julien Valentin julienvalentin51 at gmail.com
Tue Apr 3 05:48:19 PDT 2018


On osx, opengl requires strict gl context, so you have to use core version your shader


lyn wrote:
> Hi,
> 
> I have succeeded on Android ,But not well on IOS,whether it is iphone4 or 6p or 6sp...
> they all show: version '310' is not supported 
> (geometry shader only works on es3.1 later)
> But version 300 is OK(but couldn't use geometry shader),So is there somthing i missed?
> 
> code now like this:
> #version 310 es
> #extension GL_EXT_geometry_shader : enable
> 
> uniform mat4 osg_ModelViewMatrix;
> uniform mat4 osg_ViewMatrix;
> uniform mat4 osg_ProjectionMatrix; 
> uniform mat4 osg_ViewMatrixInverse;
> uniform float TubeRadius;
> uniform int EdgeCount;
> uniform vec3 DirLightDir_V3;
> 
> 
> layout(points) in;
> 
> layout(triangle_strip, max_vertices = 4) out;
> 
> out vec2 gf_uv;
> 
> void main()
> {
>     vec4 offset0 = vec4(0,0,0,0);
>     vec4 offset1 = vec4(1,0,0,0);
>     vec4 offset2 = vec4(1,1,0,0);
>     vec4 offset3 = vec4(0,1,0,0);
>     gl_Position = osg_ProjectionMatrix * (gl_in[0].gl_Position + offset0);
>     gf_uv = offset0.xy;
>     EmitVertex();
>     
>     gl_Position = osg_ProjectionMatrix * (gl_in[0].gl_Position + offset1);
>     gf_uv = offset1.xy;
> 
>     EmitVertex();    
>     
>     gl_Position = osg_ProjectionMatrix * (gl_in[0].gl_Position + offset3);
>     gf_uv = offset3.xy;
>     
>     EmitVertex();
>     
>     gl_Position = osg_ProjectionMatrix * (gl_in[0].gl_Position + offset2);
>     gf_uv = offset2.xy;
>     
>     EmitVertex();
>     EndPrimitive();
> }
> 
> Thank you!
> 
> Cheers,
> lin


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73247#73247







More information about the osg-users mailing list