예제 #1
0
 def test_006_osgGeometry(self):
     g = osg.createTexturedQuadGeometry(osg.Vec3f(0, 0, 0), osg.Vec3f(1, 0, 0), osg.Vec3f(0, 0, 1), 0, 0, 1, 1)
     self.failUnless(g.getNumPrimitiveSets() == 1)
     self.failUnless(len(g.getVertexArray()) == 4)
     self.failUnless(len(g.getTexCoordArray(0)) == 4)
     self.failUnless(len(g.getColorArray()) == 1)
     self.failUnless(len(g.getNormalArray()) == 1)
예제 #2
0
 def test_007_osgStateSet(self):
     g = osg.createTexturedQuadGeometry(osg.Vec3f(0, 0, 0), osg.Vec3f(1, 0, 0), osg.Vec3f(0, 0, 1), 0, 0, 1, 1)
     s = g.stateSet
     self.failUnless(s)
     self.failUnless(s.getMode(osg.GL_LIGHTING))  # Initially on
     s.setMode(osg.GL_LIGHTING, osg.StateAttribute.OFF)
     self.failIf(s.getMode(osg.GL_LIGHTING))  # We set it off
     s.setMode(osg.GL_LIGHTING, osg.StateAttribute.ON)
     self.failUnless(s.getMode(osg.GL_LIGHTING))  # We set it on
예제 #3
0
파일: osgqt.py 프로젝트: madlag/jarvis
 def quad_create(self, texture):
     stateset = osg.StateSet()
     stateset.setTextureAttributeAndModes(0, texture)
     corner = osg.Vec3(-self.aspect_ratio, -1.0, 0)
     width = osg.Vec3(2 * self.aspect_ratio, 0, 0)
     height = osg.Vec3(0, 2 * 1.0, 0)
     geom = osg.createTexturedQuadGeometry(corner, width, height, 0.0, 0.0, 1.0, 1.0)
     geom.setStateSet(stateset)
     geode = osg.Geode()
     geode.addDrawable(geom)
     return geode
예제 #4
0
 def quad_create(self, texture):
     stateset = osg.StateSet()
     stateset.setTextureAttributeAndModes(0, texture)
     corner = osg.Vec3(-self.aspect_ratio, -1.0, 0)
     width = osg.Vec3(2 * self.aspect_ratio, 0, 0)
     height = osg.Vec3(0, 2 * 1.0, 0)
     geom = osg.createTexturedQuadGeometry(corner, width, height, 0.0, 0.0,
                                           1.0, 1.0)
     geom.setStateSet(stateset)
     geode = osg.Geode()
     geode.addDrawable(geom)
     return geode
예제 #5
0
    def quad_create(self, texture):
        stateset = osg.StateSet()
        stateset.setTextureAttributeAndModes(0, texture)

        w = 16.0 / 9.0
        h = 1.0
        corner = osg.Vec3(-w,-h, 0)
        width = osg.Vec3(2 * w,0,0)
        height = osg.Vec3(0,2 * h,0)

        geom = osg.createTexturedQuadGeometry(corner, width, height, 0.0, 0.0, 1.0, 1.0)
        geom.setStateSet(stateset)

        geode = osg.Geode()
        geode.addDrawable(geom)
        return geode
예제 #6
0
    def osgViewerAndGeometry(self,  testStateSet):
        print "-"*40
        print "Testing osgViewer with osg::Geometry"
        g = osg.createTexturedQuadGeometry(osg.Vec3f(0,0,0), osg.Vec3f(1,0,0), osg.Vec3f(0,0,1), 0, 0, 1, 1)
        g.getColorArray()[0] = osg.Vec4f(1,1,1,0.5)
        geode = osg.Geode()
        geode.addDrawable(g)

        if (testStateSet):
            print "Will add a texture"
            i = osgDB.readImageFile("Images/osg256.png")
            t = osg.Texture2D(i)
            s = geode.stateSet
            s.setTextureAttributeAndModes(0, t, osg.StateAttribute.ON)
            s.setRenderingHint(osg.StateSet.TRANSPARENT_BIN)
            s.setMode(osg.GL_BLEND, osg.StateAttribute.ON)

        runViewer(geode)
        self.failUnless(True)
예제 #7
0
파일: test.py 프로젝트: cmbruns/osgswig
import ctypes
import osgDB, osgViewer, osg
group = osg.Group()
image = osgDB.readImageFile("/home/trigrou/Pictures/backgrounds/games/Another_World_by_Orioto.jpg")
loadedModel = osg.Group()

corner = osg.Vec3(0,0,0);
width = osg.Vec3(1,0,0);
height = osg.Vec3(0,1,0);
geom = osg.createTexturedQuadGeometry(corner, width, height, 0.0, 0.0, 1.0, 1.0);
geom.getOrCreateStateSet().setTextureAttributeAndModes(0, osg.Texture2D(image))
geom.getOrCreateStateSet().setTextureAttributeAndModes(1, osg.Texture2D(osgDB.readImageFile("/home/trigrou/Pictures/backgrounds/games/Big_Blue_by_Orioto.jpg")))

vertProg = """
void main()
	{	
		gl_Position = ftransform();
                gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
	}
"""
fragProg = """
uniform float test;
uniform int index;
uniform sampler2D tex0;
uniform sampler2D tex1;
	void main()
	{
                vec4 color;
                if (index == 0.0)
	           color = texture2D(tex0,gl_TexCoord[0].st);
                if (index != 0.0)
예제 #8
0
import ctypes
import osgDB, osgViewer, osg
group = osg.Group()
image = osgDB.readImageFile(
    "/home/trigrou/Pictures/backgrounds/games/Another_World_by_Orioto.jpg")
loadedModel = osg.Group()

corner = osg.Vec3(0, 0, 0)
width = osg.Vec3(1, 0, 0)
height = osg.Vec3(0, 1, 0)
geom = osg.createTexturedQuadGeometry(corner, width, height, 0.0, 0.0, 1.0,
                                      1.0)
geom.getOrCreateStateSet().setTextureAttributeAndModes(0, osg.Texture2D(image))
geom.getOrCreateStateSet().setTextureAttributeAndModes(
    1,
    osg.Texture2D(
        osgDB.readImageFile(
            "/home/trigrou/Pictures/backgrounds/games/Big_Blue_by_Orioto.jpg"))
)

vertProg = """
void main()
	{	
		gl_Position = ftransform();
                gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
	}
"""
fragProg = """
uniform float test;
uniform int index;
uniform sampler2D tex0;