Added changes for enabling OpenGL accumulation buffer to implement antialiasing

in the Freestyle renderer.
This commit is contained in:
Tamito Kajiyama
2008-11-20 20:41:07 +00:00
parent e77e6dea97
commit 4c1dcf103d
3 changed files with 31 additions and 2 deletions

View File

@@ -46,22 +46,34 @@ AGLContext GHOST_WindowCarbon::s_firstaglCtx = NULL;
const GHOST_TInt32 GHOST_WindowCarbon::s_sizeRectSize = 16;
#endif //GHOST_DRAW_CARBON_GUTTER
static const GLint sPreferredFormatWindow[8] = {
static const GLint sPreferredFormatWindow[16] = {
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_ACCELERATED,
AGL_DEPTH_SIZE, 32,
AGL_AUX_BUFFERS, 1,
#if 1 // FRS_antialiasing
AGL_ACCUM_RED_SIZE, 16,
AGL_ACCUM_GREEN_SIZE, 16,
AGL_ACCUM_BLUE_SIZE, 16,
AGL_ACCUM_ALPHA_SIZE, 16,
#endif
AGL_NONE,
};
static const GLint sPreferredFormatFullScreen[9] = {
static const GLint sPreferredFormatFullScreen[17] = {
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_ACCELERATED,
AGL_FULLSCREEN,
AGL_DEPTH_SIZE, 32,
AGL_AUX_BUFFERS, 1,
#if 1 // FRS_antialiasing
AGL_ACCUM_RED_SIZE, 16,
AGL_ACCUM_GREEN_SIZE, 16,
AGL_ACCUM_BLUE_SIZE, 16,
AGL_ACCUM_ALPHA_SIZE, 16,
#endif
AGL_NONE,
};

View File

@@ -84,7 +84,11 @@ static PIXELFORMATDESCRIPTOR sPreferredFormat = {
0, 0, 0, 0, 0, 0, /* color bits (ignored) */
0, /* no alpha buffer */
0, /* alpha bits (ignored) */
#if 1 // FRS_antialiasing
1, /* accumulation buffer */
#else
0, /* no accumulation buffer */
#endif
0, 0, 0, 0, /* accum bits (ignored) */
32, /* depth buffer */
0, /* no stencil buffer */
@@ -491,6 +495,10 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
// For debugging only: retrieve the pixel format chosen
PIXELFORMATDESCRIPTOR preferredFormat;
::DescribePixelFormat(m_hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &preferredFormat);
#if 1 // FRS_antialiasing
if (preferredFormat.cAccumBits > 0)
printf("Accumulation buffer enabled\n");
#endif
// Create the context
m_hGlRc = ::wglCreateContext(m_hDC);
if (m_hGlRc) {
@@ -829,6 +837,9 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd) {
!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
!(pfd.dwFlags & PFD_DOUBLEBUFFER) || /* Blender _needs_ this */
( pfd.cDepthBits <= 8 ) ||
#if 1 // FRS_antialiasing
!pfd.cAccumBits || /* for antialiasing in Freestyle */
#endif
!(pfd.iPixelType == PFD_TYPE_RGBA) )
return 0;

View File

@@ -168,6 +168,12 @@ GHOST_WindowX11(
attributes[i++] = GLX_BLUE_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_GREEN_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_DEPTH_SIZE; attributes[i++] = 1;
#if 1 // FRS_antialiasing
attributes[i++] = GLX_ACCUM_RED_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_ACCUM_GREEN_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_ACCUM_BLUE_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_ACCUM_ALPHA_SIZE; attributes[i++] = 1;
#endif
attributes[i] = None;
m_visual = glXChooseVisual(m_display, DefaultScreen(m_display), attributes);