Author: ArcRiley Date: 2008-05-20 13:22:13 -0400 (Tue, 20 May 2008) New Revision: 1293
Modified: trunk/pysoy/examples/pyramid.py trunk/pysoy/src/materials/Bumpmapped.pym trunk/pysoy/src/materials/Material.pym trunk/pysoy/src/materials/Textured.pym trunk/pysoy/src/widgets/Canvas.pym Log: Ticket #955 : * bumpmapping is fixed - though blocks.py needs work still (see #949) * updated pyramid.py example, which works now * sorted out glClientActiveTexture vs glActiveTexture mess Modified: trunk/pysoy/examples/pyramid.py =================================================================== --- trunk/pysoy/examples/pyramid.py 2008-05-20 07:30:51 UTC (rev 1292) +++ trunk/pysoy/examples/pyramid.py 2008-05-20 17:22:13 UTC (rev 1293) @@ -6,7 +6,7 @@ diffuse=soy.colors.cyan) mat1 = soy.materials.Material(ambient=soy.colors.yellowGreen, diffuse=soy.colors.goldenRod) - mat2 = soy.materials.Material(color=tex) + mat2 = soy.materials.Textured(colormap=tex) a = soy.atoms.Vertex(self,position=( 0, 1, 0), texcoord=(0,0,0)) b = soy.atoms.Vertex(self,position=(-1,-1, 1), texcoord=(0,0,0)) @@ -20,23 +20,22 @@ soy.atoms.Face(self, verts=(a,e,b), material=mat1) soy.atoms.Face(self, verts=(d,c,b), material=mat2) soy.atoms.Face(self, verts=(e,d,b), material=mat2) -if __name__ == "__main__": + +if __name__ == "__main__" : sce = soy.scenes.Scene() lava = soy.transports.File('media/lava.soy')['gimp'] a = Pyramid(lava) scr = soy.Screen() - mat= soy.materials.Material() - win = soy.Window(scr, 'Colored Blocks') - #scr.fullscreen = win - axis = soy.models.Camera() + win = soy.Window(scr, 'Pyramid') cam = soy.bodies.Camera(sce) - body = soy.bodies.Body(sce,mesh=a) - body1 = soy.bodies.Body(sce,mesh=axis) + body = soy.bodies.Body(sce, model=a) #myjoint = soy.joints.Fixed(sce,body,body1) - body1.rotation=(1,1,1) + body.rotation=(1,1,1) cam.position = (0.0, 0.0, 6.0) lig = soy.bodies.Light(sce) lig.position = (-10.0,10.0,2.0) #ca1 = soy.widgets.Canvas(win, aspect=2.0, texture=lava) pro = soy.widgets.Projector(win, camera=cam) + while 1 : + sleep(60) Modified: trunk/pysoy/src/materials/Bumpmapped.pym =================================================================== --- trunk/pysoy/src/materials/Bumpmapped.pym 2008-05-20 07:30:51 UTC (rev 1292) +++ trunk/pysoy/src/materials/Bumpmapped.pym 2008-05-20 17:22:13 UTC (rev 1293) @@ -123,6 +123,7 @@ # # Texture1 - the normalisation cubemap # + gl.glActiveTexture(gl.GL_TEXTURE1) gl.glClientActiveTexture(gl.GL_TEXTURE1) gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY) gl.glTexCoordPointer(3, gl.GL_FLOAT, 0, _tslvs) @@ -146,6 +147,7 @@ # # Texture0 - the dot3 normal map (bumpmap) # + gl.glActiveTexture(gl.GL_TEXTURE0) gl.glClientActiveTexture(gl.GL_TEXTURE0) gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY) gl.glTexCoordPointer(3, gl.GL_FLOAT, 48, _texcoords) @@ -171,9 +173,11 @@ # # start by cleaning up from last pass # + gl.glActiveTexture(gl.GL_TEXTURE1) gl.glClientActiveTexture(gl.GL_TEXTURE1) + _normalisation_cube_map._disable() gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY) - _normalisation_cube_map._disable() + gl.glActiveTexture(gl.GL_TEXTURE0) gl.glClientActiveTexture(gl.GL_TEXTURE0) self._bumpmap._disable() # @@ -210,6 +214,7 @@ # render the colormap # if self._colormap is not None : + gl.glActiveTexture(_texunits[_unit]) gl.glClientActiveTexture(_texunits[_unit]) gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY) gl.glTexCoordPointer(3, gl.GL_FLOAT, 48, _texcoords) @@ -222,6 +227,7 @@ # render the glowmap # if self._glowmap is not None : + gl.glActiveTexture(_texunits[_unit]) gl.glClientActiveTexture(_texunits[_unit]) gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY) gl.glTexCoordPointer(3, gl.GL_FLOAT, 48, _texcoords) @@ -255,11 +261,11 @@ # _unit = 0 if self._colormap is not None : - gl.glClientActiveTexture(_texunits[_unit]) + gl.glActiveTexture(_texunits[_unit]) self._colormap._disable() _unit += 1 if self._glowmap is not None : - gl.glClientActiveTexture(_texunits[_unit]) + gl.glActiveTexture(_texunits[_unit]) self._glowmap._disable() return 0 # Modified: trunk/pysoy/src/materials/Material.pym =================================================================== --- trunk/pysoy/src/materials/Material.pym 2008-05-20 07:30:51 UTC (rev 1292) +++ trunk/pysoy/src/materials/Material.pym 2008-05-20 17:22:13 UTC (rev 1293) @@ -265,7 +265,7 @@ # # disable what we're not using and return # - for _i from 0 <= _i < 4 : + for _i from 4 > _i >= 0 : gl.glClientActiveTexture(_texunits[_i]) gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY) return 1 Modified: trunk/pysoy/src/materials/Textured.pym =================================================================== --- trunk/pysoy/src/materials/Textured.pym 2008-05-20 07:30:51 UTC (rev 1292) +++ trunk/pysoy/src/materials/Textured.pym 2008-05-20 17:22:13 UTC (rev 1293) @@ -157,6 +157,7 @@ gl.glClientActiveTexture(_texunits[_unit]) gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY) gl.glTexCoordPointer(3, gl.GL_FLOAT, 48, _texcoords) + gl.glActiveTexture(_texunits[_unit]) gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_MODULATE) self._colormap._enable() _unit += 1 @@ -169,10 +170,11 @@ gl.glClientActiveTexture(_texunits[_unit]) gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY) gl.glTexCoordPointer(3, gl.GL_FLOAT, 48, _texcoords) + gl.glActiveTexture(_texunits[_unit]) + self._glowmap._enable() gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_ADD) gl.glEnable(gl.GL_BLEND) gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE) - self._glowmap._enable() _unit += 1 # #################################### @@ -188,11 +190,11 @@ else : _unit = 0 if self._colormap is not None : - gl.glClientActiveTexture(_texunits[_unit]) + gl.glActiveTexture(_texunits[_unit]) self._colormap._disable() _unit += 1 if self._glowmap is not None : - gl.glClientActiveTexture(_texunits[_unit]) + gl.glActiveTexture(_texunits[_unit]) self._glowmap._disable() return 0 # Modified: trunk/pysoy/src/widgets/Canvas.pym =================================================================== --- trunk/pysoy/src/widgets/Canvas.pym 2008-05-20 07:30:51 UTC (rev 1292) +++ trunk/pysoy/src/widgets/Canvas.pym 2008-05-20 17:22:13 UTC (rev 1293) @@ -125,19 +125,12 @@ if gl.GLEW_ARB_vertex_buffer_object : gl.glBindBufferARB (gl.GL_ELEMENT_ARRAY_BUFFER_ARB, 0) gl.glBindBufferARB (gl.GL_ARRAY_BUFFER_ARB, 0) - # - ###################################### - # - # disable the other textures, this needs to be more complete - # - gl.glActiveTexture(gl.GL_TEXTURE1) - gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY) # ###################################### # # enable texture0 # - gl.glActiveTexture(gl.GL_TEXTURE0) + gl.glClientActiveTexture(gl.GL_TEXTURE0) gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY) self._texture._enable() # _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn