fix GhostSDL displaying text in multiple views.

add support for multi-sample.
This commit is contained in:
Campbell Barton 2012-12-02 15:58:26 +00:00
parent ecf89326e1
commit 432193552c
3 changed files with 22 additions and 10 deletions

@ -73,7 +73,7 @@ GHOST_SystemSDL::createWindow(const STR_String& title,
{
GHOST_WindowSDL *window = NULL;
window = new GHOST_WindowSDL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
window = new GHOST_WindowSDL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, numOfAASamples);
if (window) {
if (GHOST_kWindowStateFullScreen == state) {

@ -26,6 +26,7 @@
#include "GHOST_WindowSDL.h"
#include "SDL_mouse.h"
#include <GL/glew.h>
#include <assert.h>
static SDL_GLContext s_firstContext = NULL;
@ -48,6 +49,20 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
m_invalid_window(false),
m_sdl_custom_cursor(NULL)
{
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
if (numOfAASamples) {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, numOfAASamples);
}
/* creating the window _must_ come after setting attributes */
m_sdl_win = SDL_CreateWindow(title,
left,
top,
@ -55,14 +70,7 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
height,
SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
m_sdl_glcontext = SDL_GL_CreateContext(m_sdl_win);
@ -164,6 +172,10 @@ GHOST_WindowSDL::activateDrawingContext()
if (m_sdl_glcontext != NULL) {
int status = SDL_GL_MakeCurrent(m_sdl_win, m_sdl_glcontext);
(void)status;
/* Disable AA by default */
if (m_numOfAASamples > 0) {
glDisable(GL_MULTISAMPLE_ARB);
}
return GHOST_kSuccess;
}
return GHOST_kFailure;

@ -2579,7 +2579,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
BMIter iter;
int i;
/* make the precision of the pronted value proportionate to the gridsize */
/* make the precision of the display value proportionate to the gridsize */
if (grid < 0.01f) conv_float = "%.6g";
else if (grid < 0.1f) conv_float = "%.5g";