Problem with setColorBits in FrameBufferProperties()

I’m working on WinXp machine using the opengl pipe and I cannot use setColorBits to request any bits other than ‘1’. Anything else crashes Panda, including the same colotbits as base.win

rdb, tried to request more bits on his Linux box and ran into the same problem. Has anybody gotten this to work?

I’m trying to play with deferred rendering systems, and I would like to get more precision for normals storage and to play a bit with HDR.

import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from panda3d.core import FrameBufferProperties, GraphicsPipe, GraphicsOutput, Texture, WindowProperties

winprops = WindowProperties.size( 1024, 1024 )
fbprops = FrameBufferProperties()
fbprops.setColorBits(24)
fbprops.setAlphaBits(1)
fbprops.setDepthBits(1)
fbprops.setStencilBits (1)
objBuffer = base.graphicsEngine.makeOutput(base.pipe, 'hello', 10, fbprops, winprops, GraphicsPipe.BFRefuseWindow, base.win.getGsg(), base.win)

def foo():
	for i in range(0, 10):
		taskMgr.step()

foo()

print objBuffer.getFbProperties()

The error message that it gives is:

:display(error): Could not get requested FrameBufferProperties; abandoning window.
requested: depth_bits=1 color_bits=24 alpha_bits=1 stencil_bits=1
got: depth_bits=1 color_bits=1 alpha_bits=8 stencil_bits=1 multisamples=16 force_hardware=1d
:display:wgldisplay(error): Could not share texture contexts between wglGraphics
StateGuardians.

I’ve tried requesting a 64bit window to start with in the prc, but no matter values I choose, I always end up with the same 32bit window.

depth_bits=24 color_bits=32 alpha_bits=8 stencil_bits=8 back_buffers=1 force_hardware = 1

Has anybody else had any luck?

Looks to me like this is a bug; I think this bug has been previously reported. The nature of the bug is that Panda is filling in color_bits = 1, whereas it should be filling in the actual number of color_bits it successfully created.

David

Looking at glGraphicsBuffer_src.cxx, that’s what that code is designed to do. I don’t know enough about FBO’s to correct that though.

  _fb_properties.set_depth_bits(1);
  _fb_properties.set_color_bits(1);
  _fb_properties.set_alpha_bits(_host->get_fb_properties().get_alpha_bits());

Yep, that’s the bug. I think Josh Yelon wrote that, not realizing that it was supposed to do more than that.

One workaround would be to add GraphicsPipe.BFFbPropsOptional to the flags passed to makeOutput(). This asks the code not to abort in case it fails to get the requested properties.

David