diff options
author | cvs2svn <platform-releng-dev@eclipse.org> | 2005-06-27 17:56:10 +0000 |
---|---|---|
committer | cvs2svn <platform-releng-dev@eclipse.org> | 2005-06-27 17:56:10 +0000 |
commit | 6861ff31758719eea6426ced00c2a911bdd285b9 (patch) | |
tree | 55eeeaf20e43066c7996d4878edb672ead223b71 /examples/org.eclipse.swt.opengl.examples | |
parent | 0da9591c16fd1b83bb3969aa065a9dd2e74261f5 (diff) | |
download | eclipse.platform.swt-3138.tar.gz eclipse.platform.swt-3138.tar.xz eclipse.platform.swt-3138.zip |
This commit was manufactured by cvs2svn to create tag 'v3138'.v3138
Sprout from master 2005-06-16 19:51:57 UTC Veronika Irvine <veronika> '3.1 RC3 build v3138'
Cherrypick from master 2005-06-23 21:36:59 UTC Carolyn MacLeod <carolyn> 'Comment out deprecated TableTree tab':
examples/org.eclipse.swt.examples.browser.demos/doc-html/swt_browser_demos_ex.html
examples/org.eclipse.swt.examples.browser/doc-html/swt_browser_ex.html
examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html
examples/org.eclipse.swt.examples.controls/doc-html/swt_customcontrols_ex.html
examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html
examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.exsd
examples/org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html
examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html
examples/org.eclipse.swt.examples/doc-html/hglegal.htm
examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_browser_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_clipboard_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_controls_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_customcontrols_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_dnd_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_launcher_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_layout_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html
examples/org.eclipse.swt.examples/doc-html/swt_paint_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CustomControlExample.java
Cherrypick from master 2005-06-27 17:56:09 UTC Billy Biggs <bbiggs> '96652':
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/SwtPerformanceTestCase.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_situational.java
Delete:
bundles/org.eclipse.swt.opengl/.classpath_gtk
bundles/org.eclipse.swt.opengl/.classpath_motif
bundles/org.eclipse.swt.opengl/.classpath_win32
bundles/org.eclipse.swt.opengl/.cvsignore
bundles/org.eclipse.swt.opengl/.project
bundles/org.eclipse.swt.opengl/META-INF/MANIFEST.MF
bundles/org.eclipse.swt.opengl/about.html
bundles/org.eclipse.swt.opengl/common/library/gl.c
bundles/org.eclipse.swt.opengl/common/library/gl.h
bundles/org.eclipse.swt.opengl/common/library/gl_stats.c
bundles/org.eclipse.swt.opengl/common/library/gl_stats.h
bundles/org.eclipse.swt.opengl/common/library/gl_structs.c
bundles/org.eclipse.swt.opengl/common/library/gl_structs.h
bundles/org.eclipse.swt.opengl/common/library/glu.c
bundles/org.eclipse.swt.opengl/common/library/glu.h
bundles/org.eclipse.swt.opengl/common/library/glu_stats.c
bundles/org.eclipse.swt.opengl/common/library/glu_stats.h
bundles/org.eclipse.swt.opengl/common/library/glu_structs.c
bundles/org.eclipse.swt.opengl/common/library/glu_structs.h
bundles/org.eclipse.swt.opengl/common/library/swt.c
bundles/org.eclipse.swt.opengl/common/library/swt.h
bundles/org.eclipse.swt.opengl/common/org/eclipse/swt/opengl/GL.java
bundles/org.eclipse.swt.opengl/common/org/eclipse/swt/opengl/GLU.java
bundles/org.eclipse.swt.opengl/common/org/eclipse/swt/opengl/GLYPHMETRICSFLOAT.java
bundles/org.eclipse.swt.opengl/common/org/eclipse/swt/opengl/ImageDataUtil.java
bundles/org.eclipse.swt.opengl/common/org/eclipse/swt/opengl/Library.java
bundles/org.eclipse.swt.opengl/gtk/library/build.sh
bundles/org.eclipse.swt.opengl/gtk/library/glx.c
bundles/org.eclipse.swt.opengl/gtk/library/make_linux.mak
bundles/org.eclipse.swt.opengl/gtk/library/structs.c
bundles/org.eclipse.swt.opengl/gtk/library/structs.h
bundles/org.eclipse.swt.opengl/gtk/library/xgtk.c
bundles/org.eclipse.swt.opengl/gtk/org/eclipse/swt/opengl/GLContext.java
bundles/org.eclipse.swt.opengl/gtk/org/eclipse/swt/opengl/internal/gtk/XGL.java
bundles/org.eclipse.swt.opengl/gtk/org/eclipse/swt/opengl/internal/gtk/XGTK.java
bundles/org.eclipse.swt.opengl/gtk/org/eclipse/swt/opengl/internal/gtk/XVisualInfo.java
bundles/org.eclipse.swt.opengl/motif/library/build.sh
bundles/org.eclipse.swt.opengl/motif/library/glx.c
bundles/org.eclipse.swt.opengl/motif/library/make_aix.mak
bundles/org.eclipse.swt.opengl/motif/library/make_hpux.mak
bundles/org.eclipse.swt.opengl/motif/library/make_linux.mak
bundles/org.eclipse.swt.opengl/motif/library/make_solaris.mak
bundles/org.eclipse.swt.opengl/motif/library/structs.c
bundles/org.eclipse.swt.opengl/motif/library/structs.h
bundles/org.eclipse.swt.opengl/motif/org/eclipse/swt/opengl/GLContext.java
bundles/org.eclipse.swt.opengl/motif/org/eclipse/swt/opengl/internal/motif/XGL.java
bundles/org.eclipse.swt.opengl/motif/org/eclipse/swt/opengl/internal/motif/XVisualInfo.java
bundles/org.eclipse.swt.opengl/plugin.properties
bundles/org.eclipse.swt.opengl/plugin.xml
bundles/org.eclipse.swt.opengl/win32/library/build.bat
bundles/org.eclipse.swt.opengl/win32/library/glw.c
bundles/org.eclipse.swt.opengl/win32/library/make_win32.mak
bundles/org.eclipse.swt.opengl/win32/library/structs.c
bundles/org.eclipse.swt.opengl/win32/library/structs.h
bundles/org.eclipse.swt.opengl/win32/library/swt.rc
bundles/org.eclipse.swt.opengl/win32/org/eclipse/swt/opengl/GLContext.java
bundles/org.eclipse.swt.opengl/win32/org/eclipse/swt/opengl/internal/win32/LAYERPLANEDESCRIPTOR.java
bundles/org.eclipse.swt.opengl/win32/org/eclipse/swt/opengl/internal/win32/PIXELFORMATDESCRIPTOR.java
bundles/org.eclipse.swt.opengl/win32/org/eclipse/swt/opengl/internal/win32/POINTFLOAT.java
bundles/org.eclipse.swt.opengl/win32/org/eclipse/swt/opengl/internal/win32/WGL.java
examples/org.eclipse.swt.examples.ole.win32/.classpath
examples/org.eclipse.swt.examples.ole.win32/.cvsignore
examples/org.eclipse.swt.examples.ole.win32/.project
examples/org.eclipse.swt.examples.ole.win32/about.html
examples/org.eclipse.swt.examples.ole.win32/build.properties
examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.htm
examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.gif
examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html
examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif
examples/org.eclipse.swt.examples.ole.win32/plugin.properties
examples/org.eclipse.swt.examples.ole.win32/plugin.xml
examples/org.eclipse.swt.examples.ole.win32/src/import.properties
examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
examples/org.eclipse.swt.examples/doc-html/ngibmcpy.gif
examples/org.eclipse.swt.opengl.examples/.classpath
examples/org.eclipse.swt.opengl.examples/.cvsignore
examples/org.eclipse.swt.opengl.examples/.project
examples/org.eclipse.swt.opengl.examples/about.html
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AntialiasingTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AreaTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/BezierTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/BitmapTextTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ColorSelectionGroup.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/GradientTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/IColorSelectionListener.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LightTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/NurbTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ObjectsTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLExample.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OutlineTextTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ReflectionTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/SelectionTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/StencilTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TextureTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TransparencyTab.java
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Ball.jpg
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Box.bmp
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Floor.jpg
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/splash.bmp
examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/untitled.jpg
examples/org.eclipse.swt.snippets/.classpath
examples/org.eclipse.swt.snippets/.cvsignore
examples/org.eclipse.swt.snippets/.project
examples/org.eclipse.swt.snippets/about.html
examples/org.eclipse.swt.snippets/build.properties
examples/org.eclipse.swt.snippets/plugin.properties
examples/org.eclipse.swt.snippets/plugin.xml
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet1.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet10.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet100.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet101.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet102.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet103.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet104.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet105.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet106.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet107.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet108.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet109.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet11.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet110.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet111.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet112.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet113.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet114.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet115.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet116.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet117.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet118.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet119.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet12.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet120.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet121.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet122.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet124.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet125.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet126.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet127.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet128.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet129.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet13.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet130.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet131.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet132.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet133.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet134.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet135.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet136.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet137.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet138.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet139.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet14.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet140.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet141.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet143.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet144.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet145.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet146.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet147.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet148.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet149.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet15.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet150.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet152.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet153.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet154.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet155.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet156.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet157.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet158.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet159.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet16.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet160.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet161.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet162.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet163.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet164.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet165.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet166.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet167.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet168.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet17.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet170.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet171.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet173.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet174.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet175.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet176.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet177.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet178.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet179.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet18.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet181.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet182.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet183.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet184.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet185.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.html
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.html
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet187.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet188.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet189.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet19.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet190.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet191.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet2.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet20.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet22.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet23.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet24.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet25.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet26.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet27.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet28.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet29.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet3.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet30.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet31.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet32.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet33.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet34.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet35.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet36.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet37.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet38.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet39.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet4.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet40.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet41.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet42.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet43.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet44.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet45.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet46.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet47.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet48.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet49.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet5.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet50.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet51.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet52.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet53.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet54.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet55.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet57.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet58.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet59.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet6.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet60.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet61.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet63.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet64.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet65.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet66.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet67.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet68.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet69.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet7.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet70.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet71.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet72.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet73.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet74.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet75.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet76.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet77.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet78.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet79.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet8.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet80.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet81.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet82.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet83.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet84.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet85.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet86.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet87.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet88.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet89.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet9.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet90.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet91.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet92.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet93.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet95.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet97.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet98.java
examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet99.java
Diffstat (limited to 'examples/org.eclipse.swt.opengl.examples')
28 files changed, 0 insertions, 4570 deletions
diff --git a/examples/org.eclipse.swt.opengl.examples/.classpath b/examples/org.eclipse.swt.opengl.examples/.classpath deleted file mode 100644 index 8437e3bb55..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="src" path="/org.eclipse.swt.opengl"/> - <classpathentry kind="src" path="/org.eclipse.swt"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/examples/org.eclipse.swt.opengl.examples/.cvsignore b/examples/org.eclipse.swt.opengl.examples/.cvsignore deleted file mode 100644 index c5e82d7458..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/examples/org.eclipse.swt.opengl.examples/.project b/examples/org.eclipse.swt.opengl.examples/.project deleted file mode 100644 index 9112e8e738..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/.project +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.swt.opengl.examples</name> - <comment></comment> - <projects> - <project>org.eclipse.swt</project> - <project>org.eclipse.swt.opengl</project> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/examples/org.eclipse.swt.opengl.examples/about.html b/examples/org.eclipse.swt.opengl.examples/about.html deleted file mode 100644 index 6f6b96c4c8..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/about.html +++ /dev/null @@ -1,22 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>February 24, 2005</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p> - -</body> -</html>
\ No newline at end of file diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AntialiasingTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AntialiasingTab.java deleted file mode 100644 index 693998e857..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AntialiasingTab.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class AntialiasingTab extends OpenGLTab { - private Button antiAliasButton; - private float xPos = 0.0f, yPos = 0.0f, zPos = -6.0f; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setText("Translation"); - movementGroup.setLayout(new GridLayout(2, false)); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider xMove = new Slider(movementGroup, SWT.NONE); - xMove.setIncrement(1); - xMove.setMaximum(12); - xMove.setMinimum(0); - xMove.setThumb(2); - xMove.setPageIncrement(2); - xMove.setSelection(5); - xMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = xMove.getSelection() - 5; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider yMove = new Slider(movementGroup, SWT.NONE); - yMove.setIncrement(1); - yMove.setMaximum(12); - yMove.setMinimum(0); - yMove.setThumb(2); - yMove.setPageIncrement(2); - yMove.setSelection(5); - yMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = yMove.getSelection() - 5; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Z:"); - final Slider zMove = new Slider(movementGroup, SWT.NONE); - zMove.setIncrement(1); - zMove.setMaximum(12); - zMove.setMinimum(0); - zMove.setThumb(2); - zMove.setPageIncrement(2); - zMove.setSelection(5); - zMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zPos = zMove.getSelection() - 11; - } - }); - - antiAliasButton = new Button(composite, SWT.CHECK); - antiAliasButton.setText("Anti-Aliasing"); - antiAliasButton.setSelection(true); - antiAliasButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - if (antiAliasButton.getSelection()) { - GL.glEnable(GL.GL_LINE_SMOOTH); - } else { - GL.glDisable(GL.GL_LINE_SMOOTH); - } - } - }); - - ColorSelectionGroup colorGroup = - new ColorSelectionGroup(composite, SWT.NONE); - colorGroup.setText("Foreground color"); - colorGroup.addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - GL.glColor3ub((byte) rgb.red, (byte) rgb.green, (byte) rgb.blue); - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GL.glDeleteLists(1, 1); - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Anti-aliasing"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glColor3f(1.0f, 0.0f, 0.0f); - final float[] BEZIER_POINTS = { - -1.5f, -1.5f, 4.0f, -0.5f, -1.5f, 2.0f, 0.5f, -1.5f, - -1.0f, 1.5f, -1.5f, 2.0f, -1.5f, -0.5f, 1.0f, -0.5f, - -0.5f, 3.0f, 0.5f, -0.5f, 0.0f, 1.5f, -0.5f, -1.0f, - -1.5f, 0.5f, 4.0f, -0.5f, 0.5f, 0.0f, 0.5f, 0.5f, - 3.0f, 1.5f, 0.5f, 4.0f, -1.5f, 1.5f, -2.0f, -0.5f, - 1.5f, -2.0f, 0.5f, 1.5f, 0.0f, 1.5f, 1.5f, -1.0f, - }; - GL.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST); - GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - GL.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, BEZIER_POINTS); - GL.glMapGrid2f(30, 0.0f, 1.0f, 30, 0.0f, 1.0f); - - GL.glEnable(GL.GL_AUTO_NORMAL); - GL.glEnable(GL.GL_LINE_SMOOTH); - GL.glEnable(GL.GL_LINE_STIPPLE); - GL.glEnable(GL.GL_BLEND); - GL.glEnable(GL.GL_MAP2_VERTEX_3); - - // create display lists - GL.glNewList(1, GL.GL_COMPILE); - GL.glEvalMesh2(GL.GL_LINE, 0, 30, 0, 30); - GL.glEndList(); - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glTranslatef(xPos, yPos, zPos); - GL.glCallList(1); // draw the beizer surface - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AreaTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AreaTab.java deleted file mode 100644 index 89ee480722..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/AreaTab.java +++ /dev/null @@ -1,434 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class AreaTab extends OpenGLTab { - abstract class Shape { - abstract void draw(); - } - class State { - private String name; - private int index; - /** - * Constructor. - * - * @param name the display name of this state - * @param index the display list index corresponding to this state - */ - State (String name, int index) { - super(); - this.index = index; - this.name = name; - } - void display() { - GL.glCallList(index); - } - void dispose() { - GL.glDeleteLists(index, 1); - } - String getName() { - return name; - } - } - - private State[] states; - private State currentState; - private float xPos = 0.0f, yPos = 0.0f, zPos = -30.0f; - private float xRot = 90.0f, yRot = 0.0f, zRot = 0.0f; - private int quadratic, disk; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setText("Translation"); - movementGroup.setLayout(new GridLayout(2, false)); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider xMove = new Slider(movementGroup, SWT.NONE); - xMove.setIncrement(1); - xMove.setMaximum(22); - xMove.setMinimum(0); - xMove.setThumb(2); - xMove.setPageIncrement(2); - xMove.setSelection(10); - xMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = xMove.getSelection() - 10; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider yMove = new Slider(movementGroup, SWT.NONE); - yMove.setIncrement(1); - yMove.setMaximum(22); - yMove.setMinimum(0); - yMove.setThumb(2); - yMove.setPageIncrement(2); - yMove.setSelection(10); - yMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = yMove.getSelection() - 10; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Z:"); - final Slider zMove = new Slider(movementGroup, SWT.NONE); - zMove.setIncrement(1); - zMove.setMaximum(22); - zMove.setMinimum(0); - zMove.setThumb(2); - zMove.setPageIncrement(2); - zMove.setSelection(10); - zMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zPos = zMove.getSelection() - 40; - } - }); - - Group rotationGroup = new Group(composite, SWT.NONE); - rotationGroup.setText("Rotation"); - rotationGroup.setLayout(new GridLayout(2, false)); - - new Label(rotationGroup, SWT.NONE).setText("X:"); - final Slider xRotation = new Slider(rotationGroup, SWT.NONE); - xRotation.setIncrement(10); - xRotation.setMaximum(362); - xRotation.setMinimum(0); - xRotation.setThumb(2); - xRotation.setPageIncrement(20); - xRotation.setSelection(90); - xRotation.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xRot = xRotation.getSelection(); - } - }); - - new Label(rotationGroup, SWT.NONE).setText("Y:"); - final Slider yRotation = new Slider(rotationGroup, SWT.NONE); - yRotation.setIncrement(10); - yRotation.setMaximum(362); - yRotation.setMinimum(0); - yRotation.setThumb(2); - yRotation.setPageIncrement(20); - yRotation.setSelection(0); - yRotation.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yRot = yRotation.getSelection(); - } - }); - - new Label(rotationGroup, SWT.NONE).setText("Z:"); - final Slider zRotation = new Slider(rotationGroup, SWT.NONE); - zRotation.setIncrement(10); - zRotation.setMaximum(362); - zRotation.setMinimum(0); - zRotation.setThumb(2); - zRotation.setPageIncrement(20); - zRotation.setSelection(0); - zRotation.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zRot = zRotation.getSelection(); - } - }); - - Composite optionsGroup = new Composite(composite, SWT.NONE); - GridLayout layout = new GridLayout(2, false); - layout.marginWidth = 0; - optionsGroup.setLayout(layout); - - new Label(optionsGroup, SWT.NONE).setText("Shape:"); - - final Combo statesCombo = new Combo(optionsGroup, SWT.READ_ONLY); - for (int i = 0; i < states.length; i++) { - statesCombo.add(states[i].getName()); - } - statesCombo.select(0); - statesCombo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - currentState = states[statesCombo.getSelectionIndex()]; - } - }); - - final Button lightsButton = new Button(composite, SWT.CHECK); - lightsButton.setText("Lights"); - lightsButton.setSelection(true); - lightsButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - if (lightsButton.getSelection()) { - GL.glEnable(GL.GL_LIGHTING); - } else { - GL.glDisable(GL.GL_LIGHTING); - } - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GLU.gluDeleteQuadric(quadratic); - GLU.gluDeleteQuadric(disk); - if (states != null) { - for (int i = 0; i < states.length; i++) { - states [i].dispose(); - } - } - } - - /** - * Draws the logical AND of two shapes. - * - * @param a shape A - * @param b shape B - */ - void drawAandB(Shape a, Shape b) { - // draw parts of B that are inside A - drawAinsideB(a, b, GL.GL_BACK, GL.GL_NOTEQUAL); - // we do not want the following to show up - GL.glColorMask(false, false, false, false); - // turn on depth testing - GL.glEnable(GL.GL_DEPTH_TEST); - GL.glDepthFunc(GL.GL_ALWAYS); - // render the front face of B - b.draw(); - // reset the depth function - GL.glDepthFunc(GL.GL_LESS); - // draw parts of A that are inside B - drawAinsideB(b, a, GL.GL_BACK, GL.GL_NOTEQUAL); - } - - /** - * Draws the contents of one shape that appear within another. - * - * @param a the shape to draw - * @param b the constraining shape - * @param face - * @param test - */ - void drawAinsideB(Shape a, Shape b, int face, int test) { - // turn off the color buffer - GL.glColorMask(false, false, false, false); - // clear the stencil buffer - GL.glClearStencil(0); - GL.glEnable(GL.GL_DEPTH_TEST); - // set to proper Culling - GL.glCullFace(face); - // render shape A - a.draw(); - // set depth mask - GL.glDepthMask(false); - // enable stencil test - GL.glEnable(GL.GL_STENCIL_TEST); - GL.glStencilFunc(GL.GL_ALWAYS, 0, 0); - // set the stencil buffer to increment if the depth test passes - GL.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_INCR); - // turn on back face culling - GL.glCullFace(GL.GL_BACK); - // render B - b.draw(); - // set the stencil buffer to decrement if the depth test passes - GL.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_DECR); - // cull the front face - GL.glCullFace(GL.GL_FRONT); - // render B again - b.draw(); - // set depth mask - GL.glDepthMask(true); - GL.glColorMask(true, true, true, true); - // set the stencil buffer - GL.glStencilFunc(test, 0, 1); - // turn off depth testing - GL.glDisable(GL.GL_DEPTH_TEST); - // set to proper culling - GL.glCullFace(face); - // render A - a.draw(); - // disable stencil test - GL.glDisable(GL.GL_STENCIL_TEST); - } - - /** - * Draws the logical OR of two shapes. - * - * @param a shape A - * @param b shape B - */ - void drawAorB(Shape a, Shape b) { - GL.glEnable(GL.GL_DEPTH_TEST); - a.draw(); - b.draw(); - GL.glDisable(GL.GL_DEPTH_TEST); - } - - /** - * Draws one shape subtracted from another. - * - * @param a the base shape - * @param b the shape to subtract - */ - void drawAsubB(Shape a, Shape b) { - // draw back parts of B inside A - drawAinsideB(b, a, GL.GL_FRONT, GL.GL_NOTEQUAL); - // we do not want the following to show up - GL.glColorMask(false, false, false, false); - GL.glEnable(GL.GL_DEPTH_TEST); - // change the depth test to GL_ALWAYS - GL.glDepthFunc(GL.GL_ALWAYS); - // render the front face of B - a.draw(); - // reset the depth function - GL.glDepthFunc(GL.GL_LESS); - // draw front parts of A outside B - drawAinsideB(a, b, GL.GL_BACK, GL.GL_EQUAL); - } - - /** - * Draws the specifed shape. - * - * @param shape the shape to draw - */ - void drawShape(Shape shape) { - GL.glEnable(GL.GL_DEPTH_TEST); - shape.draw(); - GL.glDisable(GL.GL_DEPTH_TEST); - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Area"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - if (!hasStencilSupport()) return; - - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - float[] lightPos = { 0.0f, 5.0f, -10.0f, 1.0f }; - GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, lightPos); - quadratic = GLU.gluNewQuadric(); - disk = GLU.gluNewQuadric(); - - GL.glEnable(GL.GL_CULL_FACE); - GL.glEnable(GL.GL_LIST_MODE); - GL.glEnable(GL.GL_LIGHT0); - GL.glEnable(GL.GL_LIGHTING); - GL.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_TRUE); - - final float[] sphereMaterial = { 0.0f, 1.0f, 0.0f, 1.0f }; - final float[] cylinderMaterial = { 1.0f, 0.0f, 0.0f, 1.0f }; - - Shape sphere = new Shape() { - public void draw() { - GL.glMaterialfv( - GL.GL_FRONT_AND_BACK, - GL.GL_AMBIENT_AND_DIFFUSE, - sphereMaterial); - GL.glColor3f(0.0f, 1.0f, 0.0f); - GLU.gluSphere(quadratic, 3, 32, 32); - } - }; - Shape cylinder = new Shape() { - public void draw() { - GL.glMaterialfv( - GL.GL_FRONT_AND_BACK, - GL.GL_AMBIENT_AND_DIFFUSE, - cylinderMaterial); - GL.glColor3f(1.0f, 0.0f, 0.0f); - GLU.gluQuadricOrientation(disk, GLU.GLU_INSIDE); - GL.glPushMatrix(); - GL.glTranslatef(1.0f, 1.0f, 0.0f); - GLU.gluDisk(disk, 0, 3, 32, 32); - GLU.gluCylinder(quadratic, 3, 3, 6, 32, 32); - GL.glPushMatrix(); - GL.glTranslatef(0.0f, 0.0f, 6.0f); - GLU.gluQuadricOrientation(disk, GLU.GLU_OUTSIDE); - GLU.gluDisk(disk, 0, 3, 32, 32); - GL.glPopMatrix(); - GL.glPopMatrix(); - } - }; - - // create the display lists and states - states = new State[6]; - int index = 1; - - GL.glNewList(index, GL.GL_COMPILE); - drawShape(cylinder); - GL.glEndList(); - states[0] = new State("Cylinder",index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawShape(sphere); - GL.glEndList(); - states[1] = new State("Sphere",index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawAorB(cylinder, sphere); - GL.glEndList(); - states[2] = new State("Cylinder OR Sphere",index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawAandB(cylinder, sphere); - GL.glEndList(); - states[3] = new State("Cylinder AND Sphere",index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawAsubB(cylinder, sphere); - GL.glEndList(); - states[4] = new State("Cylinder SUB Sphere",index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawAsubB(sphere, cylinder); - GL.glEndList(); - states[5] = new State("Sphere SUB Cylinder",index++); - - currentState = states[0]; - } - - /** - * @see OpenGLTab#isStencilSupportNeeded - */ - boolean isStencilSupportNeeded() { - return true; - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear( - GL.GL_COLOR_BUFFER_BIT - | GL.GL_DEPTH_BUFFER_BIT - | GL.GL_STENCIL_BUFFER_BIT); - - GL.glLoadIdentity(); - GL.glTranslatef(xPos, yPos, zPos); - GL.glRotatef(xRot, 1.0f, 0.0f, 0.0f); - GL.glRotatef(yRot, 0.0f, 1.0f, 0.0f); - GL.glRotatef(zRot, 0.0f, 0.0f, 1.0f); - - currentState.display(); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/BezierTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/BezierTab.java deleted file mode 100644 index fc1de9f618..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/BezierTab.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class BezierTab extends SelectionTab { - private boolean showCtrlPoints = true; - private Point offset; - private int currentPoint = -1; - private int lineDivisions = 30; - private double[][] ctrlPts = { - { 1.5, 0.5, 0.0, 0.6, 0.9, 0.0, 0.85, 0.12, - 0.0, 1.1, 1.0, 0.0, 0.53, 1.4, 0.0 - }, - { 0.53, 1.4, 0.0, 1.03, 1.87, 0.0, 1.52, 0.26, - 0.0, 1.86, 0.43, 0.0, 1.5, 0.5, 0.0 - } - }; - private static final int LENGTH = 5; - private static final int[][] PICK_NAMES = { - { 1, 2, 3, 4, 5 }, - { 6, 7, 8, 9, 10 } - }; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - new Label(composite, SWT.NONE).setText("Click and drag points to adjust shape."); - new Label(composite, SWT.NONE).setText("Line division count:"); - final Slider divisions = new Slider(composite, SWT.NONE); - divisions.setIncrement(1); - divisions.setMaximum(52); - divisions.setMinimum(1); - divisions.setThumb(2); - divisions.setPageIncrement(2); - divisions.setSelection(30); - divisions.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - lineDivisions = divisions.getSelection(); - } - }); - - final Button showPointsButton = new Button(composite, SWT.CHECK); - showPointsButton.setText("Show Points"); - showPointsButton.setSelection(true); - showPointsButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - showCtrlPoints = showPointsButton.getSelection(); - } - }); - - final Button blendButton = new Button(composite, SWT.CHECK); - blendButton.setText("Blend"); - blendButton.setSelection(true); - blendButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - if (blendButton.getSelection()) { - GL.glEnable(GL.GL_BLEND); - } else { - GL.glDisable(GL.GL_BLEND); - } - } - }); - - final Button smoothLineButton = new Button(composite, SWT.CHECK); - smoothLineButton.setText("Smooth Line"); - smoothLineButton.setSelection(true); - smoothLineButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - if (smoothLineButton.getSelection()) { - GL.glEnable(GL.GL_LINE_SMOOTH); - } else { - GL.glDisable(GL.GL_LINE_SMOOTH); - } - } - }); - - final Canvas glCanvas = getGlCanvas(); - glCanvas.addMouseListener(new MouseAdapter() { - public void mouseUp(MouseEvent e) { - offset = null; - } - - }); - - glCanvas.addListener(SWT.MouseDown, new Listener() { - public void handleEvent(Event e) { - e.y = glCanvas.getClientArea().height - e.y; - if (e.button == 1) { - if (processSelection(e.x, e.y, 10) > 0) { - offset = new Point(e.x, e.y); - } else { - currentPoint = 0; - } - } - } - }); - - glCanvas.addListener(SWT.MouseMove, new Listener() { - public void handleEvent(Event e) { - if (offset == null) return; - int currentSegment = (currentPoint - 1) / LENGTH; - int current = (currentPoint - 1) * 3; - if (currentPoint > LENGTH) { - current = (currentPoint - 6) * 3; - } - Rectangle rect = glCanvas.getClientArea(); - e.y = rect.height - e.y; - if (0 < e.x && e.x < rect.width && 0 < e.y && e.y < rect.height && currentPoint > 0) { - ctrlPts[currentSegment][current] = (float) e.x / (float) 200; - ctrlPts[currentSegment][current + 1] = (float) e.y / (float) 200; - switch (currentPoint) { - case 10 : - ctrlPts[0][0] = (float) e.x / (float) 200; - ctrlPts[0][1] = (float) e.y / (float) 200; - break; - case 6 : - ctrlPts[0][12] = (float) e.x / (float) 200; - ctrlPts[0][13] = (float) e.y / (float) 200; - break; - } - } - } - }); - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Bezier"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST); - GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - GL.glPointSize(7.0f); - GL.glLineWidth(4.0f); - - GL.glEnable(GL.GL_AUTO_NORMAL); - GL.glEnable(GL.GL_MAP1_VERTEX_3); - GL.glEnable(GL.GL_LINE_SMOOTH); - GL.glEnable(GL.GL_BLEND); - } - - /** - * @see SelectionTab.processPick (int[], int) - */ - void processPick(int[] pSelectBuff, int hits) { - int counter = 0; - currentPoint = 0; - for (int i = 0; i < hits; i++) { - int count = pSelectBuff[counter]; - counter += 3; - for (int j = 0; j < count; j++) { - currentPoint = pSelectBuff[counter]; - counter++; - } - } - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glTranslatef(-1.0f, -1.0f, -2.45f); - GL.glColor3f(0.0f, 0.0f, 1.0f); - for (int i = 0; i < ctrlPts.length; i++) { - GL.glMapGrid1d(lineDivisions, 0.0f, 1f); - GL.glMap1d(GL.GL_MAP1_VERTEX_3, 0, 1, 3, LENGTH, ctrlPts[i]); - GL.glEvalMesh1(GL.GL_LINE, 0, lineDivisions); - } - if (showCtrlPoints) { - GL.glPushName(0); - for (int j = 0; j < ctrlPts.length; j++) { - for (int i = 0; i < LENGTH * 3; i += 3) { - GL.glLoadName(PICK_NAMES[j][i / 3]); - GL.glBegin(GL.GL_POINTS); - if (PICK_NAMES[j][i / 3] == currentPoint) { - GL.glColor3f(1.0f, 0.0f, 0.0f); - } else { - GL.glColor3f(0.0f, 0.0f, 0.0f); - } - GL.glVertex3d(ctrlPts[j][i], ctrlPts[j][i + 1], ctrlPts[j][i + 2]); - GL.glEnd(); - } - } - } - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/BitmapTextTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/BitmapTextTab.java deleted file mode 100644 index 65e6ae8cb7..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/BitmapTextTab.java +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class BitmapTextTab extends OpenGLTab { - private Text messageText; - private FontData fontData; - private float[] textColor = { 1.0f, 0.0f, 0.0f }; - private float xPos = -130.0f, yPos = 0.0f; - private int listIndexBase; - private final static int LIST_INDEX_SIZE = 256; - private final static int DEFAULT_FONT_SIZE = 24; - private final static String DEFAULT_FONT_NAME = "Courier"; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setText("Translation"); - movementGroup.setLayout(new GridLayout(2, false)); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider xMove = new Slider(movementGroup, SWT.NONE); - xMove.setIncrement(1); - xMove.setMaximum(42); - xMove.setMinimum(0); - xMove.setThumb(2); - xMove.setPageIncrement(2); - xMove.setSelection(7); - xMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = (xMove.getSelection() * 10) - 200; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider yMove = new Slider(movementGroup, SWT.NONE); - yMove.setIncrement(1); - yMove.setMaximum(42); - yMove.setMinimum(0); - yMove.setThumb(2); - yMove.setPageIncrement(2); - yMove.setSelection(20); - yMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = (yMove.getSelection() * 10) - 200; - } - }); - - Composite textGroup = new Composite(composite,SWT.NONE); - GridLayout layout = new GridLayout(2,false); - layout.marginHeight = 0; - layout.marginWidth = 0; - textGroup.setLayout(layout); - textGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - new Label(textGroup, SWT.NONE).setText("Text:"); - messageText = new Text(textGroup, SWT.BORDER); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - data.grabExcessHorizontalSpace = true; - messageText.setLayoutData(data); - messageText.setText("OpenGL - SWT"); - - final Button fontSelectButton = new Button(composite, SWT.NONE); - fontSelectButton.setText("Set Font"); - - final ColorSelectionGroup colorGroup = - new ColorSelectionGroup(composite, SWT.NONE); - colorGroup.setText("Text color"); - colorGroup.addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - GL.glColor3ub((byte) rgb.red, (byte) rgb.green, (byte) rgb.blue); - } - }); - - fontSelectButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - FontDialog fontDialog = new FontDialog(fontSelectButton.getShell()); - fontDialog.setText("Choose Font Options"); - double[] currentColor = new double[4]; - GL.glGetDoublev(GL.GL_CURRENT_COLOR, currentColor); - fontDialog.setRGB( - new RGB( - (int) currentColor[0] * 255, - (int) currentColor[1] * 255, - (int) currentColor[2] * 255)); - fontDialog.setFontList(new FontData[] {fontData}); - FontData result = fontDialog.open(); - if (result != null) { - fontData = result; - RGB rgb = fontDialog.getRGB(); - GL.glColor3ub((byte) rgb.red, (byte) rgb.green, (byte) rgb.blue); - colorGroup.setRGB(rgb); - getContext().loadBitmapFont(fontData, null, listIndexBase, 32, 96); - } - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GL.glDeleteLists(listIndexBase, LIST_INDEX_SIZE); - } - - /** - * Draws the text to the screen - * - * @param string the text to draw - */ - void drawText(String string) { - char[] stringChars = string.toCharArray(); - int[] text = new int[stringChars.length]; - for (int i = 0; i < text.length; i++) { - text[i] = (int) stringChars[i]; - } - // pushes the display list bits - GL.glPushAttrib(GL.GL_LIST_BIT); - // sets the base character to 32 - GL.glListBase(listIndexBase - 32); - GL.glCallLists(text.length, GL.GL_UNSIGNED_INT, text); - // pops the display list bits - GL.glPopAttrib(); - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Bitmap Text"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glColor3fv(textColor); - GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - GL.glEnable(GL.GL_DEPTH_TEST); - GL.glEnable(GL.GL_BLEND); - // build the initial font - listIndexBase = GL.glGenLists(LIST_INDEX_SIZE); - fontData = new FontData(); - fontData.setHeight(DEFAULT_FONT_SIZE); - fontData.setName(DEFAULT_FONT_NAME); - getContext().loadBitmapFont(fontData, null, listIndexBase, 32, LIST_INDEX_SIZE); - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glRasterPos2f(xPos, yPos); - drawText(messageText.getText()); - } - - /** - * @see OpenGLTab#setupViewingArea() - */ - void setupViewingArea() { - // use ortho view since this tab does not need any depth - Rectangle rect = getGlCanvas().getClientArea(); - int width = rect.width; - int height = rect.height; - width = Math.max(width, 1); - GL.glViewport(0, 0, width, height); - float nRange = 200.0f; - GL.glMatrixMode(GL.GL_PROJECTION); - GL.glLoadIdentity(); - if (width <= height) { - GL.glOrtho( - -nRange, nRange, -nRange * height / width, - nRange * height / width, -nRange, nRange); - } else { - GL.glOrtho( - -nRange * height / width, nRange * height / width, -nRange, - nRange, -nRange, nRange); - } - GL.glMatrixMode(GL.GL_MODELVIEW); - GL.glLoadIdentity(); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ColorSelectionGroup.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ColorSelectionGroup.java deleted file mode 100644 index 2fc30c0641..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ColorSelectionGroup.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import java.util.Vector; -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.GL; -import org.eclipse.swt.widgets.*; - -class ColorSelectionGroup implements Listener { - private Color color; - private Label label; - private Image image; - private Button button; - private Vector listeners = new Vector(); - - /** - * Constructor. - * - * @param parent the parent composite - * @param style style bits to be applied to the color group - */ - ColorSelectionGroup(Composite parent, int style) { - super(); - initColor(parent.getDisplay()); - - Composite colorGroup = new Composite(parent, style); - GridLayout layout = new GridLayout(2, false); - layout.marginWidth = 0; - layout.marginHeight = 0; - colorGroup.setLayout(layout); -// GridData data = new GridData(GridData.FILL_HORIZONTAL); -// data.grabExcessHorizontalSpace = true; -// colorGroup.setLayoutData(data); - - button = new Button(colorGroup, SWT.NONE); - button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - image = new Image(button.getDisplay(), 12, 12); - drawButtonImage(); - button.setImage(image); - button.addListener(SWT.Selection, this); - button.addDisposeListener(new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - if (image != null) image.dispose(); - if (color != null) color.dispose(); - } - }); - - label = new Label(colorGroup, SWT.NONE); - label.setText("Color"); -// data = new GridData(GridData.FILL_HORIZONTAL); -// data.grabExcessHorizontalSpace = true; -// label.setLayoutData(data); - } - - /** - * Adds the argument to this group's collection of - * color selection listeners. - * - * @param listener - */ - void addColorSelectionListener(IColorSelectionListener listener) { - listeners.addElement(listener); - } - - /** - * Draws the colored square on the selection button. - */ - void drawButtonImage() { - GC gc = new GC(image); - gc.setBackground(color); - Rectangle bounds = image.getBounds(); - gc.fillRectangle(0, 0, bounds.width, bounds.height); - gc.drawRectangle(0, 0, bounds.width - 1, bounds.height - 1); - gc.dispose(); - } - - /** - * @see org.eclipse.swt.widgets.Listener#handleEvent(Event) - */ - public void handleEvent(Event e) { - Shell shell = button.getShell(); - ColorDialog colorDialog = new ColorDialog(shell); - colorDialog.setRGB( - new RGB(color.getRed(), color.getGreen(), color.getBlue())); - RGB rgb = colorDialog.open(); - if (rgb == null) return; - setRGB(rgb); - notifyListeners(rgb); - } - - /** - * Initializes the color by querying for the current color. - * - * @param display - */ - void initColor(Display display) { - double[] currentColor = new double[4]; - GL.glGetDoublev(GL.GL_CURRENT_COLOR, currentColor); - RGB rgb = - new RGB( - (int) currentColor[0] * 255, - (int) currentColor[1] * 255, - (int) currentColor[2] * 255); - color = new Color(display, rgb); - } - - /** - * Notifies all registered color selection listeners. - * - * @param value - */ - void notifyListeners(RGB rgb) { - IColorSelectionListener[] listenersArr = - new IColorSelectionListener[listeners.size()]; - listeners.copyInto(listenersArr); - for (int i = 0; i < listenersArr.length; i++) { - listenersArr [i].handleColorSelection(rgb); - } - } - - /** - * Removes the argument from this group's collection of color selection - * listeners. If the argument is not a registered listener then does - * nothing. - * - * @param listener - */ - void removeColorSelectionListener(IColorSelectionListener listener) { - listeners.removeElement(listener); - } - - /** - * Sets the text for the group's label. - * - * @param text the new label text - */ - void setText(String text) { - label.setText(text); - } - - /** - * Sets the current color. - * - * @param rgb the rgb of the new color - */ - void setRGB(RGB rgb) { - Color oldColor = color; - color = new Color(button.getDisplay(), rgb); - drawButtonImage(); - button.setImage(image); - if (oldColor != null) oldColor.dispose(); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java deleted file mode 100644 index ee61535d74..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/FogTab.java +++ /dev/null @@ -1,254 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class FogTab extends OpenGLTab { - - private float rotY = 0.0f; - private float yPos = 0.0f, xPos = 0.0f, zPos = -15.0f; - private int cubeListIndexBase; - private final static int[] FOG_TYPES = { GL.GL_LINEAR, GL.GL_EXP, GL.GL_EXP2 }; - private final static String[] FOG_NAMES = { "LINEAR", "GL_EXP", "GL_EXP2" }; - private final static int SLEEP_LENGTH = 0; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setText("Translation"); - movementGroup.setLayout(new GridLayout(2, false)); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider xMove = new Slider(movementGroup, SWT.NONE); - xMove.setIncrement(1); - xMove.setMaximum(12); - xMove.setMinimum(0); - xMove.setThumb(2); - xMove.setPageIncrement(2); - xMove.setSelection(5); - xMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = xMove.getSelection() - 5; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider yMove = new Slider(movementGroup, SWT.NONE); - yMove.setIncrement(1); - yMove.setMaximum(12); - yMove.setMinimum(0); - yMove.setThumb(2); - yMove.setPageIncrement(2); - yMove.setSelection(5); - yMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = yMove.getSelection() - 5; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Z:"); - final Slider zMove = new Slider(movementGroup, SWT.NONE); - zMove.setIncrement(1); - zMove.setMaximum(24); - zMove.setMinimum(0); - zMove.setThumb(4); - zMove.setPageIncrement(2); - zMove.setSelection(10); - zMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zPos = zMove.getSelection() - 25; - } - }); - - Composite fogTypesGroup = new Composite(composite,SWT.NONE); - GridLayout layout = new GridLayout(2,false); - layout.marginHeight = 0; - layout.marginWidth = 0; - fogTypesGroup.setLayout(layout); - fogTypesGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - new Label(fogTypesGroup, SWT.NONE).setText("Fog Types:"); - final Combo fogTypeCombo = new Combo(fogTypesGroup, SWT.READ_ONLY); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - data.grabExcessHorizontalSpace = true; - fogTypeCombo.setLayoutData(data); - fogTypeCombo.setItems(FOG_NAMES); - fogTypeCombo.select(0); - - new Label(composite, SWT.NONE).setText("Fog Density:"); - final Slider fogDensitySlider = new Slider(composite, SWT.NONE); - fogDensitySlider.setIncrement(1); - fogDensitySlider.setMaximum(32); - fogDensitySlider.setMinimum(0); - fogDensitySlider.setThumb(2); - fogDensitySlider.setPageIncrement(5); - fogDensitySlider.setSelection(0); - fogDensitySlider.setEnabled(false); - fogDensitySlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - float fogDensity = ((float)fogDensitySlider.getSelection()) / 100; - GL.glFogf(GL.GL_FOG_DENSITY, fogDensity); - } - }); - fogTypeCombo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - int currentSelection = fogTypeCombo.getSelectionIndex(); - // fog type GL.GL_LINEAR does not utilize fogDensity, but the other fog types do - fogDensitySlider.setEnabled(currentSelection != 0); - GL.glFogf(GL.GL_FOG_MODE, FOG_TYPES[currentSelection]); - } - }); - } - - /** - * Creates a cube at 0,0 in the viewport. - */ - void createCube() { - GL.glNewList(cubeListIndexBase, GL.GL_COMPILE); - GL.glBegin(GL.GL_QUADS); - // front - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(-0.5f, -0.5f, 0.5f); // bottom left - GL.glColor3f(0.0f, 0.0f, 1.0f); - GL.glVertex3f(0.5f, -0.5f, 0.5f); // bottom right - GL.glColor3f(1.0f, 1.0f, 0.0f); - GL.glVertex3f(0.5f, 0.5f, 0.5f); // top right - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(-0.5f, 0.5f, 0.5f); // top left - // back - GL.glColor3f(0.0f, 0.0f, 1.0f); - GL.glVertex3f(-0.5f, -0.5f, -0.5f); // bottom left - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(0.5f, -0.5f, -0.5f); // bottom right - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(0.5f, 0.5f, -0.5f); // top right - GL.glColor3f(1.0f, 1.0f, 0.0f); - GL.glVertex3f(-0.5f, 0.5f, -0.5f); // top left - // left - GL.glColor3f(0.0f, 0.0f, 1.0f); - GL.glVertex3f(-0.5f, -0.5f, -0.5f); // bottom left - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(-0.5f, -0.5f, 0.5f); // bottom right - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(-0.5f, 0.5f, 0.5f); // top right - GL.glColor3f(1.0f, 1.0f, 0.0f); - GL.glVertex3f(-0.5f, 0.5f, -0.5f); // top left - // right - GL.glColor3f(0.0f, 0.0f, 1.0f); - GL.glVertex3f(0.5f, -0.5f, 0.5f); // bottom left - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(0.5f, -0.5f, -0.5f); // bottom right - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(0.5f, 0.5f, -0.5f); // top right - GL.glColor3f(1.0f, 1.0f, 0.0f); - GL.glVertex3f(0.5f, 0.5f, 0.5f); // top left - // top - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(0.5f, 0.5f, -0.5f); - GL.glColor3f(1.0f, 1.0f, 0.0f); - GL.glVertex3f(-0.5f, 0.5f, -0.5f); - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(-0.5f, 0.5f, 0.5f); - GL.glColor3f(1.0f, 1.0f, 0.0f); - GL.glVertex3f(0.5f, 0.5f, 0.5f); - // bottom - GL.glColor3f(0.0f, 0.0f, 1.0f); - GL.glVertex3f(0.5f, -0.5f, 0.5f); - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(-0.5f, -0.5f, 0.5f); - GL.glColor3f(0.0f, 0.0f, 1.0f); - GL.glVertex3f(-0.5f, -0.5f, -0.5f); - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(0.5f, -0.5f, -0.5f); - GL.glEnd(); - GL.glEndList(); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GL.glDeleteLists(cubeListIndexBase, 1); - } - - /** - * @see OpenGLTab#getSleepLength() - */ - int getSleepLength() { - return SLEEP_LENGTH; - } - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Fog"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - // fog color should be the same as the clear color - // to look appropriate - float[] fogColor = { 1.0f, 1.0f, 1.0f, 1.0f }; - GL.glFogfv(GL.GL_FOG_COLOR, fogColor); - GL.glHint(GL.GL_FOG_HINT, GL.GL_DONT_CARE); - GL.glFogf(GL.GL_FOG_START, 0); - GL.glFogf(GL.GL_FOG_DENSITY, 0.0f); - // set the end of the start distance; anything > 15 - // units from the camera will be covered in fog - GL.glFogf(GL.GL_FOG_END, 15); - GL.glFogf(GL.GL_FOG_MODE, FOG_TYPES[0]); - GL.glEnable(GL.GL_FOG); - GL.glEnable(GL.GL_DEPTH_TEST); - - cubeListIndexBase = GL.glGenLists(1); - createCube(); - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glTranslatef(xPos, yPos, zPos); - GL.glRotatef(rotY, 0.0f, 1.0f, 0.0f); - - GL.glCallList(cubeListIndexBase); - - GL.glPushMatrix(); - GL.glTranslatef(3, 0, -3); - GL.glCallList(cubeListIndexBase); - GL.glPopMatrix(); - - GL.glPushMatrix(); - GL.glTranslatef(-3, 0, -3); - GL.glCallList(cubeListIndexBase); - GL.glPopMatrix(); - - GL.glPushMatrix(); - GL.glTranslatef(0, 0, 4); - GL.glCallList(cubeListIndexBase); - GL.glPopMatrix(); - - rotY += 0.6f; - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/GradientTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/GradientTab.java deleted file mode 100644 index 3863dda9b0..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/GradientTab.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class GradientTab extends OpenGLTab { - private float xPos = 0.0f, yPos = 0.0f, zPos = -7.0f; - private float xRot = 180.0f, yRot = 180.0f, zRot = 180.0f; - private int currentSelection = 1; - private final static float[] BEZIER_COLORS = { - 0.0f, 1.0f, 0.0f, 0.0f, 0.3f, 0.6f, 0.1f, 0.0f, - 0.8f, 0.2f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, 0.8f, 0.8f, 0.8f, 0.0f - }; - private final static float[] BEZIER_POINTS = { - -1.5f, -1.5f, 4.0f, -0.5f, -1.5f, 2.0f, 0.5f, -1.5f, - -1.0f, 1.5f, -1.5f, 2.0f, -1.5f, -0.5f, 1.0f, -0.5f, - -0.5f, 3.0f, 0.5f, -0.5f, 0.0f, 1.5f, -0.5f, -1.0f, - -1.5f, 0.5f, 4.0f, -0.5f, 0.5f, 0.0f, 0.5f, 0.5f, - 3.0f, 1.5f, 0.5f, 4.0f, -1.5f, 1.5f, -2.0f, -0.5f, - 1.5f, -2.0f, 0.5f, 1.5f, 0.0f, 1.5f, 1.5f, -1.0f, - }; - private final static String[] OBJECT_NAMES = { "Bezier", "Square" }; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setText("Translation"); - movementGroup.setLayout(new GridLayout(2, false)); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider xMove = new Slider(movementGroup, SWT.NONE); - xMove.setIncrement(1); - xMove.setMaximum(12); - xMove.setMinimum(0); - xMove.setThumb(2); - xMove.setPageIncrement(2); - xMove.setSelection(5); - xMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = xMove.getSelection() - 5; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider yMove = new Slider(movementGroup, SWT.NONE); - yMove.setIncrement(1); - yMove.setMaximum(12); - yMove.setMinimum(0); - yMove.setThumb(2); - yMove.setPageIncrement(2); - yMove.setSelection(5); - yMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = yMove.getSelection() - 5; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Z:"); - final Slider zMove = new Slider(movementGroup, SWT.NONE); - zMove.setIncrement(1); - zMove.setMaximum(12); - zMove.setMinimum(0); - zMove.setThumb(2); - zMove.setPageIncrement(2); - zMove.setSelection(5); - zMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zPos = zMove.getSelection() - 12; - } - }); - - Group rotationGroup = new Group(composite, SWT.NONE); - rotationGroup.setText("Rotation"); - rotationGroup.setLayout(new GridLayout(2, false)); - - new Label(rotationGroup, SWT.NONE).setText("X:"); - final Slider xRotation = new Slider(rotationGroup, SWT.NONE); - xRotation.setIncrement(10); - xRotation.setMaximum(362); - xRotation.setMinimum(0); - xRotation.setThumb(2); - xRotation.setPageIncrement(20); - xRotation.setSelection(180); - xRotation.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xRot = xRotation.getSelection(); - } - }); - - new Label(rotationGroup, SWT.NONE).setText("Y:"); - final Slider yRotation = new Slider(rotationGroup, SWT.NONE); - yRotation.setIncrement(10); - yRotation.setMaximum(362); - yRotation.setMinimum(0); - yRotation.setThumb(2); - yRotation.setPageIncrement(20); - yRotation.setSelection(180); - yRotation.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yRot = yRotation.getSelection(); - } - }); - - new Label(rotationGroup, SWT.NONE).setText("Z:"); - final Slider zRotation = new Slider(rotationGroup, SWT.NONE); - zRotation.setIncrement(10); - zRotation.setMaximum(362); - zRotation.setMinimum(0); - zRotation.setThumb(2); - zRotation.setPageIncrement(20); - zRotation.setSelection(180); - zRotation.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zRot = zRotation.getSelection(); - } - }); - - Composite objectGroup = new Composite(composite,SWT.NONE); - GridLayout layout = new GridLayout(2,false); - layout.marginHeight = 0; - layout.marginWidth = 0; - objectGroup.setLayout(layout); - objectGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - new Label(objectGroup, SWT.NONE).setText("Object:"); - final Combo objectCombo = new Combo(objectGroup, SWT.READ_ONLY); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - data.grabExcessHorizontalSpace = true; - objectCombo.setLayoutData(data); - objectCombo.setItems(OBJECT_NAMES); - objectCombo.select(0); - objectCombo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - currentSelection = objectCombo.getSelectionIndex() + 1; - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GL.glDeleteLists(1, 2); - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Gradients"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST); - GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); - GL.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, BEZIER_POINTS); - GL.glMap2f(GL.GL_MAP2_COLOR_4, 0, 1, 4, 1, 0, 1, 4, 6, BEZIER_COLORS); - GL.glMapGrid2f(20, 0.0f, 1.0f, 20, 0.0f, 1.0f); - GL.glShadeModel(GL.GL_SMOOTH); - GL.glEnable(GL.GL_LINE_SMOOTH); - GL.glEnable(GL.GL_LINE_STIPPLE); - GL.glEnable(GL.GL_BLEND); - GL.glEnable(GL.GL_MAP2_COLOR_4); - GL.glEnable(GL.GL_MAP2_VERTEX_3); - GL.glEnable(GL.GL_DEPTH_TEST); - - // create display lists - GL.glNewList(1, GL.GL_COMPILE); - GL.glEvalMesh2(GL.GL_FILL, 0, 20, 0, 20); - GL.glEndList(); - GL.glNewList(2, GL.GL_COMPILE); - GL.glBegin(GL.GL_TRIANGLE_FAN); - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(0.0f, 0.0f, 0.0f); - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(0.0f, 2.0f, 0.0f); - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(-2.0f, 2.0f, 0.0f); - GL.glColor3f(0.0f, 0.0f, 1.0f); - GL.glVertex3f(-2.0f, 0.0f, 0.0f); - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(-2.0f, -2.0f, 0.0f); - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(0.0f, -2.0f, 0.0f); - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(2.0f, -2.0f, 0.0f); - GL.glColor3f(0.0f, 0.0f, 1.0f); - GL.glVertex3f(2.0f, 0.0f, 0.0f); - GL.glColor3f(0.0f, 1.0f, 0.0f); - GL.glVertex3f(2.0f, 2.0f, 0.0f); - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(0.0f, 2.0f, 0.0f); - GL.glEnd(); - GL.glEndList(); - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glTranslatef(xPos, yPos, zPos); - GL.glRotatef(xRot, 1.0f, 0.0f, 0.0f); - GL.glRotatef(yRot, 0.0f, 1.0f, 0.0f); - GL.glRotatef(zRot, 0.0f, 0.0f, 1.0f); - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glCallList(currentSelection); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/IColorSelectionListener.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/IColorSelectionListener.java deleted file mode 100644 index 4bd11b30bb..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/IColorSelectionListener.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - -import org.eclipse.swt.graphics.RGB; - - -public interface IColorSelectionListener { - public void handleColorSelection(RGB rgb); -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LightTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LightTab.java deleted file mode 100644 index 542ddb3dd3..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/LightTab.java +++ /dev/null @@ -1,354 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class LightTab extends OpenGLTab { - private float[] materialShininess = { 25.0f }; - private float[] lightPosition = { 0.0f, 0.0f, 0.0f, 1.0f }; - private float[][] colorValues = { - { 1.0f, 1.0f, 1.0f, 1.0f }, // light diffuse - { 1.0f, 1.0f, 1.0f, 1.0f }, // light ambient - { 1.0f, 1.0f, 1.0f, 1.0f }, // light specular - { 0.5f, 0.5f, 0.5f, 1.0f }, // light main ambient - { 0.0f, 0.0f, 1.0f, 1.0f }, // material diffuse - { 0.3f, 0.3f, 0.3f, 1.0f }, // material ambient - { 1.0f, 1.0f, 1.0f, 1.0f } // material specular - }; - private float yPos = 0.0f, xPos = 0.0f, zPos = -20.0f; - private int quadratic, sphere; - // sourceType values: 0 = light, 1 = material - private int sourceType; - // lightType values: 0 = diffuse, 1 = ambient, 2 = specular, 3 = main ambient - private int lightType = 0; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setText("Translation"); - movementGroup.setLayout(new GridLayout(2, false)); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider xMove = new Slider(movementGroup, SWT.NONE); - xMove.setIncrement(1); - xMove.setMaximum(22); - xMove.setMinimum(0); - xMove.setThumb(2); - xMove.setPageIncrement(2); - xMove.setSelection(10); - xMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = xMove.getSelection() - 10; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider yMove = new Slider(movementGroup, SWT.NONE); - yMove.setIncrement(1); - yMove.setMaximum(22); - yMove.setMinimum(0); - yMove.setThumb(2); - yMove.setPageIncrement(2); - yMove.setSelection(10); - yMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = yMove.getSelection() - 10; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Z:"); - final Slider zMove = new Slider(movementGroup, SWT.NONE); - zMove.setIncrement(1); - zMove.setMaximum(22); - zMove.setMinimum(0); - zMove.setThumb(2); - zMove.setPageIncrement(2); - zMove.setSelection(10); - zMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zPos = zMove.getSelection() - 30; - } - }); - - Group positionGroup = new Group(composite, SWT.NONE); - positionGroup.setText("Light Position"); - positionGroup.setLayout(new GridLayout(2, false)); - - new Label(positionGroup, SWT.NONE).setText("X:"); - final Slider lightX = new Slider(positionGroup, SWT.NONE); - lightX.setIncrement(1); - lightX.setMaximum(22); - lightX.setMinimum(0); - lightX.setThumb(2); - lightX.setPageIncrement(2); - lightX.setSelection(10); - lightX.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - lightPosition[0] = ((float) lightX.getSelection() * 10) - 100; - } - }); - - new Label(positionGroup, SWT.NONE).setText("Y:"); - final Slider lightY = new Slider(positionGroup, SWT.NONE); - lightY.setIncrement(1); - lightY.setMaximum(22); - lightY.setMinimum(0); - lightY.setThumb(2); - lightY.setPageIncrement(2); - lightY.setSelection(10); - lightY.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - lightPosition[1] = ((float) lightY.getSelection() * 10) - 100; - } - }); - - new Label(positionGroup, SWT.NONE).setText("Z:"); - final Slider lightZ = new Slider(positionGroup, SWT.NONE); - lightZ.setIncrement(1); - lightZ.setMaximum(22); - lightZ.setMinimum(0); - lightZ.setThumb(2); - lightZ.setPageIncrement(2); - lightZ.setSelection(10); - lightZ.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - lightPosition[2] = ((float) lightZ.getSelection() * 10) - 20; - } - }); - - Group lightColorsGroup = new Group(composite, SWT.NONE); - lightColorsGroup.setText("Light Colors"); - lightColorsGroup.setLayout(new GridLayout()); - GridData data = new GridData(GridData.FILL_BOTH); - lightColorsGroup.setLayoutData(data); - - ColorSelectionGroup lightDiffuseButton = - new ColorSelectionGroup(lightColorsGroup, SWT.NONE); - lightDiffuseButton.setText("Diffuse"); - lightDiffuseButton.setRGB( - new RGB( - (int) (colorValues[0][0] * 255), - (int) (colorValues[0][1] * 255), - (int) (colorValues[0][2] * 255))); - lightDiffuseButton - .addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - colorValues[0][0] = ((float) rgb.red) / 255; - colorValues[0][1] = ((float) rgb.green) / 255; - colorValues[0][2] = ((float) rgb.blue) / 255; - setColorValues(); - } - }); - - ColorSelectionGroup lightAmbientButton = - new ColorSelectionGroup(lightColorsGroup, SWT.NONE); - lightAmbientButton.setText("Ambient"); - lightAmbientButton.setRGB( - new RGB( - (int) (colorValues[1][0] * 255), - (int) (colorValues[1][1] * 255), - (int) (colorValues[1][2] * 255))); - lightAmbientButton - .addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - colorValues[1][0] = ((float) rgb.red) / 255; - colorValues[1][1] = ((float) rgb.green) / 255; - colorValues[1][2] = ((float) rgb.blue) / 255; - setColorValues(); - } - }); - - ColorSelectionGroup lightSpecularButton = - new ColorSelectionGroup(lightColorsGroup, SWT.NONE); - lightSpecularButton.setText("Specular"); - lightSpecularButton.setRGB( - new RGB( - (int) (colorValues[2][0] * 255), - (int) (colorValues[2][1] * 255), - (int) (colorValues[2][2] * 255))); - lightSpecularButton - .addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - colorValues[2][0] = ((float) rgb.red) / 255; - colorValues[2][1] = ((float) rgb.green) / 255; - colorValues[2][2] = ((float) rgb.blue) / 255; - setColorValues(); - } - }); - - ColorSelectionGroup lightMainAmbientButton = - new ColorSelectionGroup(lightColorsGroup, SWT.NONE); - lightMainAmbientButton.setText("Main Ambient"); - lightMainAmbientButton.setRGB( - new RGB( - (int) (colorValues[3][0] * 255), - (int) (colorValues[3][1] * 255), - (int) (colorValues[3][2] * 255))); - lightMainAmbientButton - .addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - colorValues[3][0] = ((float) rgb.red) / 255; - colorValues[3][1] = ((float) rgb.green) / 255; - colorValues[3][2] = ((float) rgb.blue) / 255; - setColorValues(); - } - }); - - Group materialColorsGroup = new Group(composite, SWT.NONE); - materialColorsGroup.setText("Material Colors"); - materialColorsGroup.setLayout(new GridLayout()); - data = new GridData(GridData.FILL_BOTH); - materialColorsGroup.setLayoutData(data); - - ColorSelectionGroup materialDiffuseButton = - new ColorSelectionGroup(materialColorsGroup, SWT.NONE); - materialDiffuseButton.setText("Diffuse"); - materialDiffuseButton.setRGB( - new RGB( - (int) (colorValues[4][0] * 255), - (int) (colorValues[4][1] * 255), - (int) (colorValues[4][2] * 255))); - materialDiffuseButton - .addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - colorValues[4][0] = ((float) rgb.red) / 255; - colorValues[4][1] = ((float) rgb.green) / 255; - colorValues[4][2] = ((float) rgb.blue) / 255; - setColorValues(); - } - }); - - ColorSelectionGroup materialAmbientButton = - new ColorSelectionGroup(materialColorsGroup, SWT.NONE); - materialAmbientButton.setText("Ambient"); - materialAmbientButton.setRGB( - new RGB( - (int) (colorValues[5][0] * 255), - (int) (colorValues[5][1] * 255), - (int) (colorValues[5][2] * 255))); - materialAmbientButton - .addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - colorValues[5][0] = ((float) rgb.red) / 255; - colorValues[5][1] = ((float) rgb.green) / 255; - colorValues[5][2] = ((float) rgb.blue) / 255; - setColorValues(); - } - }); - - ColorSelectionGroup materialSpecularButton = - new ColorSelectionGroup(materialColorsGroup, SWT.NONE); - materialSpecularButton.setText("Specular"); - materialSpecularButton.setRGB( - new RGB( - (int) (colorValues[6][0] * 255), - (int) (colorValues[6][1] * 255), - (int) (colorValues[6][2] * 255))); - materialSpecularButton - .addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - colorValues[6][0] = ((float) rgb.red) / 255; - colorValues[6][1] = ((float) rgb.green) / 255; - colorValues[6][2] = ((float) rgb.blue) / 255; - setColorValues(); - } - }); - - new Label(composite, SWT.NONE).setText("Material Shininess:"); - final Slider shineSlider = new Slider(composite, SWT.NONE); - shineSlider.setIncrement(5); - shineSlider.setMaximum(102); - shineSlider.setMinimum(0); - shineSlider.setThumb(2); - shineSlider.setPageIncrement(10); - shineSlider.setSelection(25); - shineSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - materialShininess[0] = shineSlider.getSelection(); - GL.glMaterialfv(GL.GL_FRONT_AND_BACK, - GL.GL_SHININESS, - materialShininess); - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GLU.gluDeleteQuadric(quadratic); - GL.glDeleteLists(sphere, 1); - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Light"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glClearDepth(1.0); - setColorValues(); - GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, materialShininess); - quadratic = GLU.gluNewQuadric(); - GLU.gluQuadricNormals(quadratic, GLU.GLU_SMOOTH); - GL.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST); - GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); - GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - GL.glPointSize(2.0f); - GL.glEnable(GL.GL_LIGHTING); - GL.glEnable(GL.GL_LIGHT0); - GL.glEnable(GL.GL_DEPTH_TEST); - sphere = GL.glGenLists(1); - GL.glNewList(sphere, GL.GL_COMPILE); - GLU.gluSphere(quadratic, 3, 32, 32); - GL.glEndList(); - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, lightPosition); - GL.glTranslatef(xPos, yPos, zPos); - GL.glCallList(sphere); - } - - /** - * Sets the current color values into the rendered display. - */ - void setColorValues() { - GL.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, colorValues[0]); - GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, colorValues[4]); - GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, colorValues[5]); - GL.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, colorValues[1]); - GL.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, colorValues[2]); - GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, colorValues[6]); - GL.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, colorValues[3]); - GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, materialShininess); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/NurbTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/NurbTab.java deleted file mode 100644 index 87d8c72e14..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/NurbTab.java +++ /dev/null @@ -1,294 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class NurbTab extends OpenGLTab { - private float xPos = -5.0f, yPos = -5.0f, zPos = -25.0f; - private float xRot = 330.0f, yRot = 0.0f, zRot = 0.0f; - private int nurb; - - /** - * Returns a 3 dimensional array to store vertex points for the nurb - * surface. - * - * @return the array - */ - float[][][] buildNurb() { - float[][][] ctrl = new float[4][4][3]; - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 4; j++) { - // set the x value - ctrl[i][j][0] = 2 * (i + (float) Math.cos(i + j)); - // set the y value - ctrl[i][j][1] = 2 * (j + (float) Math.cos(i + j)); - // set the z value - if ((i == 1 && j == 1) || (i == 2 && j == 2)) { - // this makes the hill - ctrl[i][j][2] = 6.0f; - } else { - ctrl[i][j][2] = 0.0f; - } - } - } - // sets this particular z value to a large number to make a high - // hill - ctrl[2][2][2] = 8.0f; - - return ctrl; - } - - /** - * Returns a 1 dimensional array representing the 3 dimensional - * argument. This result can be passed to the nurb renderer - * - * @param ctrl source 3D array - * @return 1D array - */ - float[] convert(float[][][] ctrl) { - float[] pts = - new float[ctrl.length * ctrl[0].length * ctrl[0][0].length]; - int row = 0; - int col = 0; - // set rowIncr to number of columns * depth - int rowIncr = ctrl[0].length * ctrl[0][0].length; - // set colIncr to depth - int colIncr = ctrl[0][0].length; - // loop through rows - for (int i = 0; i < ctrl.length; i++) { - col = 0; - // loop through columns - for (int j = 0; j < ctrl[0].length; j++) { - // loop through to get the depth values - for (int k = 0; k < ctrl[0][0].length; k++) { - pts[row + col + k] = ctrl[i][j][k]; - } - col += colIncr; - } - row += rowIncr; - } - return pts; - } - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(final Composite composite) { - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setText("Translation"); - movementGroup.setLayout(new GridLayout(2, false)); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider xMove = new Slider(movementGroup, SWT.NONE); - xMove.setIncrement(1); - xMove.setMaximum(12); - xMove.setMinimum(0); - xMove.setThumb(2); - xMove.setPageIncrement(2); - xMove.setSelection(5); - xMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = xMove.getSelection() - 10; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider yMove = new Slider(movementGroup, SWT.NONE); - yMove.setIncrement(1); - yMove.setMaximum(12); - yMove.setMinimum(0); - yMove.setThumb(2); - yMove.setPageIncrement(2); - yMove.setSelection(5); - yMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = yMove.getSelection() - 10; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Z:"); - final Slider zMove = new Slider(movementGroup, SWT.NONE); - zMove.setIncrement(1); - zMove.setMaximum(12); - zMove.setMinimum(0); - zMove.setThumb(2); - zMove.setPageIncrement(2); - zMove.setSelection(5); - zMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zPos = zMove.getSelection() - 30; - } - }); - - Group rotationGroup = new Group(composite, SWT.NONE); - rotationGroup.setText("Rotation"); - rotationGroup.setLayout(new GridLayout(2, false)); - - new Label(rotationGroup, SWT.NONE).setText("X:"); - final Slider xRotation = new Slider(rotationGroup, SWT.NONE); - xRotation.setIncrement(10); - xRotation.setMaximum(362); - xRotation.setMinimum(0); - xRotation.setThumb(2); - xRotation.setPageIncrement(20); - xRotation.setSelection(330); - xRotation.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xRot = xRotation.getSelection(); - } - }); - - new Label(rotationGroup, SWT.NONE).setText("Y:"); - final Slider yRotation = new Slider(rotationGroup, SWT.NONE); - yRotation.setIncrement(10); - yRotation.setMaximum(362); - yRotation.setMinimum(0); - yRotation.setThumb(2); - yRotation.setPageIncrement(20); - yRotation.setSelection(0); - yRotation.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yRot = yRotation.getSelection(); - } - }); - - new Label(rotationGroup, SWT.NONE).setText("Z:"); - final Slider zRotation = new Slider(rotationGroup, SWT.NONE); - zRotation.setIncrement(10); - zRotation.setMaximum(362); - zRotation.setMinimum(0); - zRotation.setThumb(2); - zRotation.setPageIncrement(20); - zRotation.setSelection(0); - zRotation.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zRot = zRotation.getSelection(); - } - }); - - new Label(composite, SWT.NONE).setText("Sampling Tolerance:"); - final Slider sSlider = new Slider(composite, SWT.NONE); - sSlider.setIncrement(1); - sSlider.setMaximum(101); - sSlider.setMinimum(0); - sSlider.setThumb(2); - sSlider.setPageIncrement(2); - sSlider.setSelection(75); - sSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - GLU.gluNurbsProperty( - nurb, - GLU.GLU_SAMPLING_TOLERANCE, - sSlider.getSelection() + 1); - } - }); - - final Button fillButton = new Button(composite, SWT.CHECK); - fillButton.setText("Fill"); - fillButton.setSelection(true); - fillButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - if (fillButton.getSelection()) { - GLU.gluNurbsProperty( - nurb, - GLU.GLU_DISPLAY_MODE, - GLU.GLU_FILL); - } else { - GLU.gluNurbsProperty( - nurb, - GLU.GLU_DISPLAY_MODE, - GLU.GLU_OUTLINE_POLYGON); - } - } - }); - - ColorSelectionGroup colorGroup = - new ColorSelectionGroup(composite, SWT.NONE); - colorGroup.setText("Foreground color"); - colorGroup.addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - GL.glColor3ub((byte) rgb.red, (byte) rgb.green, (byte) rgb.blue); - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GLU.gluDeleteNurbsRenderer(nurb); - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Nurb"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glColor3f(1.0f, 0.0f, 0.0f); - // set up material color which helps show curves - float mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f }; - float mat_shininess[] = { 100.0f }; - GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, mat_specular); - GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, mat_shininess); - GL.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE); - - GL.glEnable(GL.GL_LIGHTING); - GL.glEnable(GL.GL_LIGHT0); - GL.glEnable(GL.GL_COLOR_MATERIAL); - GL.glEnable(GL.GL_DEPTH_TEST); - GL.glEnable(GL.GL_AUTO_NORMAL); - GL.glEnable(GL.GL_NORMALIZE); - - nurb = GLU.gluNewNurbsRenderer(); - - GLU.gluNurbsProperty( - nurb, - GLU.GLU_SAMPLING_METHOD, - GLU.GLU_PATH_LENGTH); - // sampling tolerance is specific for GLU.GLU_PATH_LENGTH - GLU.gluNurbsProperty(nurb, GLU.GLU_SAMPLING_TOLERANCE, 75.0f); - GLU.gluNurbsProperty(nurb, GLU.GLU_DISPLAY_MODE, GLU.GLU_FILL); - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glLoadIdentity(); - // do translation and rotation - GL.glTranslatef(xPos, yPos, zPos); - GL.glRotatef(xRot, 1.0f, 0.0f, 0.0f); - GL.glRotatef(yRot, 0.0f, 1.0f, 0.0f); - GL.glRotatef(zRot, 0.0f, 0.0f, 1.0f); - // define nurbs surface - float[] knots = { 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f }; - GLU.gluBeginSurface(nurb); - GLU.gluNurbsSurface( - nurb, 8, knots, 8, knots, 12, 3, - convert(buildNurb()), 4, 4, GL.GL_MAP2_VERTEX_3); - GLU.gluEndSurface(nurb); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ObjectsTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ObjectsTab.java deleted file mode 100644 index a544f25b3f..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ObjectsTab.java +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class ObjectsTab extends OpenGLTab { - private class Shape { - private String name; - private int index; - /** - * Constructor. - * - * @param name the display name of this shape - * @param index the display list index corresponding to this shape - */ - Shape(String name, int index) { - super(); - this.index = index; - this.name = name; - } - void dispose() { - GL.glDeleteLists(index, 1); - } - void draw() { - GL.glCallList(index); - } - String getName() { - return name; - } - } - - private Shape[] shapes; - private Shape currentShape; - private float xRot = 0.0f, yRot = 0.0f; - private boolean fill = true; - private int quadratic; - private final static int SLEEP_LENGTH = 50; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(final Composite composite) { - GridLayout layout = new GridLayout(2, false); - layout.marginWidth = 0; - Composite controls = new Composite(composite, SWT.NONE); - controls.setLayout(layout); - - new Label(controls, SWT.NONE).setText("Object:"); - final Combo objectsCombo = new Combo(controls, SWT.READ_ONLY); - for (int i = 0; i < shapes.length; i++) { - objectsCombo.add(shapes[i].getName()); - } - objectsCombo.select(0); - objectsCombo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - currentShape = shapes[objectsCombo.getSelectionIndex()]; - } - }); - - final Button fillToggleButton = new Button(controls, SWT.CHECK); - fillToggleButton.setText("Fill"); - fillToggleButton.setSelection(true); - fillToggleButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - fill = fillToggleButton.getSelection(); - } - }); - - ColorSelectionGroup colorGroup = - new ColorSelectionGroup(composite, SWT.NONE); - colorGroup.setText("Foreground color"); - colorGroup.addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - GL.glColor3ub((byte) rgb.red, (byte) rgb.green, (byte) rgb.blue); - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GLU.gluDeleteQuadric(quadratic); - for (int i = 0; i < shapes.length; i++) { - shapes [i].dispose(); - } - } - - /** - * Creates a circle centered at 0,0 in the viewport. - * - * @param radius - * @param xShrink - * @param yShrink - */ - void drawCircle(float radius, float xShrink, float yShrink) { - GL.glBegin(GL.GL_POLYGON); - float dia = (float) 2.0 * (float) Math.PI; - for (float angle = 0.0f; angle <= dia; angle += 0.1f) { - GL.glVertex2d(radius * Math.cos(angle), radius * Math.sin(angle)); - } - GL.glEnd(); - } - - /** - * Creates a cube centered at 0,0 in the viewport. - * - * @param width - * @param height - * @param depth - */ - void drawCube(float width, float height, float depth) { - GL.glBegin(GL.GL_QUADS); - // front - GL.glVertex3f(-width, -height, depth); // bottom left - GL.glVertex3f(width, -height, depth); // bottom right - GL.glVertex3f(width, height, depth); // top right - GL.glVertex3f(-width, height, depth); // top left - // back - GL.glVertex3f(-width, -height, -depth); // bottom left - GL.glVertex3f(width, -height, -depth); // bottom right - GL.glVertex3f(width, height, -depth); // top right - GL.glVertex3f(-width, height, -depth); // top left - // left - GL.glVertex3f(-width, -height, -depth); // bottom left - GL.glVertex3f(-width, -height, depth); // bottom right - GL.glVertex3f(-width, height, depth); // top right - GL.glVertex3f(-width, height, -depth); // top left - // right - GL.glVertex3f(width, -height, depth); // bottom left - GL.glVertex3f(width, -height, -depth); // bottom right - GL.glVertex3f(width, height, -depth); // top right - GL.glVertex3f(width, height, depth); // top left - // top - GL.glVertex3f(width, height, -depth); // back right - GL.glVertex3f(-width, height, -depth); // back left - GL.glVertex3f(-width, height, depth); // front left - GL.glVertex3f(width, height, depth); // front right - // bottom - GL.glVertex3f(width, -height, depth); // front right - GL.glVertex3f(-width, -height, depth); // front left - GL.glVertex3f(-width, -height, -depth); // back left - GL.glVertex3f(width, -height, -depth); // back right - GL.glEnd(); - } - - /** - * Creates a pyramid centered at 0,0 in the viewport. - * - * @param width - * @param height - * @param depth - */ - void drawPyramid(float width, float height, float depth) { - GL.glBegin(GL.GL_TRIANGLES); - // front - GL.glVertex3f(0.0f, height, 0.0f); // top - GL.glVertex3f(-width, -height, depth); // left - GL.glVertex3f(width, -height, depth); // right - // left - GL.glVertex3f(0.0f, height, 0.0f); // top - GL.glVertex3f(-width, -height, -depth); // left - GL.glVertex3f(-width, -height, depth); // right - // front - GL.glVertex3f(-width, -height, -depth); // left - GL.glVertex3f(0.0f, height, 0.0f); // top - GL.glVertex3f(width, -height, -depth); // right - // right - GL.glVertex3f(0.0f, height, 0.0f); // top - GL.glVertex3f(width, -height, depth); // left - GL.glVertex3f(width, -height, -depth); // right - GL.glEnd(); - GL.glBegin(GL.GL_QUADS); - // bottom - GL.glVertex3f(-width, -height, depth); // front left - GL.glVertex3f(-width, -height, -depth); // back left - GL.glVertex3f(width, -height, -depth); // back right - GL.glVertex3f(width, -height, depth); // front right - GL.glEnd(); - } - - /** - * Creates a square centered at 0,0 in the viewport. - * - * @param width - * @param height - */ - void drawSquare(float width, float height) { - GL.glBegin(GL.GL_QUADS); - GL.glVertex3f(-width, -height, 0.0f); // bottom left - GL.glVertex3f(width, -height, 0.0f); // bottom right - GL.glVertex3f(width, height, 0.0f); // top right - GL.glVertex3f(-width, height, 0.0f); // top left - GL.glEnd(); - } - - /** - * This method is from glut_shapes.c . - * - * @param r - * @param R - * @param nsides - * @param rings - */ - void drawTorus(float r, float R, int nsides, int rings) { - float ringDelta = 2.0f * (float) Math.PI / rings; - float sideDelta = 2.0f * (float) Math.PI / nsides; - float theta = 0.0f; - float cosTheta = 1.0f; - float sinTheta = 0.0f; - - for (int i = rings - 1; i >= 0; i--) { - float theta1 = theta + ringDelta; - float cosTheta1 = (float) Math.cos(theta1); - float sinTheta1 = (float) Math.sin(theta1); - GL.glBegin(GL.GL_QUAD_STRIP); - float phi = 0.0f; - - for (int j = nsides; j >= 0; j--) { - phi += sideDelta; - float cosPhi = (float) Math.cos(phi); - float sinPhi = (float) Math.sin(phi); - float dist = R + r * cosPhi; - GL.glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); - GL.glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); - GL.glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); - GL.glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi); - } - - GL.glEnd(); - theta = theta1; - cosTheta = cosTheta1; - sinTheta = sinTheta1; - } - } - - /** - * Creates a triangle centered at 0,0 in the viewport. - * - * @param width - * @param height - */ - void drawTriangle(float width, float height) { - GL.glBegin(GL.GL_TRIANGLES); - GL.glVertex3f(0.0f, height, 0.0f); // middle - GL.glVertex3f(-width, -height, 0.0f); // left - GL.glVertex3f(width, -height, 0.0f); // right - GL.glEnd(); - } - - /** - * @see OpenGLTab#getSleepLength() - */ - int getSleepLength() { - return SLEEP_LENGTH; - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Objects"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); - GL.glClearDepth(1.0); - quadratic = GLU.gluNewQuadric(); - GLU.gluQuadricNormals(quadratic, GLU.GLU_SMOOTH); - GL.glLineWidth(2); - - GL.glEnable(GL.GL_DEPTH_TEST); - - // create the display lists and shapes - shapes = new Shape[11]; - int index = 1; - - GL.glNewList(index, GL.GL_COMPILE); - drawTriangle(2.0f, 2.0f); - GL.glEndList(); - shapes[0] = new Shape("Triangle", index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawPyramid(2.0f, 2.0f, 2.0f); - GL.glEndList(); - shapes[1] = new Shape("Pyramid", index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawSquare(2.0f, 2.0f); - GL.glEndList(); - shapes[2] = new Shape("Square", index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawCube(2.0f, 2.0f, 2.0f); - GL.glEndList(); - shapes[3] = new Shape("Cube", index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawCircle(2.0f, 0.0f, 0.0f); - GL.glEndList(); - shapes[4] = new Shape("Circle", index++); - - GL.glNewList(index, GL.GL_COMPILE); - GLU.gluPartialDisk(quadratic, 0.5, 2.0, 18, 18, 90, 125); - GL.glEndList(); - shapes[5] = new Shape("Partial Disk", index++); - - GL.glNewList(index, GL.GL_COMPILE); - GLU.gluDisk(quadratic, 0.5, 2.0, 18, 18); - GL.glEndList(); - shapes[6] = new Shape("Disk", index++); - - GL.glNewList(index, GL.GL_COMPILE); - drawTorus(1, 2, 18, 18); - GL.glEndList(); - shapes[7] = new Shape("Torus", index++); - - GL.glNewList(index, GL.GL_COMPILE); - GLU.gluSphere(quadratic, 2.0, 18, 18); - GL.glEndList(); - shapes[8] = new Shape("Sphere", index++); - - GL.glNewList(index, GL.GL_COMPILE); - GLU.gluCylinder(quadratic, 2.0, 2.0, 4, 18, 18); - GL.glEndList(); - shapes[9] = new Shape("Cylinder", index++); - - GL.glNewList(index, GL.GL_COMPILE); - GLU.gluCylinder(quadratic, 0, 2.0, 4, 18, 18); - GL.glEndList(); - shapes[10] = new Shape("Cone", index++); - - currentShape = shapes[0]; - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glTranslatef(0.0f, 0.0f, -14.0f); - // rotate around X and Y axis - GL.glRotatef(yRot, 0.0f, 1.0f, 0.0f); - GL.glRotatef(xRot, 1.0f, 0.0f, 0.0f); - // sets polygon fill mode - if (fill) { - GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); - } else { - GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE); - } - currentShape.draw(); - yRot += 1.5; - xRot += 1.5; - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLExample.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLExample.java deleted file mode 100644 index 95f99c73ff..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLExample.java +++ /dev/null @@ -1,115 +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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -public class OpenGLExample { - private TabFolder tabFolder; - private OpenGLTab[] tabs; - private int sleep; - - /** - * Renders the scene of the current tab. - */ - void display() { - int index = tabFolder.getSelectionIndex(); - tabs[index].render(); - tabs[index].swap(); - } - - /** - * Disposes of all contained tabs. - */ - void dispose() { - tabFolder = null; - for (int i = 0; i < tabs.length; i++) { - tabs[i].dispose(); - } - } - - /** - * Runs the OpenGL example - */ - void run() { - final Display display = new Display(); - final Shell shell = - new Shell(display, SWT.SHELL_TRIM | SWT.NO_BACKGROUND); - shell.setLayout(new FillLayout()); - - tabFolder = new TabFolder(shell, SWT.NONE); - tabs = - new OpenGLTab[] { - new AntialiasingTab(), - new AreaTab(), - new BezierTab(), - new BitmapTextTab(), - new FogTab(), - new GradientTab(), - new LightTab(), - new NurbTab(), - new ObjectsTab(), - new OutlineTextTab(), /* outline tab is win32-only */ - new ReflectionTab(), - new StencilTab(), - new TextureTab(), - new TransparencyTab()}; - - for (int i = 0; i < tabs.length; i++) { - TabItem item = new TabItem(tabFolder, SWT.NONE); - item.setText(tabs[i].getTabText()); - item.setControl(tabs[i].createTabFolderPage(tabFolder)); - } - - tabFolder.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - OpenGLTab tab = tabs[tabFolder.getSelectionIndex()]; - tab.setCurrent(); - sleep = tab.getSleepLength(); - } - }); - if (tabs.length > 0) { - tabs[0].setCurrent(); - sleep = tabs[0].getSleepLength(); - } - - shell.setText("OpenGL Example"); - Runnable timer = new Runnable() { - public void run() { - if (shell.isDisposed()) return; - display(); - display.timerExec(sleep, this); - } - }; - timer.run(); - shell.addListener(SWT.Dispose, new Listener() { - public void handleEvent(Event e) { - dispose(); - } - }); - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - } - - /** - * Invokes as a standalone program. - */ - public static void main(String[] args) { - new OpenGLExample().run(); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLTab.java deleted file mode 100644 index bde5683bb8..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OpenGLTab.java +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; - -/** - * <code>OpenGLTab</code> is the abstract superclass of every page - * in the example's tab folder. Each page in the tab folder - * displays a different example. - * - * An OpenGLTab itself is not a control but instead provides a hierarchy - * with which to share code that is common to every page in the folder. - */ -abstract class OpenGLTab { - private Canvas glCanvas; - private Composite tabFolderPage; - private GLContext context; - private boolean stencilSupport; - private final static int DEFAULT_SLEEP_LENGTH = 100; - - /** - * Creates this tab's controls. Subclasses must override. - * - * @param composite the parent composite - */ - abstract void createControls(Composite composite); - - /** - * Creates the OpenGL canvas on which all drawing is done. - */ - void createOpenGLContext() { - context = new GLContext(glCanvas); - setCurrent(); - setupViewingArea(); - } - - /** - * Creates the tab folder page. - * - * @param tabFolder the parent tab folder - * @return the new page - */ - Composite createTabFolderPage(TabFolder tabFolder) { - tabFolderPage = new Composite(tabFolder, SWT.NONE); - tabFolderPage.setLayout(new GridLayout(2, false)); - - GridData gridData = new GridData(); - gridData.heightHint = 400; - gridData.widthHint = 400; - gridData.verticalAlignment = GridData.BEGINNING; - glCanvas = new Canvas(tabFolderPage, SWT.NONE); - glCanvas.setLayout(new GridLayout()); - glCanvas.setLayoutData(gridData); - glCanvas.setSize(400, 400); // needed for windows - - gridData = new GridData(); - gridData.verticalAlignment = GridData.BEGINNING; - Composite controlComposite = new Composite(tabFolderPage, SWT.NONE); - controlComposite.setLayout(new GridLayout()); - controlComposite.setLayoutData(gridData); - - // create the OpenGL Screen and controls - createOpenGLContext(); - - // determine if native stencil support is available - int[] param = new int[1]; - GL.glGetIntegerv(GL.GL_STENCIL_BITS, param); - stencilSupport = param[0] != 0; - - init(); - - if (!isStencilSupportNeeded() || hasStencilSupport()) { - createControls(controlComposite); - } else { - Label label = new Label(controlComposite, SWT.NONE); - label.setText("This tab requires native stencil support."); - } - - return tabFolderPage; - } - - /** - * Disposes all resources allocated by this tab. - */ - void dispose() { - context.dispose(); - } - - /** - * Returns the context for this tab. - * - * @return GLContext - */ - GLContext getContext() { - return context; - } - - /** - * Returns the glCanvas for this tab. - * - * @return Canvas - */ - Canvas getGlCanvas() { - return glCanvas; - } - - /** - * Returns the length of time in milliseconds that the example - * should sleep between animation redraws. As this length - * increases, user responsiveness increases and the frequency of - * animation redraws decreases. Subclasses with moving animations - * may wish to override this default implementation to return a - * smaller value if their animations do not occur frequently enough. - * - * @return the length of time in milliseconds to sleep between redraws - */ - int getSleepLength() { - return DEFAULT_SLEEP_LENGTH; - } - - /** - * Returns the text for this tab. Subclasses must override. - * - * @return the text for the tab item - */ - abstract String getTabText(); - - /** - * Returns whether this machine has native stencils support. - * - * @return boolean - */ - boolean hasStencilSupport() { - return stencilSupport; - } - - /** - * Initialize OpenGL resources for this tab. Subclasses must override. - */ - abstract void init(); - - /** - * Loads a texture. - * - * @param context - * @param fileName - * @param index - * @param texture[] - */ - static void loadTexture(GLContext context, String fileName, int index, int[] texture) { - GL.glBindTexture(GL.GL_TEXTURE_2D, texture[index]); - ImageData source = - new ImageData(OpenGLTab.class.getResourceAsStream(fileName)); - Image image = new Image(Display.getCurrent(), source); - Image newImage = new Image(Display.getCurrent(), 256, 256); - GC gc = new GC(newImage); - gc.drawImage(image, 0, 0, source.width, source.height, 0, 0, 256, 256); - source = newImage.getImageData(); - gc.dispose(); - source = context.convertImageData(source); - newImage.dispose(); - image.dispose(); - GL.glTexImage2D( - GL.GL_TEXTURE_2D, 0, 3, - source.width, source.height, 0, - GL.GL_RGB, GL.GL_UNSIGNED_BYTE, source.data); - GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); - GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); - } - - /** - * Renders this tab. - */ - void render() { - if (!isStencilSupportNeeded() || hasStencilSupport()) { - renderScene(); - } else { - GL.glClear(GL.GL_COLOR_BUFFER_BIT); - } - } - - /** - * Renders the scene for this tab. Subclasses must override. - */ - abstract void renderScene(); - - /** - * Returns whether this tab requires stencil support in order to display - * properly. Subclasses may wish to override this method. - * - * @return boolean - */ - boolean isStencilSupportNeeded() { - return false; - } - - /** - * Sets this rendering context to be current. - */ - void setCurrent() { - context.setCurrent(); - } - - /** - * Sets up the viewing area for the OpenGL screen. The default - * behavior is to use a perspective view, but there also exist frustrum - * and ortho views. Subclasses may wish to override this method. - */ - void setupViewingArea() { - Rectangle rect = glCanvas.getClientArea(); - int width = rect.width; - int height = rect.height; - height = Math.max(height, 1); - GL.glViewport(0, 0, width, height); - GL.glMatrixMode(GL.GL_PROJECTION); // select the projection matrix - GL.glLoadIdentity(); // reset the projection matrix - float fAspect = (float) width / (float) height; - GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); - GL.glMatrixMode(GL.GL_MODELVIEW); // select the modelview matrix - GL.glLoadIdentity(); - } - - /** - * Swaps the buffers. - */ - void swap() { - context.swapBuffers(); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OutlineTextTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OutlineTextTab.java deleted file mode 100644 index 6b0a53f50e..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/OutlineTextTab.java +++ /dev/null @@ -1,251 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class OutlineTextTab extends OpenGLTab { - private Text messageText; - private FontData fontData; - private float[] textColor = { 1.0f, 0.0f, 0.0f }; - private boolean fill = true; - private float extrude = 0.0f; - private float xPos = 0.0f, yPos = 0.0f, zPos = -10.0f; - private float xRot = 0.0f; - private int listIndexBase; - private final static int LIST_INDEX_SIZE = 256; - private final static int DEFAULT_FONT_SIZE = 24; - private final static String DEFAULT_FONT_NAME = "Arial"; - private final static int SLEEP_LENGTH = 50; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(final Composite composite) { - if (!SWT.getPlatform().startsWith("win32")) { - new Label(composite, SWT.NONE).setText("This tab requires win32."); - return; - } - - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setText("Translation"); - movementGroup.setLayout(new GridLayout(2, false)); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider xMove = new Slider(movementGroup, SWT.NONE); - xMove.setIncrement(1); - xMove.setMaximum(22); - xMove.setMinimum(0); - xMove.setThumb(2); - xMove.setPageIncrement(2); - xMove.setSelection(10); - xMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = xMove.getSelection() - 10; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider yMove = new Slider(movementGroup, SWT.NONE); - yMove.setIncrement(1); - yMove.setMaximum(22); - yMove.setMinimum(0); - yMove.setThumb(2); - yMove.setPageIncrement(2); - yMove.setSelection(10); - yMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = yMove.getSelection() - 10; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Z:"); - final Slider zMove = new Slider(movementGroup, SWT.NONE); - zMove.setIncrement(1); - zMove.setMaximum(22); - zMove.setMinimum(0); - zMove.setThumb(2); - zMove.setPageIncrement(2); - zMove.setSelection(10); - zMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zPos = zMove.getSelection() - 20; - } - }); - - Composite textGroup = new Composite(composite,SWT.NONE); - GridLayout layout = new GridLayout(2,false); - layout.marginHeight = 0; - layout.marginWidth = 0; - textGroup.setLayout(layout); - textGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - new Label(textGroup, SWT.NONE).setText("Text:"); - messageText = new Text(textGroup, SWT.BORDER); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - data.grabExcessHorizontalSpace = true; - messageText.setLayoutData(data); - messageText.setText("OpenGL - SWT"); - - new Label(composite, SWT.NONE).setText("Extrude:"); - final Slider extrudeSlider = new Slider(composite, SWT.NONE); - extrudeSlider.setIncrement(1); - extrudeSlider.setMaximum(22); - extrudeSlider.setMinimum(0); - extrudeSlider.setThumb(2); - extrudeSlider.setPageIncrement(2); - extrudeSlider.setSelection(0); - extrudeSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - extrude = (float) extrudeSlider.getSelection() / 10; - getContext().loadOutlineFont( - fontData, extrudeSlider.getDisplay(), - listIndexBase, 0, 255, 0.0f, extrude, - fill ? GL.GL_POLYGON : GL.GL_LINE, - null); - } - }); - - final Button fontSelectButton = new Button(composite, SWT.NONE); - fontSelectButton.setText("Set Font"); - final ColorSelectionGroup colorGroup = - new ColorSelectionGroup(composite, SWT.NONE); - colorGroup.setText("Text color"); - colorGroup.addColorSelectionListener(new IColorSelectionListener() { - public void handleColorSelection(RGB rgb) { - GL.glColor3ub((byte) rgb.red, (byte) rgb.green, (byte) rgb.blue); - } - }); - - fontSelectButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - FontDialog fontDialog = new FontDialog(fontSelectButton.getShell()); - fontDialog.setText("Choose Font Options"); - double[] currentColor = new double[4]; - GL.glGetDoublev(GL.GL_CURRENT_COLOR, currentColor); - fontDialog.setRGB( - new RGB( - (int) currentColor[0] * 255, - (int) currentColor[1] * 255, - (int) currentColor[2] * 255)); - fontDialog.setFontList(new FontData[] {fontData}); - FontData result = fontDialog.open(); - if (result != null) { - fontData = result; - RGB rgb = fontDialog.getRGB(); - GL.glColor3ub((byte) rgb.red, (byte) rgb.green, (byte) rgb.blue); - colorGroup.setRGB(rgb); - getContext().loadOutlineFont( - fontData, fontSelectButton.getDisplay(), - listIndexBase, 0, 255, 0.0f, extrude, - fill ? GL.GL_POLYGON : GL.GL_LINE, - null); - } - } - }); - - final Button fillButton = new Button(composite, SWT.CHECK); - fillButton.setText("Fill"); - fillButton.setSelection(true); - fillButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - fill = fillButton.getSelection(); - getContext().loadOutlineFont( - fontData, fillButton.getDisplay(), - listIndexBase, 0, 255, 0.0f, extrude, - fill ? GL.GL_POLYGON : GL.GL_LINE, - null); - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GL.glDeleteLists(listIndexBase, LIST_INDEX_SIZE); - } - - /** - * Draws the text to the screen - * - * @param string the text to draw - */ - void drawText(String string) { - char[] stringChars = string.toCharArray(); - int[] text = new int[stringChars.length]; - for (int i = 0; i < text.length; i++) { - text[i] = (int) stringChars[i]; - } - GL.glPushAttrib(GL.GL_LIST_BIT); - GL.glListBase(listIndexBase); - GL.glCallLists(text.length, GL.GL_UNSIGNED_INT, text); - GL.glPopAttrib(); - } - - /** - * @see OpenGLTab#getSleepLength() - */ - int getSleepLength() { - return SLEEP_LENGTH; - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Outline Text"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glColor3fv(textColor); - GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - GL.glEnable(GL.GL_DEPTH_TEST); - GL.glEnable(GL.GL_BLEND); - // build the initial font - listIndexBase = GL.glGenLists(LIST_INDEX_SIZE); - fontData = new FontData(); - fontData.setHeight(DEFAULT_FONT_SIZE); - fontData.setName(DEFAULT_FONT_NAME); - getContext().loadOutlineFont( - fontData, getGlCanvas().getDisplay(), - listIndexBase, 0, 255, 0f, extrude, - fill ? GL.GL_POLYGON : GL.GL_LINE, - null); - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glTranslatef(xPos, yPos, zPos); - GL.glRotatef(xRot, 1.0f, 0.0f, 0.0f); // rotate on X axis - // use GL.glScalef to change size since outline fonts - // don't support size - float size = (float) fontData.getHeight() / 24; - GL.glScalef(size, size, 1.0f); - // draw the text, assuming that we're running on win32 - if (messageText != null) drawText(messageText.getText()); - xRot += 1.2f; - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ReflectionTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ReflectionTab.java deleted file mode 100644 index d680b83752..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/ReflectionTab.java +++ /dev/null @@ -1,556 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class ReflectionTab extends OpenGLTab { - private float ballY = 0.0f; - private float ballZ = 1.6666666f; - private float ballX = 0.0f; - private float ballRot = 0.0f; - private float cubeX = 2.5f; - private float cubeY = -2.0f; - private float cubeZ = 2.0f; - private float xPos = 0.0f; - private float yPos = 0.0f; - private float zPos = 22.0f; - private float ballRotSpeed = 0.0f; - private int quadratic; - private int[] textures = new int[3]; - private final static int - LIST_INDEX_BALL = 1,LIST_INDEX_BOX = 2, - LIST_INDEX_MIRROR = 3, LIST_INDEX_ROOM = 4; - private final static int - TEXTURE_INDEX_BALL = 0, TEXTURE_INDEX_FLOOR = 1, - TEXTURE_INDEX_BOX = 2; - private final static String[] IMAGES = { - "images/Ball.jpg", "images/Floor.jpg", "images/Box.bmp" }; - private final static int SLEEP_LENGTH = 50; - - /** - * Draws the ball - */ - void createBall() { - GL.glNewList(LIST_INDEX_BALL, GL.GL_COMPILE); - GL.glColor3f(1.0f, 1.0f, 1.0f); - GL.glBindTexture(GL.GL_TEXTURE_2D, textures[TEXTURE_INDEX_BALL]); - GLU.gluSphere(quadratic, 0.35f, 32, 16); - GL.glDisable(GL.GL_BLEND); - GL.glEndList(); - } - - /** - * Draws the box - */ - void createBox() { - float size = 1.0f; - GL.glNewList(LIST_INDEX_BOX, GL.GL_COMPILE); - GL.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GL.glBindTexture(GL.GL_TEXTURE_2D, textures[TEXTURE_INDEX_BOX]); - GL.glBegin(GL.GL_QUADS); - // front - GL.glNormal3f(0.0f, 0.0f, 1.0f); - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(-size, -size, size); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(size, -size, size); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(size, size, size); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(-size, size, size); - // back - GL.glNormal3f(0.0f, 0.0f, -1.0f); - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(-size, -size, -size); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(size, -size, -size); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(size, size, -size); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(-size, size, -size); - // left - GL.glNormal3f(-1.0f, 0.0f, 0.0f); - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(-size, -size, -size); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(-size, -size, size); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(-size, size, size); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(-size, size, -size); - // right - GL.glNormal3f(1.0f, 0.0f, 0.0f); - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(size, -size, -size); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(size, -size, size); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(size, size, size); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(size, size, -size); - // top - GL.glNormal3f(0.0f, 1.0f, 0.0f); - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(size, size, -size); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(-size, size, -size); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(-size, size, size); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(size, size, size); - // bottom - GL.glNormal3f(0.0f, -1.0f, 0.0f); - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(size, -size, -size); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(-size, -size, -size); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(-size, -size, size); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(size, -size, size); - GL.glEnd(); - GL.glEndList(); - } - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Group ballTranslation = new Group(composite, SWT.NONE); - ballTranslation.setLayout(new GridLayout(2, false)); - ballTranslation.setText("Ball Translation"); - - new Label(ballTranslation, SWT.NONE).setText("X:"); - final Slider ballXPosSlider = new Slider(ballTranslation, SWT.NONE); - ballXPosSlider.setIncrement(1); - ballXPosSlider.setMaximum(38); - ballXPosSlider.setMinimum(0); - ballXPosSlider.setThumb(2); - ballXPosSlider.setPageIncrement(2); - ballXPosSlider.setSelection(18); - ballXPosSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - ballX = (float) (ballXPosSlider.getSelection() - 18) / 5; - } - }); - - new Label(ballTranslation, SWT.NONE).setText("Y:"); - final Slider ballYPosSlider = new Slider(ballTranslation, SWT.NONE); - ballYPosSlider.setIncrement(1); - ballYPosSlider.setMaximum(38); - ballYPosSlider.setMinimum(0); - ballYPosSlider.setThumb(2); - ballYPosSlider.setPageIncrement(2); - ballYPosSlider.setSelection(18); - ballYPosSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - ballY = (float) (ballYPosSlider.getSelection() - 18) / 5; - } - }); - - new Label(ballTranslation, SWT.NONE).setText("Z:"); - final Slider ballZPosSlider = new Slider(ballTranslation, SWT.NONE); - ballZPosSlider.setIncrement(1); - ballZPosSlider.setMaximum(24); - ballZPosSlider.setMinimum(0); - ballZPosSlider.setThumb(1); - ballZPosSlider.setPageIncrement(2); - ballZPosSlider.setSelection(4); - ballZPosSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - ballZ = (float) (ballZPosSlider.getSelection() + 1) / 3; - } - }); - - Group cubeTranslation = new Group(composite, SWT.NONE); - cubeTranslation.setLayout(new GridLayout(2, false)); - cubeTranslation.setText("Cube Translation"); - - new Label(cubeTranslation, SWT.NONE).setText("X:"); - final Slider cubeXPosSlider = new Slider(cubeTranslation, SWT.NONE); - cubeXPosSlider.setIncrement(1); - cubeXPosSlider.setMaximum(14); - cubeXPosSlider.setMinimum(0); - cubeXPosSlider.setThumb(2); - cubeXPosSlider.setPageIncrement(2); - cubeXPosSlider.setSelection(11); - cubeXPosSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - cubeX = (float) (cubeXPosSlider.getSelection() - 6) / 2; - } - }); - - new Label(cubeTranslation, SWT.NONE).setText("Y:"); - final Slider cubeYPosSlider = new Slider(cubeTranslation, SWT.NONE); - cubeYPosSlider.setIncrement(1); - cubeYPosSlider.setMaximum(14); - cubeYPosSlider.setMinimum(0); - cubeYPosSlider.setThumb(2); - cubeYPosSlider.setPageIncrement(2); - cubeYPosSlider.setSelection(2); - cubeYPosSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - cubeY = (float) (cubeYPosSlider.getSelection() - 6) / 2; - } - }); - - new Label(cubeTranslation, SWT.NONE).setText("Z:"); - final Slider cubeZPosSlider = new Slider(cubeTranslation, SWT.NONE); - cubeZPosSlider.setIncrement(1); - cubeZPosSlider.setMaximum(10); - cubeZPosSlider.setMinimum(1); - cubeZPosSlider.setThumb(1); - cubeZPosSlider.setPageIncrement(2); - cubeZPosSlider.setSelection(2); - cubeZPosSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - cubeZ = (float) (cubeZPosSlider.getSelection() + 2) / 2; - } - }); - - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setLayout(new GridLayout(2, false)); - movementGroup.setText("Room Rotation"); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider screenXPosSlider = new Slider(movementGroup, SWT.NONE); - screenXPosSlider.setIncrement(1); - screenXPosSlider.setMaximum(42); - screenXPosSlider.setMinimum(0); - screenXPosSlider.setThumb(2); - screenXPosSlider.setPageIncrement(2); - screenXPosSlider.setSelection(20); - screenXPosSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = screenXPosSlider.getSelection() - 20; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider screenYPosSlider = new Slider(movementGroup, SWT.NONE); - screenYPosSlider.setIncrement(1); - screenYPosSlider.setMaximum(42); - screenYPosSlider.setMinimum(0); - screenYPosSlider.setThumb(2); - screenYPosSlider.setPageIncrement(2); - screenYPosSlider.setSelection(20); - screenYPosSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = screenYPosSlider.getSelection() - 20; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Z:"); - final Slider screenZPosSlider = new Slider(movementGroup, SWT.NONE); - screenZPosSlider.setIncrement(1); - screenZPosSlider.setMaximum(42); - screenZPosSlider.setMinimum(0); - screenZPosSlider.setThumb(2); - screenZPosSlider.setPageIncrement(2); - screenZPosSlider.setSelection(20); - screenZPosSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zPos = screenZPosSlider.getSelection() + 2; - } - }); - - new Label(composite, SWT.NONE).setText("Ball Rotation Speed:"); - final Slider ballRotSlider = new Slider(composite, SWT.NONE); - ballRotSlider.setIncrement(1); - ballRotSlider.setMaximum(22); - ballRotSlider.setMinimum(0); - ballRotSlider.setThumb(2); - ballRotSlider.setPageIncrement(2); - ballRotSlider.setSelection(0); - ballRotSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - ballRotSpeed = ballRotSlider.getSelection(); - } - }); - } - - /** - * Draws the mirror - */ - void createMirror() { - GL.glNewList(LIST_INDEX_MIRROR, GL.GL_COMPILE); - GL.glDisable(GL.GL_TEXTURE_2D); - GL.glColor4f(1.0f, 1.0f, 1.0f, 0.4f); - GL.glNormal3f(0.0f, 0.0f, 1.0f); - GL.glBegin(GL.GL_QUADS); - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(-2.0f, 2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(-2.0f, -2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(2.0f, -2.0f, 0.0f); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(2.0f, 2.0f, 0.0f); - GL.glEnd(); - GL.glEnable(GL.GL_TEXTURE_2D); - GL.glEndList(); - } - - /** - * Draws the room - */ - void createRoom() { - GL.glNewList(LIST_INDEX_ROOM, GL.GL_COMPILE); - GL.glDisable(GL.GL_TEXTURE_2D); - GL.glBegin(GL.GL_QUADS); - // left wall - GL.glNormal3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(-4.0f, 4.0f, 0.0f); - GL.glVertex3f(-4.0f, 4.0f, 6.0f); - GL.glVertex3f(-4.0f, -4.0f, 6.0f); - GL.glVertex3f(-4.0f, -4.0f, 0.0f); - // right wall - GL.glNormal3f(-1.0f, 0.0f, 01.0f); - GL.glVertex3f(4.0f, 4.0f, 0.0f); - GL.glVertex3f(4.0f, 4.0f, 6.0f); - GL.glVertex3f(4.0f, -4.0f, 6.0f); - GL.glVertex3f(4.0f, -4.0f, 0.0f); - // ceiling - GL.glNormal3f(0.0f, -1.0f, 0.0f); - GL.glColor3f(0.9f, 0.9f, 0.9f); - GL.glVertex3f(-4.0f, 4.0f, 0.0f); - GL.glVertex3f(-4.0f, 4.0f, 6.0f); - GL.glVertex3f(4.0f, 4.0f, 6.0f); - GL.glVertex3f(4.0f, 4.0f, 0.0f); - GL.glEnd(); - // back wall with triangle strip to illiminate t-intersections - GL.glBegin(GL.GL_TRIANGLE_STRIP); - GL.glNormal3f(0.0f, 0.0f, 1.0f); - GL.glVertex3d(-4.0, -4.0, 0.0); - GL.glVertex3d(-2.2, -4.0, 0.0); - GL.glVertex3d(-2.2, -2.2, 0.0); - GL.glVertex3d(2.2, -4.0, 0.0); - GL.glVertex3d(2.2, -2.2, 0.0); - GL.glVertex3d(4.0, -4.0, 0.0); - GL.glVertex3d(2.2, -2.2, 0.0); - GL.glVertex3d(4.0, -2.2, 0.0); - GL.glVertex3d(2.2, 2.2, 0.0); - GL.glVertex3d(4.0, 2.2, 0.0); - GL.glVertex3d(2.2, 2.2, 0.0); - GL.glVertex3d(4.0, 4.0, 0.0); - GL.glVertex3d(2.2, 2.2, 0.0); - GL.glVertex3d(2.2, 4.0, 0.0); - GL.glVertex3d(-2.2, 2.2, 0.0); - GL.glVertex3d(-2.2, 4.0, 0.0); - GL.glVertex3d(-4.0, 4.0, 0.0); - GL.glVertex3d(-2.2, 2.2, 0.0); - GL.glVertex3d(-4.0, 2.2, 0.0); - GL.glVertex3d(-2.2, -2.2, 0.0); - GL.glVertex3d(-4.0, -2.2, 0.0); - GL.glVertex3d(-4.0, -4.0, 0.0); - GL.glEnd(); - GL.glEnable(GL.GL_TEXTURE_2D); - // draw floor - GL.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GL.glBindTexture(GL.GL_TEXTURE_2D, textures[TEXTURE_INDEX_FLOOR]); - GL.glNormal3f(0.0f, 1.0f, 0.0f); - GL.glBegin(GL.GL_QUADS); - // floor - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(-4.0f, -4.0f, 6.0f); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(-4.0f, -4.0f, 0.0f); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(4.0f, -4.0f, 0.0f); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(4.0f, -4.0f, 6.0f); - GL.glEnd(); - // draw mirror frame - GL.glBindTexture(GL.GL_TEXTURE_2D, textures[TEXTURE_INDEX_BOX]); - GL.glNormal3f(0.0f, 0.0f, 1.0f); - GL.glBegin(GL.GL_QUADS); - // top - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(-2.2f, 2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(2.2f, 2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(2.2f, 2.2f, 0.0f); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(-2.2f, 2.2f, 0.0f); - // right - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(2.0f, 2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(2.0f, -2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(2.2f, -2.0f, 0.0f); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(2.2f, 2.0f, 0.0f); - // bottom - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(-2.2f, -2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(2.2f, -2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(2.2f, -2.2f, 0.0f); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(-2.2f, -2.2f, 0.0f); - // left - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(-2.0f, 2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(-2.0f, -2.0f, 0.0f); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(-2.2f, -2.0f, 0.0f); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(-2.2f, 2.0f, 0.0f); - GL.glEnd(); - GL.glEndList(); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GLU.gluDeleteQuadric(quadratic); - GL.glDeleteLists(LIST_INDEX_BALL, 1); - GL.glDeleteLists(LIST_INDEX_BOX, 1); - GL.glDeleteLists(LIST_INDEX_MIRROR, 1); - GL.glDeleteLists(LIST_INDEX_ROOM, 1); - } - - /** - * @see OpenGLTab#getSleepLength() - */ - int getSleepLength() { - return SLEEP_LENGTH; - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Reflection"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - if (!hasStencilSupport()) return; - - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glClearDepth(1.0f); - GL.glClearStencil(0); - GL.glGenTextures(IMAGES.length, textures); - for (int i = 0; i < IMAGES.length; i++) { - loadTexture(getContext(), IMAGES[i], i, textures); - } - - GL.glShadeModel(GL.GL_SMOOTH); - quadratic = GLU.gluNewQuadric(); - GLU.gluQuadricNormals(quadratic, GL.GL_SMOOTH); - GLU.gluQuadricTexture(quadratic, true); - GL.glDepthFunc(GL.GL_LEQUAL); - GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); - - // set up the lights - float[] LightAmb = { 0.7f, 0.7f, 0.7f, 1.0f }; - float[] LightDif = { 1.0f, 1.0f, 1.0f, 1.0f }; - float[] lightsAmbient = { 0.5f, 0.5f, 0.5f, 1.0f }; - GL.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, lightsAmbient); - GL.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, LightAmb); - GL.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, LightDif); - - GL.glEnable(GL.GL_LIGHT0); - GL.glEnable(GL.GL_LIGHTING); - GL.glEnable(GL.GL_LINE_SMOOTH); - GL.glEnable(GL.GL_DEPTH_TEST); - GL.glEnable(GL.GL_TEXTURE_2D); - GL.glEnable(GL.GL_BLEND); - - createRoom(); - createBall(); - createBox(); - createMirror(); - } - - /** - * @see OpenGLTab#isStencilSupportNeeded - */ - boolean isStencilSupportNeeded() { - return true; - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear( - GL.GL_COLOR_BUFFER_BIT - | GL.GL_DEPTH_BUFFER_BIT - | GL.GL_STENCIL_BUFFER_BIT); - - GL.glLoadIdentity(); - GLU.gluLookAt(xPos, yPos, zPos, 0, 0, 0, 0, 1, 0); - // clip plane equation - double clipEquation[] = { 0.0f, 0.0f, -1.0f, 0.0f }; - float[] LightPos = { 0.0f, 2.0f, 7.0f, 1.0f }; - GL.glColorMask(false, false, false, false); - // enable stencil buffer for "marking" the mirror - GL.glEnable(GL.GL_STENCIL_TEST); - // set the stencil buffer to 1 where a polygon is drawn - GL.glStencilFunc(GL.GL_ALWAYS, 1, 1); - GL.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_REPLACE); - GL.glDisable(GL.GL_DEPTH_TEST); - GL.glCallList(LIST_INDEX_MIRROR); - GL.glEnable(GL.GL_DEPTH_TEST); - GL.glColorMask(true, true, true, true); - GL.glStencilFunc(GL.GL_EQUAL, 1, 1); - // draw where the stencil is 1 - GL.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_KEEP); - GL.glEnable(GL.GL_CLIP_PLANE0); - GL.glClipPlane(GL.GL_CLIP_PLANE0, clipEquation); - GL.glPushMatrix(); - GL.glScalef(1.0f, 1.0f, -1.0f); - GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, LightPos); - GL.glCallList(LIST_INDEX_ROOM); // reflection - GL.glPushMatrix(); - GL.glTranslatef(cubeX, cubeY, cubeZ); - GL.glCallList(LIST_INDEX_BOX); // reflection - GL.glPopMatrix(); - GL.glTranslatef(ballX, ballY, ballZ); - GL.glRotatef(ballRot, 1.0f, 0.0f, 0.0f); - GL.glCallList(LIST_INDEX_BALL); // reflection - GL.glPopMatrix(); - GL.glDisable(GL.GL_CLIP_PLANE0); - GL.glDisable(GL.GL_STENCIL_TEST); - GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, LightPos); - GL.glEnable(GL.GL_BLEND); - GL.glDisable(GL.GL_LIGHTING); - GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - GL.glCallList(LIST_INDEX_MIRROR); - GL.glEnable(GL.GL_LIGHTING); - GL.glDisable(GL.GL_BLEND); - GL.glCallList(LIST_INDEX_ROOM); - GL.glPushMatrix(); - GL.glTranslatef(cubeX, cubeY, cubeZ); - GL.glCallList(LIST_INDEX_BOX); - GL.glPopMatrix(); - GL.glTranslatef(ballX, ballY, ballZ); - GL.glRotatef(ballRot, 1.0f, 0.0f, 0.0f); - GL.glCallList(LIST_INDEX_BALL); - ballRot += ballRotSpeed; - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/SelectionTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/SelectionTab.java deleted file mode 100644 index 272b9c6e95..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/SelectionTab.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.opengl.*; - -abstract class SelectionTab extends OpenGLTab { - private final static int BUFFER_LENGTH = 64; - - /** - * Sets the selected object. Subclasses must override this method. - */ - abstract void processPick(int[] pSelectBuff, int hits); - - /** - * Invoke processPick for the object at the specified coordinate. - */ - int processSelection(int xPos, int yPos, int pointSize) { - int[] selectBuffer = new int[BUFFER_LENGTH]; - int[] viewport = new int[4]; - // new fix for sun jre - int ptr = getContext().getSelectBufferPtr(selectBuffer); - - GL.glSelectBuffer(BUFFER_LENGTH, ptr); - GL.glGetIntegerv(GL.GL_VIEWPORT, viewport); - GL.glRenderMode(GL.GL_SELECT); - GL.glMatrixMode(GL.GL_PROJECTION); - GL.glPushMatrix(); - GL.glLoadIdentity(); - GLU.gluPickMatrix(xPos, yPos, pointSize, pointSize, viewport); - Rectangle rect = getGlCanvas().getClientArea(); - float fAspect = (float) rect.width / (float) rect.height; - GLU.gluPerspective(45.0f, fAspect, 0.5f, 600.0f); - GL.glMatrixMode(GL.GL_MODELVIEW); - GL.glInitNames(); - render(); - int hits = GL.glRenderMode(GL.GL_RENDER); - // new fix for sun jre - // must be called after render mode is switched - getContext().getSelectBuffer(ptr, selectBuffer); - if (hits != 0) processPick(selectBuffer, hits); - GL.glMatrixMode(GL.GL_PROJECTION); - GL.glPopMatrix(); - GL.glMatrixMode(GL.GL_MODELVIEW); - return hits; - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/StencilTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/StencilTab.java deleted file mode 100644 index 5dce41278f..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/StencilTab.java +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class StencilTab extends OpenGLTab { - private abstract class Shape { - private String name; - /** - * Constructor - * - * @param name the shape's name - */ - Shape(String name) { - super(); - this.name = name; - } - /** - * Draws this shape. - */ - abstract void draw(); - /** - * Returns the name. - * - * @return String - */ - String getName() { - return name; - } - } - - private Shape[] shapes = new Shape[5]; - private Shape currentShape; - private float xPos = 0, yPos = 0; - private float size = 0.45f; - private int texture; - private int quadratic; - private final static String IMAGE = "images/splash.bmp"; - private final static int SLEEP_LENGTH = 50; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Composite controls = new Composite(composite, SWT.NONE); - GridLayout layout = new GridLayout(2, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - controls.setLayout(layout); - new Label(controls, SWT.NONE).setText("Object:"); - final Combo shapeCombo = new Combo(controls, SWT.READ_ONLY); - for (int i = 0; i < shapes.length; i++) { - shapeCombo.add(shapes[i].getName()); - } - shapeCombo.select(0); - shapeCombo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - currentShape = shapes[shapeCombo.getSelectionIndex()]; - } - }); - - new Label(composite, SWT.NONE).setText("Size:"); - final Slider sizeSlider = new Slider(composite, SWT.HORIZONTAL); - sizeSlider.setValues(0, 15, 75, 5, 5, 10); - sizeSlider.setSelection(45); - sizeSlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - size = ((float) sizeSlider.getSelection()) / 100; - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GLU.gluDeleteQuadric(quadratic); - } - - /** - * @see OpenGLTab#getSleepLength() - */ - int getSleepLength() { - return SLEEP_LENGTH; - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Stencil"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - if (!hasStencilSupport()) return; - - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glClearDepth(1.0f); - int[] textureOut = new int[1]; - GL.glGenTextures(1, textureOut); - loadTexture(getContext(), IMAGE, 0, textureOut); - this.texture = textureOut[0]; - quadratic = GLU.gluNewQuadric(); - GLU.gluQuadricNormals(quadratic, GLU.GLU_SMOOTH); - GL.glDepthFunc(GL.GL_LEQUAL); - GL.glEnable(GL.GL_STENCIL_TEST); - GL.glEnable(GL.GL_TEXTURE_2D); - GL.glEnable(GL.GL_DEPTH_TEST); - // create shapes - shapes[0] = new Shape("Triangle") { - public void draw() { - GL.glBegin(GL.GL_TRIANGLES); - GL.glVertex3f(0.0f, size, 0.0f); - GL.glVertex3f(-size, -size, 0.0f); - GL.glVertex3f(size, -size, 0.0f); - GL.glEnd(); - } - }; - - shapes[1] = new Shape("Disk") { - public void draw() { - GLU.gluDisk(quadratic, 0.0f, size, 32, 32); - } - }; - - shapes[2] = new Shape("Square") { - public void draw() { - GL.glRectf(-size, -size, size, size); - } - }; - - shapes[3] = new Shape("Hour Glass") { - public void draw() { - GL.glBegin(GL.GL_TRIANGLES); - GL.glVertex3f(0.0f, size, 0.0f); - GL.glVertex3f(-size, -size, 0.0f); - GL.glVertex3f(size, -size, 0.0f); - GL.glVertex3f(0.0f, -size, 0.0f); - GL.glVertex3f(size, size, 0.0f); - GL.glVertex3f(-size, size, 0.0f); - GL.glEnd(); - } - }; - - shapes[4] = new Shape("Star") { - public void draw() { - GL.glBegin(GL.GL_TRIANGLES); - GL.glVertex3f(-0.3f, 0, 0.0f); - GL.glVertex3f(2 * size - 0.3f, 0, 0.0f); - GL.glVertex3f(size - 0.3f, 2 * size * 0.85f, 0.0f); - GL.glVertex3f(2 * size - 0.3f, size, 0.0f); - GL.glVertex3f(0 - 0.3f, size, 0.0f); - GL.glVertex3f(size - 0.3f, -size * 0.85f, 0.0f); - GL.glEnd(); - } - }; - - currentShape = shapes[0]; - } - - /** - * @see OpenGLTab#isStencilSupportNeeded - */ - boolean isStencilSupportNeeded() { - return true; - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear( - GL.GL_COLOR_BUFFER_BIT - | GL.GL_DEPTH_BUFFER_BIT - | GL.GL_STENCIL_BUFFER_BIT); - - GL.glLoadIdentity(); - GL.glTranslatef( - (float) (1.5 * Math.cos(xPos)), - (float) (1.0 * Math.sin(yPos)), - -3.0f); - xPos += 0.15f; - yPos += 0.3f; - - GL.glColorMask(false, false, false, false); - GL.glStencilFunc(GL.GL_ALWAYS, 1, 1); - GL.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_REPLACE); - GL.glDisable(GL.GL_DEPTH_TEST); - GL.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - currentShape.draw(); - - GL.glEnable(GL.GL_DEPTH_TEST); - GL.glColorMask(true, true, true, true); - GL.glStencilFunc(GL.GL_EQUAL, 1, 1); - GL.glStencilOp(GL.GL_KEEP, GL.GL_KEEP, GL.GL_KEEP); - - GL.glLoadIdentity(); - // load the texture behind the stencil object - GL.glTranslatef(0.0f, 0.0f, -3.1f); - GL.glBindTexture(GL.GL_TEXTURE_2D, texture); - GL.glBegin(GL.GL_QUADS); - GL.glTexCoord2f(0.0f, 0.0f); - GL.glVertex3f(-0.85f, -0.85f, 1.0f); - GL.glTexCoord2f(1.0f, 0.0f); - GL.glVertex3f(0.85f, -0.85f, 1.0f); - GL.glTexCoord2f(1.0f, 1.0f); - GL.glVertex3f(0.85f, 0.85f, 1.0f); - GL.glTexCoord2f(0.0f, 1.0f); - GL.glVertex3f(-0.85f, 0.85f, 1.0f); - GL.glEnd(); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TextureTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TextureTab.java deleted file mode 100644 index f9b5639fe2..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TextureTab.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class TextureTab extends OpenGLTab { - private float yrot = 0, zrot = 0; - private float xPos = 0.0f, yPos = 0.0f, zPos = -20; - private int texture = 0; - private float[][][] points = new float[45][45][3]; - private final static String IMAGE = "images/splash.bmp"; - private final static int SLEEP_LENGTH = 50; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Group movementGroup = new Group(composite, SWT.NONE); - movementGroup.setText("Translation"); - movementGroup.setLayout(new GridLayout(2, false)); - - new Label(movementGroup, SWT.NONE).setText("X:"); - final Slider xMove = new Slider(movementGroup, SWT.NONE); - xMove.setIncrement(1); - xMove.setMaximum(12); - xMove.setMinimum(0); - xMove.setThumb(2); - xMove.setPageIncrement(2); - xMove.setSelection(5); - xMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - xPos = xMove.getSelection() - 5; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Y:"); - final Slider yMove = new Slider(movementGroup, SWT.NONE); - yMove.setIncrement(1); - yMove.setMaximum(12); - yMove.setMinimum(0); - yMove.setThumb(2); - yMove.setPageIncrement(2); - yMove.setSelection(5); - yMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - yPos = yMove.getSelection() - 5; - } - }); - - new Label(movementGroup, SWT.NONE).setText("Z:"); - final Slider zMove = new Slider(movementGroup, SWT.NONE); - zMove.setIncrement(1); - zMove.setMaximum(24); - zMove.setMinimum(0); - zMove.setThumb(4); - zMove.setPageIncrement(2); - zMove.setSelection(10); - zMove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - zPos = zMove.getSelection() - 30; - } - }); - } - - /** - * @see OpenGLTab#getSleepLength() - */ - int getSleepLength() { - return SLEEP_LENGTH; - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Texture"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - //GL.glClearColor(0.0f, 0.0f, 0.3f, 1.0f); - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glClearDepth(1.0f); - int[] textureOut = new int[1]; - GL.glGenTextures(1, textureOut); - loadTexture(getContext(), IMAGE, 0, textureOut); - texture = textureOut[0]; - GL.glDepthFunc(GL.GL_LEQUAL); - GL.glPolygonMode(GL.GL_BACK, GL.GL_FILL); - GL.glPolygonMode(GL.GL_FRONT, GL.GL_LINE); - GL.glEnable(GL.GL_LIST_MODE); - GL.glEnable(GL.GL_TEXTURE_2D); - GL.glEnable(GL.GL_DEPTH_TEST); - // initialize points - for (int x = 0; x < 45; x++) { - for (int y = 0; y < 45; y++) { - points[x][y][0] = x / 5.0f - 4.5f; - points[x][y][1] = y / 5.0f - 4.5f; - points[x][y][2] = - (float) Math.sin( - (((x / 5.0f) * 40.0f) / 360.0f) * Math.PI * 2); - } - } - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - GL.glClear( - GL.GL_COLOR_BUFFER_BIT - | GL.GL_DEPTH_BUFFER_BIT - | GL.GL_STENCIL_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glTranslatef(xPos, yPos, zPos); - GL.glRotatef(yrot, 0.0f, 1.0f, 0.0f); - GL.glRotatef(zrot, 0.0f, 0.0f, 1.0f); - GL.glBindTexture(GL.GL_TEXTURE_2D, texture); - - GL.glBegin(GL.GL_QUADS); - for (int x = 0; x < 44; x++) { - for (int y = 0; y < 44; y++) { - float fx = x / 44.0f; - float fy = y / 44.0f; - float fxb = (x + 1) / 44.0f; - float fyb = (y + 1) / 44.0f; - GL.glTexCoord2f(fx, fy); - GL.glVertex3f( - points[x][y][0], - points[x][y][1], - points[x][y][2]); - GL.glTexCoord2f(fx, fyb); - GL.glVertex3f( - points[x][y + 1][0], - points[x][y + 1][1], - points[x][y + 1][2]); - GL.glTexCoord2f(fxb, fyb); - GL.glVertex3f( - points[x + 1][y + 1][0], - points[x + 1][y + 1][1], - points[x + 1][y + 1][2]); - GL.glTexCoord2f(fxb, fy); - GL.glVertex3f( - points[x + 1][y][0], - points[x + 1][y][1], - points[x + 1][y][2]); - } - } - GL.glEnd(); - // perform wave motion - for (int y = 0; y < 45; y++) { - float hold = points[0][y][2]; - for (int x = 0; x < 44; x++) { - points[x][y][2] = points[x + 1][y][2]; - } - points[44][y][2] = hold; - } - yrot += 0.9f; - zrot += 0.6f; - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TransparencyTab.java b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TransparencyTab.java deleted file mode 100644 index 5514cbf25a..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/TransparencyTab.java +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.examples; - - -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.opengl.*; -import org.eclipse.swt.widgets.*; - -class TransparencyTab extends SelectionTab { - private float[] alphas = { 0.3f, 0.5f, 1.0f }; - private int quadratic; - private int currentSelection = 1; - private final static int - INDEX_TRIANGLE = 1, INDEX_SPHERE = 2, INDEX_DISK = 3; - private final static String[] OBJECTS = {"Triangle", "Sphere", "Disk" }; - - /** - * @see OpenGLTab#createControls(Composite) - */ - void createControls(Composite composite) { - Composite objectGroup = new Composite(composite, SWT.NONE); - GridLayout layout = new GridLayout(2, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - objectGroup.setLayout(layout); - objectGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - new Label(objectGroup, SWT.NONE).setText("Object:"); - final Combo objectCombo = new Combo(objectGroup, SWT.READ_ONLY); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - data.grabExcessHorizontalSpace = true; - objectCombo.setLayoutData(data); - objectCombo.setItems(OBJECTS); - objectCombo.select(0); - - new Label(composite, SWT.NONE).setText("Transparency:"); - final Slider transparencySlider = new Slider(composite, SWT.HORIZONTAL); - transparencySlider.setValues(0, 0, 11, 1, 1, 2); - transparencySlider.setSelection(7); - transparencySlider.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - float alpha = transparencySlider.getSelection(); - alpha = 1.0f - alpha / 10; - alphas[currentSelection - 1] = alpha; - } - }); - objectCombo.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - currentSelection = objectCombo.getSelectionIndex() + 1; - transparencySlider.setSelection( - (int) ((1.0f - alphas[currentSelection - 1]) * 10)); - } - }); - - final Canvas glCanvas = getGlCanvas(); - glCanvas.addMouseListener(new MouseAdapter() { - public void mouseUp(MouseEvent e) { - Rectangle rect = glCanvas.getClientArea(); - e.y = rect.height - e.y; - if (e.button == 1) { - processSelection(e.x, e.y, 2); - transparencySlider.setSelection( - (int) ((1.0f - alphas[currentSelection - 1]) * 10)); - objectCombo.select(currentSelection - 1); - } - } - }); - } - - /** - * @see OpenGLTab#dispose() - */ - void dispose() { - super.dispose(); - GLU.gluDeleteQuadric(quadratic); - GL.glDeleteLists(INDEX_DISK, 1); - GL.glDeleteLists(INDEX_SPHERE, 1); - GL.glDeleteLists(INDEX_TRIANGLE, 1); - } - - /** - * @see OpenGLTab#getTabText() - */ - String getTabText() { - return "Transparency"; - } - - /** - * @see OpenGLTab#init() - */ - void init() { - GL.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); - GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - quadratic = GLU.gluNewQuadric(); - GLU.gluQuadricNormals(quadratic, GLU.GLU_SMOOTH); - GL.glEnable(GL.GL_CULL_FACE); - GL.glEnable(GL.GL_DEPTH_TEST); - GL.glEnable(GL.GL_BLEND); - // create display lists - GL.glNewList(INDEX_SPHERE, GL.GL_COMPILE); - GLU.gluQuadricDrawStyle(quadratic, GLU.GLU_FILL); - GLU.gluSphere(quadratic, 1.5, 32, 32); - GL.glEndList(); - GL.glNewList(INDEX_DISK, GL.GL_COMPILE); - GLU.gluQuadricDrawStyle(quadratic, GLU.GLU_FILL); - GLU.gluDisk(quadratic, 1.0, 3, 32, 32); - GL.glEndList(); - GL.glNewList(INDEX_TRIANGLE, GL.GL_COMPILE); - GL.glBegin(GL.GL_TRIANGLES); - GL.glVertex3f(0.0f, 2.0f, 0.0f); - GL.glVertex3f(-2.0f, -2.0f, 2.0f); - GL.glVertex3f(2.0f, -2.0f, 2.0f); - GL.glEnd(); - GL.glEndList(); - } - - /** - * @see SelectionTab.processPick (int[], int) - */ - void processPick(int[] pSelectBuff, int hits) { - int count, zDepth; - int tempSelection = pSelectBuff[3]; - zDepth = pSelectBuff[2]; - // pick object with largest z value - for (int i = 4; i <= 4 * (hits - 1); i = i + 4) { - if (zDepth > pSelectBuff[i + 2]) { - zDepth = pSelectBuff[i + 2]; - tempSelection = pSelectBuff[i + 3]; - } - } - if (tempSelection > 0) currentSelection = tempSelection; - } - - /** - * @see OpenGLTab#renderScene() - */ - void renderScene() { - // draw items with transparent qualities in reverse Z order - GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - GL.glLoadIdentity(); - GL.glTranslatef(0.0f, 0.0f, -14.0f); - GL.glPushName(0); - - // draw disk - GL.glPushMatrix(); - GL.glTranslatef(-1.0f, 0.0f, 1.0f); - GL.glColor4f(0.0f, 1.0f, 0.0f, alphas[2]); - GL.glLoadName(INDEX_DISK); - GL.glCallList(INDEX_DISK); - if (currentSelection == INDEX_DISK) { - GL.glColor3f(1.0f, 0.0f, 0.0f); - GLU.gluQuadricDrawStyle(quadratic, GLU.GLU_LINE); - GLU.gluDisk(quadratic, 0.98, 3.02, 32, 32); - } - GL.glPopMatrix(); - - // draw triangle - GL.glTranslatef(0.0f, 0.0f, +3.0f); - GL.glLoadName(INDEX_TRIANGLE); - GL.glColor4f(1.0f, 0.0f, 0.0f, alphas[0]); - GL.glCallList(INDEX_TRIANGLE); - GL.glPointSize(5.0f); - if (currentSelection == INDEX_TRIANGLE) { - GL.glBegin(GL.GL_POINTS); - GL.glColor3f(1.0f, 0.0f, 0.0f); - GL.glVertex3f(0.0f, 2.0f, 0.0f); - GL.glVertex3f(-2.0f, -2.0f, 2.0f); - GL.glVertex3f(2.0f, -2.0f, 2.0f); - GL.glEnd(); - } - - // draw sphere - GL.glPushMatrix(); - GL.glTranslatef(1.0f, 0.0f, +3.0f); - GL.glColor4f(0.0f, 0.0f, 1.0f, alphas[1]); - GL.glLoadName(INDEX_SPHERE); - GL.glCallList(INDEX_SPHERE); - if (currentSelection == INDEX_SPHERE) { - GL.glColor3f(1.0f, 0.0f, 0.0f); - GLU.gluQuadricDrawStyle(quadratic, GLU.GLU_LINE); - GLU.gluSphere(quadratic, 1.51, 8, 8); - } - GL.glPopMatrix(); - } -} diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Ball.jpg b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Ball.jpg Binary files differdeleted file mode 100644 index 6890d26807..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Ball.jpg +++ /dev/null diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Box.bmp b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Box.bmp Binary files differdeleted file mode 100644 index 5eef6630d3..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Box.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Floor.jpg b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Floor.jpg Binary files differdeleted file mode 100644 index 4934c9c82a..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/Floor.jpg +++ /dev/null diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/splash.bmp b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/splash.bmp Binary files differdeleted file mode 100644 index 6ec75da1a8..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/splash.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/untitled.jpg b/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/untitled.jpg Binary files differdeleted file mode 100644 index f5d6aa11d5..0000000000 --- a/examples/org.eclipse.swt.opengl.examples/src/org/eclipse/swt/opengl/examples/images/untitled.jpg +++ /dev/null |