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
diff options
context:
space:
mode:
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.mm29
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsCocoa.mm2
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsUnix.cpp2
3 files changed, 10 insertions, 23 deletions
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index cfad6034be7..5fe40cb04a0 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -188,24 +188,10 @@ static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
attribs.push_back((NSOpenGLPixelFormatAttribute)0);
}
-// TODO(merwin): make this available to all platforms
-static void getVersion(int *major, int *minor)
-{
-#if 1 // legacy GL
- sscanf((const char *)glGetString(GL_VERSION), "%d.%d", major, minor);
-#else // 3.0+
- glGetIntegerv(GL_MAJOR_VERSION, major);
- glGetIntegerv(GL_MINOR_VERSION, minor);
-#endif
-}
-
GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- std::vector<NSOpenGLPixelFormatAttribute> attribs;
- attribs.reserve(40);
-
#ifdef GHOST_OPENGL_ALPHA
static const bool needAlpha = true;
#else
@@ -213,16 +199,15 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
#endif
static bool softwareGL = getenv("BLENDER_SOFTWAREGL"); // command-line argument would be better
- GLint major = 0, minor = 0;
- NSOpenGLPixelFormat *pixelFormat;
- // TODO: keep pixel format for subsequent windows/contexts instead of recreating each time
+ std::vector<NSOpenGLPixelFormatAttribute> attribs;
+ attribs.reserve(40);
makeAttribList(attribs, m_coreProfile, m_stereoVisual, needAlpha, softwareGL);
- pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
-
- if (pixelFormat == nil)
+ NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
+ if (pixelFormat == nil) {
goto error;
+ }
m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat
shareContext:s_sharedOpenGLContext];
@@ -230,8 +215,10 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
[m_openGLContext makeCurrentContext];
- getVersion(&major, &minor);
if (m_debug) {
+ GLint major = 0, minor = 0;
+ glGetIntegerv(GL_MAJOR_VERSION, &major);
+ glGetIntegerv(GL_MINOR_VERSION, &minor);
fprintf(stderr, "OpenGL version %d.%d%s\n", major, minor, softwareGL ? " (software)" : "");
fprintf(stderr, "Renderer: %s\n", glGetString(GL_RENDERER));
}
diff --git a/intern/ghost/intern/GHOST_SystemPathsCocoa.mm b/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
index 232ef048351..830d58ba42c 100644
--- a/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
@@ -110,5 +110,5 @@ const GHOST_TUns8 *GHOST_SystemPathsCocoa::getBinaryDir() const
void GHOST_SystemPathsCocoa::addToSystemRecentFiles(const char *filename) const
{
- /* XXXXX TODO: Implementation for X11 if possible */
+ /* TODO: implement for macOS */
}
diff --git a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
index 94e48f98510..9514edb7404 100644
--- a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
+++ b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
@@ -115,5 +115,5 @@ const GHOST_TUns8 *GHOST_SystemPathsUnix::getBinaryDir() const
void GHOST_SystemPathsUnix::addToSystemRecentFiles(const char * /*filename*/) const
{
- /* XXXXX TODO: Implementation for X11 if possible */
+ /* TODO: implement for X11 */
}