View Single Post
  #2  
Old 09-14-2010, 03:07 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The texture objects have a few functions for loading images from memory.

<texture>.setImageData allows you to set the raw RGB data of an image. This is the most efficient method.

If the data is from an image format that is in memory (png, jpeg, bmp, etc..), then you can use <texture>.loadBuffer.

Here is some sample code:
Code:
# Create a blank texture that will be updated later
tex = viz.addBlankTexture([1,1])

# Set image from raw rgb data that is 256 x 256
tex.setImageData(rgbData,[256,256],viz.TEX_RGB)

# Set image from png image data in memory
tex.loadBuffer('.png',pngData)
Reply With Quote