linux fixes, bugfixes, comments

This commit is contained in:
Irlan Robson
2016-12-21 19:15:43 -02:00
parent 1672673839
commit 81f744b805
149 changed files with 2371 additions and 3413 deletions

View File

@ -636,7 +636,7 @@ GLAPI int gladLoadGL(void);
GLAPI int gladLoadGLLoader(GLADloadproc);
#include <stddef.h>
//#include <KHR\khrplatform.h>
//#include <KHR/khrplatform.h>
#include <glad/khrplatform.h>
#ifndef GLEXT_64_TYPES_DEFINED
/* This code block is duplicated in glxext.h, so must be protected */

312
external/glad/glad_glx.c vendored Normal file
View File

@ -0,0 +1,312 @@
/*
GLX loader generated by glad 0.1.12a0 on Tue Dec 20 17:04:11 2016.
Language/Generator: C/C++
Specification: glx
APIs: glx=1.4
Profile: -
Extensions:
Loader: True
Local files: False
Omit khrplatform: False
Commandline:
--api="glx=1.4" --generator="c" --spec="glx" --extensions=""
Online:
http://glad.dav1d.de/#language=c&specification=glx&loader=on&api=glx%3D1.4
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glad/glad_glx.h>
static void* get_proc(const char *namez);
#ifdef _WIN32
#include <windows.h>
static HMODULE libGL;
typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);
PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
static
int open_gl(void) {
libGL = LoadLibraryW(L"opengl32.dll");
if(libGL != NULL) {
gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress(
libGL, "wglGetProcAddress");
return gladGetProcAddressPtr != NULL;
}
return 0;
}
static
void close_gl(void) {
if(libGL != NULL) {
FreeLibrary(libGL);
libGL = NULL;
}
}
#else
#include <dlfcn.h>
static void* libGL;
#ifndef __APPLE__
typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);
PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
#endif
static
int open_gl(void) {
#ifdef __APPLE__
static const char *NAMES[] = {
"../Frameworks/OpenGL.framework/OpenGL",
"/Library/Frameworks/OpenGL.framework/OpenGL",
"/System/Library/Frameworks/OpenGL.framework/OpenGL",
"/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
};
#else
static const char *NAMES[] = {"libGL.so.1", "libGL.so"};
#endif
unsigned int index = 0;
for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) {
libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL);
if(libGL != NULL) {
#ifdef __APPLE__
return 1;
#else
gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL,
"glXGetProcAddressARB");
return gladGetProcAddressPtr != NULL;
#endif
}
}
return 0;
}
static
void close_gl() {
if(libGL != NULL) {
dlclose(libGL);
libGL = NULL;
}
}
#endif
static
void* get_proc(const char *namez) {
void* result = NULL;
if(libGL == NULL) return NULL;
#ifndef __APPLE__
if(gladGetProcAddressPtr != NULL) {
result = gladGetProcAddressPtr(namez);
}
#endif
if(result == NULL) {
#ifdef _WIN32
result = (void*)GetProcAddress(libGL, namez);
#else
result = dlsym(libGL, namez);
#endif
}
return result;
}
int gladLoadGLX(Display *dpy, int screen) {
int status = 0;
if(open_gl()) {
status = gladLoadGLXLoader((GLADloadproc)get_proc, dpy, screen);
close_gl();
}
return status;
}
static Display *GLADGLXDisplay = 0;
static int GLADGLXscreen = 0;
static int get_exts(void) {
return 1;
}
static void free_exts(void) {
return;
}
static int has_ext(const char *ext) {
const char *terminator;
const char *loc;
const char *extensions;
if(!GLAD_GLX_VERSION_1_1)
return 0;
extensions = glXQueryExtensionsString(GLADGLXDisplay, GLADGLXscreen);
if(extensions == NULL || ext == NULL)
return 0;
while(1) {
loc = strstr(extensions, ext);
if(loc == NULL)
break;
terminator = loc + strlen(ext);
if((loc == extensions || *(loc - 1) == ' ') &&
(*terminator == ' ' || *terminator == '\0'))
{
return 1;
}
extensions = terminator;
}
return 0;
}
int GLAD_GLX_VERSION_1_0;
int GLAD_GLX_VERSION_1_1;
int GLAD_GLX_VERSION_1_2;
int GLAD_GLX_VERSION_1_3;
int GLAD_GLX_VERSION_1_4;
PFNGLXGETSELECTEDEVENTPROC glad_glXGetSelectedEvent;
PFNGLXQUERYEXTENSIONPROC glad_glXQueryExtension;
PFNGLXMAKECURRENTPROC glad_glXMakeCurrent;
PFNGLXSELECTEVENTPROC glad_glXSelectEvent;
PFNGLXCREATECONTEXTPROC glad_glXCreateContext;
PFNGLXCREATEGLXPIXMAPPROC glad_glXCreateGLXPixmap;
PFNGLXQUERYVERSIONPROC glad_glXQueryVersion;
PFNGLXGETCURRENTREADDRAWABLEPROC glad_glXGetCurrentReadDrawable;
PFNGLXDESTROYPIXMAPPROC glad_glXDestroyPixmap;
PFNGLXGETCURRENTCONTEXTPROC glad_glXGetCurrentContext;
PFNGLXGETPROCADDRESSPROC glad_glXGetProcAddress;
PFNGLXWAITGLPROC glad_glXWaitGL;
PFNGLXISDIRECTPROC glad_glXIsDirect;
PFNGLXDESTROYWINDOWPROC glad_glXDestroyWindow;
PFNGLXCREATEWINDOWPROC glad_glXCreateWindow;
PFNGLXCOPYCONTEXTPROC glad_glXCopyContext;
PFNGLXCREATEPBUFFERPROC glad_glXCreatePbuffer;
PFNGLXSWAPBUFFERSPROC glad_glXSwapBuffers;
PFNGLXGETCURRENTDISPLAYPROC glad_glXGetCurrentDisplay;
PFNGLXGETCURRENTDRAWABLEPROC glad_glXGetCurrentDrawable;
PFNGLXQUERYCONTEXTPROC glad_glXQueryContext;
PFNGLXCHOOSEVISUALPROC glad_glXChooseVisual;
PFNGLXQUERYSERVERSTRINGPROC glad_glXQueryServerString;
PFNGLXDESTROYCONTEXTPROC glad_glXDestroyContext;
PFNGLXDESTROYGLXPIXMAPPROC glad_glXDestroyGLXPixmap;
PFNGLXGETFBCONFIGATTRIBPROC glad_glXGetFBConfigAttrib;
PFNGLXUSEXFONTPROC glad_glXUseXFont;
PFNGLXDESTROYPBUFFERPROC glad_glXDestroyPbuffer;
PFNGLXCHOOSEFBCONFIGPROC glad_glXChooseFBConfig;
PFNGLXCREATENEWCONTEXTPROC glad_glXCreateNewContext;
PFNGLXMAKECONTEXTCURRENTPROC glad_glXMakeContextCurrent;
PFNGLXGETCONFIGPROC glad_glXGetConfig;
PFNGLXGETFBCONFIGSPROC glad_glXGetFBConfigs;
PFNGLXCREATEPIXMAPPROC glad_glXCreatePixmap;
PFNGLXWAITXPROC glad_glXWaitX;
PFNGLXGETVISUALFROMFBCONFIGPROC glad_glXGetVisualFromFBConfig;
PFNGLXQUERYDRAWABLEPROC glad_glXQueryDrawable;
PFNGLXQUERYEXTENSIONSSTRINGPROC glad_glXQueryExtensionsString;
PFNGLXGETCLIENTSTRINGPROC glad_glXGetClientString;
static void load_GLX_VERSION_1_0(GLADloadproc load) {
if(!GLAD_GLX_VERSION_1_0) return;
glad_glXChooseVisual = (PFNGLXCHOOSEVISUALPROC)load("glXChooseVisual");
glad_glXCreateContext = (PFNGLXCREATECONTEXTPROC)load("glXCreateContext");
glad_glXDestroyContext = (PFNGLXDESTROYCONTEXTPROC)load("glXDestroyContext");
glad_glXMakeCurrent = (PFNGLXMAKECURRENTPROC)load("glXMakeCurrent");
glad_glXCopyContext = (PFNGLXCOPYCONTEXTPROC)load("glXCopyContext");
glad_glXSwapBuffers = (PFNGLXSWAPBUFFERSPROC)load("glXSwapBuffers");
glad_glXCreateGLXPixmap = (PFNGLXCREATEGLXPIXMAPPROC)load("glXCreateGLXPixmap");
glad_glXDestroyGLXPixmap = (PFNGLXDESTROYGLXPIXMAPPROC)load("glXDestroyGLXPixmap");
glad_glXQueryExtension = (PFNGLXQUERYEXTENSIONPROC)load("glXQueryExtension");
glad_glXQueryVersion = (PFNGLXQUERYVERSIONPROC)load("glXQueryVersion");
glad_glXIsDirect = (PFNGLXISDIRECTPROC)load("glXIsDirect");
glad_glXGetConfig = (PFNGLXGETCONFIGPROC)load("glXGetConfig");
glad_glXGetCurrentContext = (PFNGLXGETCURRENTCONTEXTPROC)load("glXGetCurrentContext");
glad_glXGetCurrentDrawable = (PFNGLXGETCURRENTDRAWABLEPROC)load("glXGetCurrentDrawable");
glad_glXWaitGL = (PFNGLXWAITGLPROC)load("glXWaitGL");
glad_glXWaitX = (PFNGLXWAITXPROC)load("glXWaitX");
glad_glXUseXFont = (PFNGLXUSEXFONTPROC)load("glXUseXFont");
}
static void load_GLX_VERSION_1_1(GLADloadproc load) {
if(!GLAD_GLX_VERSION_1_1) return;
glad_glXQueryExtensionsString = (PFNGLXQUERYEXTENSIONSSTRINGPROC)load("glXQueryExtensionsString");
glad_glXQueryServerString = (PFNGLXQUERYSERVERSTRINGPROC)load("glXQueryServerString");
glad_glXGetClientString = (PFNGLXGETCLIENTSTRINGPROC)load("glXGetClientString");
}
static void load_GLX_VERSION_1_2(GLADloadproc load) {
if(!GLAD_GLX_VERSION_1_2) return;
glad_glXGetCurrentDisplay = (PFNGLXGETCURRENTDISPLAYPROC)load("glXGetCurrentDisplay");
}
static void load_GLX_VERSION_1_3(GLADloadproc load) {
if(!GLAD_GLX_VERSION_1_3) return;
glad_glXGetFBConfigs = (PFNGLXGETFBCONFIGSPROC)load("glXGetFBConfigs");
glad_glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)load("glXChooseFBConfig");
glad_glXGetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)load("glXGetFBConfigAttrib");
glad_glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)load("glXGetVisualFromFBConfig");
glad_glXCreateWindow = (PFNGLXCREATEWINDOWPROC)load("glXCreateWindow");
glad_glXDestroyWindow = (PFNGLXDESTROYWINDOWPROC)load("glXDestroyWindow");
glad_glXCreatePixmap = (PFNGLXCREATEPIXMAPPROC)load("glXCreatePixmap");
glad_glXDestroyPixmap = (PFNGLXDESTROYPIXMAPPROC)load("glXDestroyPixmap");
glad_glXCreatePbuffer = (PFNGLXCREATEPBUFFERPROC)load("glXCreatePbuffer");
glad_glXDestroyPbuffer = (PFNGLXDESTROYPBUFFERPROC)load("glXDestroyPbuffer");
glad_glXQueryDrawable = (PFNGLXQUERYDRAWABLEPROC)load("glXQueryDrawable");
glad_glXCreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)load("glXCreateNewContext");
glad_glXMakeContextCurrent = (PFNGLXMAKECONTEXTCURRENTPROC)load("glXMakeContextCurrent");
glad_glXGetCurrentReadDrawable = (PFNGLXGETCURRENTREADDRAWABLEPROC)load("glXGetCurrentReadDrawable");
glad_glXQueryContext = (PFNGLXQUERYCONTEXTPROC)load("glXQueryContext");
glad_glXSelectEvent = (PFNGLXSELECTEVENTPROC)load("glXSelectEvent");
glad_glXGetSelectedEvent = (PFNGLXGETSELECTEDEVENTPROC)load("glXGetSelectedEvent");
}
static void load_GLX_VERSION_1_4(GLADloadproc load) {
if(!GLAD_GLX_VERSION_1_4) return;
glad_glXGetProcAddress = (PFNGLXGETPROCADDRESSPROC)load("glXGetProcAddress");
}
static int find_extensionsGLX(void) {
if (!get_exts()) return 0;
free_exts();
return 1;
}
static void find_coreGLX(Display *dpy, int screen) {
int major = 0, minor = 0;
if(dpy == 0 && GLADGLXDisplay == 0) {
dpy = XOpenDisplay(0);
screen = XScreenNumberOfScreen(XDefaultScreenOfDisplay(dpy));
} else if(dpy == 0) {
dpy = GLADGLXDisplay;
screen = GLADGLXscreen;
}
glXQueryVersion(dpy, &major, &minor);
GLADGLXDisplay = dpy;
GLADGLXscreen = screen;
GLAD_GLX_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
GLAD_GLX_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
GLAD_GLX_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
GLAD_GLX_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
GLAD_GLX_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
}
int gladLoadGLXLoader(GLADloadproc load, Display *dpy, int screen) {
glXQueryVersion = (PFNGLXQUERYVERSIONPROC)load("glXQueryVersion");
if(glXQueryVersion == NULL) return 0;
find_coreGLX(dpy, screen);
load_GLX_VERSION_1_0(load);
load_GLX_VERSION_1_1(load);
load_GLX_VERSION_1_2(load);
load_GLX_VERSION_1_3(load);
load_GLX_VERSION_1_4(load);
if (!find_extensionsGLX()) return 0;
return 1;
}

433
external/glad/glad_glx.h vendored Normal file
View File

@ -0,0 +1,433 @@
/*
GLX loader generated by glad 0.1.12a0 on Tue Dec 20 17:04:11 2016.
Language/Generator: C/C++
Specification: glx
APIs: glx=1.4
Profile: -
Extensions:
Loader: True
Local files: False
Omit khrplatform: False
Commandline:
--api="glx=1.4" --generator="c" --spec="glx" --extensions=""
Online:
http://glad.dav1d.de/#language=c&specification=glx&loader=on&api=glx%3D1.4
*/
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <glad/glad.h>
#ifndef __glad_glxext_h_
#ifdef __glxext_h_
#error GLX header already included, remove this include, glad already provides it
#endif
#define __glad_glxext_h_
#define __glxext_h_
#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef APIENTRYP
#define APIENTRYP APIENTRY *
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef void* (* GLADloadproc)(const char *name);
#ifndef GLAPI
# if defined(GLAD_GLAPI_EXPORT)
# if defined(WIN32) || defined(__CYGWIN__)
# if defined(GLAD_GLAPI_EXPORT_BUILD)
# if defined(__GNUC__)
# define GLAPI __attribute__ ((dllexport)) extern
# else
# define GLAPI __declspec(dllexport) extern
# endif
# else
# if defined(__GNUC__)
# define GLAPI __attribute__ ((dllimport)) extern
# else
# define GLAPI __declspec(dllimport) extern
# endif
# endif
# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD)
# define GLAPI __attribute__ ((visibility ("default"))) extern
# else
# define GLAPI extern
# endif
# else
# define GLAPI extern
# endif
#endif
GLAPI int gladLoadGLX(Display *dpy, int screen);
GLAPI int gladLoadGLXLoader(GLADloadproc, Display *dpy, int screen);
#ifndef GLEXT_64_TYPES_DEFINED
/* This code block is duplicated in glext.h, so must be protected */
#define GLEXT_64_TYPES_DEFINED
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
/* (as used in the GLX_OML_sync_control extension). */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
#elif defined(__sun__) || defined(__digital__)
#include <inttypes.h>
#if defined(__STDC__)
#if defined(__arch64__) || defined(_LP64)
typedef long int int64_t;
typedef unsigned long int uint64_t;
#else
typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#endif /* __arch64__ */
#endif /* __STDC__ */
#elif defined( __VMS ) || defined(__sgi)
#include <inttypes.h>
#elif defined(__SCO__) || defined(__USLC__)
#include <stdint.h>
#elif defined(__UNIXOS2__) || defined(__SOL64__)
typedef long int int32_t;
typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#elif defined(_WIN32) && defined(__GNUC__)
#include <stdint.h>
#elif defined(_WIN32)
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
/* Fallback if nothing above works */
#include <inttypes.h>
#endif
#endif
typedef XID GLXFBConfigID;
typedef struct __GLXFBConfigRec *GLXFBConfig;
typedef XID GLXContextID;
typedef struct __GLXcontextRec *GLXContext;
typedef XID GLXPixmap;
typedef XID GLXDrawable;
typedef XID GLXWindow;
typedef XID GLXPbuffer;
typedef void (APIENTRY *__GLXextFuncPtr)(void);
typedef XID GLXVideoCaptureDeviceNV;
typedef unsigned int GLXVideoDeviceNV;
typedef XID GLXVideoSourceSGIX;
typedef XID GLXFBConfigIDSGIX;
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
typedef XID GLXPbufferSGIX;
typedef struct {
int event_type; /* GLX_DAMAGED or GLX_SAVED */
int draw_type; /* GLX_WINDOW or GLX_PBUFFER */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came for SendEvent request */
Display *display; /* display the event was read from */
GLXDrawable drawable; /* XID of Drawable */
unsigned int buffer_mask; /* mask indicating which buffers are affected */
unsigned int aux_buffer; /* which aux buffer was affected */
int x, y;
int width, height;
int count; /* if nonzero, at least this many more */
} GLXPbufferClobberEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
GLXDrawable drawable; /* drawable on which event was requested in event mask */
int event_type;
int64_t ust;
int64_t msc;
int64_t sbc;
} GLXBufferSwapComplete;
typedef union __GLXEvent {
GLXPbufferClobberEvent glxpbufferclobber;
GLXBufferSwapComplete glxbufferswapcomplete;
long pad[24];
} GLXEvent;
typedef struct {
int type;
unsigned long serial;
Bool send_event;
Display *display;
int extension;
int evtype;
GLXDrawable window;
Bool stereo_tree;
} GLXStereoNotifyEventEXT;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came for SendEvent request */
Display *display; /* display the event was read from */
GLXDrawable drawable; /* i.d. of Drawable */
int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */
int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */
unsigned int mask; /* mask indicating which buffers are affected*/
int x, y;
int width, height;
int count; /* if nonzero, at least this many more */
} GLXBufferClobberEventSGIX;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int networkId;
} GLXHyperpipeNetworkSGIX;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int channel;
unsigned int participationType;
int timeSlice;
} GLXHyperpipeConfigSGIX;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
int destXOrigin, destYOrigin, destWidth, destHeight;
} GLXPipeRect;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int XOrigin, YOrigin, maxHeight, maxWidth;
} GLXPipeRectLimits;
#define GLX_EXTENSION_NAME "GLX"
#define GLX_PbufferClobber 0
#define GLX_BufferSwapComplete 1
#define __GLX_NUMBER_EVENTS 17
#define GLX_BAD_SCREEN 1
#define GLX_BAD_ATTRIBUTE 2
#define GLX_NO_EXTENSION 3
#define GLX_BAD_VISUAL 4
#define GLX_BAD_CONTEXT 5
#define GLX_BAD_VALUE 6
#define GLX_BAD_ENUM 7
#define GLX_USE_GL 1
#define GLX_BUFFER_SIZE 2
#define GLX_LEVEL 3
#define GLX_RGBA 4
#define GLX_DOUBLEBUFFER 5
#define GLX_STEREO 6
#define GLX_AUX_BUFFERS 7
#define GLX_RED_SIZE 8
#define GLX_GREEN_SIZE 9
#define GLX_BLUE_SIZE 10
#define GLX_ALPHA_SIZE 11
#define GLX_DEPTH_SIZE 12
#define GLX_STENCIL_SIZE 13
#define GLX_ACCUM_RED_SIZE 14
#define GLX_ACCUM_GREEN_SIZE 15
#define GLX_ACCUM_BLUE_SIZE 16
#define GLX_ACCUM_ALPHA_SIZE 17
#define GLX_VENDOR 0x1
#define GLX_VERSION 0x2
#define GLX_EXTENSIONS 0x3
#define GLX_WINDOW_BIT 0x00000001
#define GLX_PIXMAP_BIT 0x00000002
#define GLX_PBUFFER_BIT 0x00000004
#define GLX_RGBA_BIT 0x00000001
#define GLX_COLOR_INDEX_BIT 0x00000002
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
#define GLX_AUX_BUFFERS_BIT 0x00000010
#define GLX_DEPTH_BUFFER_BIT 0x00000020
#define GLX_STENCIL_BUFFER_BIT 0x00000040
#define GLX_ACCUM_BUFFER_BIT 0x00000080
#define GLX_CONFIG_CAVEAT 0x20
#define GLX_X_VISUAL_TYPE 0x22
#define GLX_TRANSPARENT_TYPE 0x23
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
#define GLX_TRANSPARENT_RED_VALUE 0x25
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
#define GLX_DONT_CARE 0xFFFFFFFF
#define GLX_NONE 0x8000
#define GLX_SLOW_CONFIG 0x8001
#define GLX_TRUE_COLOR 0x8002
#define GLX_DIRECT_COLOR 0x8003
#define GLX_PSEUDO_COLOR 0x8004
#define GLX_STATIC_COLOR 0x8005
#define GLX_GRAY_SCALE 0x8006
#define GLX_STATIC_GRAY 0x8007
#define GLX_TRANSPARENT_RGB 0x8008
#define GLX_TRANSPARENT_INDEX 0x8009
#define GLX_VISUAL_ID 0x800B
#define GLX_SCREEN 0x800C
#define GLX_NON_CONFORMANT_CONFIG 0x800D
#define GLX_DRAWABLE_TYPE 0x8010
#define GLX_RENDER_TYPE 0x8011
#define GLX_X_RENDERABLE 0x8012
#define GLX_FBCONFIG_ID 0x8013
#define GLX_RGBA_TYPE 0x8014
#define GLX_COLOR_INDEX_TYPE 0x8015
#define GLX_MAX_PBUFFER_WIDTH 0x8016
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
#define GLX_MAX_PBUFFER_PIXELS 0x8018
#define GLX_PRESERVED_CONTENTS 0x801B
#define GLX_LARGEST_PBUFFER 0x801C
#define GLX_WIDTH 0x801D
#define GLX_HEIGHT 0x801E
#define GLX_EVENT_MASK 0x801F
#define GLX_DAMAGED 0x8020
#define GLX_SAVED 0x8021
#define GLX_WINDOW 0x8022
#define GLX_PBUFFER 0x8023
#define GLX_PBUFFER_HEIGHT 0x8040
#define GLX_PBUFFER_WIDTH 0x8041
#define GLX_SAMPLE_BUFFERS 100000
#define GLX_SAMPLES 100001
#ifndef GLX_VERSION_1_0
#define GLX_VERSION_1_0 1
GLAPI int GLAD_GLX_VERSION_1_0;
typedef XVisualInfo * (APIENTRYP PFNGLXCHOOSEVISUALPROC)(Display *dpy, int screen, int *attribList);
GLAPI PFNGLXCHOOSEVISUALPROC glad_glXChooseVisual;
#define glXChooseVisual glad_glXChooseVisual
typedef GLXContext (APIENTRYP PFNGLXCREATECONTEXTPROC)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
GLAPI PFNGLXCREATECONTEXTPROC glad_glXCreateContext;
#define glXCreateContext glad_glXCreateContext
typedef void (APIENTRYP PFNGLXDESTROYCONTEXTPROC)(Display *dpy, GLXContext ctx);
GLAPI PFNGLXDESTROYCONTEXTPROC glad_glXDestroyContext;
#define glXDestroyContext glad_glXDestroyContext
typedef Bool (APIENTRYP PFNGLXMAKECURRENTPROC)(Display *dpy, GLXDrawable drawable, GLXContext ctx);
GLAPI PFNGLXMAKECURRENTPROC glad_glXMakeCurrent;
#define glXMakeCurrent glad_glXMakeCurrent
typedef void (APIENTRYP PFNGLXCOPYCONTEXTPROC)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
GLAPI PFNGLXCOPYCONTEXTPROC glad_glXCopyContext;
#define glXCopyContext glad_glXCopyContext
typedef void (APIENTRYP PFNGLXSWAPBUFFERSPROC)(Display *dpy, GLXDrawable drawable);
GLAPI PFNGLXSWAPBUFFERSPROC glad_glXSwapBuffers;
#define glXSwapBuffers glad_glXSwapBuffers
typedef GLXPixmap (APIENTRYP PFNGLXCREATEGLXPIXMAPPROC)(Display *dpy, XVisualInfo *visual, Pixmap pixmap);
GLAPI PFNGLXCREATEGLXPIXMAPPROC glad_glXCreateGLXPixmap;
#define glXCreateGLXPixmap glad_glXCreateGLXPixmap
typedef void (APIENTRYP PFNGLXDESTROYGLXPIXMAPPROC)(Display *dpy, GLXPixmap pixmap);
GLAPI PFNGLXDESTROYGLXPIXMAPPROC glad_glXDestroyGLXPixmap;
#define glXDestroyGLXPixmap glad_glXDestroyGLXPixmap
typedef Bool (APIENTRYP PFNGLXQUERYEXTENSIONPROC)(Display *dpy, int *errorb, int *event);
GLAPI PFNGLXQUERYEXTENSIONPROC glad_glXQueryExtension;
#define glXQueryExtension glad_glXQueryExtension
typedef Bool (APIENTRYP PFNGLXQUERYVERSIONPROC)(Display *dpy, int *maj, int *min);
GLAPI PFNGLXQUERYVERSIONPROC glad_glXQueryVersion;
#define glXQueryVersion glad_glXQueryVersion
typedef Bool (APIENTRYP PFNGLXISDIRECTPROC)(Display *dpy, GLXContext ctx);
GLAPI PFNGLXISDIRECTPROC glad_glXIsDirect;
#define glXIsDirect glad_glXIsDirect
typedef int (APIENTRYP PFNGLXGETCONFIGPROC)(Display *dpy, XVisualInfo *visual, int attrib, int *value);
GLAPI PFNGLXGETCONFIGPROC glad_glXGetConfig;
#define glXGetConfig glad_glXGetConfig
typedef GLXContext (APIENTRYP PFNGLXGETCURRENTCONTEXTPROC)();
GLAPI PFNGLXGETCURRENTCONTEXTPROC glad_glXGetCurrentContext;
#define glXGetCurrentContext glad_glXGetCurrentContext
typedef GLXDrawable (APIENTRYP PFNGLXGETCURRENTDRAWABLEPROC)();
GLAPI PFNGLXGETCURRENTDRAWABLEPROC glad_glXGetCurrentDrawable;
#define glXGetCurrentDrawable glad_glXGetCurrentDrawable
typedef void (APIENTRYP PFNGLXWAITGLPROC)();
GLAPI PFNGLXWAITGLPROC glad_glXWaitGL;
#define glXWaitGL glad_glXWaitGL
typedef void (APIENTRYP PFNGLXWAITXPROC)();
GLAPI PFNGLXWAITXPROC glad_glXWaitX;
#define glXWaitX glad_glXWaitX
typedef void (APIENTRYP PFNGLXUSEXFONTPROC)(Font font, int first, int count, int list);
GLAPI PFNGLXUSEXFONTPROC glad_glXUseXFont;
#define glXUseXFont glad_glXUseXFont
#endif
#ifndef GLX_VERSION_1_1
#define GLX_VERSION_1_1 1
GLAPI int GLAD_GLX_VERSION_1_1;
typedef const char * (APIENTRYP PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display *dpy, int screen);
GLAPI PFNGLXQUERYEXTENSIONSSTRINGPROC glad_glXQueryExtensionsString;
#define glXQueryExtensionsString glad_glXQueryExtensionsString
typedef const char * (APIENTRYP PFNGLXQUERYSERVERSTRINGPROC)(Display *dpy, int screen, int name);
GLAPI PFNGLXQUERYSERVERSTRINGPROC glad_glXQueryServerString;
#define glXQueryServerString glad_glXQueryServerString
typedef const char * (APIENTRYP PFNGLXGETCLIENTSTRINGPROC)(Display *dpy, int name);
GLAPI PFNGLXGETCLIENTSTRINGPROC glad_glXGetClientString;
#define glXGetClientString glad_glXGetClientString
#endif
#ifndef GLX_VERSION_1_2
#define GLX_VERSION_1_2 1
GLAPI int GLAD_GLX_VERSION_1_2;
typedef Display * (APIENTRYP PFNGLXGETCURRENTDISPLAYPROC)();
GLAPI PFNGLXGETCURRENTDISPLAYPROC glad_glXGetCurrentDisplay;
#define glXGetCurrentDisplay glad_glXGetCurrentDisplay
#endif
#ifndef GLX_VERSION_1_3
#define GLX_VERSION_1_3 1
GLAPI int GLAD_GLX_VERSION_1_3;
typedef GLXFBConfig * (APIENTRYP PFNGLXGETFBCONFIGSPROC)(Display *dpy, int screen, int *nelements);
GLAPI PFNGLXGETFBCONFIGSPROC glad_glXGetFBConfigs;
#define glXGetFBConfigs glad_glXGetFBConfigs
typedef GLXFBConfig * (APIENTRYP PFNGLXCHOOSEFBCONFIGPROC)(Display *dpy, int screen, const int *attrib_list, int *nelements);
GLAPI PFNGLXCHOOSEFBCONFIGPROC glad_glXChooseFBConfig;
#define glXChooseFBConfig glad_glXChooseFBConfig
typedef int (APIENTRYP PFNGLXGETFBCONFIGATTRIBPROC)(Display *dpy, GLXFBConfig config, int attribute, int *value);
GLAPI PFNGLXGETFBCONFIGATTRIBPROC glad_glXGetFBConfigAttrib;
#define glXGetFBConfigAttrib glad_glXGetFBConfigAttrib
typedef XVisualInfo * (APIENTRYP PFNGLXGETVISUALFROMFBCONFIGPROC)(Display *dpy, GLXFBConfig config);
GLAPI PFNGLXGETVISUALFROMFBCONFIGPROC glad_glXGetVisualFromFBConfig;
#define glXGetVisualFromFBConfig glad_glXGetVisualFromFBConfig
typedef GLXWindow (APIENTRYP PFNGLXCREATEWINDOWPROC)(Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
GLAPI PFNGLXCREATEWINDOWPROC glad_glXCreateWindow;
#define glXCreateWindow glad_glXCreateWindow
typedef void (APIENTRYP PFNGLXDESTROYWINDOWPROC)(Display *dpy, GLXWindow win);
GLAPI PFNGLXDESTROYWINDOWPROC glad_glXDestroyWindow;
#define glXDestroyWindow glad_glXDestroyWindow
typedef GLXPixmap (APIENTRYP PFNGLXCREATEPIXMAPPROC)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
GLAPI PFNGLXCREATEPIXMAPPROC glad_glXCreatePixmap;
#define glXCreatePixmap glad_glXCreatePixmap
typedef void (APIENTRYP PFNGLXDESTROYPIXMAPPROC)(Display *dpy, GLXPixmap pixmap);
GLAPI PFNGLXDESTROYPIXMAPPROC glad_glXDestroyPixmap;
#define glXDestroyPixmap glad_glXDestroyPixmap
typedef GLXPbuffer (APIENTRYP PFNGLXCREATEPBUFFERPROC)(Display *dpy, GLXFBConfig config, const int *attrib_list);
GLAPI PFNGLXCREATEPBUFFERPROC glad_glXCreatePbuffer;
#define glXCreatePbuffer glad_glXCreatePbuffer
typedef void (APIENTRYP PFNGLXDESTROYPBUFFERPROC)(Display *dpy, GLXPbuffer pbuf);
GLAPI PFNGLXDESTROYPBUFFERPROC glad_glXDestroyPbuffer;
#define glXDestroyPbuffer glad_glXDestroyPbuffer
typedef void (APIENTRYP PFNGLXQUERYDRAWABLEPROC)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
GLAPI PFNGLXQUERYDRAWABLEPROC glad_glXQueryDrawable;
#define glXQueryDrawable glad_glXQueryDrawable
typedef GLXContext (APIENTRYP PFNGLXCREATENEWCONTEXTPROC)(Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
GLAPI PFNGLXCREATENEWCONTEXTPROC glad_glXCreateNewContext;
#define glXCreateNewContext glad_glXCreateNewContext
typedef Bool (APIENTRYP PFNGLXMAKECONTEXTCURRENTPROC)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
GLAPI PFNGLXMAKECONTEXTCURRENTPROC glad_glXMakeContextCurrent;
#define glXMakeContextCurrent glad_glXMakeContextCurrent
typedef GLXDrawable (APIENTRYP PFNGLXGETCURRENTREADDRAWABLEPROC)();
GLAPI PFNGLXGETCURRENTREADDRAWABLEPROC glad_glXGetCurrentReadDrawable;
#define glXGetCurrentReadDrawable glad_glXGetCurrentReadDrawable
typedef int (APIENTRYP PFNGLXQUERYCONTEXTPROC)(Display *dpy, GLXContext ctx, int attribute, int *value);
GLAPI PFNGLXQUERYCONTEXTPROC glad_glXQueryContext;
#define glXQueryContext glad_glXQueryContext
typedef void (APIENTRYP PFNGLXSELECTEVENTPROC)(Display *dpy, GLXDrawable draw, unsigned long event_mask);
GLAPI PFNGLXSELECTEVENTPROC glad_glXSelectEvent;
#define glXSelectEvent glad_glXSelectEvent
typedef void (APIENTRYP PFNGLXGETSELECTEDEVENTPROC)(Display *dpy, GLXDrawable draw, unsigned long *event_mask);
GLAPI PFNGLXGETSELECTEDEVENTPROC glad_glXGetSelectedEvent;
#define glXGetSelectedEvent glad_glXGetSelectedEvent
#endif
#ifndef GLX_VERSION_1_4
#define GLX_VERSION_1_4 1
GLAPI int GLAD_GLX_VERSION_1_4;
typedef __GLXextFuncPtr (APIENTRYP PFNGLXGETPROCADDRESSPROC)(const GLubyte *procName);
GLAPI PFNGLXGETPROCADDRESSPROC glad_glXGetProcAddress;
#define glXGetProcAddress glad_glXGetProcAddress
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,121 +0,0 @@
add_definitions(-D_GLFW_USE_CONFIG_H)
set(common_HEADERS internal.h
"${GLFW_BINARY_DIR}/src/glfw_config.h"
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
set(common_SOURCES context.c init.c input.c monitor.c vulkan.c window.c)
if (_GLFW_COCOA)
set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h cocoa_joystick.h
posix_tls.h nsgl_context.h)
set(glfw_SOURCES ${common_SOURCES} cocoa_init.m cocoa_joystick.m
cocoa_monitor.m cocoa_window.m cocoa_time.c posix_tls.c
nsgl_context.m)
elseif (_GLFW_WIN32)
set(glfw_HEADERS ${common_HEADERS} win32_platform.h win32_joystick.h
wgl_context.h egl_context.h)
set(glfw_SOURCES ${common_SOURCES} win32_init.c win32_joystick.c
win32_monitor.c win32_time.c win32_tls.c win32_window.c
wgl_context.c egl_context.c)
elseif (_GLFW_X11)
set(glfw_HEADERS ${common_HEADERS} x11_platform.h xkb_unicode.h
linux_joystick.h posix_time.h posix_tls.h glx_context.h
egl_context.h)
set(glfw_SOURCES ${common_SOURCES} x11_init.c x11_monitor.c x11_window.c
xkb_unicode.c linux_joystick.c posix_time.c posix_tls.c
glx_context.c egl_context.c)
elseif (_GLFW_WAYLAND)
set(glfw_HEADERS ${common_HEADERS} wl_platform.h linux_joystick.h
posix_time.h posix_tls.h xkb_unicode.h egl_context.h)
set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c
linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c
egl_context.c)
ecm_add_wayland_client_protocol(glfw_SOURCES
PROTOCOL
${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml
BASENAME relative-pointer-unstable-v1)
ecm_add_wayland_client_protocol(glfw_SOURCES
PROTOCOL
${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml
BASENAME pointer-constraints-unstable-v1)
elseif (_GLFW_MIR)
set(glfw_HEADERS ${common_HEADERS} mir_platform.h linux_joystick.h
posix_time.h posix_tls.h xkb_unicode.h egl_context.h)
set(glfw_SOURCES ${common_SOURCES} mir_init.c mir_monitor.c mir_window.c
linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c
egl_context.c)
endif()
if (APPLE)
# For some reason, CMake doesn't know about .m
set_source_files_properties(${glfw_SOURCES} PROPERTIES LANGUAGE C)
endif()
add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
set_target_properties(glfw PROPERTIES
OUTPUT_NAME ${GLFW_LIB_NAME}
VERSION ${GLFW_VERSION}
SOVERSION ${GLFW_VERSION_MAJOR}
POSITION_INDEPENDENT_CODE ON
FOLDER "GLFW3")
target_compile_definitions(glfw PRIVATE -D_GLFW_USE_CONFIG_H)
target_include_directories(glfw PUBLIC
$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)
target_include_directories(glfw PRIVATE
"${GLFW_SOURCE_DIR}/src"
"${GLFW_BINARY_DIR}/src"
${glfw_INCLUDE_DIRS})
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
# the inclusion of stddef.h (by glfw3.h), which is itself included before
# win32_platform.h. We define them here until a saner solution can be found
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
target_compile_definitions(glfw PRIVATE
"$<$<BOOL:${MINGW}>:UNICODE;WINVER=0x0501>")
# Enable a reasonable set of warnings (no, -Wextra is not reasonable)
target_compile_options(glfw PRIVATE
"$<$<C_COMPILER_ID:Clang>:-Wall>"
"$<$<C_COMPILER_ID:GNU>:-Wall>")
if (BUILD_SHARED_LIBS)
if (WIN32)
if (MINGW)
# Remove the lib prefix on the DLL (but not the import library
set_target_properties(glfw PROPERTIES PREFIX "")
# Add a suffix to the import library to avoid naming conflicts
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.a")
else()
# Add a suffix to the import library to avoid naming conflicts
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib")
endif()
elseif (APPLE)
# Add -fno-common to work around a bug in Apple's GCC
target_compile_options(glfw PRIVATE "-fno-common")
set_target_properties(glfw PROPERTIES
INSTALL_NAME_DIR "lib${LIB_SUFFIX}")
elseif (UNIX)
# Hide symbols not explicitly tagged for export from the shared library
target_compile_options(glfw PRIVATE "-fvisibility=hidden")
endif()
target_compile_definitions(glfw INTERFACE -DGLFW_DLL)
target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
else()
target_link_libraries(glfw INTERFACE ${glfw_LIBRARIES})
endif()
if (MSVC)
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
if (GLFW_INSTALL)
install(TARGETS glfw EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX})
endif()

View File

@ -37,7 +37,7 @@
// Define this to 1 if building GLFW for X11
/* #undef _GLFW_X11 */
// Define this to 1 if building GLFW for Win32
#define _GLFW_WIN32
//#define _GLFW_WIN32
// Define this to 1 if building GLFW for Cocoa
/* #undef _GLFW_COCOA */
// Define this to 1 if building GLFW for Wayland
@ -63,3 +63,16 @@
// Define this to 1 if windows should use full resolution on Retina displays
/* #undef _GLFW_USE_RETINA */
#if defined ( _WIN32 )
#define _GLFW_WIN32
#define _GLFW_WGL
#elif defined ( __APPLE__ )
#define _GLFW_COCOA
#define _GLFW_NSGL
#else
#define _GLFW_X11
#define _GLFW_GLX
#endif
#define _GLFW_USE_MENUBAR
#define _GLFW_USE_OPENGL

View File

@ -1,18 +0,0 @@
set(imgui_HEADERS
imconfig.h
imgui.h
imgui_internal.h
imgui_impl_glfw_gl3.h
stb_rect_pack.h
stb_textedit.h
stb_truetype.h
)
set(imgui_SOURCES
imgui.cpp
imgui_draw.cpp
imgui_impl_glfw_gl3.cpp
)
include_directories(../)
add_library(imgui STATIC ${imgui_HEADERS} ${imgui_SOURCES})

View File

@ -6,21 +6,23 @@
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
// https://github.com/ocornut/imgui
#include "imgui.h"
#include <imgui/imgui.h>
#include "imgui_impl_glfw_gl3.h"
// GL3W/GLFW
#if defined(__APPLE_CC__)
#include <OpenGL/gl3.h>
#include <OpenGL/gl3.h>
#else
#include <glad/glad.h>
// GLEW/GL3W/GLAD/...
#include <glad/glad.h>
#endif
#include <glfw/glfw3.h>
#ifdef _WIN32
#undef APIENTRY
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#include <glfw/glfw3native.h>
#if defined ( _WIN32 )
#undef APIENTRY
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#include <glfw/glfw3native.h>
#endif
// Data
@ -208,7 +210,7 @@ bool ImGui_ImplGlfwGL3_CreateDeviceObjects()
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
const GLchar *vertex_shader =
"#version 330\n"
"#version 130\n"
"uniform mat4 ProjMtx;\n"
"in vec2 Position;\n"
"in vec2 UV;\n"
@ -223,7 +225,7 @@ bool ImGui_ImplGlfwGL3_CreateDeviceObjects()
"}\n";
const GLchar* fragment_shader =
"#version 330\n"
"#version 130\n"
"uniform sampler2D Texture;\n"
"in vec2 Frag_UV;\n"
"in vec4 Frag_Color;\n"