summaryrefslogtreecommitdiff
path: root/src/powdertoyjava/OpenGLCanvasMacOS.h
blob: cca87659a199e25233622c7f41fc6b40aa6aba2b (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
#ifdef USE_JNI
#import <jawt_md.h>

#import <Cocoa/Cocoa.h>
#import <AppKit/NSOpenGL.h>

NSOpenGLPixelFormat* defaultPixelFormat();

NSOpenGLContext* ensureContext(NSOpenGLContext* openGLContext, NSView *view);

typedef struct {
    JAWT* awt;
    JAWT_DrawingSurface* ds;
    JAWT_DrawingSurfaceInfo* dsi;
    JAWT_MacOSXDrawingSurfaceInfo* dsi_mac;
	NSView *view;
	NSOpenGLContext* openGLContext;
} ContextInfo;

ContextInfo* getContext(JNIEnv *env, jobject canvas);

void freeContext(JNIEnv *env, jobject canvas, ContextInfo* ci);

#ifdef __cplusplus
extern "C" {
#endif
	JNIEXPORT jboolean JNICALL Java_OpenGLCanvas_beginOpenGL(JNIEnv *env, jobject canvas);
	JNIEXPORT void JNICALL Java_OpenGLCanvas_endOpenGL(JNIEnv *env, jobject canvas);
	JNIEXPORT void JNICALL Java_OpenGLCanvas_updateOpenGL(JNIEnv *env, jobject canvas);
	JNIEXPORT void JNICALL Java_OpenGLCanvas_allocOpenGL(JNIEnv *env, jobject canvas);
	JNIEXPORT void JNICALL Java_OpenGLCanvas_releaseOpenGL(JNIEnv *env, jobject canvas);
#ifdef __cplusplus
}
#endif
#endif