Advertisement

pbuffers & anti-aliasing

Started by September 07, 2004 02:03 AM
4 comments, last by GameDev.net 20 years, 4 months ago
Hello, does anyone know how to use antialiasing with pbuffers? If I enable antialiasing in my driver settings, nothing happens when I render to a pbuffer. Graphics card: Geforce FX 5950 Ultra 256MB Regards, Lyve
_____________________________________http://www.winmaze.de, a 3D shoot em up in OpenGL, nice graphics, multiplayer, chat rooms, a nice community, worth visiting! ;)http://www.spheretris.tk, an upcoming Tetrisphere clone for windows, a 3D tetris game on a sphere with powerful graphics for Geforce FX and similar graphics cards.
I don't believe p-buffers can have a multisample buffer associated with them in which case the answer would be no, you can't do antialiasing with pbuffers.
"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V
Advertisement
Found it, it works with GL_ARB_multisample.

@joanusdmentia: Seems to work, I've created my pbuffer by searching for a pixelformat that contains multisampling and it worked.

Lyve
_____________________________________http://www.winmaze.de, a 3D shoot em up in OpenGL, nice graphics, multiplayer, chat rooms, a nice community, worth visiting! ;)http://www.spheretris.tk, an upcoming Tetrisphere clone for windows, a 3D tetris game on a sphere with powerful graphics for Geforce FX and similar graphics cards.
Hi Lyve,

I have the same problem as you had. I'm rendering in a pbuffer and would like to enable Anti-Aliasing for that pbuffer.
What pixelformat did you use for your buffer?

thx
Hi durito

This is my code that is working now:

bool CPBuffer::Create( unsigned int _width, unsigned int _height, HDC _hdcScreen, HGLRC _hrcScreen, unsigned int _numAntialiasingSamples ){	if( !WGLEW_ARB_pbuffer || !WGLEW_ARB_pixel_format )		return false;									// pbuffer extension isn't supported	m_hdcScreen = _hdcScreen;	m_hrcScreen = _hrcScreen;	// Get ready to query for a suitable pixel format that meets our	// minimum requirements.	int iattributes[2*MAX_ATTRIBS];	float fattributes[2*MAX_ATTRIBS];	int nfattribs = 0;	int niattribs = 0;	// Attribute arrays must be 0 terminated. for simplicity, first	// just zero-out the array then fill from left to right.	for ( int a = 0; a < 2*MAX_ATTRIBS; a++ )	{		iattributes[a] = 0;		fattributes[a] = 0;	}	// Since we are trying to create a pbuffer, the pixel format we	// request (and subsequently use) must be "p-buffer capable".	iattributes[2*niattribs ] = WGL_DRAW_TO_PBUFFER_ARB;	iattributes[2*niattribs+1] = true;	niattribs++;	// We require a minimum of 24-bit depth.	iattributes[2*niattribs ] = WGL_DEPTH_BITS_ARB;	iattributes[2*niattribs+1] = 16;	niattribs++;	// We require a minimum of 8-bits for each R, G, B, and A.	iattributes[2*niattribs ] = WGL_RED_BITS_ARB;	iattributes[2*niattribs+1] = 8;	niattribs++;	iattributes[2*niattribs ] = WGL_GREEN_BITS_ARB;	iattributes[2*niattribs+1] = 8;	niattribs++;	iattributes[2*niattribs ] = WGL_BLUE_BITS_ARB;	iattributes[2*niattribs+1] = 8;	niattribs++;	iattributes[2*niattribs ] = WGL_ALPHA_BITS_ARB;	iattributes[2*niattribs+1] = 8;	niattribs++;	iattributes[2*niattribs ] = WGL_ACCELERATION_ARB;	iattributes[2*niattribs+1] = WGL_FULL_ACCELERATION_ARB;	niattribs++;	iattributes[2*niattribs ] = WGL_PIXEL_TYPE_ARB;	iattributes[2*niattribs+1] = WGL_TYPE_RGBA_ARB;	niattribs++;	if( _numAntialiasingSamples )	{		iattributes[2*niattribs ] = WGL_SAMPLES_ARB;		iattributes[2*niattribs+1] = _numAntialiasingSamples;		niattribs++;	}	// Now obtain a list of pixel formats that meet these minimum	// requirements.	HDC hdc = wglGetCurrentDC();	int pformat[MAX_PFORMATS];	unsigned int nformats;	if ( !wglChoosePixelFormatARB( hdc, iattributes, fattributes, MAX_PFORMATS, pformat, &nformats ) )	{		// pbuffer creation error: Couldn't find a suitable pixel format		return false;	}	if( nformats < 1 )		return false;		// no pbuffer format that meets our criteria (hm....)	m_width = _width;	m_height = _height;	MAKEPOWEROFTWOADD(m_width);	MAKEPOWEROFTWOADD(m_height);	m_u = (float)_width / (float)m_width;	m_v = (float)_height / (float)m_height;	int iattribs[] = { 0 };	m_hPBuffer = wglCreatePbufferARB( hdc, pformat[0], m_width, m_height, iattribs );	m_hdcPBuffer = wglGetPbufferDCARB( m_hPBuffer );	m_hrcPBuffer = wglCreateContext( m_hdcPBuffer );	ASSERT( m_hPBuffer && m_hdcPBuffer && m_hrcPBuffer );	return true;}
_____________________________________http://www.winmaze.de, a 3D shoot em up in OpenGL, nice graphics, multiplayer, chat rooms, a nice community, worth visiting! ;)http://www.spheretris.tk, an upcoming Tetrisphere clone for windows, a 3D tetris game on a sphere with powerful graphics for Geforce FX and similar graphics cards.

This topic is closed to new replies.

Advertisement