Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-12-02 19:58:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-02 19:58:26 +0400
commit432193552c43b9ab4546b72064390a373a3293e1 (patch)
tree0589d821f22360aa34e3b670115ef6e41c9ac827 /intern
parentecf89326e1f2650fe8fcd792f9bdabf3397e460d (diff)
fix GhostSDL displaying text in multiple views.
add support for multi-sample.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowSDL.cpp28
2 files changed, 21 insertions, 9 deletions
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index 237d4c0f787..fdc4f33b784 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -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) {
diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp
index 369fc4ace14..6641b28a20e 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.cpp
+++ b/intern/ghost/intern/GHOST_WindowSDL.cpp
@@ -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;