Reverted the changes (in revisions 17517-17519) for the antialiasing based on OpenGL accumulation buffer.

This commit is contained in:
Tamito Kajiyama
2008-12-04 22:47:26 +00:00
parent 3d07c6c52d
commit 4ae12f3af5
6 changed files with 5 additions and 83 deletions

View File

@@ -46,34 +46,22 @@ AGLContext GHOST_WindowCarbon::s_firstaglCtx = NULL;
const GHOST_TInt32 GHOST_WindowCarbon::s_sizeRectSize = 16;
#endif //GHOST_DRAW_CARBON_GUTTER
static const GLint sPreferredFormatWindow[16] = {
static const GLint sPreferredFormatWindow[8] = {
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[17] = {
static const GLint sPreferredFormatFullScreen[9] = {
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,11 +84,7 @@ 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 */
@@ -495,10 +491,6 @@ 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) {
@@ -837,9 +829,6 @@ 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,12 +168,6 @@ 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);

View File

@@ -33,8 +33,8 @@
#define BLI_JITTER_H
extern void BLI_initjit(float *jitarr, int num);
extern void BLI_jitterate1(float *jit1, float *jit2, int num, float _rad1);
extern void BLI_jitterate2(float *jit1, float *jit2, int num, float _rad2);
extern void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1);
extern void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2);
#endif

View File

@@ -40,13 +40,8 @@
extern "C" {
#include "BLI_blenlib.h"
#include "BLI_jitter.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#if 1 // FRS_antialiasing
#include "BKE_global.h"
#include "DNA_scene_types.h"
#endif
}
// glut.h must be included last to avoid a conflict with stdlib.h on vc .net 2003 and 2005
@@ -401,23 +396,6 @@ void AppGLWidget::DrawScene(SceneVisitor *iRenderer)
glPopAttrib();
}
#if 1 // FRS_antialiasing
void AppGLWidget::init_jit(int osa)
{
static float cache[32][2]; /* simple caching */
static int lastjit= 0;
if(lastjit != osa) {
memset(cache, 0, sizeof(cache));
BLI_initjit(cache[0], osa);
}
lastjit= osa;
memcpy(jit, cache, sizeof(jit));
}
#endif
void AppGLWidget::Draw2DScene(SceneVisitor *iRenderer)
{
static bool first = 1;
@@ -452,30 +430,7 @@ void AppGLWidget::Draw2DScene(SceneVisitor *iRenderer)
canvas->init();
first = false;
}
#if 1 // FRS_antialiasing
if (!(G.scene->r.mode & R_OSA)) {
#endif
canvas->Render(canvas->renderer());
#if 1 // FRS_antialiasing
} else {
init_jit(G.scene->r.osa);
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glClear(GL_ACCUM_BUFFER_BIT);
for (int jitter = 0; jitter < G.scene->r.osa; jitter++) {
cout << "Antialiasing " << jitter+1 << "/" << G.scene->r.osa << endl;
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glTranslatef(jit[jitter][0]*(viewport[2]+viewport[3])/viewport[2],
jit[jitter][1]*(viewport[2]+viewport[3])/viewport[3], 0.0);
canvas->Render(canvas->renderer());
glPopMatrix();
glAccum(GL_ACCUM, 1.0/G.scene->r.osa);
}
glAccum(GL_RETURN, 1.0);
}
#endif
canvas->Render(canvas->renderer());
}
glLoadIdentity();

View File

@@ -517,11 +517,7 @@ protected:
bool _record;
#if 1 // FRS_antialiasing
float jit[32][2];
void init_jit(int osa);
#endif
};