Hi all,
I have a question regarding the number of pixels allocated to content written to disk from a textureBuffer; my case is actually very specific:
Say I have a flat-plane, with x and z dimensions, of 16x16, that is:
planeStartX=0
planeEndX=16
planeStartZ=0
planeEndZ=16
I create geometry from this, then parent it to a scene connected to a textureBuffer:
#Create the hidden window:
tex=Texture()
mybuffer = base.win.makeTextureBuffer("My Buffer", int(greatestX), int(greatestY),tex,to_ram=True)
mybuffer.setSort(-100)
mycamera = base.makeCamera(mybuffer)
myscene = NodePath("My Scene")
mycamera.reparentTo(myscene)
#parent the flat plane to this scene:
flatGeometry=makeFlatPlane(16)#<-function that would return a flat plane, with the sent dimension size, in this case, 16.
flatGeometry.reparentTo(myscene)
#position the camera some distance behind the flat-plane:
centrePoint=flatGeometry.getBounds().getCenter()
mycamera.setPos(centrePoint)
mycamera.setY(-350)
#aspect ratio:
mycamera.node().getLens().setAspectRatio(float(greatestX) / float(greatestY))
#save a screenshot of the flat-plane:
file_name=Filename.fromOsSpecific("save_gameDat_001.png")
base.graphicsEngine.renderFrame()
mybuffer.saveScreenshot(file_name)
- How would I make this flat 16X16 plane occupy 16X16 pixels in the resulting saved image?
- How would I specify the pixel starting point for the plane in the resultng saved image? For instance, if I wanted it to start at pixel (20,40) and of course, being 16X16 end at (35,55).
Does anyone know how I would go about achieving that? It probably involves manipulating the camera’s fov and/or position before writing the plane out to disk as an image, but in what exact way?
Thanks in advance, if my question isn’t clear, then please ask and I’ll clarify it.