Here is my little HDScreenShot function:
def HDScreenShot():
tex=Texture()
width=1024*4
height=1024*4
mybuffer=base.win.makeTextureBuffer('HDScreenShotBuff',width,height,tex,True)
cam=Camera('HDCam')
cam.setLens(base.camLens.makeCopy())
cam.getLens().setAspectRatio(width/height)
pCam=NodePath(cam)
print "HDScreenShot "+str(width)+" by "+str(height)
mycamera = base.makeCamera(mybuffer,useCamera=pCam)
myscene = base.render
mycamera.node().setScene(myscene)
base.graphicsEngine.renderFrame()
tex = mybuffer.getTexture()
mybuffer.setActive(False)
tex.write("ScreenShots/FG_ScreenShotHD"+str(time())+".jpg")
base.graphicsEngine.removeWindow(mybuffer)
Known Issues: Does not apply any filters that may be applied to the scene. I tried, and I could not make it work.
Saves a screenshot (currently 40964096) to a screenshots folder. You will probably want to change the naming convention. Also, for cards that don’t support 40964096, you will have to use a smaller size. You might also want to use the same aspect ratio as the screen, though this code avoids distortion caused by using a a different shape.
Incase you find this post looking for how to do a regular basic screen shot, here is the code:
base.win.saveScreenshot("ScreenShot.jpg")
Edit:
Here is code that applies a bloom filter to the HD Screenshot:
def HDScreenShot():
tex=Texture()
width=1024*4
height=1024*4
mybuffer=base.win.makeTextureBuffer('HDScreenShotBuff',width,height,tex,True)
dis=mybuffer.makeDisplayRegion()
cam=Camera('HDCam')
cam.setLens(base.camLens.makeCopy())
cam.getLens().setAspectRatio(width/height)
pCam=NodePath(cam)
print "HDScreenShot "+str(width)+" by "+str(height)
dis.setCamera(pCam)
print cam.getNumDisplayRegions()
print base.cam.node().getNumDisplayRegions()
mycamera = base.makeCamera(mybuffer,useCamera=pCam)
filters = CommonFilters(mybuffer, mycamera)
filterok = filters.setBloom(blend=(0,0,0,1), desat=0.5, intensity=0.5, size="large",mintrigger=0.6, maxtrigger=1.0)
myscene = base.render
mycamera.node().setScene(myscene)
base.graphicsEngine.renderFrame()
tex = mybuffer.getTexture()
mybuffer.setActive(False)
tex.write("ScreenShots/FG_ScreenShotHD"+str(time())+".jpg")
base.graphicsEngine.removeWindow(mybuffer)