[Bf-blender-cvs] [446fa8e] soc-2014-viewport_context: clearing the screen is not visible unless there is a buffer swap. also factored out the GL clear code into a single function

Jason Wilkins noreply at git.blender.org
Thu Jul 24 09:13:27 CEST 2014


Commit: 446fa8e09747f4b6abda652e1708cbf9580e65bd
Author: Jason Wilkins
Date:   Thu Jul 24 02:07:59 2014 -0500
Branches: soc-2014-viewport_context
https://developer.blender.org/rB446fa8e09747f4b6abda652e1708cbf9580e65bd

clearing the screen is not visible unless there is a buffer swap.  also factored out the GL clear code into a single function

===================================================================

M	intern/ghost/intern/GHOST_Context.cpp
M	intern/ghost/intern/GHOST_Context.h
M	intern/ghost/intern/GHOST_ContextCGL.mm
M	intern/ghost/intern/GHOST_ContextEGL.cpp
M	intern/ghost/intern/GHOST_ContextGLX.cpp
M	intern/ghost/intern/GHOST_ContextWGL.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_Context.cpp b/intern/ghost/intern/GHOST_Context.cpp
index 7cd6db0..163219e 100644
--- a/intern/ghost/intern/GHOST_Context.cpp
+++ b/intern/ghost/intern/GHOST_Context.cpp
@@ -232,3 +232,12 @@ void GHOST_Context::initContextGLEW()
 
 	GLEW_CHK(glewInit());
 }
+
+
+
+void GHOST_Context::initClearGL()
+{
+	glClearColor(0.447, 0.447, 0.447, 0.000);
+	glClear(GL_COLOR_BUFFER_BIT);
+	glClearColor(0.000, 0.000, 0.000, 0.000);
+}
diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h
index bb08b84..b412491 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -137,6 +137,8 @@ protected:
 	
 	GHOST_TUns16 m_numOfAASamples;
 
+	static void initClearGL();
+
 private:
 	GLEWContext* m_glewContext;
 
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index 2c36330..f030b98 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -334,9 +334,8 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
 
 	initContextGLEW();
 
-	glClearColor(0.447, 0.447, 0.447, 0.000);
-	glClear(GL_COLOR_BUFFER_BIT);
-	glClearColor(0.000, 0.000, 0.000, 0.000);
+	initClearGL();
+	[m_openGLContext flushBuffer];
 
 	[pool drain];
 
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index d5ee849..42cd87d 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -278,7 +278,7 @@ GHOST_ContextEGL::~GHOST_ContextEGL()
 
 GHOST_TSuccess GHOST_ContextEGL::swapBuffers()
 {
-	return EGL_CHK(eglSwapBuffers(m_display, m_surface)) ? GHOST_kSuccess : GHOST_kFailure;
+	return EGL_CHK(::eglSwapBuffers(m_display, m_surface)) ? GHOST_kSuccess : GHOST_kFailure;
 }
 
 
@@ -605,9 +605,8 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
 
 	initContextGLEW();
 
-	glClearColor(0.447, 0.447, 0.447, 0.000);
-	glClear(GL_COLOR_BUFFER_BIT);
-	glClearColor(0.000, 0.000, 0.000, 0.000);
+	initClearGL();
+	::eglSwapBuffers(m_display, m_surface);
 
 	return GHOST_kSuccess;
 
diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index dd305c4..8cd5ee6 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -284,9 +284,8 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
 		// which means we cannot use glX extensions until after we create a context
 		initContextGLXEW();
 
-		glClearColor(0.447, 0.447, 0.447, 0.000);
-		glClear(GL_COLOR_BUFFER_BIT);
-		glClearColor(0.000, 0.000, 0.000, 0.000);
+		initClearGL();
+		::glXSwapBuffers(m_display, m_window);
 
 		success = GHOST_kSuccess;
 	}
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index d9b261b..0518527 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -850,9 +850,8 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
 
 	initContextGLEW();
 
-	glClearColor(0.447, 0.447, 0.447, 0.000);
-	glClear(GL_COLOR_BUFFER_BIT);
-	glClearColor(0.000, 0.000, 0.000, 0.000);
+	initClearGL();
+	::SwapBuffers(m_hDC);
 
 #ifndef NDEBUG
 	reportContextString("Vendor",   m_dummyVendor,   reinterpret_cast<const char*>(glGetString(GL_VENDOR)));




More information about the Bf-blender-cvs mailing list