[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52719] trunk/blender: fix GhostSDL displaying text in multiple views.

Campbell Barton ideasman42 at gmail.com
Sun Dec 2 16:58:30 CET 2012


Revision: 52719
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52719
Author:   campbellbarton
Date:     2012-12-02 15:58:26 +0000 (Sun, 02 Dec 2012)
Log Message:
-----------
fix GhostSDL displaying text in multiple views.
add support for multi-sample.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_SystemSDL.cpp
    trunk/blender/intern/ghost/intern/GHOST_WindowSDL.cpp
    trunk/blender/source/blender/editors/space_view3d/drawobject.c

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemSDL.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemSDL.cpp	2012-12-02 15:15:44 UTC (rev 52718)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemSDL.cpp	2012-12-02 15:58:26 UTC (rev 52719)
@@ -73,7 +73,7 @@
 {
 	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) {

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowSDL.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowSDL.cpp	2012-12-02 15:15:44 UTC (rev 52718)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowSDL.cpp	2012-12-02 15:58:26 UTC (rev 52719)
@@ -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 @@
 	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,15 +70,8 @@
 	                             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);
 
 	//fprintf(stderr, "Ignoring Xlib error: error code %d request code %d\n",
@@ -164,6 +172,10 @@
 	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;

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c	2012-12-02 15:15:44 UTC (rev 52718)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	2012-12-02 15:58:26 UTC (rev 52719)
@@ -2579,7 +2579,7 @@
 	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";




More information about the Bf-blender-cvs mailing list