GLU: added quadricCallback(...) methods
GLUQuadricCallbacks: Should now be fully implemented removed files: See the README.txt file for more information.
This commit is contained in:
parent
b4adb68d25
commit
1ade683e2d
|
@ -353,4 +353,18 @@ public class GLU implements GLUConstants {
|
||||||
int slices,
|
int slices,
|
||||||
int stacks
|
int stacks
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
public native void quadricCallback(
|
||||||
|
int target,
|
||||||
|
int type,
|
||||||
|
String method
|
||||||
|
);
|
||||||
|
public native void quadricCallback(
|
||||||
|
int target,
|
||||||
|
int type,
|
||||||
|
Object obj,
|
||||||
|
String method
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,54 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
dnl PARTICULAR PURPOSE.
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
|
||||||
|
|
||||||
|
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl This program is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
|
||||||
|
|
||||||
|
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl This program is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
|
||||||
|
|
||||||
|
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl This program is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
|
||||||
|
|
||||||
|
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl This program is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
# Do all the work for Automake. This macro actually does too much --
|
# Do all the work for Automake. This macro actually does too much --
|
||||||
# some checks are only needed if your package does certain things.
|
# some checks are only needed if your package does certain things.
|
||||||
# But this isn't really a big deal.
|
# But this isn't really a big deal.
|
||||||
|
@ -3606,3 +3654,7 @@ ifelse([AC_DISABLE_FAST_INSTALL])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,54 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
dnl PARTICULAR PURPOSE.
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
|
||||||
|
|
||||||
|
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl This program is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
|
||||||
|
|
||||||
|
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl This program is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
|
||||||
|
|
||||||
|
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl This program is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
|
||||||
|
|
||||||
|
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||||
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
dnl with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
dnl This program is distributed in the hope that it will be useful,
|
||||||
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
# Do all the work for Automake. This macro actually does too much --
|
# Do all the work for Automake. This macro actually does too much --
|
||||||
# some checks are only needed if your package does certain things.
|
# some checks are only needed if your package does certain things.
|
||||||
# But this isn't really a big deal.
|
# But this isn't really a big deal.
|
||||||
|
@ -3619,3 +3667,7 @@ ifelse([AC_DISABLE_FAST_INSTALL])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
//
|
|
||||||
// File: CallbackContainer.cc
|
|
||||||
// Author: alterself
|
|
||||||
//
|
|
||||||
// Created on November 28, 2002, 8:42 PM
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "CallbackContainer.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor
|
|
||||||
///
|
|
||||||
CallbackContainer::CallbackContainer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Destructor
|
|
||||||
//
|
|
||||||
CallbackContainer::~CallbackContainer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
//
|
|
||||||
// File: CallbackContainer.h
|
|
||||||
// Author: alterself
|
|
||||||
//
|
|
||||||
// Created on November 28, 2002, 8:42 PM
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef _CallbackContainer_H
|
|
||||||
#define _CallbackContainer_H
|
|
||||||
|
|
||||||
class CallbackContainer {
|
|
||||||
public:
|
|
||||||
CallbackContainer();
|
|
||||||
~CallbackContainer();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* _CallbackContainer_H */
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
//
|
|
||||||
// File: CallbackManager.cc
|
|
||||||
// Author: alterself
|
|
||||||
//
|
|
||||||
// Created on November 28, 2002, 3:15 PM
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "CallbackManager.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor
|
|
||||||
///
|
|
||||||
CallbackManager::CallbackManager()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Destructor
|
|
||||||
//
|
|
||||||
CallbackManager::~CallbackManager()
|
|
||||||
{
|
|
||||||
data.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CallbackManager::add(jint key, CallbackContainer *value)
|
|
||||||
{
|
|
||||||
data[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CallbackManager::del(jint key)
|
|
||||||
{
|
|
||||||
if (data.find(key) != data.end()) {
|
|
||||||
delete data[key];
|
|
||||||
data.erase(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CallbackContainer * CallbackManager::get(jint key)
|
|
||||||
{
|
|
||||||
if (data.find(key) == data.end()) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return data[key];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
//
|
|
||||||
// File: CallbackManager.h
|
|
||||||
// Author: alterself
|
|
||||||
//
|
|
||||||
// Created on November 28, 2002, 3:15 PM
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef _CallbackManager_H
|
|
||||||
#define _CallbackManager_H
|
|
||||||
#include <map>
|
|
||||||
#include <jni.h>
|
|
||||||
|
|
||||||
#include "CallbackContainer.h"
|
|
||||||
|
|
||||||
class CallbackManager {
|
|
||||||
public:
|
|
||||||
CallbackManager();
|
|
||||||
~CallbackManager();
|
|
||||||
|
|
||||||
bool add(jint, CallbackContainer*);
|
|
||||||
bool del(jint);
|
|
||||||
CallbackContainer* get(jint);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
private:
|
|
||||||
std::map<jint, CallbackContainer*> data;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* _CallbackManager_H */
|
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
|
|
||||||
#include "GLUQuadricCallbacks.h"
|
#include "GLUQuadricCallbacks.h"
|
||||||
|
|
||||||
|
JavaMethod* GLUQuadricCallbacks::errorCallback;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor
|
// Constructor
|
||||||
///
|
///
|
||||||
GLUQuadricCallbacks::GLUQuadricCallbacks(GLUquadricObj *quad):
|
GLUQuadricCallbacks::GLUQuadricCallbacks()
|
||||||
CallbackContainer()
|
|
||||||
{
|
{
|
||||||
quadric = quad;
|
|
||||||
errorCallback = NULL;
|
errorCallback = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,10 @@ GLUQuadricCallbacks::GLUQuadricCallbacks(GLUquadricObj *quad):
|
||||||
//
|
//
|
||||||
GLUQuadricCallbacks::~GLUQuadricCallbacks()
|
GLUQuadricCallbacks::~GLUQuadricCallbacks()
|
||||||
{
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLUQuadricCallbacks::clear() {
|
||||||
if (errorCallback != NULL) {
|
if (errorCallback != NULL) {
|
||||||
delete errorCallback;
|
delete errorCallback;
|
||||||
}
|
}
|
||||||
|
@ -29,31 +33,47 @@ GLUQuadricCallbacks::~GLUQuadricCallbacks()
|
||||||
|
|
||||||
typedef void (GLAPIENTRY *callback_t)();
|
typedef void (GLAPIENTRY *callback_t)();
|
||||||
|
|
||||||
|
void GLUQuadricCallbacks::set(jint globj, JavaMethod* cb, jint type)
|
||||||
/* having a couple issues. I cant use a pointer to a method as a function pointer? */
|
|
||||||
|
|
||||||
void GLUQuadricCallbacks::add(JavaMethod *cb, GLenum type)
|
|
||||||
{
|
{
|
||||||
/* If we are already refering to a callback, get rid of it */
|
|
||||||
if (errorCallback != NULL) {
|
|
||||||
delete errorCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GLU_ERROR:
|
case GLU_ERROR:
|
||||||
errorCallback = cb;
|
/* If we are already refering to a callback, get rid of it */
|
||||||
// gluQuadricCallback(quadric, type, (callback_t) this->gluError);
|
if (errorCallback != NULL) {
|
||||||
|
delete errorCallback;
|
||||||
|
}
|
||||||
|
if (cb == NULL) {
|
||||||
|
gluQuadricCallback((GLUquadricObj *) globj,
|
||||||
|
(GLenum) type,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
errorCallback = cb;
|
||||||
|
gluQuadricCallback((GLUquadricObj *) globj,
|
||||||
|
(GLenum) type,
|
||||||
|
(callback_t) GLUQuadricCallbacks::gluError);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK GLUQuadricCallbacks::gluError(GLenum type) {
|
void CALLBACK GLUQuadricCallbacks::gluError(GLenum type) {
|
||||||
|
|
||||||
// jclass cls = (*errorCallback->env)->GetObjectClass(errorCallback->env, errorCallback->obj);
|
if (errorCallback == NULL) {
|
||||||
// jmethodID mid = (*errorCallback->env)->getMethodID(errorCallback->env, cls, errorCallback->method.c_str());
|
return;
|
||||||
// if (mid == 0) {
|
}
|
||||||
// return;
|
|
||||||
// }
|
JNIEnv * env = errorCallback->env;
|
||||||
// /* Hopefully this will end up calling the java method for handling GLU_ERROR for this quad */
|
jobject obj = errorCallback->obj;
|
||||||
// (*errorCallback->env)->CallVoidMethod(errorCallback->env, errorCallback->obj, mid, (jint) type);
|
|
||||||
|
jclass cls = (jclass) env->GetObjectClass(obj);
|
||||||
|
|
||||||
|
jmethodID mid = env->GetMethodID(cls,
|
||||||
|
errorCallback->method.c_str(),
|
||||||
|
"(I)V");
|
||||||
|
|
||||||
|
if (mid == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* Hopefully this will end up calling the java method for handling GLU_ERROR for this quad */
|
||||||
|
env->CallVoidMethod(obj, mid, (jint) type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,26 +14,24 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "JavaMethod.h"
|
#include "JavaMethod.h"
|
||||||
#include "CallbackContainer.h"
|
|
||||||
|
|
||||||
#ifndef CALLBACK
|
#ifndef CALLBACK
|
||||||
#define CALLBACK
|
#define CALLBACK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class GLUQuadricCallbacks : public CallbackContainer {
|
class GLUQuadricCallbacks {
|
||||||
public:
|
public:
|
||||||
GLUQuadricCallbacks(GLUquadricObj *quad);
|
GLUQuadricCallbacks();
|
||||||
~GLUQuadricCallbacks();
|
~GLUQuadricCallbacks();
|
||||||
void add(JavaMethod*, GLenum);
|
|
||||||
|
|
||||||
void CALLBACK gluError(GLenum);
|
static void CALLBACK gluError(GLenum);
|
||||||
|
static void set(jint, JavaMethod*, jint);
|
||||||
|
static void clear();
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JavaMethod* errorCallback;
|
static JavaMethod* errorCallback;
|
||||||
GLUquadricObj* quadric;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _GLUQuadricCallbacks_H */
|
#endif /* _GLUQuadricCallbacks_H */
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,20 @@
|
||||||
|
|
||||||
class JavaMethod {
|
class JavaMethod {
|
||||||
public:
|
public:
|
||||||
JavaMethod(JNIEnv *, jobject, std::string);
|
JavaMethod(JNIEnv *newEnv, jobject newObj, std::string newMethod)
|
||||||
~JavaMethod();
|
{
|
||||||
|
env = newEnv;
|
||||||
|
obj = newObj;
|
||||||
|
method = newMethod;
|
||||||
|
}
|
||||||
|
~JavaMethod()
|
||||||
|
{
|
||||||
|
|
||||||
JNIEnv* env;
|
}
|
||||||
jobject obj;
|
|
||||||
std::string method;
|
JNIEnv* env;
|
||||||
|
jobject obj;
|
||||||
|
std::string method;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -6,11 +6,6 @@ libcallbacks_la_CPPFLAGS = -D_DEBUG
|
||||||
INCLUDES = -I../
|
INCLUDES = -I../
|
||||||
|
|
||||||
COMMON = \
|
COMMON = \
|
||||||
CallbackContainer.cpp \
|
|
||||||
CallbackContainer.h \
|
|
||||||
CallbackManager.cpp \
|
|
||||||
CallbackManager.h \
|
|
||||||
JavaMethod.cpp \
|
|
||||||
JavaMethod.h
|
JavaMethod.h
|
||||||
|
|
||||||
CALLBACKS = \
|
CALLBACKS = \
|
||||||
|
|
|
@ -1,45 +1,62 @@
|
||||||
This is just the start of my callback implementation.
|
This is just the start of my callback implementation.
|
||||||
|
|
||||||
Basically... we have 3 main classes...
|
Unfortunatly, you cant pass a non static method as an object pointer...
|
||||||
|
So we can only have callbacks for a single GLU object. However,
|
||||||
|
according to the OpenGL redbook... this should not be an issue. For example
|
||||||
|
the redbook states that, a single tess object should be used for an
|
||||||
|
entire program... and reused for each tessleation.
|
||||||
|
|
||||||
CallbackManager, which maintains a mapping of objects to callback containers
|
The implementation:
|
||||||
CallbackContainer, the base class which we extend to implement callbacks for specific objects
|
|
||||||
JavaMethod, which is a data object that contains information on the method to call.
|
|
||||||
|
|
||||||
GLUQuadricCallbacks is a CallbackContainer for working with quadric callbacks
|
JavaMethod: a data object that contains information on the method to call.
|
||||||
eventually you can expect containers to callbacks for glu nurbs and glu tesselators.
|
|
||||||
|
GLUQuadricCallbacks: a class for working with quadric callbacks
|
||||||
|
|
||||||
|
eventually you can expect callbacks for glu nurbs and glu tesselators.
|
||||||
Of course callbacks for other object types should be easy to do using this framework.
|
Of course callbacks for other object types should be easy to do using this framework.
|
||||||
|
|
||||||
|
|
||||||
Eventually... to add a callback you would do things like:
|
Note quite as elegent as I wanted, but it works.
|
||||||
|
|
||||||
/* quad is the reference to our GLUquadricObj
|
You would write a callback like this:
|
||||||
* type is one of the error types specified by gluQuadricCallback
|
|
||||||
* method is the name of the java method to call */
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_quadricCallback
|
|
||||||
(JNIEnv * env, jobject obj, jint quad, jint type, jint method) {
|
|
||||||
/* if this quad has no callback container, make one */
|
|
||||||
if (CallbackManager.get(quad) == null) {
|
|
||||||
CallbackManager.put(quad, new GLUQuadricCallbacks((GLUquadricObj *) quad);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the callback container for this quad */
|
/*
|
||||||
((GLUQuadricCallbacks *) CallbackManager.get(quad))->add(new JavaMethod(env, obj, (char*) method), (GLenum) type);
|
* Class: org_lwjgl_opengl_GLU
|
||||||
|
* Method: quadricCallback
|
||||||
|
* Signature: (IILjava/lang/String;)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_quadricCallback__IILjava_lang_String_2
|
||||||
|
(JNIEnv * env, jobject obj, jint quad, jint type, jstring method)
|
||||||
|
{
|
||||||
|
GLUQuadricCallbacks::set(quad,
|
||||||
|
new JavaMethod(env, obj, env->GetStringUTFChars(method, 0)),
|
||||||
|
type);
|
||||||
|
CHECK_GL_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_deleteQuadric
|
/*
|
||||||
(JNIEnv * env, jobject obj, jint quad) {
|
* Class: org_lwjgl_opengl_GLU
|
||||||
/* Delete the quadric from memory */
|
* Method: quadricCallback
|
||||||
gluDeleteQuadric((GLUquadricObj *) quad);
|
* Signature: (IILjava/lang/Object;Ljava/lang/String;)V
|
||||||
|
*/
|
||||||
/* delete any callbacks we assigned to the quadric */
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_quadricCallback__IILjava_lang_Object_2Ljava_lang_String_2
|
||||||
CallbackManager.del(quad);
|
(JNIEnv * env, jobject obj, jint quad, jint type, jobject target, jstring method)
|
||||||
|
{
|
||||||
|
GLUQuadricCallbacks::set(quad,
|
||||||
|
new JavaMethod(env, target, env->GetStringUTFChars(method, 0)),
|
||||||
|
type);
|
||||||
|
CHECK_GL_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
then from java:
|
and call it from java:
|
||||||
|
|
||||||
/* myquadric is a reference to a GLUquadricObj returned by glu.newQuadric()
|
/* myquadric is a reference to a GLUquadricObj returned by glu.newQuadric()
|
||||||
* GLU.ERROR is the callback type
|
* GLU.ERROR is the callback type
|
||||||
* errorCallback is the method you wish to be called */
|
* errorCallback is the method you wish to be called */
|
||||||
glu.quadricCallback(myquadric, GLU.ERROR, "errorCallback");
|
glu.quadricCallback(myquadric, GLU.ERROR, "errorCallback");
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
glu.quadricCallback(myquadric, GLU.ERROR, someObject, "errorCallback");
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@
|
||||||
#include "checkGLerror.h"
|
#include "checkGLerror.h"
|
||||||
#include "GL/glu.h"
|
#include "GL/glu.h"
|
||||||
|
|
||||||
|
#include "callbacks/GLUQuadricCallbacks.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_opengl_GLU
|
* Class: org_lwjgl_opengl_GLU
|
||||||
* Method: getString
|
* Method: getString
|
||||||
|
@ -275,3 +277,31 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_sphere
|
||||||
CHECK_GL_ERROR
|
CHECK_GL_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_lwjgl_opengl_GLU
|
||||||
|
* Method: quadricCallback
|
||||||
|
* Signature: (IILjava/lang/String;)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_quadricCallback__IILjava_lang_String_2
|
||||||
|
(JNIEnv * env, jobject obj, jint quad, jint type, jstring method)
|
||||||
|
{
|
||||||
|
GLUQuadricCallbacks::set(quad,
|
||||||
|
new JavaMethod(env, obj, env->GetStringUTFChars(method, 0)),
|
||||||
|
type);
|
||||||
|
CHECK_GL_ERROR
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_lwjgl_opengl_GLU
|
||||||
|
* Method: quadricCallback
|
||||||
|
* Signature: (IILjava/lang/Object;Ljava/lang/String;)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_quadricCallback__IILjava_lang_Object_2Ljava_lang_String_2
|
||||||
|
(JNIEnv * env, jobject obj, jint quad, jint type, jobject target, jstring method)
|
||||||
|
{
|
||||||
|
GLUQuadricCallbacks::set(quad,
|
||||||
|
new JavaMethod(env, target, env->GetStringUTFChars(method, 0)),
|
||||||
|
type);
|
||||||
|
CHECK_GL_ERROR
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,22 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_quadricTexture
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_sphere
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_sphere
|
||||||
(JNIEnv *, jobject, jint, jdouble, jint, jint);
|
(JNIEnv *, jobject, jint, jdouble, jint, jint);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_lwjgl_opengl_GLU
|
||||||
|
* Method: quadricCallback
|
||||||
|
* Signature: (IILjava/lang/String;)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_quadricCallback__IILjava_lang_String_2
|
||||||
|
(JNIEnv *, jobject, jint, jint, jstring);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_lwjgl_opengl_GLU
|
||||||
|
* Method: quadricCallback
|
||||||
|
* Signature: (IILjava/lang/Object;Ljava/lang/String;)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLU_quadricCallback__IILjava_lang_Object_2Ljava_lang_String_2
|
||||||
|
(JNIEnv *, jobject, jint, jint, jobject, jstring);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue