Skip to content

Commit

Permalink
GL: Restored GL_SetMultisample()
Browse files Browse the repository at this point in the history
For enabling and disabling multisampling when vid-fsaa is 1.
  • Loading branch information
skyjake committed Apr 13, 2012
1 parent 7f9db5e commit c1004c9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
21 changes: 19 additions & 2 deletions doomsday/engine/portable/include/gl_main.h
Expand Up @@ -89,8 +89,25 @@ void GL_UseFog(int yes);
void GL_LowRes(void);

void GL_ModulateTexture(int mode);
void GL_SetVSync(boolean on);
void GL_SetMultisample(boolean on);

/**
* Enables or disables vsync. Changes the value of the vid-vsync variable.
* May cause the OpenGL surface to be recreated.
*
* @param on @c true to enable vsync, @c false to disable.
*/
void GL_SetVSync(boolean on);

/**
* Enables or disables multisampling when FSAA is available (vid-fsaa 1). You
* cannot enable multisampling if vid-fsaa is 0. Never causes the GL surface or
* pixel format to be modified; can be called at any time during the rendering
* of a frame.
*
* @param on @c true to enable multisampling, @c false to disable.
*/
void GL_SetMultisample(boolean on);

void GL_BlendOp(int op);
boolean GL_NewList(DGLuint list, int mode);
DGLuint GL_EndList(void);
Expand Down
3 changes: 3 additions & 0 deletions doomsday/engine/portable/src/canvas.cpp
Expand Up @@ -118,6 +118,9 @@ Canvas::Canvas(QWidget* parent, QGLWidget* shared) : QGLWidget(parent, shared)
LOG_DEBUG("swap interval: ") << format().swapInterval();
LOG_DEBUG("multisample: %b") << format().sampleBuffers();

// Update the capability flags.
GL_state.features.multisample = format().sampleBuffers();

setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true); // receive moves always

Expand Down
9 changes: 4 additions & 5 deletions doomsday/engine/portable/src/dgl_common.c
Expand Up @@ -387,18 +387,17 @@ void GL_SetVSync(boolean on)

void GL_SetMultisample(boolean on)
{
Con_SetInteger("vid-fsaa", on? 1 : 0);

/*
if(!GL_state.features.multisample) return;

LIBDENG_ASSERT_IN_MAIN_THREAD();

#if WIN32
#if defined(WIN32)
if(on) glEnable(GL_MULTISAMPLE_ARB);
else glDisable(GL_MULTISAMPLE_ARB);
#else
if(on) glEnable(GL_MULTISAMPLE);
else glDisable(GL_MULTISAMPLE);
#endif
*/
}

void DGL_SetScissor(const RectRaw* rect)
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/rend_main.c
Expand Up @@ -3365,7 +3365,7 @@ void Rend_RenderMap(void)
// Set to true if dynlights are inited for this frame.
loInited = false;

//GL_SetMultisample(true);
GL_SetMultisample(true);

// Setup the modelview matrix.
Rend_ModelViewMatrix(true);
Expand Down Expand Up @@ -3442,7 +3442,7 @@ void Rend_RenderMap(void)
// Draw the Source Bias Editor's draw that identifies the current light.
SBE_DrawCursor();

//GL_SetMultisample(false);
GL_SetMultisample(false);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/ui2_main.c
Expand Up @@ -589,7 +589,7 @@ void FIPage_Drawer(fi_page_t* p)
glPushMatrix();
//glLoadIdentity();

//GL_SetMultisample(true);
GL_SetMultisample(true);

// The 3D projection matrix.
// We're assuming pixels are squares.
Expand Down Expand Up @@ -648,7 +648,7 @@ void FIPage_Drawer(fi_page_t* p)
GL_DrawRectf2Color(0, 0, SCREENWIDTH, SCREENHEIGHT, p->_filter[0].value, p->_filter[1].value, p->_filter[2].value, p->_filter[3].value);
}

//GL_SetMultisample(false);
GL_SetMultisample(false);

glMatrixMode(GL_MODELVIEW);
glPopMatrix();
Expand Down

0 comments on commit c1004c9

Please sign in to comment.