aboutsummaryrefslogtreecommitdiffstats
path: root/CNativeCode/GLCallbackHelperJNI.h
blob: 102f65ad092cdfb37f1d632c1dd369426cad991e (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

#ifndef GLCALLBACKHELPERJNI
	#define GLCALLBACKHELPERJNI

	#include <stdio.h>
	#include <stdlib.h>
	#include <stdarg.h>

	#ifdef _WIN32_
		#include "winstuff.h"
	#endif

	#include <jni.h>

	#include<GL/gl.h>
	#include <GL/glu.h>

	#ifndef LIBAPIENTRY
		#define LIBAPIENTRY
	#endif
	#ifndef LIBAPI
		#define LIBAPI
	#endif

	typedef struct {
		/* The Java Handles */
		JNIEnv *env;		/* non-copy */
		jobject jobj;		/* copy */
		char *methodName;	/* copy */
		char *signature;	/* copy */
		int argListNumber;	/* copy */
		int arrayLen1;	/* copy */
		int arrayLen2;	/* copy */
		int arrayLen3;	/* copy */
		int arrayLen4;	/* copy */
		int arrayLen5;	/* copy */

		/* The Native Handles */
		void *cb_obj; /* non-copy, the tesselator, quadratics, etc. object */
		GLenum which; /* copy, the function type */
		jlong glx; /* copy, the GL-Context */
	} CallbackEntry;

	typedef struct _CallbackNode {
		struct _CallbackNode *prev;
		CallbackEntry *this;
		struct _CallbackNode *next;
	} CallbackNode;

	LIBAPI void LIBAPIENTRY PrintCallbackEntry(const char *title, CallbackEntry * cbe);

	LIBAPI void LIBAPIENTRY PrintCallbackNode(const char *title, CallbackNode * cbn);

	LIBAPI CallbackNode * LIBAPIENTRY LastCallbackNode();

	LIBAPI CallbackNode * LIBAPIENTRY FindNextCallbackNodeOfCbObj(void *cb_obj);
	LIBAPI CallbackNode * LIBAPIENTRY FindCallbackNode(GLenum which, jlong glx);

	LIBAPI CallbackEntry * LIBAPIENTRY FindCallbackEntry(GLenum which, jlong glx);

	LIBAPI void  LIBAPIENTRY AddCallbackNode(JNIEnv * env, jobject jobj, 
			      const char *methodName, const char *signature,
			      int arrayLen1, int arrayLen2, int arrayLen3,
		      	      int arrayLen4, int arrayLen5,
			      void *cb_obj, GLenum which, jlong glx);

	LIBAPI void  LIBAPIENTRY RemoveCallbackNodes(void *cb_obj);

	LIBAPI jlong  LIBAPIENTRY GetCurrentGLContext();

#endif