It looks like you're new here. If you want to get involved, click one of these buttons!
Timer.delayedCall(5000, function() local function face(color,rx,ry) -- Create a colored face c=Sprite.new() s=Shape.new() s:setFillStyle(Shape.SOLID, color,0.8) s:beginPath() s:moveTo(-1,-1) s:lineTo(-1,1) s:lineTo(1,1) s:lineTo(1,-1) s:lineTo(-1,-1) s:endPath() s:setZ(-1) c:addChild(s) c:setRotationX(rx) c:setRotationY(ry) return c; end --Create a cube cube=Mesh.new(true) cube:addChild(face(0xFF0000,0,0)) cube:addChild(face(0xFFFF00,90,0)) cube:addChild(face(0xFF00FF,-90,0)) cube:addChild(face(0x00FF00,180,0)) cube:addChild(face(0x00FFFF,0,90)) cube:addChild(face(0x0000FF,0,-90)) --Set up the 3D view and projection local sw,sh=800,600 local projection=Matrix.new() projection:perspectiveProjection(45,sw/sh,0.1,1000) local view=Viewport.new() view:setProjection(projection) view:setPosition(sw/2,sh/2) view:setScale(-sw/2,-sh/2,1) stage:addChild(view) --Add our cube to the scene view:setContent(cube) --Look at it from -8 units in Z direction view:lookAt(0,0,-8,0,0,0,0,1,0) cube:setRotationX(20) cube:setRotationY(49) cube:setRotation(30) cube:addEventListener(Event.ENTER_FRAME,function () cube:setRotationX(cube:getRotationX()+1) cube:setRotationY(cube:getRotationY()+1.2) cube:setRotation(cube:getRotation()+1.3) end) -- Draw the cube the the render target and add a Bitmap using it to the stage, offset from the 3D version: local rt = RenderTarget.new(800, 600) rt:draw(view) b = Bitmap.new(rt) b:setPosition(300, 0) stage:addChild(b) end ) |
Comments
I fixed it now: https://github.com/gideros/gideros/commit/4a3d0bb8ec3541171ec1b1c3cea385c37ce425c2
Likes: MoKaLux, pie, PaulH
If 2D still works, then it would probably be depth buffer thing.
Likes: MoKaLux, pie