Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multisampled buffer produces “GL_INVALID_OPERATION” #416

Closed
ArsThaumaturgis opened this issue Oct 10, 2018 · 2 comments
Closed

Multisampled buffer produces “GL_INVALID_OPERATION” #416

ArsThaumaturgis opened this issue Oct 10, 2018 · 2 comments

Comments

@ArsThaumaturgis
Copy link
Contributor

(This text is partially copied from the forum, as this seems like the place for this issue, now that it's been confirmed to be a bug.)

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.

It seems that part of the issue is the number of depth-bits requested when constructing frame-buffer properties: if a 32 depth-bits are requested, the issue is present on my machine; when 16 depth-bits are requested, it isn't, I believe.

Below is a short test-program that displays the issue on my machine. Note the parameter to "makeBuffers", which controls the number of multi-samples requested, and the two calls to "setDepthBits", one of which is commented-out.

from direct.showbase import ShowBase as showBase
from panda3d.core import Vec4, NodePath, PandaNode, FrameBufferProperties, GraphicsPipe, GraphicsOutput, Texture

class game(showBase.ShowBase):

    def __init__(self):
        showBase.ShowBase.__init__(self)

        self.rootNode = NodePath(PandaNode("root"))

        self.model = loader.loadModel("panda")
        self.model.reparentTo(self.rootNode)
        self.model.setPos(0, 50, -5)

        self.mainBuffer = None
        self.sceneCamera = None
        self.sceneTexture = None

        self.card = base.win.getTextureCard()
        self.card.reparentTo(render2d)
        self.card.setShaderOff(1)

        self.makeBuffers(8)

    def makeBuffers(self, multisamples):
        frameProperties = FrameBufferProperties()
        frameProperties.setMultisamples(multisamples)
        frameProperties.setRgbaBits(8, 8, 8, 0)
        frameProperties.setDepthBits(32)
        #frameProperties.setDepthBits(16)

        windowProperties = base.win.getProperties()

        self.mainBuffer = base.graphicsEngine.makeOutput(base.pipe, "Main Buffer", -1,
                                                         frameProperties, windowProperties,
                                                         GraphicsPipe.BFRefuseWindow, base.win.getGsg(), base.win)

        if self.sceneCamera is None:
            self.sceneCamera = base.makeCamera(self.mainBuffer)
            self.sceneCamera.node().setScene(self.rootNode)
        else:
            region = self.mainBuffer.makeDisplayRegion(0, 1, 0, 1)
            region.setCamera(self.sceneCamera)

        self.sceneTexture = Texture()

        self.mainBuffer.addRenderTexture(self.sceneTexture,
                                         GraphicsOutput.RTMBindOrCopy)

        self.card.setTexture(self.sceneTexture)

app = game()
app.run()
@rdb rdb closed this as completed in 75826c9 Oct 16, 2018
@rdb
Copy link
Member

rdb commented Oct 16, 2018

I could reproduce this and I think this is fixed now. Let me know if you still run into issues.

@ArsThaumaturgis
Copy link
Contributor Author

Having tried a new build, it does indeed seem to be fixed! Thank you very much! ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants