]> git.cworth.org Git - apitrace/commitdiff
glws: Add support for profiles
authorChia-I Wu <olvaffe@gmail.com>
Mon, 7 Nov 2011 23:12:29 +0000 (16:12 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 17 Nov 2011 15:50:26 +0000 (15:50 +0000)
The valid profiles are PROFILE_COMPAT, PROFILE_ES1, and PROFILE_ES2.  They
stand for desktop GL with compatibility profile, GLESv1, and GLESv2
respectively.  Update createContext to take profile as the last parameter.

glws.hpp
glws_cocoa.mm
glws_glx.cpp
glws_wgl.cpp

index d6c2003e0c90ae873c0743057725214152017e3b..adabe14dd8038a415e8430b9c8a68f5deb0f7337 100644 (file)
--- a/glws.hpp
+++ b/glws.hpp
 namespace glws {
 
 
+enum Profile {
+    PROFILE_COMPAT,
+    PROFILE_ES1,
+    PROFILE_ES2,
+};
+
+
 extern bool debug;
 
 
@@ -144,7 +151,7 @@ Drawable *
 createDrawable(const Visual *visual, int width = 32, int height = 32);
 
 Context *
-createContext(const Visual *visual, Context *shareContext = 0);
+createContext(const Visual *visual, Context *shareContext = 0, Profile profile = PROFILE_COMPAT);
 
 bool
 makeCurrent(Drawable *drawable, Context *context);
index 493cb4a58dc54b1c3af3e0a9da4243298d2b70a2..315c6bca591ef742898e00f265a7839835be7261 100644 (file)
@@ -204,12 +204,16 @@ createDrawable(const Visual *visual, int width, int height)
 }
 
 Context *
-createContext(const Visual *visual, Context *shareContext)
+createContext(const Visual *visual, Context *shareContext, Profile profile)
 {
     NSOpenGLPixelFormat *pixelFormat = dynamic_cast<const CocoaVisual *>(visual)->pixelFormat;
     NSOpenGLContext *share_context = nil;
     NSOpenGLContext *context;
 
+    if (profile != PROFILE_COMPAT) {
+        return nil;
+    }
+
     if (shareContext) {
         share_context = dynamic_cast<CocoaContext*>(shareContext)->context;
     }
index 3c49de81309dd25983da7a3eca51efee5d14f3a1..d771093b430b80ec343b8be0e93bf341781da0d0 100644 (file)
@@ -293,12 +293,16 @@ createDrawable(const Visual *visual, int width, int height)
 }
 
 Context *
-createContext(const Visual *_visual, Context *shareContext)
+createContext(const Visual *_visual, Context *shareContext, Profile profile)
 {
     const GlxVisual *visual = dynamic_cast<const GlxVisual *>(_visual);
     GLXContext share_context = NULL;
     GLXContext context;
 
+    if (profile != PROFILE_COMPAT) {
+        return NULL;
+    }
+
     if (shareContext) {
         share_context = dynamic_cast<GlxContext*>(shareContext)->context;
     }
index 1958b5fc22a193aa8f64cc116231631806768be9..4b5870ef75c97378967ebeb02f22c6245849b2bd 100644 (file)
@@ -210,8 +210,12 @@ createDrawable(const Visual *visual, int width, int height)
 }
 
 Context *
-createContext(const Visual *visual, Context *shareContext)
+createContext(const Visual *visual, Context *shareContext, Profile profile)
 {
+    if (profile != PROFILE_COMPAT) {
+        return NULL;
+    }
+
     return new WglContext(visual, dynamic_cast<WglContext *>(shareContext));
 }