Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt.opengl/carbon')
-rw-r--r--bundles/org.eclipse.swt.opengl/carbon/library/agl.c193
-rw-r--r--bundles/org.eclipse.swt.opengl/carbon/library/agl.h3
-rw-r--r--bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.c56
-rw-r--r--bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.h38
-rw-r--r--bundles/org.eclipse.swt.opengl/carbon/library/agl_structs.h13
-rw-r--r--bundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/internal/opengl/carbon/AGL.java63
-rwxr-xr-xbundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/opengl/GLCanvas.java255
7 files changed, 0 insertions, 621 deletions
diff --git a/bundles/org.eclipse.swt.opengl/carbon/library/agl.c b/bundles/org.eclipse.swt.opengl/carbon/library/agl.c
deleted file mode 100644
index 6b612c0697..0000000000
--- a/bundles/org.eclipse.swt.opengl/carbon/library/agl.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2000, 2005 IBM Corporation and others.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* IBM Corporation - initial API and implementation
-*******************************************************************************/
-
-#include "swt.h"
-#include "agl_structs.h"
-#include "agl_stats.h"
-
-#define AGL_NATIVE(func) Java_org_eclipse_swt_internal_opengl_carbon_AGL_##func
-
-#ifndef NO_aglChoosePixelFormat
-JNIEXPORT jint JNICALL AGL_NATIVE(aglChoosePixelFormat)
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2)
-{
- jint *lparg2=NULL;
- jint rc = 0;
- AGL_NATIVE_ENTER(env, that, aglChoosePixelFormat_FUNC);
- if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
- rc = (jint)aglChoosePixelFormat(arg0, arg1, lparg2);
-fail:
- if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- AGL_NATIVE_EXIT(env, that, aglChoosePixelFormat_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglCreateContext
-JNIEXPORT jint JNICALL AGL_NATIVE(aglCreateContext)
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- jint rc = 0;
- AGL_NATIVE_ENTER(env, that, aglCreateContext_FUNC);
- rc = (jint)aglCreateContext(arg0, arg1);
- AGL_NATIVE_EXIT(env, that, aglCreateContext_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglDescribePixelFormat
-JNIEXPORT jboolean JNICALL AGL_NATIVE(aglDescribePixelFormat)
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2)
-{
- jint *lparg2=NULL;
- jboolean rc = 0;
- AGL_NATIVE_ENTER(env, that, aglDescribePixelFormat_FUNC);
- if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
- rc = (jboolean)aglDescribePixelFormat(arg0, arg1, lparg2);
-fail:
- if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- AGL_NATIVE_EXIT(env, that, aglDescribePixelFormat_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglDestroyContext
-JNIEXPORT jboolean JNICALL AGL_NATIVE(aglDestroyContext)
- (JNIEnv *env, jclass that, jint arg0)
-{
- jboolean rc = 0;
- AGL_NATIVE_ENTER(env, that, aglDestroyContext_FUNC);
- rc = (jboolean)aglDestroyContext(arg0);
- AGL_NATIVE_EXIT(env, that, aglDestroyContext_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglDestroyPixelFormat
-JNIEXPORT void JNICALL AGL_NATIVE(aglDestroyPixelFormat)
- (JNIEnv *env, jclass that, jint arg0)
-{
- AGL_NATIVE_ENTER(env, that, aglDestroyPixelFormat_FUNC);
- aglDestroyPixelFormat(arg0);
- AGL_NATIVE_EXIT(env, that, aglDestroyPixelFormat_FUNC);
-}
-#endif
-
-#ifndef NO_aglEnable
-JNIEXPORT jboolean JNICALL AGL_NATIVE(aglEnable)
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- jboolean rc = 0;
- AGL_NATIVE_ENTER(env, that, aglEnable_FUNC);
- rc = (jboolean)aglEnable(arg0, arg1);
- AGL_NATIVE_EXIT(env, that, aglEnable_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglGetCurrentContext
-JNIEXPORT jint JNICALL AGL_NATIVE(aglGetCurrentContext)
- (JNIEnv *env, jclass that)
-{
- jint rc = 0;
- AGL_NATIVE_ENTER(env, that, aglGetCurrentContext_FUNC);
- rc = (jint)aglGetCurrentContext();
- AGL_NATIVE_EXIT(env, that, aglGetCurrentContext_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglGetDrawable
-JNIEXPORT jint JNICALL AGL_NATIVE(aglGetDrawable)
- (JNIEnv *env, jclass that, jint arg0)
-{
- jint rc = 0;
- AGL_NATIVE_ENTER(env, that, aglGetDrawable_FUNC);
- rc = (jint)aglGetDrawable(arg0);
- AGL_NATIVE_EXIT(env, that, aglGetDrawable_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglSetCurrentContext
-JNIEXPORT jboolean JNICALL AGL_NATIVE(aglSetCurrentContext)
- (JNIEnv *env, jclass that, jint arg0)
-{
- jboolean rc = 0;
- AGL_NATIVE_ENTER(env, that, aglSetCurrentContext_FUNC);
- rc = (jboolean)aglSetCurrentContext(arg0);
- AGL_NATIVE_EXIT(env, that, aglSetCurrentContext_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglSetDrawable
-JNIEXPORT jboolean JNICALL AGL_NATIVE(aglSetDrawable)
- (JNIEnv *env, jclass that, jint arg0, jint arg1)
-{
- jboolean rc = 0;
- AGL_NATIVE_ENTER(env, that, aglSetDrawable_FUNC);
- rc = (jboolean)aglSetDrawable(arg0, arg1);
- AGL_NATIVE_EXIT(env, that, aglSetDrawable_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglSetInteger__III
-JNIEXPORT jboolean JNICALL AGL_NATIVE(aglSetInteger__III)
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2)
-{
- jboolean rc = 0;
- AGL_NATIVE_ENTER(env, that, aglSetInteger__III_FUNC);
- rc = (jboolean)aglSetInteger(arg0, arg1, arg2);
- AGL_NATIVE_EXIT(env, that, aglSetInteger__III_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglSetInteger__II_3I
-JNIEXPORT jboolean JNICALL AGL_NATIVE(aglSetInteger__II_3I)
- (JNIEnv *env, jclass that, jint arg0, jint arg1, jintArray arg2)
-{
- jint *lparg2=NULL;
- jboolean rc = 0;
- AGL_NATIVE_ENTER(env, that, aglSetInteger__II_3I_FUNC);
- if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
- rc = (jboolean)aglSetInteger(arg0, arg1, lparg2);
-fail:
- if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- AGL_NATIVE_EXIT(env, that, aglSetInteger__II_3I_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_aglSwapBuffers
-JNIEXPORT void JNICALL AGL_NATIVE(aglSwapBuffers)
- (JNIEnv *env, jclass that, jint arg0)
-{
- AGL_NATIVE_ENTER(env, that, aglSwapBuffers_FUNC);
- aglSwapBuffers(arg0);
- AGL_NATIVE_EXIT(env, that, aglSwapBuffers_FUNC);
-}
-#endif
-
-#ifndef NO_aglUpdateContext
-JNIEXPORT jboolean JNICALL AGL_NATIVE(aglUpdateContext)
- (JNIEnv *env, jclass that, jint arg0)
-{
- jboolean rc = 0;
- AGL_NATIVE_ENTER(env, that, aglUpdateContext_FUNC);
- rc = (jboolean)aglUpdateContext(arg0);
- AGL_NATIVE_EXIT(env, that, aglUpdateContext_FUNC);
- return rc;
-}
-#endif
-
diff --git a/bundles/org.eclipse.swt.opengl/carbon/library/agl.h b/bundles/org.eclipse.swt.opengl/carbon/library/agl.h
deleted file mode 100644
index 9a87d429a7..0000000000
--- a/bundles/org.eclipse.swt.opengl/carbon/library/agl.h
+++ /dev/null
@@ -1,3 +0,0 @@
-
-#include <OpenGL/gl.h>
-
diff --git a/bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.c b/bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.c
deleted file mode 100644
index c1f016799f..0000000000
--- a/bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2000, 2005 IBM Corporation and others.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* IBM Corporation - initial API and implementation
-*******************************************************************************/
-
-#include "swt.h"
-#include "agl_stats.h"
-
-#ifdef NATIVE_STATS
-
-int AGL_nativeFunctionCount = 14;
-int AGL_nativeFunctionCallCount[14];
-char * AGL_nativeFunctionNames[] = {
- "aglChoosePixelFormat",
- "aglCreateContext",
- "aglDescribePixelFormat",
- "aglDestroyContext",
- "aglDestroyPixelFormat",
- "aglEnable",
- "aglGetCurrentContext",
- "aglGetDrawable",
- "aglSetCurrentContext",
- "aglSetDrawable",
- "aglSetInteger__III",
- "aglSetInteger__II_3I",
- "aglSwapBuffers",
- "aglUpdateContext",
-};
-
-#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func
-
-JNIEXPORT jint JNICALL STATS_NATIVE(AGL_1GetFunctionCount)
- (JNIEnv *env, jclass that)
-{
- return AGL_nativeFunctionCount;
-}
-
-JNIEXPORT jstring JNICALL STATS_NATIVE(AGL_1GetFunctionName)
- (JNIEnv *env, jclass that, jint index)
-{
- return (*env)->NewStringUTF(env, AGL_nativeFunctionNames[index]);
-}
-
-JNIEXPORT jint JNICALL STATS_NATIVE(AGL_1GetFunctionCallCount)
- (JNIEnv *env, jclass that, jint index)
-{
- return AGL_nativeFunctionCallCount[index];
-}
-
-#endif
diff --git a/bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.h b/bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.h
deleted file mode 100644
index fc359aff5c..0000000000
--- a/bundles/org.eclipse.swt.opengl/carbon/library/agl_stats.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2000, 2005 IBM Corporation and others.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* IBM Corporation - initial API and implementation
-*******************************************************************************/
-
-#ifdef NATIVE_STATS
-extern int AGL_nativeFunctionCount;
-extern int AGL_nativeFunctionCallCount[];
-extern char* AGL_nativeFunctionNames[];
-#define AGL_NATIVE_ENTER(env, that, func) AGL_nativeFunctionCallCount[func]++;
-#define AGL_NATIVE_EXIT(env, that, func)
-#else
-#define AGL_NATIVE_ENTER(env, that, func)
-#define AGL_NATIVE_EXIT(env, that, func)
-#endif
-
-typedef enum {
- aglChoosePixelFormat_FUNC,
- aglCreateContext_FUNC,
- aglDescribePixelFormat_FUNC,
- aglDestroyContext_FUNC,
- aglDestroyPixelFormat_FUNC,
- aglEnable_FUNC,
- aglGetCurrentContext_FUNC,
- aglGetDrawable_FUNC,
- aglSetCurrentContext_FUNC,
- aglSetDrawable_FUNC,
- aglSetInteger__III_FUNC,
- aglSetInteger__II_3I_FUNC,
- aglSwapBuffers_FUNC,
- aglUpdateContext_FUNC,
-} AGL_FUNCS;
diff --git a/bundles/org.eclipse.swt.opengl/carbon/library/agl_structs.h b/bundles/org.eclipse.swt.opengl/carbon/library/agl_structs.h
deleted file mode 100644
index 36531f5373..0000000000
--- a/bundles/org.eclipse.swt.opengl/carbon/library/agl_structs.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2000, 2005 IBM Corporation and others.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* IBM Corporation - initial API and implementation
-*******************************************************************************/
-
-#include "agl.h"
-
diff --git a/bundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/internal/opengl/carbon/AGL.java b/bundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/internal/opengl/carbon/AGL.java
deleted file mode 100644
index 3c1339e33e..0000000000
--- a/bundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/internal/opengl/carbon/AGL.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.internal.opengl.carbon;
-
-import org.eclipse.swt.opengl.Library;
-
-public class AGL {
-
-static {
- Library.loadLibrary("gl");
-}
-
-/* Attributes */
-public static final int AGL_NONE = 0;
-public static final int AGL_BUFFER_SIZE = 2;
-public static final int AGL_LEVEL = 3;
-public static final int AGL_RGBA = 4;
-public static final int AGL_DOUBLEBUFFER = 5;
-public static final int AGL_STEREO = 6;
-public static final int AGL_AUX_BUFFERS = 7;
-public static final int AGL_RED_SIZE = 8;
-public static final int AGL_GREEN_SIZE = 9;
-public static final int AGL_BLUE_SIZE = 10;
-public static final int AGL_ALPHA_SIZE = 11;
-public static final int AGL_DEPTH_SIZE = 12;
-public static final int AGL_STENCIL_SIZE = 13;
-public static final int AGL_ACCUM_RED_SIZE = 14;
-public static final int AGL_ACCUM_GREEN_SIZE = 15;
-public static final int AGL_ACCUM_BLUE_SIZE = 16;
-public static final int AGL_ACCUM_ALPHA_SIZE = 17;
-
-public static final int AGL_SAMPLE_BUFFERS_ARB = 55;
-public static final int AGL_SAMPLES_ARB = 56;
-
-/* Integer parameters */
-public static final int AGL_BUFFER_RECT = 202;
-public static final int AGL_SWAP_INTERVAL = 222;
-public static final int AGL_BUFFER_NAME = 231;
-public static final int AGL_CLIP_REGION = 254;
-
-public static final native int aglChoosePixelFormat(int gdevs, int ndev, int[] attribs);
-public static final native int aglCreateContext(int pix, int share);
-public static final native boolean aglDescribePixelFormat(int pix, int attrib, int[] value);
-public static final native boolean aglDestroyContext(int ctx);
-public static final native void aglDestroyPixelFormat(int pix);
-public static final native boolean aglEnable(int ctx, int pname);
-public static final native int aglGetCurrentContext();
-public static final native int aglGetDrawable(int ctx);
-public static final native boolean aglSetCurrentContext(int ctx);
-public static final native boolean aglSetDrawable(int ctx, int draw);
-public static final native boolean aglSetInteger(int ctx, int pname, int[] params);
-public static final native boolean aglSetInteger(int ctx, int pname, int param);
-public static final native void aglSwapBuffers(int ctx);
-public static final native boolean aglUpdateContext(int ctx);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/opengl/GLCanvas.java
deleted file mode 100755
index ebfc775bf3..0000000000
--- a/bundles/org.eclipse.swt.opengl/carbon/org/eclipse/swt/opengl/GLCanvas.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.opengl;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.carbon.*;
-import org.eclipse.swt.internal.opengl.carbon.*;
-
-/**
- * GLCanvas is a widget capable of displaying OpenGL content.
- */
-
-public class GLCanvas extends Canvas {
- int context;
- int pixelFormat;
- static final int MAX_ATTRIBUTES = 32;
-
-/**
- * Create a GLCanvas widget using the attributes described in the GLData
- * object provided.
- *
- * @param parent a composite widget
- * @param style the bitwise OR'ing of widget styles
- * @param data the requested attributes of the GLCanvas
- *
- * @exception IllegalArgumentException
- * <ul><li>ERROR_NULL_ARGUMENT when the data is null
- * <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided</ul>
- * @exception SWTException
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
- * <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
- * <li>ERROR_CANNOT_OPEN_FILE when failed to open file
- * <li>ERROR_INTERFACE_NOT_FOUND when unable to create callbacks for OLE Interfaces
- * <li>ERROR_INVALID_CLASSID
- * </ul>
- */
-public GLCanvas (Composite parent, int style, GLData data) {
- super (parent, style);
- if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int aglAttrib [] = new int [MAX_ATTRIBUTES];
- int pos = 0;
- aglAttrib [pos++] = AGL.AGL_RGBA;
- if (data.doubleBuffer) aglAttrib [pos++] = AGL.AGL_DOUBLEBUFFER;
- if (data.stereo) aglAttrib [pos++] = AGL.AGL_STEREO;
- if (data.redSize > 0) {
- aglAttrib [pos++] = AGL.AGL_RED_SIZE;
- aglAttrib [pos++] = data.redSize;
- }
- if (data.greenSize > 0) {
- aglAttrib [pos++] = AGL.AGL_GREEN_SIZE;
- aglAttrib [pos++] = data.greenSize;
- }
- if (data.blueSize > 0) {
- aglAttrib [pos++] = AGL.AGL_BLUE_SIZE;
- aglAttrib [pos++] = data.blueSize;
- }
- if (data.alphaSize > 0) {
- aglAttrib [pos++] = AGL.AGL_ALPHA_SIZE;
- aglAttrib [pos++] = data.alphaSize;
- }
- if (data.depthSize > 0) {
- aglAttrib [pos++] = AGL.AGL_DEPTH_SIZE;
- aglAttrib [pos++] = data.depthSize;
- }
- if (data.stencilSize > 0) {
- aglAttrib [pos++] = AGL.AGL_STENCIL_SIZE;
- aglAttrib [pos++] = data.stencilSize;
- }
- if (data.accumRedSize > 0) {
- aglAttrib [pos++] = AGL.AGL_ACCUM_RED_SIZE;
- aglAttrib [pos++] = data.accumRedSize;
- }
- if (data.accumGreenSize > 0) {
- aglAttrib [pos++] = AGL.AGL_ACCUM_GREEN_SIZE;
- aglAttrib [pos++] = data.accumGreenSize;
- }
- if (data.accumBlueSize > 0) {
- aglAttrib [pos++] = AGL.AGL_ACCUM_BLUE_SIZE;
- aglAttrib [pos++] = data.accumBlueSize;
- }
- if (data.accumAlphaSize > 0) {
- aglAttrib [pos++] = AGL.AGL_ACCUM_ALPHA_SIZE;
- aglAttrib [pos++] = data.accumAlphaSize;
- }
- if (data.sampleBuffers > 0) {
- aglAttrib [pos++] = AGL.AGL_SAMPLE_BUFFERS_ARB;
- aglAttrib [pos++] = data.sampleBuffers;
- }
- if (data.samples > 0) {
- aglAttrib [pos++] = AGL.AGL_SAMPLES_ARB;
- aglAttrib [pos++] = data.samples;
- }
- aglAttrib [pos++] = AGL.AGL_NONE;
- pixelFormat = AGL.aglChoosePixelFormat (0, 0, aglAttrib);
-// context = AGL.aglCreateContext (pixelFormat, share == null ? 0 : share.context);
- context = AGL.aglCreateContext (pixelFormat, 0);
- int window = OS.GetControlOwner (handle);
- int port = OS.GetWindowPort (window);
- AGL.aglSetDrawable (context, port);
-
- Listener listener = new Listener () {
- public void handleEvent (Event event) {
- switch (event.type) {
- case SWT.Dispose:
- AGL.aglDestroyContext (context);
- AGL.aglDestroyPixelFormat (pixelFormat);
- break;
- case SWT.Resize:
- case SWT.Hide:
- case SWT.Show:
- getDisplay().asyncExec(new Runnable() {
- public void run() {
- fixBounds();
- }
- });
- break;
- }
- }
- };
- addListener (SWT.Resize, listener);
- Shell shell = getShell();
- shell.addListener(SWT.Resize, listener);
- shell.addListener(SWT.Show, listener);
- shell.addListener(SWT.Hide, listener);
- Control c = this;
- do {
- c.addListener(SWT.Show, listener);
- c.addListener(SWT.Hide, listener);
- c = c.getParent();
- } while (c != shell);
- addListener (SWT.Dispose, listener);
-}
-
-void fixBounds () {
- GCData data = new GCData ();
- int gc = internal_new_GC (data);
- Rect bounds = new Rect ();
- OS.GetRegionBounds (data.visibleRgn, bounds);
- int width = bounds.right - bounds.left;
- int height = bounds.bottom - bounds.top;
- Rect rect = new Rect ();
- int window = OS.GetControlOwner (handle);
- int port = OS.GetWindowPort (window);
- OS.GetPortBounds (port, rect);
- int [] glbounds = new int [4];
- glbounds[0] = bounds.left;
- glbounds[1] = rect.bottom - rect.top - bounds.top - height;
- glbounds[2] = width;
- glbounds[3] = height;
- AGL.aglSetInteger (context, AGL.AGL_BUFFER_RECT, glbounds);
- AGL.aglEnable (context, AGL.AGL_BUFFER_RECT);
- AGL.aglSetInteger (context, AGL.AGL_CLIP_REGION, data.visibleRgn);
- AGL.aglUpdateContext (context);
- internal_dispose_GC (gc, data);
-}
-
-/**
- * Returns a GLData object describing the created context.
- *
- * @return GLData description of the OpenGL context attributes
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public GLData getGLData () {
- checkWidget ();
- GLData data = new GLData ();
- int [] value = new int [1];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_DOUBLEBUFFER, value);
- data.doubleBuffer = value [0] != 0;
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_STEREO, value);
- data.stereo = value [0] != 0;
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_RED_SIZE, value);
- data.redSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_GREEN_SIZE, value);
- data.greenSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_BLUE_SIZE, value);
- data.blueSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ALPHA_SIZE, value);
- data.alphaSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_DEPTH_SIZE, value);
- data.depthSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_STENCIL_SIZE, value);
- data.stencilSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ACCUM_RED_SIZE, value);
- data.accumRedSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ACCUM_GREEN_SIZE, value);
- data.accumGreenSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ACCUM_BLUE_SIZE, value);
- data.accumBlueSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_ACCUM_ALPHA_SIZE, value);
- data.accumAlphaSize = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_SAMPLE_BUFFERS_ARB, value);
- data.sampleBuffers = value [0];
- AGL.aglDescribePixelFormat (pixelFormat, AGL.AGL_SAMPLES_ARB, value);
- data.samples = value [0];
- return data;
-}
-
-/**
- * Returns a boolean indicating whether the receiver's OpenGL context
- * is the current context.
- *
- * @return true if the receiver holds the current OpenGL context,
- * false otherwise
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public boolean isCurrent () {
- checkWidget ();
- return AGL.aglGetCurrentContext () == context;
-}
-
-/**
- * Sets the OpenGL context associated with this GLCanvas to be the
- * current GL context.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setCurrent () {
- checkWidget ();
- if (AGL.aglGetCurrentContext () != context) {
- AGL.aglSetCurrentContext (context);
- }
-}
-
-/**
- * Swaps the front and back color buffers.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void swapBuffers () {
- checkWidget ();
- AGL.aglSwapBuffers (context);
-}
-}

Back to the top