WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   geometryshader parameters (https://forum.worldviz.com/showthread.php?t=4140)

Andy 02-15-2012 08:30 AM

geometryshader parameters
 
Hi,
I want to use a simple geometry shader. How can I set the GEOMETRY_INPUT_TYPE_ARB, GL_GEOMETRY_OUTPUT_TYPE_ARB and GL_GEOMETRY_VERTICES_OUT_ARB parameters?

Code:

#version 120
 
#extension GL_ARB_geometry_shader4 : enable
 
//input GL_TRIANGLES
//output GL_LINE_STRIP
 
varying in vec4 V[3];
varying in vec3 N[3];
 
uniform float nLength;
 
void createNormal( vec3 V, vec3 N )
{
    gl_Position = gl_ModelViewProjectionMatrix * vec4( V, 1.0f );
    EmitVertex();
 
    gl_Position = gl_ModelViewProjectionMatrix * vec4( V + N * nLength, 1.0f );
    EmitVertex();
 
    EndPrimitive();
}
 
void main()
{
    for ( int i = 0; i < 3; ++i )
    {
        createNormal( V[i].xyz, N[i] );
    }
}

Any idear?

farshizzo 02-15-2012 08:34 AM

You should be able to use the layout modifier in your geometry shader source to specify these parameters. Example:
Code:

#version 330 compatibility
layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;


Andy 02-21-2012 06:21 AM

thanks, it works :)


All times are GMT -7. The time now is 02:46 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC