aboutsummaryrefslogtreecommitdiffstats
path: root/CNativeCode/OpenGL_JauJNI14_funcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'CNativeCode/OpenGL_JauJNI14_funcs.c')
-rw-r--r--CNativeCode/OpenGL_JauJNI14_funcs.c224
1 files changed, 143 insertions, 81 deletions
diff --git a/CNativeCode/OpenGL_JauJNI14_funcs.c b/CNativeCode/OpenGL_JauJNI14_funcs.c
index fd518d5..691fd11 100644
--- a/CNativeCode/OpenGL_JauJNI14_funcs.c
+++ b/CNativeCode/OpenGL_JauJNI14_funcs.c
@@ -4,87 +4,149 @@
*/
-/*
- * Leo Chan -- 1995
- *
- * This mammoth C file takes care of all the native implementation for the
- * bulk of OpenGL commands
- * ---------------
- *
- * Sven Goethel
- *
- * September 1997
- */
-
-/*
- * need to include the JAVA internal header files for macros and function
- * prototypes required to maipulated JAVA data structures and functions
- *
- * StubPreamble.h includes the structure and macro definitions neede to
- * convert JAVA data structures into C data structures.
- *
- */
-
-#include "OpenGL_misc.h"
-
-/*
- * the next thing to include are special headers that were created by
- * JAVAH. They include the C structure definitions for the JAVA classes
- */
-#include "gl4java_GLFunc14JauJNI.h"
-
-/*--------------------------------------------------------------------------
- * here on in is just regular apple pie C
- */
-
-#ifndef LIBAPIENTRY
- #define LIBAPIENTRY
-#endif
-#ifndef LIBAPI
- #define LIBAPI
-#endif
-
-#ifndef CALLBACK
- #define CALLBACK
-#endif
-/** THIS IS A MANUAL CODED PART
- gl-manualCodedImplJNI.java
-*/
-
-static const char _gl_n_a_string[] = "GL-String not avaiable !";
-
-JNIEXPORT jstring JNICALL
-Java_gl4java_GLFunc14JauJNI_glGetString ( JNIEnv *env, jobject obj,
- jint name )
-{
- const char * tmpString=0;
-
- if ( disp__glGetString == NULL )
- return (*env)->NewStringUTF(env, _gl_n_a_string);
-
- tmpString = disp__glGetString ( /* jint */ name);
- if(tmpString==NULL)
- tmpString=_gl_n_a_string;
-
- return (*env)->NewStringUTF(env, tmpString);
-}
-
-static const char * _gl_lib_vendor_="Jausoft - Sven Goethel Software Development";
-static const char * _gl_lib_version_="2.8.0.8";
-
-JNIEXPORT jstring JNICALL
-Java_gl4java_GLFunc14JauJNI_getNativeVendor ( JNIEnv *env, jobject obj )
-{
- return (*env)->NewStringUTF(env, _gl_lib_vendor_);
-}
-
-JNIEXPORT jstring JNICALL
-Java_gl4java_GLFunc14JauJNI_getNativeVersion ( JNIEnv *env, jobject obj )
-{
- return (*env)->NewStringUTF(env, _gl_lib_version_);
-}
-
+/*
+ * Leo Chan -- 1995
+ *
+ * This mammoth C file takes care of all the native implementation for the
+ * bulk of OpenGL commands
+ * ---------------
+ *
+ * Sven Goethel
+ *
+ * September 1997
+ */
+
+/*
+ * need to include the JAVA internal header files for macros and function
+ * prototypes required to maipulated JAVA data structures and functions
+ *
+ * StubPreamble.h includes the structure and macro definitions neede to
+ * convert JAVA data structures into C data structures.
+ *
+ */
+
+#include "OpenGL_misc.h"
+
+/*
+ * the next thing to include are special headers that were created by
+ * JAVAH. They include the C structure definitions for the JAVA classes
+ */
+#include "gl4java_GLFunc14JauJNI.h"
+
+/*--------------------------------------------------------------------------
+ * here on in is just regular apple pie C
+ */
+
+#ifndef LIBAPIENTRY
+ #define LIBAPIENTRY
+#endif
+#ifndef LIBAPI
+ #define LIBAPI
+#endif
+
+#ifndef CALLBACK
+ #define CALLBACK
+#endif
+/** THIS IS A MANUAL CODED PART
+ gl-manualCodedImplJNI.java
+*/
+
+static const char _gl_n_a_string[] = "GL-String not avaiable !";
+
+JNIEXPORT jstring JNICALL
+Java_gl4java_GLFunc14JauJNI_glGetString ( JNIEnv *env, jobject obj,
+ jint name )
+{
+ const char * tmpString=0;
+
+ if ( disp__glGetString == NULL )
+ return (*env)->NewStringUTF(env, _gl_n_a_string);
+
+ tmpString = disp__glGetString ( /* jint */ name);
+ if(tmpString==NULL)
+ tmpString=_gl_n_a_string;
+
+ return (*env)->NewStringUTF(env, tmpString);
+}
+
+static const char * _gl_lib_vendor_="Jausoft - Sven Goethel Software Development";
+static const char * _gl_lib_version_="2.8.0.8";
+
+JNIEXPORT jstring JNICALL
+Java_gl4java_GLFunc14JauJNI_getNativeVendor ( JNIEnv *env, jobject obj )
+{
+ return (*env)->NewStringUTF(env, _gl_lib_vendor_);
+}
+
+JNIEXPORT jstring JNICALL
+Java_gl4java_GLFunc14JauJNI_getNativeVersion ( JNIEnv *env, jobject obj )
+{
+ return (*env)->NewStringUTF(env, _gl_lib_version_);
+}
+
+//----------------------------------------------------------------------
+// Support for NVidia routines
+//
+
+#include "ptrtypes.h"
+
+#ifdef _X11_
+ #include <GL/glx.h>
+ #include <dlfcn.h>
+ #include "glxtool.h"
+ #include <unistd.h>
+#endif
+
+#ifdef _WIN32_
+ #include "wgltool.h"
+#endif
+
+#define GET_GL_PROCADDRESS(a) getGLProcAddressHelper (NULL, NULL, (a), NULL, 1, 0);
+
+JNIEXPORT jlong JNICALL
+Java_gl4java_GLFunc14JauJNI_glAllocateMemoryNV0(JNIEnv* env, jobject unused,
+ jint size,
+ jfloat readFreq,
+ jfloat writeFreq,
+ jfloat priority)
+{
+ void* (CALLBACK *disp__glAllocateMemoryNV)(int, float, float, float) =
+#ifdef _WIN32_
+ disp__wglAllocateMemoryNV;
+#elif defined(_X11_)
+ disp__glXAllocateMemoryNV;
+#else
+ NULL;
+#endif
+
+ if (disp__glAllocateMemoryNV == NULL) return 0;
+
+ return ((uintptr_t) disp__glAllocateMemoryNV(size, readFreq, writeFreq, priority));
+}
+
+JNIEXPORT void JNICALL
+Java_gl4java_GLFunc14JauJNI_glFreeMemoryNV0(JNIEnv* env, jobject unused, jlong address)
+{
+ void (CALLBACK *disp__glFreeMemoryNV)(void*) =
+#if (defined(_WIN32_))
+ disp__wglFreeMemoryNV;
+#elif defined(_X11_)
+ disp__glXFreeMemoryNV;
+#else
+ NULL;
+#endif
+
+ if (disp__glFreeMemoryNV == NULL) return;
+
+ disp__glFreeMemoryNV((void*) ((uintptr_t) address));
+}
+
+JNIEXPORT jobject JNICALL
+Java_gl4java_GLFunc14JauJNI_newDirectByteBuffer(JNIEnv* env, jobject unused, jlong addr, jint capacity)
+{
+ return (*env)->NewDirectByteBuffer(env, (void *) ((uintptr_t) addr), capacity);
+}
/**
* C2J Parser Version 3.0
* Jausoft - Sven Goethel Software Development