In my current project, in order to support antialiasing, I render to an off-screen buffer that, depending on the game’s settings, may be set to be multisampled. If the player changes the relevant setting while the game is running, the relevant method is called, recreating the buffer and associating the camera with it.
I believe that this had previously worked.
However, as of a few days ago, I found that enabling multisampling resulted in an OpenGL error being reported. Adding " gl-debug #t" to my “prc” file (as suggested by the initial error message) resulted in this error-text being repeated:
:display:gsg:glgsg(error): GL_INVALID_OPERATION error generated. Depth formats do not match.
The following is my current approach to creating my buffer and camera (with some commented-out code omitted). If the value given to “setMultisamples” is “0”, it successfully creates a buffer, and the scene is visible. If instead it’s given some other value (in all fairness, I’ve only tested a few power-of-two values), it seems to fail, with only blackness in place of the scene.
def makeBuffers(self, multisamples):
self.cleanupBuffers()
frameProperties = FrameBufferProperties()
frameProperties.setMultisamples(multisamples)
frameProperties.setRgbaBits(8, 8, 8, 0)
frameProperties.setDepthBits(32)
windowProperties = base.win.getProperties()
self.mainBuffer = base.graphicsEngine.makeOutput(base.pipe, "Main Buffer", -1,
frameProperties, windowProperties,
GraphicsPipe.BFRefuseWindow, base.win.getGsg(), base.win)
self.mainBuffer.setClearColor(Vec4(0, 0, 0, 1))
if self.sceneCamera is None:
self.sceneCamera = base.makeCamera(self.mainBuffer)
self.sceneCamera.node().setScene(self.rootNode)
self.sceneCamera.node().setCameraMask(BitMask32(1))
self.updateAspectRatio()
else:
region = self.mainBuffer.makeDisplayRegion(0, 1, 0, 1)
region.setCamera(self.sceneCamera)
self.sceneTexture = Texture()
self.sceneTexture.setWrapU(Texture.WM_clamp)
self.sceneTexture.setWrapV(Texture.WM_clamp)
self.mainBuffer.addRenderTexture(self.sceneTexture,
GraphicsOutput.RTMBindOrCopy)
self.card.setTexture(self.sceneTexture)
I’m not sure of whether this is a bug in Panda, a problem with my approach (perhaps linked to changes in Panda, since it once worked), or perhaps even an issue with my computer’s drivers–hence my not filing this in the issue tracker just yet!