diff options
author | Kenneth Russel <[email protected]> | 2006-01-22 03:38:03 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2006-01-22 03:38:03 +0000 |
commit | 72acc211539803f1ef57d4331938afb48600398e (patch) | |
tree | 80d37e7c44d2c9a7bae74fc48434810526c8e80a /make/glx-CustomCCode.c | |
parent | ae26492c30051eb7c6c883b3c6397390f91afcae (diff) |
Fixed Issue 173: Adjust gamma, brightness and contrast
Added com.sun.opengl.util.Gamma supporting adjusting of gamma,
brightness, and contrast. API and implementation derived from code in
the LWJGL project. Added demos.gamma.TestGamma demo illustrating how
to use the APIs. Tested on Linux, Mac OS X and Windows. No Solaris
support at this time, although future Solaris releases, being based on
the Xorg server, will probably have support for the required
XF86VidMode extension.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@557 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make/glx-CustomCCode.c')
-rwxr-xr-x | make/glx-CustomCCode.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/make/glx-CustomCCode.c b/make/glx-CustomCCode.c new file mode 100755 index 000000000..2d92b2dde --- /dev/null +++ b/make/glx-CustomCCode.c @@ -0,0 +1,62 @@ +#include <inttypes.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <GL/glx.h> +/* Linux headers don't work properly */ +#define __USE_GNU +#include <dlfcn.h> +#undef __USE_GNU + +/* Current versions of Solaris don't expose the XF86 extensions, + although with the recent transition to Xorg this will probably + happen in an upcoming release */ +#ifndef __sun +#include <X11/extensions/xf86vmode.h> +#else +/* Need to provide stubs for these */ +Bool XF86VidModeGetGammaRampSize( + Display *display, + int screen, + int* size) +{ + return False; +} + +Bool XF86VidModeGetGammaRamp( + Display *display, + int screen, + int size, + unsigned short *red array, + unsigned short *green array, + unsigned short *blue array) { + return False; +} +Bool XF86VidModeSetGammaRamp( + Display *display, + int screen, + int size, + unsigned short *red array, + unsigned short *green array, + unsigned short *blue array) { + return False; +} +#endif + +/* Need to expose DefaultScreen and RootWindow macros to Java */ +JNIEXPORT jlong JNICALL +Java_com_sun_opengl_impl_x11_GLX_DefaultScreen(JNIEnv *env, jclass _unused, jlong display) { + return DefaultScreen((Display*) (intptr_t) display); +} +JNIEXPORT jlong JNICALL +Java_com_sun_opengl_impl_x11_GLX_RootWindow(JNIEnv *env, jclass _unused, jlong display, jint screen) { + return RootWindow((Display*) (intptr_t) display, screen); +} +JNIEXPORT jlong JNICALL +Java_com_sun_opengl_impl_x11_GLX_dlsym(JNIEnv *env, jclass _unused, jstring name) { + const jbyte* chars; + void* res; + chars = (*env)->GetStringUTFChars(env, name, NULL); + res = dlsym(RTLD_DEFAULT, chars); + (*env)->ReleaseStringUTFChars(env, name, chars); + return (jlong) ((intptr_t) res); +} |