本文整理汇总了Python中IECoreGL.glslVersion方法的典型用法代码示例。如果您正苦于以下问题:Python IECoreGL.glslVersion方法的具体用法?Python IECoreGL.glslVersion怎么用?Python IECoreGL.glslVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IECoreGL
的用法示例。
在下文中一共展示了IECoreGL.glslVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGeometryShaderViaFile
# 需要导入模块: import IECoreGL [as 别名]
# 或者: from IECoreGL import glslVersion [as 别名]
def testGeometryShaderViaFile( self ) :
if IECoreGL.glslVersion() < 150 :
# no point testing unavailable functionality
return
g = IECore.Group()
p = IECore.PointsPrimitive( IECore.V3fVectorData( [ IECore.V3f( 0 ) ] ) )
p["type"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Uniform, IECore.StringData( "gl:point" ) )
g.addChild( p )
g.addState( IECore.AttributeState( { "gl:pointsPrimitive:glPointWidth" : IECore.FloatData( 4 ) } ) )
g.addState( IECore.Shader( "pointTripler", "gl:surface" ) )
image = self.renderImage( g )
self.assertImageValues(
image,
[
( IECore.V2f( 0.125, 0.5 ), IECore.Color4f( 0, 0, 0, 0 ) ),
( IECore.V2f( 0.25, 0.5 ), IECore.Color4f( 1, 1, 1, 1 ) ),
( IECore.V2f( 0.375, 0.5 ), IECore.Color4f( 0, 0, 0, 0 ) ),
( IECore.V2f( 0.5, 0.5 ), IECore.Color4f( 1, 1, 1, 1 ) ),
( IECore.V2f( 0.625, 0.5 ), IECore.Color4f( 0, 0, 0, 0 ) ),
( IECore.V2f( 0.75, 0.5 ), IECore.Color4f( 1, 1, 1, 1 ) ),
( IECore.V2f( 0.875, 0.5 ), IECore.Color4f( 0, 0, 0, 0 ) ),
]
)
示例2: testGeometryShader
# 需要导入模块: import IECoreGL [as 别名]
# 或者: from IECoreGL import glslVersion [as 别名]
def testGeometryShader( self ) :
if IECoreGL.glslVersion() < 150 :
# can't test geometry shaders if they don't exist
return
geometrySource = """
#version 150
layout( triangles ) in;
layout( triangle_strip, max_vertices=3 ) out;
uniform float geometryShaderParameter = 0;
void main()
{
for( int i = 0; i < gl_in.length(); i++)
{
gl_Position = gl_in[i].gl_Position + vec4( geometryShaderParameter, 0, 0, 1 );
EmitVertex();
}
}
"""
s = IECoreGL.Shader( IECoreGL.Shader.defaultVertexSource(), geometrySource, IECoreGL.Shader.defaultFragmentSource() )
self.failUnless( "geometryShaderParameter" in s.uniformParameterNames() )