forked from bgasiorzewski/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cl.c
38 lines (34 loc) · 886 Bytes
/
cl.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "cl.h"
// this provides a nice _WIN32 definition
#include <GLFW/glfw3.h>
// TODO: add support for OS X, EGL
#ifdef _WIN32
#include <Windows.h>
#else
#include <GL/glx.h>
#endif
#include "globals.h"
cl_context_properties *getContextProperties(cl_platform_id platform_id) {
static cl_context_properties props[] = {
CL_CONTEXT_PLATFORM,
0,
CL_GL_CONTEXT_KHR,
0,
CL_WGL_HDC_KHR,
0,
0,
0,
0,
};
props[1] = (cl_context_properties)platform_id;
#if _WIN32
props[3] = (cl_context_properties)wglGetCurrentContext();
props[4] = CL_WGL_HDC_KHR;
props[5] = (cl_context_properties)wglGetCurrentDC();
#else
props[3] = (cl_context_properties)glXGetCurrentContext();
props[4] = CL_GLX_DISPLAY_KHR;
props[5] = (cl_context_properties)glXGetCurrentDisplay();
#endif
return props;
}