# - display (array) -
# Offscreen using mesa
import CPlot
import Transform as T
import Geom as D

a = D.sphere( (0,0,0), 1)

# One image
CPlot.display([a], offscreen=1, bgColor=1, mode=1, meshStyle=2,
              solidStyle=1, posCam=(0,6,0), export="one.png")
CPlot.finalizeExport()

# Movie
for i in range(50):
    a = T.rotate(a, (0,0,0), (0,0,1), 1.)
    CPlot.display([a], offscreen=1, bgColor=1, mode=1, meshStyle=2,
                  solidStyle=1, posCam=(0,6,0), 
                  exportResolution='680x600', export="export.mpeg")
    CPlot.finalizeExport() # wait for end of file write
CPlot.finalizeExport(1)
import os; os._exit(0)
Ejemplo n.º 2
0
              meshStyle=2,
              solidStyle=1,
              posCam=(0, 6, 0),
              export='one.png')

for i in range(5):
    a = T.rotate(a, (0, 0, 0), (0, 0, 1), 1.)
    CPlot.display([a],
                  offscreen=2,
                  bgColor=1,
                  mode=0,
                  meshStyle=2,
                  solidStyle=1,
                  posCam=(0, 6, 0),
                  export='one%d.png' % i)
    CPlot.finalizeExport()
# import os
# os._exit(0)

# Mpeg Movie -> Not working !!
for i in range(50):
    a = T.rotate(a, (0, 0, 0), (0, 0, 1), 1.)
    CPlot.display([a],
                  bgColor=1,
                  mode=0,
                  solidStyle=1,
                  posCam=(0, 6, 0),
                  export='export.mpeg',
                  exportResolution='680x600',
                  offscreen=2)
    CPlot.finalizeExport()
# - display (array) -
# Offscreen using FBO
import CPlot
import Transform as T
import Geom as D

a = D.sphere((0,0,0), 1, N=200)

# Multi images
CPlot.display(a, offscreen=2, bgColor=1, mode=0, meshStyle=2,
              solidStyle=1, posCam=(0,6,0), export='one.png')
CPlot.finalizeExport() # wait for end of file write
for i in range(5):
    a = T.rotate(a, (0,0,0), (0,0,1), 1.)
    CPlot.display(a, offscreen=2, bgColor=1, mode=0, meshStyle=2,
              solidStyle=1, posCam=(0,6,0), export='one%d.png'%i)
    CPlot.finalizeExport() # wait for end of file write
import os; os._exit(0)

# Mpeg Movie
for i in range(50):
    a = T.rotate(a, (0,0,0), (0,0,1), 1.)
    CPlot.display(a, bgColor=1, mode=0,
                  solidStyle=1, posCam=(0,6,0), export='export.mpeg',
                  exportResolution='680x600', offscreen=2)
    CPlot.finalizeExport() # wait for end of file write
CPlot.finalizeExport(1) # close mpeg file
import os; os._exit(0)
Ejemplo n.º 4
0
def finalizeExport(action=0):
    """Finalize export (barrier, end movie, stop continuous export."""
    CPlot.finalizeExport(action)
import Generator as G
import CPlot
import os

sphere = D.sphere((0., 0., 0.), 1.0)
cube = G.cart((0.2, 0.2, 0.2), (1., 1., 1.), (2, 2, 2))
cube2 = G.cart((-1.5, -0.2, -1.2), (1., 1., 1.), (2, 2, 2))

# Full display
CPlot.display([sphere, cube2],
              posCam=(-0.449, 1.63, -2.9),
              posEye=(0.35, 0.35, 0.35),
              dirCam=(0.94, -0.16, -0.3),
              export="ref.png",
              offscreen=2)
CPlot.finalizeExport()

# Accumulate in images
CPlot.display([sphere],
              posCam=(-0.449, 1.63, -2.9),
              posEye=(0.35, 0.35, 0.35),
              dirCam=(0.94, -0.16, -0.3),
              export="composited.png",
              offscreen=3)
CPlot.finalizeExport(3)

CPlot.display([cube2],
              posCam=(-0.449, 1.63, -2.9),
              posEye=(0.35, 0.35, 0.35),
              dirCam=(0.94, -0.16, -0.3),
              export="composited.png",