aboutsummaryrefslogtreecommitdiffstats
path: root/make/stub_includes/opengl/macosx-window-system.h
blob: 47b51a5090d1c6ae22a7a82f24712ba8d1768c04 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* C routines encapsulating small amounts of Objective C code to allow
   nsContext creation and manipulation to occur from Java

   It's unfortunate this couldn't be placed in the macosx
   stub_includes directory, but due to the presence of the jni.h stub
   headers in that directory, if that is in the include path during
   compilation then the build fails.
*/

#include <AppKit/NSView.h>
#include <AppKit/NSOpenGL.h>
#include <AppKit/NSOpenGLView.h>
#include <AppKit/NSOpenGLLayer.h>
#include <OpenGL/CGLDevice.h>
#include <OpenGL/OpenGL.h>

typedef int Bool;

// CGL ..
void CGLQueryPixelFormat(CGLPixelFormatObj fmt, int* iattrs, int niattrs, int* ivalues);

// NS ..
NSOpenGLPixelFormat* createPixelFormat(int* iattrs, int niattrs, int* ivalues);
void queryPixelFormat(NSOpenGLPixelFormat* fmt, int* iattrs, int niattrs, int* ivalues);
void deletePixelFormat(NSOpenGLPixelFormat* fmt);

// NS ..
NSOpenGLContext* getCurrentContext(void);
CGLContextObj getCGLContext(NSOpenGLContext* ctx);
NSView* getNSView(NSOpenGLContext* ctx);

NSOpenGLContext* createContext(NSOpenGLContext* shareContext,
                    NSView* nsView,
                    Bool allowIncompleteView,
                    NSOpenGLPixelFormat* pixelFormat,
                    Bool opaque,
                    int* viewNotReady);
Bool  makeCurrentContext(NSOpenGLContext* ctx);
Bool  clearCurrentContext(NSOpenGLContext *ctx);
Bool  deleteContext(NSOpenGLContext* ctx, Bool releaseOnMainThread);
Bool  flushBuffer(NSOpenGLContext* ctx);
void  setContextOpacity(NSOpenGLContext* ctx, int opacity);
void  updateContext(NSOpenGLContext* ctx);
void  copyContext(NSOpenGLContext* dest, NSOpenGLContext* src, int mask);

void* updateContextRegister(NSOpenGLContext* ctx, NSView* view);
Bool updateContextNeedsUpdate(void* updater);
void  updateContextUnregister(void* updater);

NSOpenGLPixelBuffer* createPBuffer(int renderTarget, int internalFormat, int width, int height);
Bool destroyPBuffer(NSOpenGLPixelBuffer* pBuffer);
void setContextPBuffer(NSOpenGLContext* ctx, NSOpenGLPixelBuffer* pBuffer);
void setContextTextureImageToPBuffer(NSOpenGLContext* ctx, NSOpenGLPixelBuffer* pBuffer, GLenum colorBuffer);

// NSOpenGLLayer* createNSOpenGLLayer(NSOpenGLContext* ctx, NSOpenGLPixelFormat* fmt, NSView* view, Bool opaque);
NSOpenGLLayer* createNSOpenGLLayer(NSOpenGLContext* ctx, NSOpenGLPixelFormat* fmt, NSOpenGLPixelBuffer* pbuffer, Bool opaque, int texWidth, int texHeight);
void setNSOpenGLLayerSwapInterval(NSOpenGLLayer* layer, int interval);
void waitUntilNSOpenGLLayerIsReady(NSOpenGLLayer* layer, long to_micros);
void setNSOpenGLLayerNeedsDisplay(NSOpenGLLayer* glLayer);
void releaseNSOpenGLLayer(NSOpenGLLayer *glLayer);

void* getProcAddress(const char *procName);

void setSwapInterval(NSOpenGLContext* ctx, int interval);

/* Gamma-related functionality */
Bool setGammaRamp(int tableSize, float* redRamp, float* greenRamp, float* blueRamp);
void resetGammaRamp();

/* returns the screen refresh rate in Hz */
int getScreenRefreshRate(int scrn_idx);