Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removing outdated 'opengl' template.

  • Loading branch information...
commit 2bed10089a67cafdd2c7fc216ed0ec79334a22de 1 parent 277ce41
@ginkgo authored
Showing with 0 additions and 344 deletions.
  1. +0 −236 templates/opengl/opengl.c.template
  2. +0 −108 templates/opengl/opengl.h.template
View
236 templates/opengl/opengl.c.template
@@ -1,236 +0,0 @@
-// WARNING: This file was automatically generated
-// Do not edit.
-
-#raw
-#include <opengl.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#end raw
-
-void loadOpenglFunctions(void);
-
-static void open_libgl(void);
-static void close_libgl(void);
-static void *get_proc(const char *proc);
-static void add_extension(const char* extension);
-
-int importOpenGL(void)
-{
- GLint minor, major;
-#if $version.major >= 3
- GLint profile;
- GLint num_extensions;
- int i;
-#else
- const char* p;
- GLubyte* extensions;
- GLubyte* i;
-#end if
-
- open_libgl();
- loadOpenglFunctions();
- close_libgl();
-
-
-#if $version.major >= 3
- glGetIntegerv(GL_MAJOR_VERSION, &major);
- glGetIntegerv(GL_MINOR_VERSION, &minor);
-#else
- p = (const char *) glGetString(GL_VERSION);
- if (!p)
- return GL_FALSE;
- for (major = 0; *p >= '0' && *p <= '9'; p++)
- major = 10 * major + *p - '0';
- for (minor = 0, p++; *p >= '0' && *p <= '9'; p++)
- minor = 10 * minor + *p - '0';
-#end if
-
- if (major < $version.major || (major == $version.major && minor < $version.minor)) {
- fprintf(stderr, "Error: OpenGL version $(version.major).$(version.minor) not supported.\n");
- fprintf(stderr, " Your version is %d.%d.\n", major, minor);
- fprintf(stderr, " Try updating your graphics driver.\n");
- return GL_FALSE;
- }
-
-#if $version.major*10 + $version.minor >= 32 and not $version.core
-
- glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
-
- if ((profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) == 0) {
- fprintf(stderr, "Error: This application requires a compatibility profile\n");
- return GL_FALSE;
- }
-#end if
-
-#if $version.major < 3
- extensions = strdup(glGetString(GL_EXTENSIONS));
- i = extensions;
-
- while (*i != '\0') {
- GLubyte *ext = i;
- while (*i != ' ' && *i != '\0') {
- ++i;
- }
- while (*i == ' ') {
- *i = '\0';
- ++i;
- }
-
- add_extension(ext);
- }
-
- free(extensions);
-#else
- glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
-
- for (i = 0; i < num_extensions; i++) {
- add_extension(glGetStringi(GL_EXTENSIONS, i));
- }
-#end if
-
-#for $extension,$required in $extensions.iteritems()
-#if $required:
- if (!GL_$extension) {
- fprintf(stderr, "Error: OpenGL extension $(extension) not supported.\n");
- fprintf(stderr, " Try updating your graphics driver.\n");
- return GL_FALSE;
- }
-#end if
-#end for
-
- return GL_TRUE;
-}
-
-
-
-void loadOpenglFunctions(void)
-{
- // --- Function pointer loading
-#for $category in $categories
-#if $functions.has_key($category) and len($functions[$category]) > 0 and $category not in ['VERSION_1_0', 'VERSION_1_1','VERSION_1_0_DEPRECATED', 'VERSION_1_1_DEPRECATED' ]
-
- // $category
-
-#for $function in $functions[$category]
- glpf$function.name = (PFNGL$(function.name.upper())PROC)get_proc("gl$function.name");
-#end for
-#end if
-#end for
-}
-
-// ----------------------- Extension flag definitions ----------------------
-#for $extension,$required in $extensions.iteritems()
-int GL_$extension = GL_FALSE;
-#end for
-
-// ----------------- Function pointer definitions ----------------
-
-#for $category in $categories
-#if $functions.has_key($category) and len($functions[$category]) > 0 and $category not in ['VERSION_1_0', 'VERSION_1_1','VERSION_1_0_DEPRECATED', 'VERSION_1_1_DEPRECATED' ]
-#for $function in $functions[$category]
-PFNGL$(function.name.upper())PROC glpf$(function.name) = NULL;
-#end for
-#end if
-#end for
-
-static void add_extension(const char* extension)
-{
-#for $extension,$required in $extensions.iteritems()
- if (strcmp("GL_$(extension)", extension) == 0) {
- GL_$(extension) = GL_TRUE;
- }
-#end for
-}
-
-#raw
-
-// get_proc from Slavomir Kaslev's gl3w.
-
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN 1
-#include <windows.h>
-
-static HMODULE libgl;
-
-static void open_libgl(void)
-{
- libgl = LoadLibraryA("opengl32.dll");
-}
-
-static void close_libgl(void)
-{
- FreeLibrary(libgl);
-}
-
-static void *get_proc(const char *proc)
-{
- void *res;
-
- res = wglGetProcAddress(proc);
- if (!res)
- res = GetProcAddress(libgl, proc);
- return res;
-}
-#elif defined(__APPLE__) || defined(__APPLE_CC__)
-#include <Carbon/Carbon.h>
-
-CFBundleRef bundle;
-CFURLRef bundleURL;
-
-static void open_libgl(void)
-{
- bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
- CFSTR("/System/Library/Frameworks/OpenGL.framework"),
- kCFURLPOSIXPathStyle, true);
-
- bundle = CFBundleCreate(kCFAllocatorDefault, bundleURL);
- assert(bundle != NULL);
-}
-
-static void close_libgl(void)
-{
- CFRelease(bundle);
- CFRelease(bundleURL);
-}
-
-static void *get_proc(const char *proc)
-{
- void *res;
-
- CFStringRef procname = CFStringCreateWithCString(kCFAllocatorDefault, proc,
- kCFStringEncodingASCII);
- res = CFBundleGetFunctionPointerForName(bundle, procname);
- CFRelease(procname);
- return res;
-}
-#else
-#include <dlfcn.h>
-#include <GL/glx.h>
-
-static void *libgl;
-
-static void open_libgl(void)
-{
- libgl = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL);
-}
-
-static void close_libgl(void)
-{
- dlclose(libgl);
-}
-
-static void *get_proc(const char *proc)
-{
- void *res;
-
- res = glXGetProcAddress((const GLubyte *) proc);
- if (!res)
- res = dlsym(libgl, proc);
- return res;
-}
-#endif
-
-#end raw
View
108 templates/opengl/opengl.h.template
@@ -1,108 +0,0 @@
-#raw
-// WARNING: This file was automatically generated
-// Do not edit.
-
-#ifndef __gl_h_
-#define __gl_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Function declaration macros - to move into glplatform.h */
-
-#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
-#define WIN32_LEAN_AND_MEAN 1
-#include <windows.h>
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY
-#endif
-#ifndef APIENTRYP
-#define APIENTRYP APIENTRY *
-#endif
-#ifndef GLAPI
-#define GLAPI extern
-#endif
-
-#end raw
-
-//-------------------------------- DATA TYPES -------------------------------//
-
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef void GLvoid;
-typedef signed char GLbyte; /* 1-byte signed */
-typedef short GLshort; /* 2-byte signed */
-typedef int GLint; /* 4-byte signed */
-typedef unsigned char GLubyte; /* 1-byte unsigned */
-typedef unsigned short GLushort; /* 2-byte unsigned */
-typedef unsigned int GLuint; /* 4-byte unsigned */
-typedef int GLsizei; /* 4-byte signed */
-typedef float GLfloat; /* single precision float */
-typedef float GLclampf; /* single precision float in [0,1] */
-typedef double GLdouble; /* double precision float */
-typedef double GLclampd; /* double precision float in [0,1] */
-
-//--------------------------------- PASSTHRU --------------------------------//
-
-$passthru
-
-//----------------------------------- ENUMS ---------------------------------//
-
-#for $enum,$value in $enums
-#define GL_$enum $(' ' * ($longest_enum-len($enum))) ${"0x%x" % ($value)}
-#end for
-//------------------------ FUNCTION PROTOTYPES -----------------------------//
-
-#for $category in $categories
-#if $functions.has_key($category) and len($functions[$category]) > 0
-
-// $category
-
-#if $category in ['VERSION_1_0', 'VERSION_1_1','VERSION_1_0_DEPRECATED', 'VERSION_1_1_DEPRECATED' ]
-#for $function in $functions[$category]
-GLAPI $(function.returntype) APIENTRY gl$(function.name) ($(', '.join(['%s %s' % (type,name) for name, type in $function.params])));
-#end for
-#else
-#for $function in $functions[$category]
-typedef $(function.returntype) (APIENTRYP PFNGL$(function.name.upper())PROC)($(', '.join(['%s %s' % (type,name) for name, type in $function.params])));
-#end for
-
-#for $function in $functions[$category]
-GLAPI PFNGL$(function.name.upper())PROC glpf$function.name;
-#end for
-
-#for $function in $functions[$category]
-#define gl$function.name glpf$function.name
-#end for
-#end if
-#end if
-#end for
-
-#for $category in $categories
-#define GL_$category 1
-#end for
-
-
-// ------------------ Flags for optional extensions ----------------
-
-#for $extension,$required in $extensions.iteritems()
-extern int GL_$extension;
-#end for
-
-int importOpenGL(void);
-
-#define OPENGL_MAJOR_VERSION $(version.major)
-#define OPENGL_MINOR_VERSION $(version.minor)
-#define OPENGL_CORE_PROFILE $(1 if $version.core else 0)
-
-#ifdef __cplusplus
-}
-#endif
-
-
-
-#endif /* __gl_h_ */
Please sign in to comment.
Something went wrong with that request. Please try again.