Renamed glInit and glDeinit to glCreateContext and glDestroyContext. trunk
authorRyan C. Gordon <icculus@icculus.org>
Mon, 28 Apr 2008 06:00:37 -0400
branchtrunk
changeset 238 e98f14da2897
parent 237 09f35dfc1d7e
child 239 9a9971a6828d
Renamed glInit and glDeinit to glCreateContext and glDestroyContext.
finderrors.c
mojoshader.h
mojoshader_opengl.c
--- a/finderrors.c	Mon Apr 28 05:50:02 2008 -0400
+++ b/finderrors.c	Mon Apr 28 06:00:37 2008 -0400
@@ -114,10 +114,10 @@
         SDL_GL_LoadLibrary(NULL);
         SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);
         MOJOSHADER_glContext *ctx;
-        ctx = MOJOSHADER_glInit(profile, SDL_GL_GetProcAddress, 0, 0, 0);
+        ctx = MOJOSHADER_glCreateContext(profile, SDL_GL_GetProcAddress, 0, 0, 0);
         if (ctx == NULL)
         {
-            printf("MOJOSHADER_glInit() fail: %s\n", MOJOSHADER_glGetError());
+            printf("MOJOSHADER_glCreateContext() fail: %s\n", MOJOSHADER_glGetError());
             SDL_Quit();
             return 1;
         } // if
@@ -130,7 +130,7 @@
         printf("Saw %d bytecode files.\n", total);
 
         #if FINDERRORS_COMPILE_SHADERS
-        MOJOSHADER_glDeinit(ctx);
+        MOJOSHADER_glDestroyContext(ctx);
         SDL_Quit();
         #endif
     } // else
--- a/mojoshader.h	Mon Apr 28 05:50:02 2008 -0400
+++ b/mojoshader.h	Mon Apr 28 06:00:37 2008 -0400
@@ -359,8 +359,8 @@
  * You must call this once AFTER you have successfully built your GL context
  *  and made it current. This function will lookup the GL functions it needs
  *  through the callback you supply, after which it may call them at any time
- *  up until you call MOJOSHADER_glDeinit(). The lookup function is neither
- *  stored nor used by MojoShader after this function returns.
+ *  up until you call MOJOSHADER_glDestroyContext(). The lookup function is
+ *  neither stored nor used by MojoShader after this function returns.
  *
  * (profile) is an OpenGL-specific MojoShader profile, which decides how
  *  Direct3D bytecode shaders get turned into OpenGL programs, and how they
@@ -385,14 +385,15 @@
  *  are not thread safe, you should probably only call this from the same
  *  thread that created the GL context.
  */
-MOJOSHADER_glContext *MOJOSHADER_glInit(const char *profile,
+MOJOSHADER_glContext *MOJOSHADER_glCreateContext(const char *profile,
                                         void *(*lookup)(const char *fnname),
                                         MOJOSHADER_malloc m, MOJOSHADER_free f,
                                         void *d);
 
 /*
  * You must call this before using the context that you got from
- *  MOJOSHADER_glInit(), and must use it when you switch to a new GL context.
+ *  MOJOSHADER_glCreateContext(), and must use it when you switch to a new GL
+ *  context.
  *
  * You can only have one MOJOSHADER_glContext per actual GL context, or
  *  undefined behaviour will result.
@@ -419,15 +420,13 @@
  *  buffer. Do not keep the pointer around, either, as it's likely to become
  *  invalid as soon as you call into MojoShader again.
  *
- * This is safe to call even if MOJOSHADER_glInit() failed.
- *
  * This call is NOT thread safe! As most OpenGL implementations are not thread
  *  safe, you should probably only call this from the same thread that created
  *  the GL context.
  *
  * This call does NOT require a valid MOJOSHADER_glContext to have been made
  *  current. The error buffer is shared between contexts, so you can get
- *  error results from a failed MOJOSHADER_glInit().
+ *  error results from a failed MOJOSHADER_glCreateContext().
  */
 const char *MOJOSHADER_glGetError(void);
 
@@ -699,10 +698,10 @@
 /*
  * Deinitialize MojoShader's OpenGL shader management.
  *
- * You must call this once, while your GL context is still current, if you
- *  previously had a successful call to MOJOSHADER_glInit(). This should
- *  be the last MOJOSHADER_gl* function you call until you've initialized
- *  again.
+ * You must call this once, while your GL context (not MojoShader context) is
+ *  still current, if you previously had a successful call to
+ *  MOJOSHADER_glCreateContext(). This should be the last MOJOSHADER_gl*
+ *  function you call until you've prepared a context again.
  *
  * This will clean up resources previously allocated, and may call into the GL.
  *
@@ -718,7 +717,7 @@
  *  are not thread safe, you should probably only call this from the same
  *  thread that created the GL context.
  */
-void MOJOSHADER_glDeinit(MOJOSHADER_glContext *ctx);
+void MOJOSHADER_glDestroyContext(MOJOSHADER_glContext *ctx);
 
 #ifdef __cplusplus
 }
--- a/mojoshader_opengl.c	Mon Apr 28 05:50:02 2008 -0400
+++ b/mojoshader_opengl.c	Mon Apr 28 06:00:37 2008 -0400
@@ -297,7 +297,7 @@
 } // check_extensions
 
 
-MOJOSHADER_glContext *MOJOSHADER_glInit(const char *_profile,
+MOJOSHADER_glContext *MOJOSHADER_glCreateContext(const char *_profile,
                                         void *(*lookup)(const char *fnname),
                                         MOJOSHADER_malloc m, MOJOSHADER_free f,
                                         void *d)
@@ -343,7 +343,7 @@
         f(ctx, d);
     ctx = current_ctx;
     return NULL;
-} // MOJOSHADER_glInit
+} // MOJOSHADER_glCreateContext
 
 
 void MOJOSHADER_glMakeContextCurrent(MOJOSHADER_glContext *_ctx)
@@ -820,7 +820,7 @@
 } // MOJOSHADER_glDeleteShader
 
 
-void MOJOSHADER_glDeinit(MOJOSHADER_glContext *_ctx)
+void MOJOSHADER_glDestroyContext(MOJOSHADER_glContext *_ctx)
 {
     MOJOSHADER_glContext *current_ctx = ctx;
     ctx = _ctx;
@@ -828,7 +828,7 @@
     lookup_entry_points(NULL);
     Free(ctx);
     ctx = ((current_ctx == _ctx) ? NULL : current_ctx);
-} // MOJOSHADER_glDeinit
+} // MOJOSHADER_glDestroyContext
 
 // end of mojoshader_opengl.c ...