2002-11-29 07:06:16 +01:00
|
|
|
//
|
|
|
|
|
// File: GLUQuadricCallback.cc
|
|
|
|
|
// Author: alterself
|
|
|
|
|
//
|
|
|
|
|
// Created on November 28, 2002, 8:21 PM
|
|
|
|
|
//
|
|
|
|
|
|
2002-11-30 01:19:59 +01:00
|
|
|
#include "GLUQuadricCallbacks.h"
|
2002-11-29 07:06:16 +01:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Constructor
|
|
|
|
|
///
|
|
|
|
|
GLUQuadricCallbacks::GLUQuadricCallbacks(GLUquadricObj *quad):
|
|
|
|
|
CallbackContainer()
|
|
|
|
|
{
|
|
|
|
|
quadric = quad;
|
|
|
|
|
errorCallback = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Destructor
|
|
|
|
|
//
|
|
|
|
|
GLUQuadricCallbacks::~GLUQuadricCallbacks()
|
|
|
|
|
{
|
|
|
|
|
if (errorCallback != NULL) {
|
|
|
|
|
delete errorCallback;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-30 01:19:59 +01:00
|
|
|
typedef void (GLAPIENTRY *callback_t)();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* having a couple issues. I cant use a pointer to a method as a function pointer? */
|
|
|
|
|
|
2002-11-29 07:06:16 +01:00
|
|
|
void GLUQuadricCallbacks::add(JavaMethod *cb, GLenum type)
|
|
|
|
|
{
|
|
|
|
|
/* If we are already refering to a callback, get rid of it */
|
2002-11-30 01:19:59 +01:00
|
|
|
if (errorCallback != NULL) {
|
2002-11-29 07:06:16 +01:00
|
|
|
delete errorCallback;
|
|
|
|
|
}
|
2002-11-30 01:19:59 +01:00
|
|
|
|
2002-11-29 07:06:16 +01:00
|
|
|
switch (type) {
|
2002-11-30 01:19:59 +01:00
|
|
|
case GLU_ERROR:
|
2002-11-29 07:06:16 +01:00
|
|
|
errorCallback = cb;
|
2002-11-30 01:19:59 +01:00
|
|
|
// gluQuadricCallback(quadric, type, (callback_t) this->gluError);
|
2002-11-29 07:06:16 +01:00
|
|
|
break;
|
2002-11-30 01:19:59 +01:00
|
|
|
}
|
2002-11-29 07:06:16 +01:00
|
|
|
}
|
|
|
|
|
|
2002-11-30 01:19:59 +01:00
|
|
|
void CALLBACK GLUQuadricCallbacks::gluError(GLenum type) {
|
|
|
|
|
|
|
|
|
|
// jclass cls = (*errorCallback->env)->GetObjectClass(errorCallback->env, errorCallback->obj);
|
|
|
|
|
// jmethodID mid = (*errorCallback->env)->getMethodID(errorCallback->env, cls, errorCallback->method.c_str());
|
|
|
|
|
// if (mid == 0) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// /* Hopefully this will end up calling the java method for handling GLU_ERROR for this quad */
|
|
|
|
|
// (*errorCallback->env)->CallVoidMethod(errorCallback->env, errorCallback->obj, mid, (jint) type);
|
|
|
|
|
}
|