Timbuntu
11-21-2012, 08:42 AM
Hello,
I am trying to save the content of a renderTexture to a file.
I basically use code from the examples as listed further down my post.
Everytime I call renderTexture.save("test") i get an error message that tells me that there is no data in the image.
* ERROR: Texture does not contain image data, cannot save to file 'test'
Any hints on what I am doing wrong?
I also put the texture on a quad to see if there is actually something going wrong, but the desired render is diplayed fine on the quad.
Here is my code:
# Create render texture for sending screenshots
self.renderTexture = viz.addRenderTexture()
# Create render node as camera
self.renderNode = viz.addRenderNode(size=(800,600))
# Do not inherit view/projection settings from main window
#self.renderNode.setInheritView(False)
# Set FOV for renderTexture camera
self.renderNode.setFov(self.FOV,800/600.0,0.1,1000.0)
# Render to renderTexture feed texture
self.renderNode.attachTexture(self.renderTexture)
#NOTE: I also tried renderNode.setTexture here, but that didn't work either
# Only render once per frame, in case stereo is enabled
self.renderNode.setRenderLimit(viz.RENDER_LIMIT_FR AME)
#add a texture quad
quad = viz.addTexQuad()
#add the rendertexture to the texturequad
quad.texture( self.renderTexture )
#position the texture quad
quad.setPosition(0,1,0)
#NOTE: The texture renders fine on the quad
self.renderTexture.save("test")
#This call fails with above error
I am trying to save the content of a renderTexture to a file.
I basically use code from the examples as listed further down my post.
Everytime I call renderTexture.save("test") i get an error message that tells me that there is no data in the image.
* ERROR: Texture does not contain image data, cannot save to file 'test'
Any hints on what I am doing wrong?
I also put the texture on a quad to see if there is actually something going wrong, but the desired render is diplayed fine on the quad.
Here is my code:
# Create render texture for sending screenshots
self.renderTexture = viz.addRenderTexture()
# Create render node as camera
self.renderNode = viz.addRenderNode(size=(800,600))
# Do not inherit view/projection settings from main window
#self.renderNode.setInheritView(False)
# Set FOV for renderTexture camera
self.renderNode.setFov(self.FOV,800/600.0,0.1,1000.0)
# Render to renderTexture feed texture
self.renderNode.attachTexture(self.renderTexture)
#NOTE: I also tried renderNode.setTexture here, but that didn't work either
# Only render once per frame, in case stereo is enabled
self.renderNode.setRenderLimit(viz.RENDER_LIMIT_FR AME)
#add a texture quad
quad = viz.addTexQuad()
#add the rendertexture to the texturequad
quad.texture( self.renderTexture )
#position the texture quad
quad.setPosition(0,1,0)
#NOTE: The texture renders fine on the quad
self.renderTexture.save("test")
#This call fails with above error