git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@6971 75d07b2b-3a1a-0410-a2c5-0572b91ccdca3.0
commit
9e53abbb7a
@ -0,0 +1,42 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<classpath> |
||||
<classpathentry kind="src" path="src/core"/> |
||||
<classpathentry kind="src" path="src/core-data"/> |
||||
<classpathentry kind="src" path="src/core-plugins"/> |
||||
<classpathentry kind="src" path="src/desktop"/> |
||||
<classpathentry kind="src" path="src/desktop-fx"/> |
||||
<classpathentry kind="src" path="src/games"/> |
||||
<classpathentry kind="src" path="src/jbullet"/> |
||||
<classpathentry kind="src" path="src/jogg"/> |
||||
<classpathentry kind="src" path="src/lwjgl-oal"/> |
||||
<classpathentry kind="src" path="src/lwjgl-ogl"/> |
||||
<classpathentry kind="src" path="src/niftygui"/> |
||||
<classpathentry kind="src" path="src/ogre"/> |
||||
<classpathentry kind="src" path="src/pack"/> |
||||
<classpathentry kind="src" path="src/test"/> |
||||
<classpathentry kind="src" path="src/test-data"/> |
||||
<classpathentry kind="src" path="src/tools"/> |
||||
<classpathentry kind="src" path="src/xml"/> |
||||
<classpathentry kind="src" path="src/terrain"/> |
||||
<classpathentry kind="src" path="src/networking"/> |
||||
<classpathentry kind="lib" path="lib/jbullet/asm-all-3.1.jar"/> |
||||
<classpathentry kind="lib" path="lib/jbullet/jbullet.jar"/> |
||||
<classpathentry kind="lib" path="lib/jbullet/stack-alloc.jar"/> |
||||
<classpathentry kind="lib" path="lib/jbullet/vecmath.jar"/> |
||||
<classpathentry kind="lib" path="lib/jogg/j-ogg-oggd.jar"/> |
||||
<classpathentry kind="lib" path="lib/jogg/j-ogg-vorbisd.jar"/> |
||||
<classpathentry kind="lib" path="lib/jogl/jME3-jogl-natives.jar"/> |
||||
<classpathentry kind="lib" path="lib/swing-layout/swing-layout-1.0.4.jar"/> |
||||
<classpathentry kind="lib" path="lib/swingext/swing-layout-1.0.3.jar"/> |
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
||||
<classpathentry kind="lib" path="lib/lwjgl/jinput.jar"/> |
||||
<classpathentry kind="lib" path="lib/lwjgl/lwjgl.jar"/> |
||||
<classpathentry kind="lib" path="lib/lwjgl/jME3-lwjgl-natives.jar"/> |
||||
<classpathentry kind="lib" path="lib/niftygui/nifty-1.3-SNAPSHOT.jar"/> |
||||
<classpathentry kind="lib" path="lib/niftygui/nifty-default-controls-1.3-SNAPSHOT.jar"/> |
||||
<classpathentry kind="lib" path="lib/niftygui/nifty-style-black-1.3-SNAPSHOT.jar"/> |
||||
<classpathentry kind="lib" path="lib/niftygui/eventbus-1.4.jar"/> |
||||
<classpathentry kind="lib" path="lib/niftygui/nifty-examples-1.3-SNAPSHOT.jar"/> |
||||
<classpathentry kind="lib" path="lib/niftygui/xmlpull-xpp3-1.1.4c.jar"/> |
||||
<classpathentry kind="output" path="bin"/> |
||||
</classpath> |
@ -0,0 +1,17 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<projectDescription> |
||||
<name>jme3</name> |
||||
<comment></comment> |
||||
<projects> |
||||
</projects> |
||||
<buildSpec> |
||||
<buildCommand> |
||||
<name>org.eclipse.jdt.core.javabuilder</name> |
||||
<arguments> |
||||
</arguments> |
||||
</buildCommand> |
||||
</buildSpec> |
||||
<natures> |
||||
<nature>org.eclipse.jdt.core.javanature</nature> |
||||
</natures> |
||||
</projectDescription> |
@ -0,0 +1 @@ |
||||
X-Comment: jMonkeyEngine 3.0 |
Binary file not shown.
@ -0,0 +1,53 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<!-- |
||||
- |
||||
- ant build file for jMonkeyEngine Android Renderer |
||||
- |
||||
- author: Anton Yudin |
||||
- created: Sun Nov 7 22:38:27 EST 2010 |
||||
- |
||||
--> |
||||
|
||||
<project name="jMonkeyEngine Android Renderer" default="dist" basedir="."> |
||||
|
||||
|
||||
<path id="classpath"> |
||||
<pathelement path="lib/android/android.jar"/> |
||||
<pathelement path="dist/jMonkeyEngine3.jar"/> |
||||
</path> |
||||
|
||||
<target name="initialize"> |
||||
<mkdir dir="build/android"/> |
||||
</target> |
||||
|
||||
<target name="compile" depends="initialize"> |
||||
<javac |
||||
target="1.6" |
||||
encoding="UTF-8" |
||||
debug="true" |
||||
deprecation="on" |
||||
srcdir="src/android" |
||||
destdir="build/android" |
||||
classpathref="classpath" |
||||
excludes="**/OGLESRenderer.java,**/TestsActivity.java,**/AboutActivity.java" |
||||
/> |
||||
</target> |
||||
|
||||
<target name="dist" depends="compile"> |
||||
<jar |
||||
jarfile="build/jmonkeyengine3-android-renderer.jar" |
||||
basedir="build/android" |
||||
/> |
||||
<jar |
||||
jarfile="build/jmonkeyengine3-android-tests.jar" |
||||
basedir="build/testclasses" |
||||
/> |
||||
<jar |
||||
jarfile="build/jmonkeyengine3-android-dist.jar" |
||||
basedir="build/classes" |
||||
excludes="com/jme3/system/JmeSystem*" |
||||
/> |
||||
</target> |
||||
|
||||
</project> |
@ -0,0 +1,223 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<project name="jME3_ordered" default="default" basedir="."> |
||||
<description>Builds, tests, and runs the project jME3_ordered.</description> |
||||
<import file="nbproject/build-impl.xml"/> |
||||
<import file="nbproject/profiler-build-impl.xml"/> |
||||
|
||||
|
||||
<!--this target creates the assets jar file and modifies the classpath to include it--> |
||||
<target name="-pre-jar"> |
||||
<!--separate test classes--> |
||||
<mkdir dir="build/testclasses/"/> |
||||
<move file="build/classes/jme3test" todir="build/testclasses/" failonerror="false"/> |
||||
<move file="build/classes/jme3game" todir="build/testclasses/" failonerror="false"/> |
||||
<jar jarfile="build/jme3test.jar" basedir="build/testclasses/" compress="true"/> |
||||
|
||||
<!--create jar from assets--> |
||||
<jar jarfile="build/jme3testdata.jar" basedir="src/test-data" compress="true"/> |
||||
<!--resolve assets and assets jar location--> |
||||
<property location="src/test-data" name="testdata.dir.resolved"/> |
||||
<property location="build/jme3testdata.jar" name="testdata.jar.resolved"/> |
||||
<!--this sets properties that would normally later be created in the build-impl.xml--> |
||||
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/> |
||||
<pathconvert property="run.classpath.without.build.classes.dir"> |
||||
<path path="${run.classpath}"/> |
||||
<map from="${build.classes.dir.resolved}" to=""/> |
||||
<!--replace assets folder in dist classpath--> |
||||
<map from="${testdata.dir.resolved}" to="${testdata.jar.resolved}"/> |
||||
<!--add tests jar to dist classpath--> |
||||
<path path="build/jme3test.jar"/> |
||||
</pathconvert> |
||||
</target> |
||||
|
||||
<!-- puts jme3 jars, libs, source and javadoc in a dated zip file --> |
||||
<target name="dist" depends="clean, jar, javadoc"> |
||||
<!-- create date in the format MM-dd-yyyy --> |
||||
<tstamp> |
||||
<format property="date" pattern="yyyy-MM-dd" locale="en,US"/> |
||||
</tstamp> |
||||
<property name="jme3zip" value="jME3_${date}.zip"/> |
||||
|
||||
<!-- make zip file --> |
||||
<zip destfile="${jme3zip}"> |
||||
<fileset dir="."> |
||||
<include name="TestChooser.exe"/> |
||||
<include name="README.TXT"/> |
||||
</fileset> |
||||
<fileset dir="dist/"> |
||||
<include name="jMonkeyEngine3.jar"/> |
||||
</fileset> |
||||
<zipfileset dir="dist/lib" prefix="lib"/> |
||||
<zipfileset dir="dist/javadoc" prefix="javadoc"/> |
||||
<zipfileset dir="${src.core.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.core-data.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.core-plugins.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.desktop.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.desktop-fx.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.games.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.jbullet.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.niftygui.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.jogg.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.lwjgl-oal.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.lwjgl-ogl.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.ogre.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.pack.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.jheora.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.test.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.tools.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.xml.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.terrain.dir}" prefix="source"/> |
||||
<zipfileset dir="${src.networking.dir}" prefix="source"/> |
||||
</zip> |
||||
</target> |
||||
|
||||
<!-- convenience target to transfer jme3 libraries to jme3-gde (jMonkeyPlatform) --> |
||||
<target name="update-gde" depends="jar, javadoc"> |
||||
<antcall target="-do-update-gde" inheritall="true"> |
||||
<param name="jmp_dir" value="../jme3-gde/"/> |
||||
</antcall> |
||||
</target> |
||||
|
||||
<!-- convenience target to transfer jme3 libraries to the jme3-jmp folder on the Hudson build server (jMonkeyPlatform) --> |
||||
<target name="update-jmp-hudson"> |
||||
<!--update jme3 svn revision info properly--> |
||||
<exec executable="svn" dir="."> |
||||
<arg value="update" /> |
||||
</exec> |
||||
<!--update jmp--> |
||||
<antcall target="-do-update-gde" inheritall="true"> |
||||
<param name="jmp_dir" value="../../jme3-jmp/workspace/"/> |
||||
</antcall> |
||||
<!--antcall target="-create-jme3-svn-properties" inheritall="true"> |
||||
<param name="jmp_dir" value="../../jme3-jmp/workspace/"/> |
||||
</antcall--> |
||||
</target> |
||||
|
||||
<target name="-do-update-gde"> |
||||
<!--clear old files--> |
||||
<delete dir="${jmp_dir}/JME3TestsTemplate/src/"/> |
||||
<delete dir="${jmp_dir}/jme3-core-baselibs/release/modules/ext/"/> |
||||
<delete dir="${jmp_dir}/jme3-core-libraries/release/modules/ext/"/> |
||||
<delete dir="${jmp_dir}/jme3-project-libraries/release/libs/"/> |
||||
<delete dir="${jmp_dir}/jme3-project-baselibs/release/libs/"/> |
||||
<delete dir="${jmp_dir}/jme3-project-testdata/release/libs/"/> |
||||
|
||||
<!--jme3 base libs--> |
||||
<copy file="${dist.jar}" toDir="${jmp_dir}/jme3-core-baselibs/release/modules/ext/" overwrite="true" failonerror="true" verbose="true"/> |
||||
<copy file="dist/lib/jME3-lwjgl-natives.jar" toDir="${jmp_dir}/jme3-core-baselibs/release/modules/ext/" overwrite="true" failonerror="true" verbose="true"/> |
||||
<!-- <copy file="dist/lib/jME3-jogl-natives.jar" toDir="${jmp_dir}/jme3-core-baselibs/release/modules/ext/" overwrite="true" failonerror="true" verbose="true"/>--> |
||||
<!-- <copy file="dist/lib/jME3-natives-joal.jar" toDir="${jmp_dir}/jme3-core-baselibs/release/modules/ext/" overwrite="true" failonerror="true" verbose="true"/>--> |
||||
|
||||
<copy file="${dist.jar}" toDir="${jmp_dir}/jme3-project-baselibs/release/libs/" overwrite="true" failonerror="true" verbose="true"/> |
||||
|
||||
<!--jme3 libraries--> |
||||
<copy todir="${jmp_dir}/jme3-core-libraries/release/modules/ext/" overwrite="true" failonerror="true" verbose="true"> |
||||
<!--exclude jme3 test data from core--> |
||||
<fileset dir="dist/lib/"> |
||||
<exclude name="jme3testdata.jar"/> |
||||
<exclude name="jme3test.jar"/> |
||||
<exclude name="jME3-lwjgl-natives.jar"/> |
||||
<exclude name="jME3-jogl-natives.jar"/> |
||||
<exclude name="jME3-natives-joal.jar"/> |
||||
</fileset> |
||||
</copy> |
||||
<copy todir="${jmp_dir}/jme3-project-libraries/release/libs/" overwrite="true" failonerror="true" verbose="true"> |
||||
<!--exclude jme3 test data from libs--> |
||||
<fileset dir="dist/lib/"> |
||||
<exclude name="jme3testdata.jar"/> |
||||
<exclude name="jme3test.jar"/> |
||||
</fileset> |
||||
</copy> |
||||
|
||||
<!--test data--> |
||||
<copy file="dist/lib/jme3testdata.jar" toDir="${jmp_dir}/jme3-project-testdata/release/libs/" overwrite="true" failonerror="true" verbose="true"/> |
||||
|
||||
<!--javadoc--> |
||||
<zip destfile="dist/jMonkeyEngine3-javadoc.zip"> |
||||
<zipfileset dir="dist/javadoc/"/> |
||||
</zip> |
||||
<copy file="dist/jMonkeyEngine3-javadoc.zip" toDir="${jmp_dir}/jme3-project-baselibs/release/libs/" overwrite="true" failonerror="true" verbose="true"/> |
||||
|
||||
<!--sources--> |
||||
<zip destfile="dist/jMonkeyEngine3-sources.zip"> |
||||
<zipfileset dir="${src.core.dir}"/> |
||||
<zipfileset dir="${src.core-data.dir}"/> |
||||
<zipfileset dir="${src.core-plugins.dir}"/> |
||||
<zipfileset dir="${src.desktop.dir}"/> |
||||
<zipfileset dir="${src.desktop-fx.dir}"/> |
||||
<zipfileset dir="${src.games.dir}"/> |
||||
<zipfileset dir="${src.jbullet.dir}"/> |
||||
<zipfileset dir="${src.niftygui.dir}"/> |
||||
<zipfileset dir="${src.jogg.dir}"/> |
||||
<zipfileset dir="${src.lwjgl-oal.dir}"/> |
||||
<zipfileset dir="${src.lwjgl-ogl.dir}"/> |
||||
<zipfileset dir="${src.ogre.dir}"/> |
||||
<zipfileset dir="${src.pack.dir}"/> |
||||
<zipfileset dir="${src.jheora.dir}"/> |
||||
<zipfileset dir="${src.test.dir}"/> |
||||
<zipfileset dir="${src.tools.dir}"/> |
||||
<zipfileset dir="${src.xml.dir}"/> |
||||
<zipfileset dir="${src.terrain.dir}"/> |
||||
<zipfileset dir="${src.networking.dir}"/> |
||||
</zip> |
||||
<copy file="dist/jMonkeyEngine3-sources.zip" toDir="${jmp_dir}/jme3-project-baselibs/release/libs/" overwrite="true" failonerror="true" verbose="true"/> |
||||
|
||||
<!--examples--> |
||||
<copy todir="${jmp_dir}/JME3TestsTemplate/src/" overwrite="true" failonerror="true" verbose="true"> |
||||
<fileset dir="src/test/"> |
||||
<exclude name=".svn"/> |
||||
</fileset> |
||||
</copy> |
||||
</target> |
||||
|
||||
<!--creates properties files containing svn info for the jme3 folders in jMP--> |
||||
<target name="-create-jme3-svn-properties"> |
||||
<mkdir dir="${jmp_dir}/build"/> |
||||
<!--update jme3 svn revision--> |
||||
<exec executable="svn" dir="."> |
||||
<arg value="update" /> |
||||
</exec> |
||||
<!--jme3 svn properties--> |
||||
<exec executable="svn" dir="." output="${jmp_dir}/build/jme3-svn.properties"> |
||||
<arg value="info" /> |
||||
</exec> |
||||
<replace file="${jmp_dir}/build/jme3-svn.properties" token=" " value=""/> |
||||
<!--jme3 test data svn properties--> |
||||
<exec executable="svn" dir="src/test-data/" output="${jmp_dir}/build/jme3-testdata-svn.properties"> |
||||
<arg value="info" /> |
||||
</exec> |
||||
<replace file="${jmp_dir}/build/jme3-testdata-svn.properties" token=" " value=""/> |
||||
<!--jme3 libraries svn properties--> |
||||
<exec executable="svn" dir="lib/" output="${jmp_dir}/build/jme3-lib-svn.properties"> |
||||
<arg value="info" /> |
||||
</exec> |
||||
<replace file="${jmp_dir}/build/jme3-lib-svn.properties" token=" " value=""/> |
||||
<!--jme3 tests svn properties--> |
||||
<exec executable="svn" dir="src/test/" output="${jmp_dir}/build/jme3-tests-svn.properties"> |
||||
<arg value="info" /> |
||||
</exec> |
||||
<replace file="${jmp_dir}/build/jme3-tests-svn.properties" token=" " value=""/> |
||||
</target> |
||||
|
||||
<!-- upload jme3 zip to jmonkeyengine.com/nightly --> |
||||
<target name="deploy" depends="dist"> |
||||
<scp todir="${sshpath}:/var/www/nightly" verbose="yes" trust="yes"> |
||||
<fileset dir="."> |
||||
<include name="${jme3zip}"/> |
||||
</fileset> |
||||
</scp> |
||||
</target> |
||||
|
||||
<!-- upload jme3 zip to jmonkeyengine.com/nightly --> |
||||
<target name="deploy-hudson" depends="dist"> |
||||
<copy |
||||
file="${jme3zip}" |
||||
toDir="/var/www/nightly" overwrite="true" failonerror="true" verbose="true" |
||||
/> |
||||
<copydir |
||||
src="dist/javadoc/" dest="/var/wwworg/javadoc/" forceoverwrite="true" |
||||
/> |
||||
</target> |
||||
|
||||
</project> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,23 @@ |
||||
/* Jheora |
||||
* Copyright (C) 2004 Fluendo S.L. |
||||
* |
||||
* Written by: 2004 Wim Taymans <wim@fluendo.com> |
||||
* |
||||
* Many thanks to |
||||
* The Xiph.Org Foundation http://www.xiph.org/ |
||||
* Jheora was based on their Theora reference decoder. |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU Library General Public License |
||||
* as published by the Free Software Foundation; either version 2 of |
||||
* the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU Library General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU Library General Public |
||||
* License along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||||
*/ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,101 @@ |
||||
Changes between JOGL 1.1.0 and 1.1.1: |
||||
|
||||
- Fixed a bug in the checking of incoming buffers' sizes to |
||||
glTexImage1D, glTexImage2D, and glTexImage3D. |
||||
|
||||
Changes between JOGL 1.0.0 and 1.1.0: |
||||
|
||||
- The glext.h and associated header files JOGL uses have been updated |
||||
to OpenGL 2.1 with NVidia's GeForce 8 series extensions. The new |
||||
functions are available as methods in the GL interface. |
||||
|
||||
- The developer build bundles have been changed to zip archives, so |
||||
instead of having to download multiple jars, you can now just |
||||
download the zip archive for your particular platform. The new zip |
||||
archives are versioned with the build date. |
||||
|
||||
- The source distribution now contains the generated sources like |
||||
GL.java, GLU.java, etc. for more convenient use in IDEs. |
||||
|
||||
- The chosen GLCapabilities are now exposed from the GLDrawable via |
||||
GLDrawable.getChosenGLCapabilities(); this functionality works on |
||||
all platforms even in cases where the GLCapabilitiesChooser is not |
||||
supported, and attempts to provide correct answers so programs can |
||||
make decisions based on the results. |
||||
|
||||
- The native code for the "DRI hack" (to support the open-source DRI |
||||
drivers on Linux and other X11 platforms) has been removed; JOGL |
||||
now uses the GlueGen NativeLibrary class for this purpose. |
||||
Reliability improvements have been made to the implementation of |
||||
this class; it has been confirmed as working again with ATI's |
||||
proprietary drivers on Linux and should also work better with |
||||
NVidia's drivers. |
||||
|
||||
- The GlueGen runtime classes have been removed from jogl.jar. These |
||||
have been factored out into gluegen-rt.jar and are referenced by |
||||
both the JOGL and JOAL projects. |
||||
|
||||
- Thanks to John Burkey some optimizations have been made to the |
||||
buffer object-related validity checks in glVertexPointer, etc. as |
||||
well as a buffer size query that was being made in the glMapBuffer |
||||
implementation. This improves performance for applications |
||||
performing a lot of VBO- or vertex array-based rendering, in |
||||
particular with the multithreaded OpenGL implementation on Mac OS |
||||
X. |
||||
|
||||
- The JOGL applet launcher now supports deployment of applets which |
||||
use both OpenGL for 3D graphics via JOGL as well as OpenAL for |
||||
spatialized audio via JOAL. It now prompts the user on Windows |
||||
platforms to allow it to enable the -Dsun.java2d.noddraw=true |
||||
system property for best robustness. It has been updated for the |
||||
changes in the GlueGen runtime classes and native library |
||||
structure. Some bugs have been fixed, some of which were preventing |
||||
different JOGL-based applets from being deployed from the same |
||||
codebase. The documentation and on-line examples have been updated |
||||
as well. |
||||
|
||||
- The TextureIO implementation has been changed to no longer copy the |
||||
data associated with BufferedImage TextureData objects. Instead, |
||||
the necessary vertical flip is now implemented by flipping the |
||||
texture coordinates vertically. |
||||
|
||||
- An API for updating a sub-image of a Texture object from a |
||||
sub-portion of a TextureData object has been added. |
||||
|
||||
- A GLContext.copy() operation has been added based on community |
||||
feedback. |
||||
|
||||
- Three helper classes have been added to the com.sun.opengl.util.j2d |
||||
package to improve interoperability between JOGL and Java 2D: |
||||
TextureRenderer, Overlay and TextRenderer. The TextureRenderer |
||||
supports drawing into an OpenGL texture using Java 2D. The Overlay |
||||
class provides a convenient Java 2D-based overlay on top of an |
||||
arbitrary GLDrawable. The TextRenderer class supports drawing of |
||||
Java 2D text into an OpenGL context. Thanks to Chris Campbell of |
||||
the Java 2D team for collaboration and to the JOGL community for |
||||
extensive feedback and testing assistance. |
||||
|
||||
- Various bug fixes and robustness improvements were made to the |
||||
GlueGen runtime, JOGL and GLU implementations. |
||||
|
||||
- Fixes to the DDSImage class were contributed by the community: a |
||||
bug fix to mipmap handling and support for cubemap textures. Thanks |
||||
to java.net user bandures. |
||||
|
||||
- TextureIO.setTexRectEnabled() and isTexRectEnabled() were added |
||||
based on feedback from Chris Campbell, in order to simplify the |
||||
writing of pixel shaders which have different samplers for |
||||
GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE_ARB targets. |
||||
|
||||
- Thanks to Erik Tollerud, the links to the OpenGL documentation in |
||||
the JOGL javadoc were revised to point to the new on-line man pages |
||||
in the OpenGL SDK. |
||||
|
||||
- Support for automatic mipmap generation via GL_GENERATE_MIPMAP was |
||||
added to the TextureIO, TextureRenderer and TextRenderer classes. |
||||
|
||||
- Windows/AMD64 binaries, including the JOGL Cg binding, are now |
||||
supplied. |
||||
|
||||
- Worked around breakage of JOGL with 5.0u10; see Sun bug IDs 6504460 |
||||
and 6333613. |
@ -0,0 +1,31 @@ |
||||
|
||||
Copyright 2007 Sun Microsystems, Inc., 4150 Network |
||||
Circle, Santa Clara, California 95054, U.S.A. All rights |
||||
reserved. |
||||
|
||||
U.S. Government Rights - Commercial software. Government |
||||
users are subject to the Sun Microsystems, Inc. |
||||
standard license agreement and applicable provisions of |
||||
the FAR and its supplements. |
||||
|
||||
Use is subject to license terms. |
||||
|
||||
This distribution may include materials developed by third |
||||
parties. |
||||
|
||||
Sun, Sun Microsystems, the Sun logo and Java are trademarks |
||||
or registered trademarks of Sun Microsystems, Inc. in the |
||||
U.S. and other countries. |
||||
|
||||
OpenGL is a registered trademark of Silicon Graphics, Inc. |
||||
|
||||
This product is covered and controlled by U.S. Export |
||||
Control laws and may be subject to the export or import |
||||
laws in other countries. Nuclear, missile, chemical |
||||
biological weapons or nuclear maritime end uses or end |
||||
users, whether direct or indirect, are strictly prohibited. |
||||
Export or reexport to countries subject to U.S. embargo or |
||||
to entities identified on U.S. export exclusion lists, |
||||
including, but not limited to, the denied persons and |
||||
specially designated nationals lists is strictly prohibited. |
||||
|
@ -0,0 +1,152 @@ |
||||
JOGL is released under the BSD license. The full license terms follow: |
||||
|
||||
Copyright (c) 2003-2007 Sun Microsystems, Inc. All Rights Reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions are |
||||
met: |
||||
|
||||
- Redistribution of source code must retain the above copyright |
||||
notice, this list of conditions and the following disclaimer. |
||||
|
||||
- Redistribution in binary form must reproduce the above copyright |
||||
notice, this list of conditions and the following disclaimer in the |
||||
documentation and/or other materials provided with the distribution. |
||||
|
||||
Neither the name of Sun Microsystems, Inc. or the names of |
||||
contributors may be used to endorse or promote products derived from |
||||
this software without specific prior written permission. |
||||
|
||||
This software is provided "AS IS," without a warranty of any kind. ALL |
||||
EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, |
||||
INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A |
||||
PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN |
||||
MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR |
||||
ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR |
||||
DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR |
||||
ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR |
||||
DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE |
||||
DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, |
||||
ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF |
||||
SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
||||
|
||||
You acknowledge that this software is not designed or intended for use |
||||
in the design, construction, operation or maintenance of any nuclear |
||||
facility. |
||||
|
||||
The JOGL source tree contains code ported from the OpenGL sample |
||||
implementation by Silicon Graphics, Inc. This code is licensed under |
||||
the SGI Free Software License B (Sun is redistributing the modified code |
||||
under a slightly modified, alternative license, which is described two |
||||
paragraphs below after "NOTE:"): |
||||
|
||||
License Applicability. Except to the extent portions of this file are |
||||
made subject to an alternative license as permitted in the SGI Free |
||||
Software License B, Version 1.1 (the "License"), the contents of this |
||||
file are subject only to the provisions of the License. You may not use |
||||
this file except in compliance with the License. You may obtain a copy |
||||
of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 |
||||
Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: |
||||
|
||||
http://oss.sgi.com/projects/FreeB |
||||
|
||||
Note that, as provided in the License, the Software is distributed on an |
||||
"AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS |
||||
DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND |
||||
CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A |
||||
PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
||||
|
||||
NOTE: The Original Code (as defined below) has been licensed to Sun |
||||
Microsystems, Inc. ("Sun") under the SGI Free Software License B |
||||
(Version 1.1), shown above ("SGI License"). Pursuant to Section |
||||
3.2(3) of the SGI License, Sun is distributing the Covered Code to |
||||
you under an alternative license ("Alternative License"). This |
||||
Alternative License includes all of the provisions of the SGI License |
||||
except that Section 2.2 and 11 are omitted. Any differences between |
||||
the Alternative License and the SGI License are offered solely by Sun |
||||
and not by SGI. |
||||
|
||||
Original Code. The Original Code is: OpenGL Sample Implementation, |
||||
Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, |
||||
Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. |
||||
Copyright in any portions created by third parties is as indicated |
||||
elsewhere herein. All Rights Reserved. |
||||
|
||||
Additional Notice Provisions: The application programming interfaces |
||||
established by SGI in conjunction with the Original Code are The |
||||
OpenGL(R) Graphics System: A Specification (Version 1.2.1), released |
||||
April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version |
||||
1.3), released November 4, 1998; and OpenGL(R) Graphics with the X |
||||
Window System(R) (Version 1.3), released October 19, 1998. This software |
||||
was created using the OpenGL(R) version 1.2.1 Sample Implementation |
||||
published by SGI, but has not been independently verified as being |
||||
compliant with the OpenGL(R) version 1.2.1 Specification. |
||||
|
||||
|
||||
The JOGL source tree contains code from the LWJGL project which is |
||||
similarly covered by the BSD license: |
||||
|
||||
Copyright (c) 2002-2004 LWJGL Project |
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions are |
||||
met: |
||||
|
||||
* Redistributions of source code must retain the above copyright |
||||
notice, this list of conditions and the following disclaimer. |
||||
|
||||
* Redistributions in binary form must reproduce the above copyright |
||||
notice, this list of conditions and the following disclaimer in the |
||||
documentation and/or other materials provided with the distribution. |
||||
|
||||
* Neither the name of 'LWJGL' nor the names of |
||||
its contributors may be used to endorse or promote products derived |
||||
from this software without specific prior written permission. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
The JOGL source tree also contains a Java port of Brian Paul's Tile |
||||
Rendering library, used with permission of the author under the BSD |
||||
license instead of the original LGPL: |
||||
|
||||
Copyright (c) 1997-2005 Brian Paul. All Rights Reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions are |
||||
met: |
||||
|
||||
- Redistribution of source code must retain the above copyright |
||||
notice, this list of conditions and the following disclaimer. |
||||
|
||||
- Redistribution in binary form must reproduce the above copyright |
||||
notice, this list of conditions and the following disclaimer in the |
||||
documentation and/or other materials provided with the distribution. |
||||
|
||||
Neither the name of Brian Paul or the names of contributors may be |
||||
used to endorse or promote products derived from this software |
||||
without specific prior written permission. |
||||
|
||||
This software is provided "AS IS," without a warranty of any |
||||
kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND |
||||
WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY |
||||
EXCLUDED. THE COPYRIGHT HOLDERS AND CONTRIBUTORS SHALL NOT BE |
||||
LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, |
||||
MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO |
||||
EVENT WILL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY |
||||
LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, |
||||
CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND |
||||
REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR |
||||
INABILITY TO USE THIS SOFTWARE, EVEN IF THE COPYRIGHT HOLDERS OR |
||||
CONTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
@ -0,0 +1,45 @@ |
||||
|
||||
Java (TM) Binding for the OpenGL (r) API, version 1.1.1 |
||||
------------------------------------------------------- |
||||
|
||||
This software is licensed by Sun Microsystems, as specified |
||||
in the LICENSE-JOGL-1.1.1.txt file. You must use this software |
||||
in accordance with the terms under which the code is licensed. |
||||
|
||||
|
||||
|
||||
Instructions for unzipping Java Binding for the OpenGL API, version 1.1.1 |
||||
-------------------------------------------------------------------- |
||||
|
||||
After downloading and unzipping the zip file containing the |
||||
JOGL release for your target platform, you will see the |
||||
following files in the top directory: |
||||
|
||||
COPYRIGHT.txt |
||||
LICENSE-JOGL-1.1.1.txt |
||||
Userguide.html |
||||
README.txt README file (you are reading it now) |
||||
|
||||
and the following subdirectory: |
||||
|
||||
lib contains JOGL implementation |
||||
|
||||
All of the JOGL implementation files (jar files and native |
||||
libraries) are in the lib subdirectory. For instructions on |
||||
how to use these implementation files to build or run a JOGL |
||||
program see the enclosed JOGL user guide (Userguide.html). |
||||
|
||||
|
||||
|
||||
Project source code and getting assistance |
||||
------------------------------------------ |
||||
|
||||
JOGL source code and project information can be found at: |
||||
|
||||
https://jogl.dev.java.net/ |
||||
|
||||
|
||||
Numerous answers to common questions can be found on the JOGL |
||||
forum: |
||||
|
||||
http://www.javagaming.org/forums/index.php?board=25.0 |
@ -0,0 +1,999 @@ |
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
||||
<HTML> |
||||
<HEAD> |
||||
<TITLE>Jogl - User's Guide</TITLE> |
||||
</HEAD> |
||||
<BODY> |
||||
|
||||
<H1>Jogl - User's Guide</H1> |
||||
|
||||
<P> |
||||
|
||||
<UL> |
||||
|
||||
<LI> Overview |
||||
<LI> Developing with JOGL |
||||
<UL> |
||||
<LI> Building the source tree |
||||
<LI> Local installation for development |
||||
<LI> Java Web Start integration |
||||
<LI> Applet support |
||||
</UL> |
||||
<LI> GLDrawable and GLContext |
||||
<LI> Creating a GLAutoDrawable |
||||
<LI> Writing a GLEventListener |
||||
<LI> Using the Composable Pipeline |
||||
<LI> Heavyweight and Lightweight Issues |
||||
<LI> Multithreading Issues |
||||
<LI> Pbuffers |
||||
<LI> GLU |
||||
<LI> More Resources |
||||
<LI> Platform notes |
||||
<UL> |
||||
<LI> All Platforms |
||||
<LI> Windows |
||||
<LI> Linux |
||||
<LI> Solaris, Linux (X11 platforms) |
||||
<LI> Macintosh OS X |
||||
</UL> |
||||
<LI> Version History |
||||
|
||||
</UL> |
||||
|
||||
<H2> Overview </H2> |
||||
|
||||
<P> |
||||
|
||||
Jogl is a Java programming language binding for the OpenGL 3D graphics |
||||
API. It supports integration with the Java platform's AWT and Swing |
||||
widget sets while providing a minimal and easy-to-use API that handles |
||||
many of the issues associated with building multithreaded OpenGL |
||||
applications. Jogl provides access to the latest OpenGL routines |
||||
(OpenGL 2.0 with vendor extensions) as well as platform-independent |
||||
access to hardware-accelerated offscreen rendering ("pbuffers"). Jogl |
||||
also provides some of the most popular features introduced by other |
||||
Java bindings for OpenGL like GL4Java, LWJGL and Magician, including a |
||||
composable pipeline model which can provide faster debugging for |
||||
Java-based OpenGL applications than the analogous C program. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Jogl was designed for the most recent versions of the Java platform |
||||
and for this reason supports only J2SE 1.4 and later. It also only |
||||
supports truecolor (15 bits per pixel and higher) rendering; it does |
||||
not support color-indexed modes. It was designed with New I/O (NIO) in |
||||
mind and uses NIO internally in the implementation. The Jogl binding |
||||
is itself written almost completely in the Java programming language. |
||||
There are roughly 150 lines of handwritten C code in the entire Jogl |
||||
source base (100 of which work around bugs in older OpenGL drivers on |
||||
Windows); the rest of the native code is autogenerated during the |
||||
build process by a new tool called <a |
||||
href="http://gluegen.dev.java.net/">GlueGen</a>, the source code of |
||||
which is available from its own java.net project. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
The JOGL source tree in its current form is an experimental workspace |
||||
for the <a href="http://jcp.org/en/jsr/detail?id=231">JSR-231</a> Java |
||||
Bindings for OpenGL JSR. JOGL is not the official reference |
||||
implementation, but an evolving workspace. Snapshots of the JOGL |
||||
source tree are run through the JSR-231 Technology Compatibility Kit |
||||
(TCK) to become the official reference implementation (RI). As of this |
||||
writing the JSR has not been finalized, so the first official RI of |
||||
the JSR has not yet been produced. |
||||
|
||||
</P> |
||||
|
||||
<H2> Developing with JOGL </H2> |
||||
|
||||
<H3> Building the source tree </H3> |
||||
|
||||
<P> |
||||
|
||||
Most developers using JOGL will download the most current <a |
||||
href="https://jogl.dev.java.net/servlets/ProjectDocumentList">release |
||||
build</a>. Separate instructions are available on how to <a |
||||
href="https://jogl.dev.java.net/unbranded-source/browse/*checkout*/jogl/doc/HowToBuild.html?rev=HEAD&content-type=text/html">build |
||||
the source tree</a>. |
||||
|
||||
</P> |
||||
|
||||
<H3> Local installation for development </H3> |
||||
|
||||
<P> |
||||
|
||||
The JOGL distribution for developers comes in the form of a zip |
||||
archive which contains the Java classes to call OpenGL from Java, as |
||||
well as the associated JNI native libraries. JOGL depends on some |
||||
run-time support classes and native code provided by the GlueGen |
||||
project; these classes and native code are also provided in the zip |
||||
bundles. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
If you are developing a new application which uses JOGL, download the |
||||
zip archive for your platform (for example., |
||||
jogl-[version]-windows-i586.zip) and unzip it. Modify your CLASSPATH |
||||
environment variable to include the full paths to jogl.jar and |
||||
gluegen-rt.jar; for example, |
||||
".;C:\Some\Other\Package\foo.jar;C:\Users\myhome\jogl-[version]-windows-i586\lib\jogl.jar;C:\Users\myhome\jogl-[version]-windows-i586\lib\gluegen-rt.jar". |
||||
(If you did not previously set the CLASSPATH environment variable, you |
||||
may want to make sure that ".", the current directory, is on your new |
||||
CLASSPATH.) Modify your PATH environment variable (Windows), |
||||
LD_LIBRARY_PATH environment variable (Solaris and Linux), or |
||||
DYLD_LIBRARY_PATH environment variable (Mac OS X) to contain the full |
||||
path to the "lib" directory; for example, on Windows, add |
||||
"C:\Users\myhome\jogl-[version]-windows-i586\lib" to your PATH using |
||||
the System control panel, Advanced tab, Environment Variables |
||||
button. At this point your Java installation should be able to see the |
||||
JOGL class files. Users of IDEs such as NetBeans and Eclipse should |
||||
consult the IDE's documentation to see how to add jar files and native |
||||
libraries to their current project. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Dropping the JOGL jar and native library into the extension directory |
||||
of the JRE is <b>strongly discouraged</b>. Doing so can cause |
||||
conflicts with third-party applications launched via Java Web Start, |
||||
and causes confusion later when upgrading the distribution. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
If you are on the Linux platform, please see the Linux-specific |
||||
platform notes, below, with information on incompatibility between the |
||||
JPackage Java RPMs and JOGL. |
||||
|
||||
</P> |
||||
|
||||
<H3> Java Web Start integration </H3> |
||||
|
||||
<P> |
||||
|
||||
The recommended distribution vehicle for applications using JOGL is |
||||
Java Web Start. JOGL-based applications do not even need to be signed; |
||||
all that is necessary is to reference the JOGL extension JNLP file. |
||||
Because the JOGL jar files are signed, an unsigned application can |
||||
reference the signed JOGL library and continue to run inside the |
||||
sandbox. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
To reference JOGL within your application's JNLP file, simply place |
||||
the following line in the <code><resources></code> section: |
||||
|
||||
<PRE> |
||||
<extension name="jogl" href="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp" /> |
||||
</PRE> |
||||
|
||||
This JNLP file points to the current JSR-231 unofficial development |
||||
build. For reference, the extension JNLP file for the most recent |
||||
official JSR-231 build is available at |
||||
|
||||
<PRE> |
||||
<extension name="jogl" href="http://download.java.net/media/jogl/builds/archive/jsr-231-1.1.0/webstart/jogl.jnlp" /> |
||||
</PRE> |
||||
|
||||
Note that before JOGL transitioned to the JSR-231 APIs, there were |
||||
releases of the library in the <code>net.java.games.jogl</code> |
||||
namespace under version numbers "1.0", "1.1", and "1.1.1". All of |
||||
these releases have been superseded by JSR-231. Please update your |
||||
applications. |
||||
|
||||
</P> |
||||
|
||||
<H3> Applet support </H3> |
||||
|
||||
<P> |
||||
|
||||
Lilian Chamontin, in conjunction with several other members of the |
||||
JOGL community, has contributed a JOGL applet installer. This |
||||
installer uses some clever tricks to allow deployment of unsigned |
||||
applets which use JOGL into existing web browsers and JREs as far back |
||||
as 1.4.2, which is the earliest version of Java supported by JOGL. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
The JOGLAppletInstaller is distributed inside jogl.jar as a utility |
||||
class in com.sun.opengl.util. It requires that the developer host a |
||||
local, signed copy of jogl.jar and all of the jogl-natives jars; the |
||||
certificates must be the same on all of these jars. Note that in the |
||||
release builds of JOGL all of these jars are signed by Sun |
||||
Microsystems, so the developer can deploy applets without needing any |
||||
certificates. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
The JOGLAppletInstaller javadoc describes the basic steps for |
||||
deployment of an applet utilizing JOGL. Please refer to this |
||||
documentation for more information. A live example of deploying an |
||||
unsigned JOGL applet will be added to this documentation shortly once |
||||
the first signed build of the JOGLAppletInstaller has been shipped. |
||||
|
||||
</P> |
||||
|
||||
<H2> GLDrawable and GLContext </H2> |
||||
|
||||
<P> |
||||
|
||||
The JSR-231 APIs specify interfaces two low-level OpenGL abstractions: |
||||
drawables and contexts. An OpenGL drawable is effectively a surface |
||||
upon which OpenGL rendering will be performed. In order to perform |
||||
rendering, an OpenGL rendering context is needed. Contexts and |
||||
drawables typically go hand-in-hand. More than one context may be |
||||
created for a particular drawable. In the JSR-231 abstractions, a |
||||
context is always associated with exactly one drawable. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Most end users will not need to use these abstractions directly. |
||||
However, when sharing textures, display lists and other OpenGL objects |
||||
between widgets, the concrete identifier for the "namespace" for these |
||||
objects is the GLContext. |
||||
|
||||
</P> |
||||
|
||||
<H2> Creating a GLAutoDrawable </H2> |
||||
|
||||
<P> |
||||
|
||||
Jogl provides two basic widgets into which OpenGL rendering can be |
||||
performed. The GLCanvas is a heavyweight AWT widget which supports |
||||
hardware acceleration and which is intended to be the primary widget |
||||
used by applications. The GLJPanel is a fully Swing-compatible |
||||
lightweight widget which supports hardware acceleration but which is |
||||
not as fast as the GLCanvas because it typically reads back the frame |
||||
buffer in order to draw it using Java2D. The GLJPanel is intended to |
||||
provide 100% correct Swing integration in the circumstances where a |
||||
GLCanvas can not be used. See <a href = |
||||
"http://java.sun.com/products/jfc/tsc/articles/mixing/">this |
||||
article</a> on <a href = "http://java.sun.com/products/jfc/tsc/">The |
||||
Swing Connection</a> for more information about mixing lightweight and |
||||
heavyweight widgets. See also the section on "Heavyweight and |
||||
Lightweight Issues" below. Recent work in the Mustang release of the |
||||
JDK has sped up the GLJPanel significantly when the Java2D OpenGL |
||||
pipeline is enabled; see <a |
||||
href="http://www.javagaming.org/forums/index.php?topic=10813.0">this |
||||
forum discussion</a> for more details. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Both the GLCanvas and GLJPanel implement a common interface called |
||||
GLAutoDrawable so applications can switch between them with minimal |
||||
code changes. The GLAutoDrawable interface provides |
||||
|
||||
<UL> |
||||
|
||||
<LI> access to the GL object for calling OpenGL routines |
||||
|
||||
<LI> a callback mechanism (GLEventListener) for performing OpenGL |
||||
rendering |
||||
|
||||
<LI> a <CODE>display()</CODE> method for forcing OpenGL rendering to |
||||
be performed synchronously |
||||
|
||||
<LI> AWT- and Swing-independent abstractions for getting and setting |
||||
the size of the widget and adding and removing event listeners |
||||
|
||||
</UL> |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
When creating GLCanvas and GLJPanel instances, the user may request a |
||||
certain set of OpenGL parameters in the form of a GLCapabilities |
||||
object, customize the format selection algorithm by specifying a |
||||
GLCapabilitiesChooser, share textures and display lists with other |
||||
GLDrawables, and specify the display device on which the |
||||
GLAutoDrawable will be created (GLCanvas only). |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
A GLCapabilities object specifies the OpenGL parameters for a |
||||
newly-created widget, such as the color, alpha,, z-buffer and |
||||
accumulation buffer bit depths and whether the widget is |
||||
double-buffered. The default capabilities are loosely specified but |
||||
provide for truecolor RGB, a reasonably large depth buffer, |
||||
double-buffered, with no alpha, stencil, or accumulation buffers. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
An application can override the default pixel format selection |
||||
algorithm by providing a GLCapabilitiesChooser to the GLCanvas or |
||||
GLJPanel constructor. (Not all platforms support the |
||||
GLCapabilitiesChooser mechanism, however; it may be ignored, in |
||||
particular on Mac OS X where pixel format selection is very different |
||||
than on other platforms.) The chooseCapabilities method will be called |
||||
with all of the available pixel formats as an array of GLCapabilities |
||||
objects, as well as the index indicating the window system's |
||||
recommended choice; it should return an integer index into this |
||||
array. The DefaultGLCapabilitiesChooser uses the window system's |
||||
recommendation when it is available, and otherwise attempts to use a |
||||
platform-independent selection algorithm. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
The GLJPanel can be made non-opaque according to Swing's rendering |
||||
model, so it can act as an overlay to other Swing or Java2D drawing. |
||||
In order to enable this, set up your GLCapabilities object with a |
||||
non-zero alpha depth (a common value is 8 bits) and call |
||||
setOpaque(false) on the GLJPanel once it has been created. Java2D |
||||
rendering underneath it will then show through areas where OpenGL has |
||||
produced an alpha value less than 1.0. See the JGears and JRefract |
||||
demos for examples of how to use this functionality. |
||||
|
||||
</P> |
||||
|
||||
<H2> Writing a GLEventListener </H2> |
||||
|
||||
<P> |
||||
|
||||
Applications implement the GLEventListener interface to perform OpenGL |
||||
drawing via callbacks. When the methods of the GLEventListener are |
||||
called, the underlying OpenGL context associated with the drawable is |
||||
already current. The listener fetches the GL object out of the |
||||
GLAutoDrawable and begins to perform rendering. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
The <CODE>init()</CODE> method is called when a new OpenGL context is |
||||
created for the given GLAutoDrawable. Any display lists or textures |
||||
used during the application's normal rendering loop can be safely |
||||
initialized in <CODE>init()</CODE>. It is important to note that |
||||
because the underlying AWT window may be destroyed and recreated while |
||||
using the same GLCanvas and GLEventListener, the GLEventListener's |
||||
<CODE>init()</CODE> method may be called more than once during the |
||||
lifetime of the application. The init() method should therefore be |
||||
kept as short as possible and only contain the OpenGL initialization |
||||
required for the <CODE>display()</CODE> method to run properly. It is |
||||
the responsibility of the application to keep track of how its various |
||||
OpenGL contexts share display lists, textures and other OpenGL objects |
||||
so they can be either be reinitialized or so that reinitialization can |
||||
be skipped when the <CODE>init()</CODE> callback is called. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Note also that the GLEventListener should be added to the |
||||
GLAutoDrawable before the GLAutoDrawable is shown or rendered to for |
||||
the first time. If this is not done, it is possible that the init() |
||||
method will not be called on the GLEventListener. JOGL does not |
||||
maintain internal state to keep track of whether init() has been |
||||
called on a particular GLEventListener since the last time an OpenGL |
||||
context was created for that GLAutoDrawable. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
The <CODE>display()</CODE> method is called to perform per-frame |
||||
rendering. The <CODE>reshape()</CODE> method is called when the |
||||
drawable has been resized; the default implementation automatically |
||||
resizes the OpenGL viewport so often it is not necessary to do any |
||||
work in this method. The <CODE>displayChanged()</CODE> method is |
||||
designed to allow applications to support on-the-fly screen mode |
||||
switching, but support for this is not yet implemented so the body of |
||||
this method should remain empty. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
It is strongly recommended that applications always refetch the GL |
||||
object out of the GLAutoDrawable upon each call to the |
||||
<CODE>init()</CODE>, <CODE>display()</CODE> and <CODE>reshape()</CODE> |
||||
methods and pass the GL object down on the stack to any drawing |
||||
routines, as opposed to storing the GL in a field and referencing it |
||||
from there. The reason is that multithreading issues inherent to the |
||||
AWT toolkit make it difficult to reason about which threads certain |
||||
operations are occurring on, and if the GL object is stored in a field |
||||
it is unfortunately too easy to accidentally make OpenGL calls from a |
||||
thread that does not have a current context. This will usually cause |
||||
the application to crash. For more information please see the section |
||||
on multithreading. |
||||
|
||||
</P> |
||||
|
||||
<H2> Using the Composable Pipeline </H2> |
||||
|
||||
<P> |
||||
|
||||
Jogl supports the "composable pipeline" paradigm introduced by the |
||||
Magician Java binding for OpenGL. The DebugGL pipeline calls |
||||
<CODE>glGetError</CODE> after each OpenGL call, reporting any errors |
||||
found. It can greatly speed up development time because of its |
||||
fine-grained error checking as opposed to the manual error checking |
||||
usually required in OpenGL programs written in C. The TraceGL prints |
||||
logging information upon each OpenGL call and is helpful when an |
||||
application crash makes it difficult to see where the error occurred. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
To use these pipelines, call <CODE>GLAutoDrawable.setGL</CODE> at the |
||||
beginning of the <CODE>init</CODE> method in your GLEventListener. For |
||||
example, |
||||
|
||||
<PRE> |
||||
class MyListener implements GLEventListener { |
||||
public void init(GLDrawable drawable) { |
||||
drawable.setGL(new DebugGL(drawable.getGL())); |
||||
// ... |
||||
} |
||||
|
||||
// ... |
||||
} |
||||
</PRE> |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Note that the GLAutoDrawable.setGL() method simply calls setGL() on |
||||
the default OpenGL context created by the GLAutoDrawable, so |
||||
sophisticated applications creating their own OpenGL contexts can use |
||||
the composable pipeline with these contexts by setting the GL object |
||||
in the context object itself. The composable pipeline needs to be |
||||
re-installed every time GLContext.makeCurrent() returns |
||||
CONTEXT_CURRENT_NEW. |
||||
|
||||
</P> |
||||
|
||||
<H2> Heavyweight and Lightweight Issues </H2> |
||||
|
||||
<P> |
||||
|
||||
As mentioned above, JOGL supplies both a heavyweight (GLCanvas) and a |
||||
lightweight (GLJPanel) widget to be able to provide the fastest |
||||
possible performance for applications which need it as well as 100% |
||||
correct Swing integration, again for applications which need it. The |
||||
GLCanvas usually provides higher performance than the GLJPanel, though |
||||
in recent releases the GLJPanel's speed has been improved when the |
||||
Java2D/OpenGL pipeline is active as described in <a |
||||
href="http://www.javagaming.org/forums/index.php?topic=10813.0">this |
||||
forum discussion</a>. Nonetheless, the GLCanvas can be used in almost |
||||
every kind of application except those using JInternalFrames. Please |
||||
see the Swing Connection article mentioned above for details on mixing |
||||
heavyweight and lightweight widgets. A couple of common pitfalls are |
||||
described here. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
When using JPopupMenus or Swing tool tips in conjunction with the |
||||
GLCanvas, it is necessary to disable the use of lightweight widgets |
||||
for the popups. See the methods |
||||
<CODE>ToolTipManager.setLightWeightPopupEnabled</CODE>, |
||||
<CODE>JPopupMenu.setLightWeightPopupEnabled</CODE>, and |
||||
<CODE>JPopupMenu.setDefaultLightWeightPopupEnabled</CODE>. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
There are occasionally problems with certain LayoutManagers and |
||||
component configurations where if a GLCanvas is placed in the middle |
||||
of a set of lightweight widgets then it may only grow and never |
||||
shrink. These issues are documented somewhat in <a href = |
||||
"https://jogl.dev.java.net/issues/show_bug.cgi?id=135">JOGL Issue |
||||
135</a> and most recently in the thread <a |
||||
href="http://javagaming.org/forums/index.php?topic=8699.0">"Resize |
||||
behaviour"</a> in the JOGL forum. The root cause is behavior of the |
||||
Canvas, and in particular its ComponentPeer. The implementation of |
||||
getPreferredSize() calls getMinimumSize() and getMinimumSize() turns |
||||
around and calls Component.getSize(). This effectively means that the |
||||
Canvas will report its preferred size as being as large as the |
||||
component has ever been. For some layout managers this doesn't seem to |
||||
matter, but for others like the BoxLayout it does. See the test case |
||||
attached to Issue 135 for an example. Replacing the GLCanvas with an |
||||
ordinary Canvas yields the same behavior. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
One suggestion was to override getPreferredSize() so that if a |
||||
preferred size has not been set by the user, to default to (0, |
||||
0). This works fine for some test cases but breaks all of the other |
||||
JOGL demos because they use a different LayoutManager. There appear to |
||||
be a lot of interactions between heavyweight vs. lightweight widgets |
||||
and layout managers. One experiment which was done was to override |
||||
setSize() in GLCanvas to update the preferred size. This works down |
||||
to the size specified by the user; if the window is resized any |
||||
smeller the same problem appears. If reshape() (the base routine of |
||||
setSize(), setBounds(), etc.) is changed to do the same thing, the |
||||
demo breaks in the same way it originally did. Therefore this solution |
||||
is fragile because it isn't clear which of these methods are used |
||||
internally by the AWT and for what purposes. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
There are two possible solutions, both application-specific. The best |
||||
and most portable appears to be to put the GLCanvas into a JPanel and |
||||
set the JPanel's preferred size to (0, 0). The JPanel will cause this |
||||
constraint to be enforced on its contained GLCanvas. The other |
||||
workaround is to call <CODE>setPreferredSize(new Dimension(0, |
||||
0))</CODE> on a newly-created GLCanvas; this method is new in 1.5. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Another issue that occasionally arises on Windows is flickering during |
||||
live resizing of a GLCanvas. This is caused by the AWT's repainting |
||||
the background of the Canvas and can not be overridden on a per-Canvas |
||||
basis, for example when subclassing Canvas into GLCanvas. The |
||||
repainting of the background of Canvases on Windows can be disabled by |
||||
specifying the system property |
||||
<CODE>-Dsun.awt.noerasebackground=true</CODE>. Whether to specify this |
||||
flag depends on the application and should not be done universally, |
||||
but instead on a case-by-case basis. Some more detail is in the thread |
||||
<a href="http://javagaming.org/forums/index.php?topic=8770.0">"TIP: |
||||
JOGL + Swing flicker"</a> in the JOGL forum. |
||||
|
||||
</P> |
||||
|
||||
<H2> Multithreading Issues </H2> |
||||
|
||||
<P> |
||||
|
||||
Jogl was designed to interoperate with the AWT, an inherently |
||||
multithreaded GUI toolkit. OpenGL, in contrast, was originally |
||||
designed in single-threaded C programming environments. For this |
||||
reason Jogl provides a framework in which it is possible to write |
||||
correct multithreaded OpenGL applications using the GLEventListener |
||||
paradigm. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
If an application written using Jogl interacts in any way with the |
||||
mouse or keyboard, the AWT is processing these events and the |
||||
multithreaded aspects of the program must be considered. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
OpenGL applications usually behave in one of two ways: either they |
||||
repaint only on demand, for example when mouse input comes in, or they |
||||
repaint continually, regardless of whether user input is coming in. In |
||||
the repaint-on-demand model, the application can merely call |
||||
<CODE>GLAutoDrawable.display()</CODE> manually at the end of the mouse |
||||
or keyboard listener to cause repainting to be done. Alternatively if |
||||
the application knows the concrete type of the GLDrawable it can call |
||||
repaint() to have the painting scheduled for a later time. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
In the continuous repaint model, the application typically has a main |
||||
loop which is calling <CODE>GLAutoDrawable.display()</CODE> |
||||
repeatedly, or is using the Animator class, which does this |
||||
internally. In both of these cases the OpenGL rendering will be done |
||||
on this thread rather than the internal AWT event queue thread which |
||||
dispatches mouse and keyboard events. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Both of these models (repaint-on-demand and repaint continually) still |
||||
require the user to think about which thread keyboard and mouse events |
||||
are coming in on, and which thread is performing the OpenGL rendering. |
||||
OpenGL rendering <B>may not</B> occur directly inside the mouse or |
||||
keyboard handlers, because the OpenGL context for the drawable is not |
||||
current at this point (hence the warning about storing a GL object in |
||||
a field, where it can be fetched and accidentally used by another |
||||
thread). However, a mouse or keyboard listener may invoke |
||||
<CODE>GLAutoDrawable.display()</CODE>. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
It is generally recommended that applications perform as little work |
||||
as possible inside their mouse and keyboard handlers to keep the GUI |
||||
responsive. However, since OpenGL commands can not be run from |
||||
directly within the mouse or keyboard event listener, the best |
||||
practice is to store off state when the listener is entered and |
||||
retrieve this state during the next call to |
||||
<CODE>GLEventListener.display()</CODE>. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Furthermore, it is recommended that if there are long computational |
||||
sequences in the GLEventListener's <CODE>display</CODE> method which |
||||
reference variables which may be being simultaneously modified by the |
||||
AWT thread (mouse and keyboard listeners) that copies of these |
||||
variables be made upon entry to <CODE>display</CODE> and these copies |
||||
be referenced throughout display() and the methods it calls. This will |
||||
prevent the values from changing while the OpenGL rendering is being |
||||
performed. Errors of this kind show up in many ways, including certain |
||||
kinds of flickering of the rendered image as certain pieces of objects |
||||
are rendered in one place and other pieces are rendered elsewhere in |
||||
the scene. Restructuring the display() method as described has solved |
||||
all instances of this kind of error that have been seen with Jogl to |
||||
date. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Prior to Jogl 1.1 b10, the Jogl library attempted to give applications |
||||
strict control over which thread or threads performed OpenGL |
||||
rendering. The <CODE>setRenderingThread()</CODE>, |
||||
<CODE>setNoAutoRedrawMode()</CODE> and <CODE>display()</CODE> APIs |
||||
were originally designed to allow the application to create its own |
||||
animation thread and avoid OpenGL context switching on platforms that |
||||
supported it. Unfortunately, serious stability issues caused by |
||||
multithreading bugs in either vendors' OpenGL drivers or in the Java |
||||
platform implementation have arisen on three of Jogl's major supported |
||||
platforms: Windows, Linux and Mac OS X. In order to address these |
||||
bugs, the threading model in Jogl 1.1 b10 and later has changed. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
All GLEventListener callbacks and other internal OpenGL context |
||||
management are now performed on one thread. (In the current |
||||
implementation, this thread is the AWT event queue thread, which is a |
||||
thread internal to the implementation of the AWT and which is always |
||||
present when the AWT is being used. Future versions of Jogl may change |
||||
the thread on which the OpenGL work is performed.) When the |
||||
<CODE>GLAutoDrawable.display()</CODE> method is called from user code, |
||||
it now performs the work synchronously on the AWT event queue thread, |
||||
even if the calling thread is a different thread. The |
||||
<CODE>setRenderingThread()</CODE> optimization is now a no-op. The |
||||
<CODE>setNoAutoRedrawMode()</CODE> API still works as previously |
||||
advertised, though now that all work is done on the AWT event queue |
||||
thread it no longer needs to be used in most cases. (It was previously |
||||
useful for working around certain kinds of OpenGL driver bugs.) |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Most applications will not see a change in behavior from this change |
||||
in the Jogl implementation. Applications which use thread-local |
||||
storage or complex multithreading and synchronization may see a change |
||||
in their control flow requiring code changes. While it is strongly |
||||
recommended to change such applications to work under the new |
||||
threading model, the old threading model can be used by specifying the |
||||
system property <CODE>-Djogl.1thread=auto</CODE> or |
||||
<CODE>-Djogl.1thread=false</CODE>. The "auto" setting is equivalent to |
||||
the behavior in 1.1 b09 and before, where on ATI cards the |
||||
single-threaded mode would be used. The "false' setting is equivalent |
||||
to disabling the single-threaded mode. "true" is now the default |
||||
setting. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
In the JSR-231 APIs the single-threaded behavior continues to be the |
||||
default and the <CODE>setRenderingThread()</CODE> and |
||||
<CODE>setNoAutoRedrawMode()</CODE> APIs have been removed. The public |
||||
<CODE>Threading</CODE> class still provides some control over the |
||||
internal use of threads in the library as well as external access to |
||||
these mechanisms. |
||||
|
||||
</P> |
||||
|
||||
<H2> Pbuffers </H2> |
||||
|
||||
<P> |
||||
|
||||
Jogl exposes hardware-accelerated offscreen rendering (pbuffers) with |
||||
a minimal and platform-agnostic API. Several recent demos have been |
||||
successfully ported from C/C++ to Java using Jogl's pbuffer APIs. |
||||
However, the pbuffer support in Jogl remains one of the more |
||||
experimental aspects of the package and the APIs may need to change in |
||||
the future. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
To create a pbuffer, call |
||||
<CODE>GLDrawableFactory.createGLPbuffer()</CODE>. It is wise to call |
||||
<CODE>GLDrawableFactory.canCreateGLPbuffer()</CODE> first to ensure |
||||
the graphics card has pbuffer support first. The pbuffer is created |
||||
immediately and is available for rendering as soon as |
||||
<CODE>createGLPbuffer</CODE> returns. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
A pbuffer is used in conjunction with the GLEventListener mechanism by |
||||
calling its display() method. Rendering, as always, occurs while the |
||||
pbuffer's OpenGL context is current. There are render-to-texture |
||||
options that can be specified in the GLCapabilities for the pbuffer |
||||
which can make it easier to operate upon the resulting pixels. These |
||||
APIs are however highly experimental and not yet implemented on all |
||||
platforms. |
||||
|
||||
</P> |
||||
|
||||
<H2> GLU </H2> |
||||
|
||||
<P> |
||||
|
||||
Jogl contains support for the GLU (OpenGL Utility Library) version |
||||
1.3. Jogl originally supported GLU by wrapping the C version of the |
||||
APIs, but over time, and thanks to the contributions of several |
||||
individuals, it now uses a pure-Java version of SGI's GLU library. The |
||||
pure Java port is enabled by default, and addresses stability issues |
||||
on certain Linux distributions as well as the lack of native GLU 1.3 |
||||
support on the Windows platform. In case of problems with the Java |
||||
port, the C version of the GLU library may be used by specifying the |
||||
system property <CODE>-Djogl.glu.nojava</CODE> on the command |
||||
line. All of the same functionality is exposed with both the Java and |
||||
C versions of the GLU library; currently NURBS support is the only |
||||
missing feature on both sides. If you run into problems with the Java |
||||
port of the GLU library please file a bug using the Issue Tracker on |
||||
the Jogl home page. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
To use the GLU, simply instantiate a GLU object via <CODE>new |
||||
GLU()</CODE> at the beginning of your program. The methods on the GLU |
||||
object may be called at any point when an OpenGL context is current. |
||||
Because the GLU implementation is not thread-safe, one GLU object |
||||
should be created for each GLEventListener or other entity performing |
||||
OpenGL rendering in a given thread. |
||||
|
||||
</P> |
||||
|
||||
<H2> More Resources </H2> |
||||
|
||||
<P> |
||||
|
||||
The <A HREF="http://javagaming.org/forums/index.php?board=25.0">JOGL |
||||
forum</A> on <A HREF="http://javagaming.org/">javagaming.org</A> is |
||||
the best place to ask questions about the library. Many users, as well |
||||
as the Jogl developers, read this forum frequently, and the archived |
||||
threads contain a lot of useful information (which still needs to be |
||||
distilled into documentation). |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
The <A HREF="http://jogl-demos.dev.java.net/">JOGL demos</A> provide |
||||
several examples of usage of the library. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Pepijn Van Eeckhoudt, Kevin Duling and Abdul Bezrati have done <A |
||||
HREF="http://pepijn.fab4.be/software/nehe-java-ports/">JOGL ports of |
||||
many of the the NeHe demos</A>. These are small examples of various |
||||
pieces of OpenGL functionality. See also the <A |
||||
HREF="http://nehe.gamedev.net/">NeHe web site</A>. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Pepijn also did a <A |
||||
HREF="http://www.glexcess.com/files/glexcess.jar">JOGL port</a> of |
||||
Paolo Martella's <A HREF="http://www.glexcess.com/">GLExcess</A> |
||||
demo. To see the news update about this port, go to the main GLExcess |
||||
site and scroll down. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Gregory Pierce's <A |
||||
HREF="http://javagaming.org/forums/index.php?topic=1474.0">introduction |
||||
to JOGL</a> is a useful tutorial on starting to use the JOGL library. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
For release information about the JOGL library, please see the <A |
||||
HREF="http://javagaming.org/forums/index.php?topic=1596.0">JOGL Release |
||||
Information</A> thread on the JOGL forum on javagaming.org. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Please post on the JOGL forum if you have a resource you'd like to add |
||||
to this documentation. |
||||
|
||||
</P> |
||||
|
||||
<H2> Platform Notes </H2> |
||||
|
||||
<H3> All Platforms </H3> |
||||
|
||||
<P> |
||||
|
||||
The following issues, among others, are outstanding on all platforms: |
||||
|
||||
</P> |
||||
|
||||
<UL> |
||||
|
||||
<LI> A few remaining stability issues, mostly on older graphics cards. |
||||
|
||||
<LI> JOGL now supports experimental integration and interoperability |
||||
with the Java2D/OpenGL pipeline in Java SE 6 (Mustang), enabling a |
||||
much faster GLJPanel as well as other features. Please see <a |
||||
href="http://www.javagaming.org/forums/index.php?topic=10813.0">this |
||||
forum discussion</a> for more details. |
||||
|
||||
</UL> |
||||
|
||||
<H3> Windows </H3> |
||||
|
||||
<P> |
||||
|
||||
For correct operation, it is necessary to specify the system property |
||||
<CODE>-Dsun.java2d.noddraw=true</CODE> when running JOGL applications |
||||
on Windows; this system property disables the use of DirectDraw by |
||||
Java2D. There are driver-level incompatibilities between DirectDraw |
||||
and OpenGL which manifest themselves as application crashes, poor |
||||
performance, bad flickering, and other artifacts. This poor behavior |
||||
may exhibit itself when OpenGL and DirectDraw are simply used in the |
||||
same application, not even just in the same window, so disabling |
||||
Java2D's DirectDraw pipeline and forcing it to use its GDI pipeline is |
||||
the only way to work around these issues. Java Web Start applications |
||||
may set this system property by adding the following line to the |
||||
<CODE><resources></CODE> section of the JNLP file: <PRE> |
||||
<property name="sun.java2d.noddraw" value="true"/> </PRE> |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
There is a serious memory leak in ATI's OpenGL drivers which is |
||||
exhibited on Windows XP on Mobility Radeon 9700 hardware. It's |
||||
possible it will be present on other hardware as well though it was |
||||
not reproducible at the time of this writing on desktop Radeon |
||||
hardware or older ATI mobile chips. The bug is documented in <A |
||||
HREF="https://jogl.dev.java.net/issues/show_bug.cgi?id=166">JOGL Issue |
||||
166</A> and a bug has been filed with ATI. You can confirm the |
||||
presence of the bug either with the test case in that bug report or by |
||||
simply running the Gears demo; if the process size grows over time in |
||||
the Task Manager, the memory leak is present on your hardware. For the |
||||
time being, you can work around this memory leak by specifying the |
||||
system property <CODE>-Djogl.GLContext.nofree</CODE> on the command |
||||
line when launching your JOGL applications. There is no good |
||||
general-purpose workaround for this bug which behaves well on all |
||||
hardware. |
||||
|
||||
</P> |
||||
|
||||
<H3> Linux </H3> |
||||
|
||||
<P> |
||||
|
||||
The Sun JDK "compatibility" RPMs (java-1.5.0-sun-compat, |
||||
java-1.6.0-sun-compat) provided by jpackage.org are incompatible with |
||||
JOGL. These RPMs symlink an internal JDK directory to /usr/lib, which |
||||
overrides how both NVidia and ATI currently provide their drivers to |
||||
some Linux distributions, which is through an override in |
||||
/etc/ld.so.conf (actually, in /etc/ld.so.conf.d). The implicit |
||||
presence of /usr/lib on LD_LIBRARY_PATH forces the /usr/lib/libGL.so.1 |
||||
version of OpenGL to be used, which is typically Mesa and which will |
||||
provide only software rendering. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Unfortunately the JPackage maintainers have so far been unreceptive to |
||||
changing their installation mechanism; see <a |
||||
href="https://www.zarb.org/pipermail/jpackage-discuss/2007-January/010871.html">this |
||||
mailing list posting</a>. Until this is resolved, we strongly |
||||
discourage the use of the JPackage installers for the Sun JDK. |
||||
Instead, download the JRE or JDK installers directly from Sun's |
||||
website. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
Archived forum postings illustrating this problem are <a |
||||
href="http://www.javagaming.org/forums/index.php?topic=15610.0">here</a> |
||||
and <a |
||||
href="http://www.javagaming.org/forums/index.php?topic=16105.0">here</a>. |
||||
|
||||
</P> |
||||
|
||||
<H3> Solaris, Linux (X11 platforms) </H3> |
||||
|
||||
<P> |
||||
|
||||
Support has been added to the JOGL library for allowing multiple |
||||
threads to each have an OpenGL context current simultaneously, for |
||||
example to implement multi-head CAVE-like environments. Normally a |
||||
global AWT lock is held between calls to GLContext.makeCurrent() / |
||||
release() for on-screen heavyweight contexts (for example, those |
||||
associated with a Canvas or GLCanvas). We have found this to be |
||||
necessary for stability purposes on all supported X11 platforms, even |
||||
with relatively robust drivers such as those from NVidia. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
To enable multiple GLContexts to be made current simultaneously on X11 |
||||
platforms, specify the command line argument |
||||
<CODE>-Djogl.GLContext.optimize</CODE> when starting the JVM. Note |
||||
that this may incur robustness problems, in particular when resizing |
||||
or moving windows. We have also found that ATI's proprietary drivers |
||||
do not work at all with this flag, apparently because they cause GLX |
||||
tokens to be sent to the X server for various GL calls even for direct |
||||
contexts. For this reason if the GLX vendor is ATI then this flag |
||||
currently has no effect. |
||||
|
||||
</P> |
||||
|
||||
<H3> Mac OS X </H3> |
||||
|
||||
<P> |
||||
|
||||
There are some problems with visual artifacts and stability problems |
||||
with some of the Jogl demos on Mac OS X. It appears that at least some |
||||
of these problems are due to bugs in Apple's OpenGL support. Bugs have |
||||
been filed about these problems and it is hoped they will be addressed |
||||
in the near future. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
The Mac OS X port of Jogl, in particular the GL interface and its |
||||
implementation, can be used either with the provided GLCanvas widget |
||||
or with the Cocoa NSOpenGLView. In order to use it with Cocoa the |
||||
following steps should be taken: |
||||
|
||||
<UL> |
||||
|
||||
<LI> Create an "external" OpenGL context using the |
||||
<CODE>GLDrawableFactory.createExternalGLContext()</CODE> API. The |
||||
context object must be created while a real underlying OpenGL context |
||||
is current. |
||||
|
||||
<LI> Fetch the GL instance out of the context using getGL() as usual. |
||||
Only use the GL instance when the OpenGL context from the NSOpenGLView |
||||
is current. |
||||
|
||||
</UL> |
||||
|
||||
<B>NOTE:</B> the Cocoa interoperability has not been retested |
||||
recently, though similar interoperability has been tested on other |
||||
platforms. Please report any problems found with using Jogl with an |
||||
NSOpenGLView. |
||||
|
||||
</P> |
||||
<P> |
||||
|
||||
The following issues remain with the Mac OS X port: |
||||
|
||||
<UL> |
||||
|
||||
<LI> Due to the mechanism by which the Cocoa graphics system selects |
||||
OpenGL pixel formats, the GLCapabilitiesChooser mechanism can not be |
||||
implemented on Mac OS X as on other platforms. Currently the |
||||
underlying Cocoa pixel format selection is used on an |
||||
NSOpenGLPixelFormat derived from the settings in the GLCapabilities, |
||||
and the GLCapabilitiesChooser is ignored. |
||||
|
||||
</UL> |
||||
|
||||
</P> |
||||
|
||||
<H2> Version History </H2> |
||||
|
||||
<P> |
||||
|
||||
JOGL's version history can be found online in the <a |
||||
href="http://javagaming.org/forums/index.php?topic=1596.0">"JOGL Release |
||||
Information"</a> thread in the JOGL forum. Comments about the 1.1 |
||||
release train are in the thread <a |
||||
href="http://javagaming.org/forums/index.php?topic=4217.0">"JOGL 1.1 |
||||
released"</a>. |
||||
|
||||
</BODY> |
||||
</HTML> |
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,32 @@ |
||||
/***************************************************************************** |
||||
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* - Redistribution of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* |
||||
* - Redistribution in binary form must reproduce the above copyright notice, |
||||
* this list of conditions and the following disclaimer in the documentation |
||||
* and/or other materails provided with the distribution. |
||||
* |
||||
* Neither the name Sun Microsystems, Inc. or the names of the contributors |
||||
* may be used to endorse or promote products derived from this software |
||||
* without specific prior written permission. |
||||
* |
||||
* This software is provided "AS IS," without a warranty of any kind. |
||||
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING |
||||
* ANY IMPLIED WARRANT OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR |
||||
* NON-INFRINGEMEN, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND |
||||
* ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS |
||||
* A RESULT OF USING, MODIFYING OR DESTRIBUTING THIS SOFTWARE OR ITS |
||||
* DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST |
||||
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, |
||||
* INCIDENTAL OR PUNITIVE DAMAGES. HOWEVER CAUSED AND REGARDLESS OF THE THEORY |
||||
* OF LIABILITY, ARISING OUT OF THE USE OF OUR INABILITY TO USE THIS SOFTWARE, |
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
||||
* |
||||
* You acknowledge that this software is not designed or intended for us in |
||||
* the design, construction, operation or maintenance of any nuclear facility |
||||
* |
||||
*****************************************************************************/ |
@ -0,0 +1,152 @@ |
||||
JOGL is released under the BSD license. The full license terms follow: |
||||
|
||||
Copyright (c) 2003-2009 Sun Microsystems, Inc. All Rights Reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions are |
||||
met: |
||||
|
||||
- Redistribution of source code must retain the above copyright |
||||
notice, this list of conditions and the following disclaimer. |
||||
|
||||
- Redistribution in binary form must reproduce the above copyright |
||||
notice, this list of conditions and the following disclaimer in the |
||||
documentation and/or other materials provided with the distribution. |
||||
|
||||
Neither the name of Sun Microsystems, Inc. or the names of |
||||
contributors may be used to endorse or promote products derived from |
||||
this software without specific prior written permission. |
||||
|
||||
This software is provided "AS IS," without a warranty of any kind. ALL |
||||
EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, |
||||
INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A |
||||
PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN |
||||
MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR |
||||
ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR |
||||
DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR |
||||
ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR |
||||
DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE |
||||
DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, |
||||
ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF |
||||
SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
||||
|
||||
You acknowledge that this software is not designed or intended for use |
||||
in the design, construction, operation or maintenance of any nuclear |
||||
facility. |
||||
|
||||
The JOGL source tree contains code ported from the OpenGL sample |
||||
implementation by Silicon Graphics, Inc. This code is licensed under |
||||
the SGI Free Software License B (Sun is redistributing the modified code |
||||
under a slightly modified, alternative license, which is described two |
||||
paragraphs below after "NOTE:"): |
||||
|
||||
License Applicability. Except to the extent portions of this file are |
||||
made subject to an alternative license as permitted in the SGI Free |
||||
Software License B, Version 1.1 (the "License"), the contents of this |
||||
file are subject only to the provisions of the License. You may not use |
||||
this file except in compliance with the License. You may obtain a copy |
||||
of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 |
||||
Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: |
||||
|
||||
http://oss.sgi.com/projects/FreeB |
||||
|
||||
Note that, as provided in the License, the Software is distributed on an |
||||
"AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS |
||||
DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND |
||||
CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A |
||||
PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
||||
|
||||
NOTE: The Original Code (as defined below) has been licensed to Sun |
||||
Microsystems, Inc. ("Sun") under the SGI Free Software License B |
||||
(Version 1.1), shown above ("SGI License"). Pursuant to Section |
||||
3.2(3) of the SGI License, Sun is distributing the Covered Code to |
||||
you under an alternative license ("Alternative License"). This |
||||
Alternative License includes all of the provisions of the SGI License |
||||
except that Section 2.2 and 11 are omitted. Any differences between |
||||
the Alternative License and the SGI License are offered solely by Sun |
||||
and not by SGI. |
||||
|
||||
Original Code. The Original Code is: OpenGL Sample Implementation, |
||||
Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, |
||||
Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. |
||||
Copyright in any portions created by third parties is as indicated |
||||
elsewhere herein. All Rights Reserved. |
||||
|
||||
Additional Notice Provisions: The application programming interfaces |
||||
established by SGI in conjunction with the Original Code are The |
||||
OpenGL(R) Graphics System: A Specification (Version 1.2.1), released |
||||
April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version |
||||
1.3), released November 4, 1998; and OpenGL(R) Graphics with the X |
||||
Window System(R) (Version 1.3), released October 19, 1998. This software |
||||
was created using the OpenGL(R) version 1.2.1 Sample Implementation |
||||
published by SGI, but has not been independently verified as being |
||||
compliant with the OpenGL(R) version 1.2.1 Specification. |
||||
|
||||
|
||||
The JOGL source tree contains code from the LWJGL project which is |
||||
similarly covered by the BSD license: |
||||
|
||||
Copyright (c) 2002-2004 LWJGL Project |
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions are |
||||
met: |
||||
|
||||
* Redistributions of source code must retain the above copyright |
||||
notice, this list of conditions and the following disclaimer. |
||||
|
||||
* Redistributions in binary form must reproduce the above copyright |
||||
notice, this list of conditions and the following disclaimer in the |
||||
documentation and/or other materials provided with the distribution. |
||||
|
||||
* Neither the name of 'LWJGL' nor the names of |
||||
its contributors may be used to endorse or promote products derived |
||||
from this software without specific prior written permission. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
The JOGL source tree also contains a Java port of Brian Paul's Tile |
||||
Rendering library, used with permission of the author under the BSD |
||||
license instead of the original LGPL: |
||||
|
||||
Copyright (c) 1997-2005 Brian Paul. All Rights Reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions are |
||||
met: |
||||
|
||||
- Redistribution of source code must retain the above copyright |
||||
notice, this list of conditions and the following disclaimer. |
||||
|
||||
- Redistribution in binary form must reproduce the above copyright |
||||
notice, this list of conditions and the following disclaimer in the |
||||
documentation and/or other materials provided with the distribution. |
||||
|
||||
Neither the name of Brian Paul or the names of contributors may be |
||||
used to endorse or promote products derived from this software |
||||
without specific prior written permission. |
||||
|
||||
This software is provided "AS IS," without a warranty of any |
||||
kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND |
||||
WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY |
||||
EXCLUDED. THE COPYRIGHT HOLDERS AND CONTRIBUTORS SHALL NOT BE |
||||
LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, |
||||
MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO |
||||
EVENT WILL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY |
||||
LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, |
||||
CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND |
||||
REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR |
||||
INABILITY TO USE THIS SOFTWARE, EVEN IF THE COPYRIGHT HOLDERS OR |
||||
CONTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
@ -0,0 +1,15 @@ |
||||
LZMA# SDK is licensed under two licenses: |
||||
|
||||
1) GNU Lesser General Public License (GNU LGPL) |
||||
2) Common Public License (CPL) |
||||
|
||||
It means that you can select one of these two licenses and |
||||
follow rules of that license. |
||||
|
||||
SPECIAL EXCEPTION |
||||
Igor Pavlov, as the author of this code, expressly permits you |
||||
to statically or dynamically link your code (or bind by name) |
||||
to the files from LZMA# SDK without subjecting your linked |
||||
code to the terms of the CPL or GNU LGPL. |
||||
Any modifications or additions to files from LZMA# SDK, however, |
||||
are subject to the GNU LGPL or CPL terms. |
@ -0,0 +1,36 @@ |
||||
The following people have helped to make this project what it is today: |
||||
- Caspian Rychlik-Prince <cprince@shavenpuppy.com> |
||||
- Brian Matzon <brian@matzon.dk> |
||||
- Elias Naur <elias.naur@gmail.com> |
||||
- Ioannis Tsakpinis <spasi@users.sourceforge.net> |
||||
- Niels Jørgensen <nj@niemo.com> |
||||
- Tristan Campbell <tristan@happypedestrian.com> |
||||
- Gregory Pierce <gregorypierce@yahoo.com> |
||||
- Luke Holden <lholden@users.sf.net> |
||||
- Mark Bernard <captainjester@users.sourceforge.net> |
||||
- Erik Duijs <eduijs@users.sourceforge.net> |
||||
- Jos Hirth <jhirth@kaioa.com> |
||||
- Kevin Glass <kevin@cokeandcode.com> |
||||
- Atsuya Takagi |
||||
- kappaOne |
||||
- Simon Felix |
||||
- Ryan McNally |
||||
- Ciardhubh <ciardhubh[at]ciardhubh.de> |
||||
- Jens von Pilgrim |
||||
- Ruben Garat |
||||
|
||||
additional credits goes to: |
||||
- Joseph I. Valenzuela [OpenAL stuff] |
||||
- Lev Povalahev [OpenGL Extensions] |
||||
- Endolf [Nightly builds and JInput] |
||||
|
||||
The LWJGL project includes files from or depends on the following projects: |
||||
- OpenGL, SGI - http://opengl.org/ |
||||
- OpenAL, Creative Labs - http://openal.org/ |
||||
- jinput, Sun - https://jinput.dev.java.net/ |
||||
- lzma, p7zip - http://p7zip.sourceforge.net/ |
||||
- JOGL, Sun - http://kenai.com/projects/jogl/pages/Home |
||||
|
||||
Please see the /doc/3rdparty/ directory for licenses. |
||||
|
||||
All trademarks and registered trademarks are the property of their respective owners. |
@ -0,0 +1,31 @@ |
||||
/* |
||||
* Copyright (c) 2002-2008 Lightweight Java Game Library Project |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* |
||||
* * Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* |
||||
* * Neither the name of 'Light Weight Java Game Library' nor the names of |
||||
* its contributors may be used to endorse or promote products derived |
||||
* from this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
*/ |
@ -0,0 +1,50 @@ |
||||
This is the official readme file for lwjgl. |
||||
|
||||
Unless otherwise stated, all files distributed or in SVN are covered by |
||||
the license as stated in the LICENSE file. If you have not received this |
||||
file, please download it from the cvs server. |
||||
|
||||
To run some of the included tests: |
||||
Extract the archive, and cd into directory |
||||
(please substitute ; and \ according to platform) |
||||
|
||||
java -cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwjgl_util.jar;jar\jinput.jar; -Djava.library.path=native\<windows|linux|macosx|solaris> TEST |
||||
(this specifies that the jvm should locate the lwjgl native libs in 'native' directory) |
||||
|
||||
where TEST is some of the following: |
||||
|
||||
org.lwjgl.test.WindowCreationTest |
||||
org.lwjgl.test.SysTest |
||||
org.lwjgl.test.DisplayTest |
||||
|
||||
org.lwjgl.test.input.MouseCreationTest |
||||
org.lwjgl.test.input.MouseTest |
||||
org.lwjgl.test.input.HWCursorTest |
||||
org.lwjgl.test.input.KeyboardTest |
||||
org.lwjgl.test.input.TestControllers |
||||
|
||||
org.lwjgl.test.openal.ALCTest |
||||
org.lwjgl.test.openal.OpenALCreationTest |
||||
org.lwjgl.test.openal.MovingSoundTest |
||||
org.lwjgl.test.openal.PlayTest |
||||
org.lwjgl.test.openal.PlayTestMemory |
||||
org.lwjgl.test.openal.SourceLimitTest |
||||
org.lwjgl.test.openal.PositionTest |
||||
org.lwjgl.test.openal.StressTest |
||||
org.lwjgl.test.openal.SourceLimitTest |
||||
|
||||
org.lwjgl.test.opengl.FullScreenWindowedTest |
||||
org.lwjgl.test.opengl.PbufferTest |
||||
org.lwjgl.test.opengl.VBOIndexTest |
||||
org.lwjgl.test.opengl.VBOTest |
||||
|
||||
org.lwjgl.test.opengl.pbuffers.PbufferTest |
||||
|
||||
org.lwjgl.test.opengl.shaders.ShadersTest |
||||
|
||||
You may also run the Space invaders demo by executing: |
||||
java -cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwjgl_util.jar; -Djava.library.path=native\<windows|linux|macosx|solaris> org.lwjgl.examples.spaceinvaders.Game |
||||
|
||||
Project Webpage: www.lwjgl.org |
||||
Project Forum: forum.lwjgl.org |
||||
Project SVN: https://java-game-lib.svn.sourceforge.net/svnroot/java-game-lib |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,25 @@ |
||||
LWJGL "Hidden" switches: |
||||
|
||||
org.lwjgl.opengl.Display.noinput |
||||
Do not initialize any controls when creating the display |
||||
|
||||
org.lwjgl.opengl.Display.nomouse |
||||
Do not create the mouse when creating the display |
||||
|
||||
org.lwjgl.opengl.Display.nokeyboard |
||||
Do not create the keyboard when creating the display |
||||
|
||||
org.lwjgl.util.Debug |
||||
Whether to output debug info |
||||
|
||||
org.lwjgl.util.NoChecks |
||||
Whether to disable runtime function/buffer checks and state tracking. |
||||
|
||||
org.lwjgl.opengl.Display.allowSoftwareOpenGL |
||||
Whether to allow creation of a software only opengl context |
||||
|
||||
org.lwjgl.opengl.Window.undecorated |
||||
Whether to create an undecorated window (no title bar) |
||||
|
||||
org.lwjgl.input.Mouse.allowNegativeMouseCoords |
||||
Usually mouse is clamped to 0,0 - setting this to true will cause you to get negative values if dragging outside and below or left of window |
@ -0,0 +1,55 @@ |
||||
libs.CopyLibs.classpath=\ |
||||
${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar |
||||
libs.jbullet.classpath=\ |
||||
${base}/jbullet/jbullet.jar:\ |
||||
${base}/jbullet/stack-alloc.jar:\ |
||||
${base}/jbullet/vecmath.jar |
||||
libs.jheora.classpath=\ |
||||
${base}/jheora/jheora-jst-debug-0.6.0.jar |
||||
libs.jme3-test-data.classpath=\ |
||||
${base}/../src/test-data/ |
||||
libs.jogg.classpath=\ |
||||
${base}/jogg/j-ogg-oggd.jar:\ |
||||
${base}/jogg/j-ogg-vorbisd.jar |
||||
libs.jogl.classpath=\ |
||||
${base}/jogl/gluegen-rt.jar:\ |
||||
${base}/jogl/jME3-jogl-natives.jar:\ |
||||
${base}/jogl/jogl.jar |
||||
libs.jogl2.classpath=\ |
||||
${base}/jogl2/jogl.all.jar;\ |
||||
${base}/jogl2/nativewindow.all.jar;\ |
||||
${base}/jogl2/newt.all.jar;\ |
||||
${base}/jogl2/gluegen-rt.jar |
||||
libs.junit_4.classpath=\ |
||||
${base}/junit_4/junit-4.5.jar |
||||
libs.junit_4.javadoc=\ |
||||
${base}/junit_4/junit-4.5-api.zip |
||||
libs.junit_4.src=\ |
||||
${base}/junit_4/junit-4.5-src.jar |
||||
libs.JWSAntTasks.classpath=\ |
||||
${base}/JWSAntTasks/org-netbeans-modules-javawebstart-anttasks.jar |
||||
libs.lwjgl.classpath=\ |
||||
${base}/lwjgl/jME3-lwjgl-natives.jar;\ |
||||
${base}/lwjgl/jinput.jar;\ |
||||
${base}/lwjgl/lwjgl.jar |
||||
libs.niftygui1.2.classpath=\ |
||||
${base}/niftygui/nifty-1.2-SNAPSHOT.jar;\ |
||||
${base}/niftygui/nifty-default-controls-1.2-SNAPSHOT.jar;\ |
||||
${base}/niftygui/nifty-style-black-1.2-SNAPSHOT.jar;\ |
||||
${base}/niftygui/xmlpull-xpp3-1.1.4c.jar;\ |
||||
${base}/niftygui/nifty-examples-1.2_small.jar |
||||
libs.niftygui1.3.classpath=\ |
||||
${base}/niftygui/nifty-1.3-SNAPSHOT.jar;\ |
||||
${base}/niftygui/nifty-default-controls-1.3-SNAPSHOT.jar;\ |
||||
${base}/niftygui/nifty-style-black-1.3-SNAPSHOT.jar;\ |
||||
${base}/niftygui/nifty-style-grey-1.0.jar;\ |
||||
${base}/niftygui/nifty-examples-1.3-SNAPSHOT.jar;\ |
||||
${base}/niftygui/xmlpull-xpp3-1.1.4c.jar;\ |
||||
${base}/niftygui/eventbus-1.4.jar |
||||
libs.swing-layout.classpath=\ |
||||
${base}/swing-layout/swing-layout-1.0.4.jar |
||||
libs.swing-layout.javadoc=\ |
||||
${base}/swing-layout/swing-layout-1.0.4-doc.zip |
||||
libs.swing-layout.src=\ |
||||
${base}/swing-layout/swing-layout-1.0.4-src.zip |
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,26 @@ |
||||
<jnlp spec="1.0+" codebase="${jnlp.codebase}" href="launch.jnlp"> |
||||
<information> |
||||
<title>${APPLICATION.TITLE}</title> |
||||
<vendor>${APPLICATION.VENDOR}</vendor> |
||||
<homepage href="${APPLICATION.HOMEPAGE}"/> |
||||
<description>${APPLICATION.DESC}</description> |
||||
<description kind="short">${APPLICATION.DESC.SHORT}</description> |
||||
<!--${JNLP.ICONS}--> |
||||
</information> |
||||
<!--${JNLP.UPDATE}--> |
||||
<!--${JNLP.SECURITY}--> |
||||
<resources> |
||||
<!--${JNLP.RESOURCES.RUNTIME}--> |
||||
<!--${JNLP.RESOURCES.MAIN.JAR}--> |
||||
<!--${JNLP.RESOURCES.JARS}--> |
||||
<jar href='lib/jme3testdata.jar'/> |
||||
<!--${JNLP.RESOURCES.EXTENSIONS}--> |
||||
</resources> |
||||
<application-desc main-class="${jnlp.main.class}"> |
||||
<!--${JNLP.APPLICATION.ARGS}--> |
||||
</application-desc> |
||||
<shortcut online="false"> |
||||
<desktop /> |
||||
<menu submenu="jMonkeyEngine 3.0"/> |
||||
</shortcut> |
||||
</jnlp> |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,4 @@ |
||||
$label=Web Start |
||||
$target.debug=jws-debug |
||||
$target.run=jws-run |
||||
compile.on.save.unsupported.javawebstart=true |
@ -0,0 +1,11 @@ |
||||
build.xml.data.CRC32=52f8cb9e |
||||
build.xml.script.CRC32=34d4c2f2 |
||||
build.xml.stylesheet.CRC32=958a1d3e |
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. |
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. |
||||
nbproject/build-impl.xml.data.CRC32=759acdca |
||||
nbproject/build-impl.xml.script.CRC32=10762282 |
||||
nbproject/build-impl.xml.stylesheet.CRC32=229523de@1.38.3.45 |
||||
nbproject/profiler-build-impl.xml.data.CRC32=aff514c1 |
||||
nbproject/profiler-build-impl.xml.script.CRC32=abda56ed |
||||
nbproject/profiler-build-impl.xml.stylesheet.CRC32=f10cf54c@1.11.1 |
@ -0,0 +1,414 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!-- |
||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
||||
|
||||
Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. |
||||
|
||||
Oracle and Java are registered trademarks of Oracle and/or its affiliates. |
||||
Other names may be trademarks of their respective owners. |
||||
|
||||
|
||||
The contents of this file are subject to the terms of either the GNU |
||||
General Public License Version 2 only ("GPL") or the Common |
||||
Development and Distribution License("CDDL") (collectively, the |
||||
"License"). You may not use this file except in compliance with the |
||||
License. You can obtain a copy of the License at |
||||
http://www.netbeans.org/cddl-gplv2.html |
||||
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the |
||||
specific language governing permissions and limitations under the |
||||
License. When distributing the software, include this License Header |
||||
Notice in each file and include the License file at |
||||
nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this |
||||
particular file as subject to the "Classpath" exception as provided |
||||
by Oracle in the GPL Version 2 section of the License file that |
||||
accompanied this code. If applicable, add the following below the |
||||
License Header, with the fields enclosed by brackets [] replaced by |
||||
your own identifying information: |
||||
"Portions Copyrighted [year] [name of copyright owner]" |
||||
|
||||
Contributor(s): |
||||
|
||||
The Original Software is NetBeans. The Initial Developer of the Original |
||||
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun |
||||
Microsystems, Inc. All Rights Reserved. |
||||
|
||||
If you wish your version of this file to be governed by only the CDDL |
||||
or only the GPL Version 2, indicate your decision by adding |
||||
"[Contributor] elects to include this software in this distribution |
||||
under the [CDDL or GPL Version 2] license." If you do not indicate a |
||||
single choice of license, a recipient has the option to distribute |
||||
your version of this file under either the CDDL, the GPL Version 2 or |
||||
to extend the choice of license to its licensees as provided above. |
||||
However, if you add GPL Version 2 code and therefore, elected the GPL |
||||
Version 2 license, then the option applies only if the new code is |
||||
made subject to such option by the copyright holder. |
||||
--> |
||||
|
||||
<project name="jnlp-impl" default="default" basedir=".." xmlns:jnlp="http://www.netbeans.org/ns/j2se-project/jnlp"> |
||||
|
||||
<property name="jnlp.file.name.default" value="launch.jnlp"/> |
||||
<property name="jnlp.dest.dir" location="dist"/> |
||||
|
||||
<!-- helper file to create list of arguments, etc. --> |
||||
<property name="helper.file" location="helper.txt"/> |
||||
|
||||
<target name="default"> |
||||
<echo message="Default target is not set, you must specify which target you want to run."/> |
||||
</target> |
||||
|
||||
<target name="-init-platform" unless="platform.home"> |
||||
<property name="platform.home" value="${java.home}"/> |
||||
</target> |
||||
|
||||
<!-- Main target --> |
||||
|
||||
<target name="jnlp" depends="-init-filename,-test-jnlp-enabled,-do-jar-jnlp" if="is.jnlp.enabled"> |
||||
<makeurl property="jnlp.local.codebase.url" file="${basedir}/dist" validate="false"/> |
||||
<antcall target="generate-jnlp"/> |
||||
<antcall target="generate-html-preview"/> |
||||
</target> |
||||
|
||||
<!-- JNLP archiving --> |
||||
|
||||
<target name="-init-macrodef-jnlp-copylibs"> |
||||
<macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/jnlp"> |
||||
<element name="customize" optional="true"/> |
||||
<sequential> |
||||
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/> |
||||
<pathconvert property="run.classpath.without.build.classes.dir"> |
||||
<path path="${run.classpath}"/> |
||||
<map from="${build.classes.dir.resolved}" to=""/> |
||||
</pathconvert> |
||||
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> |
||||
<copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${tmp.manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> |
||||
<fileset dir="${build.classes.dir}"/> |
||||
<manifest> |
||||
<customize/> |
||||
</manifest> |
||||
</copylibs> |
||||
</sequential> |
||||
</macrodef> |
||||
</target> |
||||
|
||||
<target name="-init-macrodef-extend-manifest"> |
||||
<macrodef name="extend-manifest" uri="http://www.netbeans.org/ns/j2se-project/jnlp"> |
||||
<element name="customize"/> |
||||
<sequential> |
||||
<manifest file="${tmp.manifest.file}" mode="update"> |
||||
<customize/> |
||||
</manifest> |
||||
</sequential> |
||||
</macrodef> |
||||
</target> |
||||
|
||||
<target name="-test-jnlp-type" depends="-test-jnlp-enabled" if="is.jnlp.enabled"> |
||||
<condition property="is.applet"> |
||||
<equals arg1="${jnlp.descriptor}" arg2="applet" trim="true"/> |
||||
</condition> |
||||
<condition property="is.application"> |
||||
<equals arg1="${jnlp.descriptor}" arg2="application" trim="true"/> |
||||
</condition> |
||||
<condition property="is.component"> |
||||
<equals arg1="${jnlp.descriptor}" arg2="component" trim="true"/> |
||||
</condition> |
||||
<condition property="is.applet+mkdist.available"> |
||||
<and> |
||||
<isset property="libs.CopyLibs.classpath"/> |
||||
<istrue value="${is.applet}"/> |
||||
</and> |
||||
</condition> |
||||
<condition property="is.application+mkdist.available"> |
||||
<and> |
||||
<isset property="libs.CopyLibs.classpath"/> |
||||
<istrue value="${is.application}"/> |
||||
</and> |
||||
</condition> |
||||
<condition property="is.component+mkdist.available"> |
||||
<and> |
||||
<isset property="libs.CopyLibs.classpath"/> |
||||
<istrue value="${is.component}"/> |
||||
</and> |
||||
</condition> |
||||
</target> |
||||
|
||||
<target name="-create-tmp-manifest" unless="manifest.file"> |
||||
<property name="tmp.manifest.file" value="${build.dir}/manifest.mf"/> |
||||
<delete file="${tmp.manifest.file}" failonerror="false"/> |
||||
<touch file="${tmp.manifest.file}"/> |
||||
</target> |
||||
|
||||
<target name="-copy-tmp-manifest" if="manifest.file"> |
||||
<property name="tmp.manifest.file" value="${build.dir}/manifest.mf"/> |
||||
<copy file="${manifest.file}" tofile="${build.dir}/manifest.mf"/> |
||||
</target> |
||||
|
||||
<target name="-set-mixed-code-properties" depends="-check-signing-possible" if="jnlp.signed.true+signjars.task.available"> |
||||
<property name="jnlp.mixed.code" value=""/> |
||||
<condition property="mixed.code.trusted.only"> |
||||
<equals arg1="trusted_only" arg2="${jnlp.mixed.code}"/> |
||||
</condition> |
||||
<condition property="mixed.code.trusted.library"> |
||||
<equals arg1="trusted_library" arg2="${jnlp.mixed.code}"/> |
||||
</condition> |
||||
</target> |
||||
|
||||
<target name="-add-trusted-only-attribute" depends="-set-mixed-code-properties,-init-macrodef-extend-manifest" if="mixed.code.trusted.only"> |
||||
<jnlp:extend-manifest> |
||||
<customize> |
||||
<attribute name="Trusted-Only" value="true"/> |
||||
</customize> |
||||
</jnlp:extend-manifest> |
||||
</target> |
||||
|
||||
<target name="-add-trusted-library-attribute" depends="-set-mixed-code-properties,-init-macrodef-extend-manifest" if="mixed.code.trusted.library"> |
||||
<jnlp:extend-manifest> |
||||
<customize> |
||||
<attribute name="Trusted-Library" value="true"/> |
||||
</customize> |
||||
</jnlp:extend-manifest> |
||||
</target> |
||||
<target name="-do-jar-applet" depends="-test-jnlp-type,-init-macrodef-jnlp-copylibs" if="is.applet+mkdist.available"> |
||||
<jnlp:copylibs/> |
||||
</target> |
||||
<target name="-do-jar-jnlp-application" depends="-init-filename,-test-jnlp-type,-init-macrodef-jnlp-copylibs" if="is.application+mkdist.available"> |
||||
<jnlp:copylibs> |
||||
<customize> |
||||
<attribute name="Main-Class" value="${main.class}"/> |
||||
</customize> |
||||
</jnlp:copylibs> |
||||
<echo>To run this application from the command line without Ant, try:</echo> |
||||
<property location="${jnlp.dest.dir}/${jnlp.file}" name="jnlp.file.resolved"/> |
||||
<echo>javaws "${jnlp.file.resolved}"</echo> |
||||
</target> |
||||
<target name="-do-jar-jnlp-component" depends="-test-jnlp-type,-init-macrodef-jnlp-copylibs" if="is.component+mkdist.available"> |
||||
<jnlp:copylibs/> |
||||
</target> |
||||
<target name="-do-jar-jnlp" depends="-create-tmp-manifest,-copy-tmp-manifest,-add-trusted-only-attribute,-add-trusted-library-attribute,-do-jar-applet,-do-jar-jnlp-application,-do-jar-jnlp-component"/> |
||||
|
||||
<!-- Init jnlp filename --> |
||||
|
||||
<target name="-init-filename" depends="-check-filename-prop,-set-jnlp-filename-custom,-set-jnlp-filename-default"/> |
||||
|
||||
<target name="-set-jnlp-filename-custom" if="jnlp.file.name.set"> |
||||
<property name="jnlp.file" value="${jnlp.file.name}"/> |
||||
</target> |
||||
|
||||
<target name="-set-jnlp-filename-default" unless="jnlp.file.name.set"> |
||||
<property name="jnlp.file" value="${jnlp.file.name.default}"/> |
||||
</target> |
||||
|
||||
<target name="-check-filename-prop"> |
||||
<condition property="jnlp.file.name.set"> |
||||
<and> |
||||
<isset property="jnlp.file.name"/> |
||||
<not> |
||||
<equals arg1="jnlp.file.name" arg2="" trim="true"/> |
||||
</not> |
||||
</and> |
||||
</condition> |
||||
</target> |
||||
|
||||
<!-- Test JNLP enabled--> |
||||
|
||||
<target name="-test-jnlp-enabled"> |
||||
<condition property="is.jnlp.enabled"> |
||||
<istrue value="${jnlp.enabled}"/> |
||||
</condition> |
||||
</target> |
||||
|
||||
<!-- Generating JNLP file --> |
||||
|
||||
<target name="generate-jnlp" depends="sign-jars,-test-generate-task-available,-unavailable-generate-task" if="generate.task.available"> |
||||
<taskdef name="generate-jnlp" classname="org.netbeans.modules.javawebstart.anttasks.GenerateJnlpFileTask" |
||||
classpath="${libs.JWSAntTasks.classpath}"/> |
||||
<property name="jnlp.lazy.jars" value=""/> |
||||
<generate-jnlp destfile="${jnlp.dest.dir}/${jnlp.file}_" template="master-${jnlp.descriptor}.jnlp" destdir="dist" lazyJars="${jnlp.lazy.jars}"/> |
||||
<antcall target="-strip-empty-lines"/> |
||||
</target> |
||||
|
||||
<target name="-strip-empty-lines"> |
||||
<copy file="${jnlp.dest.dir}/${jnlp.file}_" tofile="${jnlp.dest.dir}/${jnlp.file}" overwrite="true" encoding="UTF-8"> |
||||
<filterchain> |
||||
<linecontainsregexp> |
||||
<regexp pattern=".+"/> |
||||
</linecontainsregexp> |
||||
</filterchain> |
||||
</copy> |
||||
<delete file="${jnlp.dest.dir}/${jnlp.file}_" failonerror="false"/> |
||||
</target> |
||||
|
||||
<target name="-test-generate-task-available"> |
||||
<available property="generate.task.available" classname="org.netbeans.modules.javawebstart.anttasks.GenerateJnlpFileTask" |
||||
classpath="${libs.JWSAntTasks.classpath}"/> |
||||
</target> |
||||
|
||||
<target name="-unavailable-generate-task" unless="generate.task.available"> |
||||
<echo message="Task required to generate JNLP file is missing, probably the library 'JWS Ant Tasks' is missing either from shared folder or from IDE installation."/> |
||||
<fail/> |
||||
</target> |
||||
|
||||
<!-- Codebase processing --> |
||||
|
||||
<target name="-codebase-props-check"> |
||||
<condition property="local.codebase"> |
||||
<or> |
||||
<not> |
||||
<isset property="jnlp.codebase.type"/> |
||||
</not> |
||||
<equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/> |
||||
</or> |
||||
</condition> |
||||
<condition property="non.user.codebase"> |
||||
<or> |
||||
<not> |
||||
<isset property="jnlp.codebase.type"/> |
||||
</not> |
||||
<equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/> |
||||
<equals arg1="${jnlp.codebase.type}" arg2="web" trim="true"/> |
||||
</or> |
||||
</condition> |
||||
<condition property="user.codebase"> |
||||
<equals arg1="${jnlp.codebase.type}" arg2="user" trim="true"/> |
||||
</condition> |
||||
</target> |
||||
|
||||
<target name="-init-non-user-codebase" if="non.user.codebase"> |
||||
<property name="jnlp.codebase.value" value="${jnlp.codebase.url}"/> |
||||
</target> |
||||
|
||||
<target name="-init-user-codebase" if="user.codebase"> |
||||
<property name="jnlp.codebase.value" value="${jnlp.codebase.user}"/> |
||||
</target> |
||||
|
||||
<!-- Security --> |
||||
|
||||
<target name="-security-props-check"> |
||||
<condition property="jnlp.signed.true"> |
||||
<istrue value="${jnlp.signed}"/> |
||||
</condition> |
||||
</target> |
||||
|
||||
<target name="-jnlp-init-keystore" depends="-jnlp-init-keystore-props,-check-keystore-exists" unless="jnlp.signjar.keystore.exists"> |
||||
<echo message="${application.vendor}" file="${helper.file}"/> |
||||
<loadfile property="application.vendor.filtered" srcfile="${helper.file}"> |
||||
<filterchain> |
||||
<deletecharacters chars=","/> |
||||
</filterchain> |
||||
</loadfile> |
||||
<delete file="${helper.file}"/> |
||||
<property name="jnlp.signjar.vendor" value="CN=${application.vendor.filtered}"/> |
||||
<echo message="Going to create default keystore in ${jnlp.signjar.keystore}"/> |
||||
<genkey dname="${jnlp.signjar.vendor}" alias="${jnlp.signjar.alias}" keystore="${jnlp.signjar.keystore}" |
||||
storepass="${jnlp.signjar.storepass}" keypass="${jnlp.signjar.keypass}"/> |
||||
</target> |
||||
|
||||
<target name="-check-keystore-exists"> |
||||
<available property="jnlp.signjar.keystore.exists" file="${jnlp.signjar.keystore}"/> |
||||
</target> |
||||
|
||||
<target name="-jnlp-init-keystore-props"> |
||||
<property name="jnlp.signjar.keystore" value="${basedir}/build/nb-jws.ks"/> |
||||
<property name="jnlp.signjar.storepass" value="storepass"/> |
||||
<property name="jnlp.signjar.keypass" value="keypass"/> |
||||
<property name="jnlp.signjar.alias" value="nb-jws"/> |
||||
</target> |
||||
|
||||
<!-- Signing --> |
||||
|
||||
<target name="-test-signjars-task-available"> |
||||
<available property="signjars.task.available" |
||||
classname="org.netbeans.modules.javawebstart.anttasks.SignJarsTask" |
||||
classpath="${libs.JWSAntTasks.classpath}"/> |
||||
</target> |
||||
|
||||
<target name="-check-signing-possible" depends="-security-props-check,-test-signjars-task-available,-unavailable-signjars-task"> |
||||
<condition property="jnlp.signed.true+signjars.task.available"> |
||||
<and> |
||||
<isset property="jnlp.signed.true"/> |
||||
<isset property="signjars.task.available"/> |
||||
</and> |
||||
</condition> |
||||
</target> |
||||
|
||||
<target name="-unavailable-signjars-task" depends="-test-signjars-task-available" unless="signjars.task.available"> |
||||
<echo message="Task required to sign JAR file is missing, probably the library 'JWS Ant Tasks' is missing either from shared folder or from IDE installation. JAR files will not be signed."/> |
||||
</target> |
||||
|
||||
<target name="sign-jars" depends="-jnlp-init-keystore,-check-signing-possible" if="jnlp.signed.true+signjars.task.available"> |
||||
<taskdef name="sign-jars" classname="org.netbeans.modules.javawebstart.anttasks.SignJarsTask" |
||||
classpath="${libs.JWSAntTasks.classpath}"/> |
||||
<sign-jars keystore="${jnlp.signjar.keystore}" storepass="${jnlp.signjar.storepass}" |
||||
keypass="${jnlp.signjar.keypass}" alias="${jnlp.signjar.alias}" mainjar="${dist.jar}" destdir="dist" |
||||
codebase="${jnlp.codebase.value}" signedjarsprop="jnlp.signed.jars" |
||||
componentsprop="jnlp.components"> |
||||
<fileset dir="dist/lib"> |
||||
<include name="*.jar"/> |
||||
</fileset> |
||||
</sign-jars> |
||||
</target> |
||||
|
||||
<!-- Running/Debugging --> |
||||
|
||||
<target name="jws-run" depends="jar,-verify-jnlp-enabled,-verify-codebase,-init-platform" description="Start javaws execution"> |
||||
<exec executable="${platform.home}/bin/javaws"> |
||||
<arg file="${jnlp.dest.dir}/${jnlp.file}"/> |
||||
</exec> |
||||
</target> |
||||
|
||||
<target name="jws-debug" if="netbeans.home" depends="jar,-verify-jnlp-enabled,-verify-codebase,-debug-start-debugger,-debug-javaws-debuggee" |
||||
description="Debug javaws project in IDE"/> |
||||
|
||||
<target name="-init-debug-args"> |
||||
<property name="version-output" value="java version "${ant.java.version}"/> |
||||
<condition property="have-jdk-older-than-1.4"> |
||||
<or> |
||||
<contains string="${version-output}" substring="java version "1.0"/> |
||||
<contains string="${version-output}" substring="java version "1.1"/> |
||||
<contains string="${version-output}" substring="java version "1.2"/> |
||||
<contains string="${version-output}" substring="java version "1.3"/> |
||||
</or> |
||||
</condition> |
||||
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> |
||||
<istrue value="${have-jdk-older-than-1.4}"/> |
||||
</condition> |
||||
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> |
||||
<os family="windows"/> |
||||
</condition> |
||||
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> |
||||
<isset property="debug.transport"/> |
||||
</condition> |
||||
</target> |
||||
|
||||
<target name="-debug-javaws-debuggee" depends="-init-debug-args"> |
||||
<exec executable="${java.home}/bin/javaws"> |
||||
<env key="JAVAWS_VM_ARGS" value="${debug-args-line} -Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> |
||||
<arg file="${jnlp.dest.dir}/${jnlp.file}"/> |
||||
</exec> |
||||
</target> |
||||
|
||||
<target name="-verify-codebase" depends="-codebase-props-check" unless="local.codebase"> |
||||
<fail message="Project cannot be run with non-local codebase. Open project properties dialog and set Web Start Codebase to Local Execution."/> |
||||
</target> |
||||
|
||||
<target name="-verify-jnlp-enabled" depends="-test-jnlp-enabled" unless="is.jnlp.enabled"> |
||||
<fail message="Project cannot be run with selected Run Configuration when Java Web Start is disabled."/> |
||||
</target> |
||||
|
||||
<!-- Generate simple HTML preview page --> |
||||
|
||||
<target name="-check-html-preview"> |
||||
<condition property="generate.html.preview"> |
||||
<or> |
||||
<equals arg1="${jnlp.descriptor}" arg2="application"/> |
||||
<equals arg1="${jnlp.descriptor}" arg2="applet"/> |
||||
</or> |
||||
</condition> |
||||
</target> |
||||
|
||||
<target name="generate-html-preview" depends="-check-html-preview" if="generate.html.preview"> |
||||
<taskdef name="copy-template-page" classname="org.netbeans.modules.javawebstart.anttasks.CopyTemplatePageTask" |
||||
classpath="${libs.JWSAntTasks.classpath}"/> |
||||
<copy-template-page destfile="${jnlp.dest.dir}/launch.html" template="preview-${jnlp.descriptor}.html" destdir="${jnlp.dest.dir}"/> |
||||
</target> |
||||
|
||||
</project> |
@ -0,0 +1,131 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!-- |
||||
*** GENERATED FROM project.xml - DO NOT EDIT *** |
||||
*** EDIT ../build.xml INSTEAD *** |
||||
|
||||
For the purpose of easier reading the script |
||||
is divided into following sections: |
||||
|
||||
- initialization |
||||
- profiling |
||||
- applet profiling |
||||
|
||||
--> |
||||
<project name="-profiler-impl" default="profile" basedir=".."> |
||||
<target name="default" depends="profile" description="Build and profile the project."/> |
||||
<!-- |
||||
====================== |
||||
INITIALIZATION SECTION |
||||
====================== |
||||
--> |
||||
<target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check"/> |
||||
<target name="-profile-pre-init"> |
||||
<!-- Empty placeholder for easier customization. --> |
||||
<!-- You can override this target in the ../build.xml file. --> |
||||
</target> |
||||
<target name="-profile-post-init"> |
||||
<!-- Empty placeholder for easier customization. --> |
||||
<!-- You can override this target in the ../build.xml file. --> |
||||
</target> |
||||
<target name="-profile-init-macrodef-profile"> |
||||
<macrodef name="resolve"> |
||||
<attribute name="name"/> |
||||
<attribute name="value"/> |
||||
<sequential> |
||||
<property name="@{name}" value="${env.@{value}}"/> |
||||
</sequential> |
||||
</macrodef> |
||||
<macrodef name="profile"> |
||||
<attribute name="classname" default="${main.class}"/> |
||||
<element name="customize" optional="true"/> |
||||
<sequential> |
||||
<property environment="env"/> |
||||
<resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> |
||||
<java fork="true" classname="@{classname}" dir="${profiler.info.dir}" jvm="${profiler.info.jvm}"> |
||||
<jvmarg value="${profiler.info.jvmargs.agent}"/> |
||||
<jvmarg line="${profiler.info.jvmargs}"/> |
||||
<env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> |
||||
<arg line="${application.args}"/> |
||||
<classpath> |
||||
<path path="${run.classpath}"/> |
||||
</classpath> |
||||
<syspropertyset> |
||||
<propertyref prefix="run-sys-prop."/> |
||||
<mapper type="glob" from="run-sys-prop.*" to="*"/> |
||||
</syspropertyset> |
||||
<customize/> |
||||
</java> |
||||
</sequential> |
||||
</macrodef> |
||||
</target> |
||||
<target name="-profile-init-check" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile"> |
||||
<fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> |
||||
<fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> |
||||
</target> |
||||
<!-- |
||||
================= |
||||
PROFILING SECTION |
||||
================= |
||||
--> |
||||
<target name="profile" if="netbeans.home" depends="profile-init,compile" description="Profile a project in the IDE."> |
||||
<nbprofiledirect> |
||||
<classpath> |
||||
<path path="${run.classpath}"/> |
||||
</classpath> |
||||
</nbprofiledirect> |
||||
<profile/> |
||||
</target> |
||||
<target name="profile-single" if="netbeans.home" depends="profile-init,compile-single" description="Profile a selected class in the IDE."> |
||||
<fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> |
||||
<nbprofiledirect> |
||||
<classpath> |
||||
<path path="${run.classpath}"/> |
||||
</classpath> |
||||
</nbprofiledirect> |
||||
<profile classname="${profile.class}"/> |
||||
</target> |
||||
<!-- |
||||
========================= |
||||
APPLET PROFILING SECTION |
||||
========================= |
||||
--> |
||||
<target name="profile-applet" if="netbeans.home" depends="profile-init,compile-single"> |
||||
<nbprofiledirect> |
||||
<classpath> |
||||
<path path="${run.classpath}"/> |
||||
</classpath> |
||||
</nbprofiledirect> |
||||
<profile classname="sun.applet.AppletViewer"> |
||||
<customize> |
||||
<arg value="${applet.url}"/> |
||||
</customize> |
||||
</profile> |
||||
</target> |
||||
<!-- |
||||
========================= |
||||
TESTS PROFILING SECTION |
||||
========================= |
||||
--> |
||||
<target name="profile-test-single" if="netbeans.home" depends="profile-init,compile-test-single"> |
||||
<nbprofiledirect> |
||||
<classpath> |
||||
<path path="${run.test.classpath}"/> |
||||
</classpath> |
||||
</nbprofiledirect> |
||||
<junit showoutput="true" fork="true" dir="${profiler.info.dir}" jvm="${profiler.info.jvm}" failureproperty="tests.failed" errorproperty="tests.failed"> |
||||
<env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> |
||||
<jvmarg value="${profiler.info.jvmargs.agent}"/> |
||||
<jvmarg line="${profiler.info.jvmargs}"/> |
||||
<test name="${profile.class}"/> |
||||
<classpath> |
||||
<path path="${run.test.classpath}"/> |
||||
</classpath> |
||||
<syspropertyset> |
||||
<propertyref prefix="test-sys-prop."/> |
||||
<mapper type="glob" from="test-sys-prop.*" to="*"/> |
||||
</syspropertyset> |
||||
<formatter type="brief" usefile="false"/> |
||||
<formatter type="xml"/> |
||||
</junit> |
||||
</target> |
||||
</project> |
@ -0,0 +1,107 @@ |
||||
annotation.processing.enabled=false |
||||
annotation.processing.enabled.in.editor=false |
||||
annotation.processing.run.all.processors=true |
||||
ant.customtasks.libs=JWSAntTasks |
||||
application.homepage=http://www.jmonkeyengine.com/ |
||||
application.title=jMonkeyEngine 3.0 |
||||
application.vendor=jMonkeyEngine |
||||
build.classes.dir=${build.dir}/classes |
||||
build.classes.excludes=**/*.java,**/*.form |
||||
# This directory is removed when the project is cleaned: |
||||
build.dir=build |
||||
build.generated.dir=${build.dir}/generated |
||||
build.generated.sources.dir=${build.dir}/generated-sources |
||||
# Only compile against the classpath explicitly listed here: |
||||
build.sysclasspath=ignore |
||||
build.test.classes.dir=${build.dir}/test/classes |
||||
build.test.results.dir=${build.dir}/test/results |
||||
# Uncomment to specify the preferred debugger connection transport: |
||||
#debug.transport=dt_socket |
||||
debug.classpath=\ |
||||
${run.classpath} |
||||
debug.test.classpath=\ |
||||
${run.test.classpath} |
||||
# This directory is removed when the project is cleaned: |
||||
dist.dir=dist |
||||
dist.jar=${dist.dir}/jMonkeyEngine3.jar |
||||
dist.javadoc.dir=${dist.dir}/javadoc |
||||
endorsed.classpath= |
||||
excludes= |
||||
file.reference.src-test-data=src/test-data |
||||
includes=** |
||||
jar.archive.disabled=${jnlp.enabled} |
||||
jar.compress=true |
||||
jar.index=${jnlp.enabled} |
||||
javac.classpath=\ |
||||
${libs.jogg.classpath}:\ |
||||
${libs.jbullet.classpath}:\ |
||||
${libs.lwjgl.classpath}:\ |
||||
${libs.jheora.classpath}:\ |
||||
${libs.niftygui1.3.classpath}:\ |
||||
${libs.jme3-test-data.classpath} |
||||
# Space-separated list of extra javac options |
||||
javac.compilerargs= |
||||
javac.deprecation=false |
||||
javac.processorpath=\ |
||||
${javac.classpath} |
||||
javac.source=1.5 |
||||
javac.target=1.5 |
||||
javac.test.classpath=\ |
||||
${javac.classpath}:\ |
||||
${build.classes.dir}:\ |
||||
${libs.junit_4.classpath} |
||||
javadoc.additionalparam= |
||||
javadoc.author=false |
||||
javadoc.encoding=${source.encoding} |
||||
javadoc.noindex=false |
||||
javadoc.nonavbar=false |
||||
javadoc.notree=false |
||||
javadoc.private=false |
||||
javadoc.splitindex=true |
||||
javadoc.use=true |
||||
javadoc.version=false |
||||
javadoc.windowtitle=jMonkeyEngine3 |
||||
jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api" |
||||
jnlp.applet.class=jme3test.awt.AppHarness |
||||
jnlp.applet.height=300 |
||||
jnlp.applet.width=300 |
||||
jnlp.codebase.type=user |
||||
jnlp.codebase.user=http://jmonkeyengine.com/javawebstart/ |
||||
jnlp.descriptor=application |
||||
jnlp.enabled=false |
||||
jnlp.icon=/Users/normenhansen/Pictures/jme/icons/jme-logo48.png |
||||
jnlp.mixed.code=defaut |
||||
jnlp.offline-allowed=true |
||||
jnlp.signed=true |
||||
main.class=jme3test.TestChooser |
||||
manifest.file=MANIFEST.MF |
||||
meta.inf.dir=${src.dir}/META-INF |
||||
platform.active=default_platform |
||||
run.classpath=\ |
||||
${javac.classpath}:\ |
||||
${build.classes.dir} |
||||
run.jvmargs=-Xms40m -Xmx40m -XX:MaxDirectMemorySize=256M |
||||
run.test.classpath=\ |
||||
${javac.test.classpath}:\ |
||||
${build.test.classes.dir} |
||||
source.encoding=UTF-8 |
||||
src.core-data.dir=src/core-data |
||||
src.core-plugins.dir=src/core-plugins |
||||
src.core.dir=src/core |
||||
src.desktop-fx.dir=src/desktop-fx |
||||
src.desktop.dir=src/desktop |
||||
src.games.dir=src/games |
||||
src.jbullet.dir=src/jbullet |
||||
src.jheora.dir=src/jheora |
||||
src.jogg.dir=src/jogg |
||||
src.lwjgl-oal.dir=src/lwjgl-oal |
||||
src.lwjgl-ogl.dir=src/lwjgl-ogl |
||||
src.networking.dir=src\\networking |
||||
src.niftygui.dir=src/niftygui |
||||
src.ogre.dir=src/ogre |
||||
src.pack.dir=src/pack |
||||
src.terrain.dir=src/terrain |
||||
src.test.dir=src/test |
||||
src.tools.dir=src/tools |
||||
src.xml.dir=src/xml |
||||
test.test.dir=test |
@ -0,0 +1,42 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://www.netbeans.org/ns/project/1"> |
||||
<type>org.netbeans.modules.java.j2seproject</type> |
||||
<configuration> |
||||
<buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1"> |
||||
<extension file="jnlp-impl.xml" id="jws"> |
||||
<dependency dependsOn="jnlp" target="jar"/> |
||||
</extension> |
||||
</buildExtensions> |
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3"> |
||||
<name>jMonkeyEngine3</name> |
||||
<minimum-ant-version>1.6.5</minimum-ant-version> |
||||
<source-roots> |
||||
<root id="src.core.dir" name="Core"/> |
||||
<root id="src.core-data.dir" name="Core-Data"/> |
||||
<root id="src.core-plugins.dir" name="Core-Plugins"/> |
||||
<root id="src.terrain.dir" name="Terrain"/> |
||||
<root id="src.networking.dir" name="Networking"/> |
||||
<root id="src.desktop.dir" name="Desktop"/> |
||||
<root id="src.desktop-fx.dir" name="Desktop-FX"/> |
||||
<root id="src.games.dir" name="Games"/> |
||||
<root id="src.jbullet.dir" name="JBullet"/> |
||||
<root id="src.niftygui.dir" name="NiftyGUI"/> |
||||
<root id="src.jogg.dir" name="JOGG"/> |
||||
<root id="src.lwjgl-oal.dir" name="LWJGL-OAL"/> |
||||
<root id="src.lwjgl-ogl.dir" name="LWJGL-OGL"/> |
||||
<root id="src.ogre.dir" name="Ogre"/> |
||||
<root id="src.pack.dir" name="Pack"/> |
||||
<root id="src.jheora.dir" name="Jheora"/> |
||||
<root id="src.test.dir" name="Test"/> |
||||
<root id="src.tools.dir" name="Tools"/> |
||||
<root id="src.xml.dir" name="XML"/> |
||||
</source-roots> |
||||
<test-roots> |
||||
<root id="test.test.dir" name="Unit Test"/> |
||||
</test-roots> |
||||
</data> |
||||
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1"> |
||||
<definitions>./lib/nblibraries.properties</definitions> |
||||
</libraries> |
||||
</configuration> |
||||
</project> |
@ -0,0 +1,17 @@ |
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
||||
<html> |
||||
<head> |
||||
<title>Test page for launching the application via JNLP</title> |
||||
</head> |
||||
<body> |
||||
<h3>Test page for launching the application via JNLP</h3> |
||||
<script src="http://java.com/js/deployJava.js"></script> |
||||
<script> |
||||
deployJava.createWebStartLaunchButton("${JNLP.FILE}") |
||||
</script> |
||||
<!-- Or use the following link element to launch with the application --> |
||||
<!-- |
||||
<a href="${JNLP.FILE}">Launch the application</a> |
||||
--> |
||||
</body> |
||||
</html> |
Binary file not shown.
@ -0,0 +1,20 @@ |
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY. |
||||
* |
||||
* This class was automatically generated by the |
||||
* aapt tool from the resource data it found. It |
||||
* should not be modified by hand. |
||||
*/ |
||||
|
||||
package com.jme3; |
||||
|
||||
public final class R { |
||||
public static final class attr { |
||||
} |
||||
public static final class layout { |
||||
public static final int main=0x7f020000; |
||||
} |
||||
public static final class string { |
||||
public static final int app_name=0x7f030000; |
||||
public static final int jme3_appclass=0x7f030001; |
||||
} |
||||
} |
@ -0,0 +1,72 @@ |
||||
package com.jme3.app; |
||||
|
||||
import android.app.Activity; |
||||
import android.content.res.Resources; |
||||
import android.opengl.GLSurfaceView; |
||||
import android.os.Bundle; |
||||
import android.view.Window; |
||||
import android.view.WindowManager; |
||||
import com.jme3.R; |
||||
import com.jme3.system.AppSettings; |
||||
import com.jme3.system.JmeSystem; |
||||
import com.jme3.system.android.OGLESContext; |
||||
|
||||
/** |
||||
* |
||||
* @author Kirill |
||||
*/ |
||||
public class AndroidHarness extends Activity { |
||||
|
||||
private OGLESContext ctx; |
||||
private GLSurfaceView view; |
||||
|
||||
@Override |
||||
public void onCreate(Bundle savedInstanceState) { |
||||
super.onCreate(savedInstanceState); |
||||
|
||||
JmeSystem.setResources(getResources()); |
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE); |
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, |
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
||||
|
||||
AppSettings settings = new AppSettings(true); |
||||
|
||||
// String appClass = getResources().getString(R.string.jme3_appclass);
|
||||
String appClass = "jme3test.android.Test"; |
||||
Application app = null; |
||||
try{ |
||||
Class<? extends Application> clazz = (Class<? extends Application>) Class.forName(appClass); |
||||
app = clazz.newInstance(); |
||||
}catch (Exception ex){ |
||||
ex.printStackTrace(); |
||||
} |
||||
|
||||
app.setSettings(settings); |
||||
app.start(); |
||||
|
||||
ctx = (OGLESContext) app.getContext(); |
||||
view = ctx.createView(this); |
||||
setContentView(view); |
||||
} |
||||
|
||||
@Override |
||||
protected void onResume() { |
||||
super.onResume(); |
||||
view.onResume(); |
||||
} |
||||
|
||||
@Override |
||||
protected void onPause() { |
||||
super.onPause(); |
||||
view.onPause(); |
||||
} |
||||
|
||||
// @Override
|
||||
// protected void onDestroy(){
|
||||
// super.onDestroy();
|
||||
|
||||
// Debug.stopMethodTracing();
|
||||
// }
|
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY. |
||||
* |
||||
* This class was automatically generated by the |
||||
* aapt tool from the resource data it found. It |
||||
* should not be modified by hand. |
||||
*/ |
||||
|
||||
package com.jme3.app; |
||||
|
||||
public final class R { |
||||
public static final class attr { |
||||
} |
||||
public static final class layout { |
||||
public static final int main=0x7f020000; |
||||
} |
||||
public static final class string { |
||||
public static final int app_name=0x7f030000; |
||||
public static final int jme3_appclass=0x7f030001; |
||||
} |
||||
} |
@ -0,0 +1,269 @@ |
||||
package com.jme3.asset; |
||||
|
||||
import com.jme3.asset.plugins.AndroidLocator; |
||||
import com.jme3.audio.AudioData; |
||||
import com.jme3.audio.AudioKey; |
||||
import com.jme3.export.binary.BinaryExporter; |
||||
import com.jme3.export.binary.BinaryImporter; |
||||
import com.jme3.font.BitmapFont; |
||||
import com.jme3.font.plugins.BitmapFontLoader; |
||||
import com.jme3.material.Material; |
||||
import com.jme3.material.plugins.J3MLoader; |
||||
import com.jme3.scene.Spatial; |
||||
import com.jme3.shader.Shader; |
||||
import com.jme3.shader.ShaderKey; |
||||
import com.jme3.shader.plugins.GLSLLoader; |
||||
import com.jme3.texture.Image; |
||||
import com.jme3.texture.Texture; |
||||
import com.jme3.texture.plugins.AndroidImageLoader; |
||||
import java.io.File; |
||||
import java.io.FileInputStream; |
||||
import java.io.FileOutputStream; |
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.io.OutputStream; |
||||
import java.util.HashMap; |
||||
import java.util.logging.Level; |
||||
import java.util.logging.Logger; |
||||
|
||||
/** |
||||
* AssetManager for Android |
||||
* |
||||
* @author Kirill Vainer |
||||
*/ |
||||
public final class AndroidAssetManager implements AssetManager { |
||||
|
||||
private static final Logger logger = Logger.getLogger(AndroidAssetManager.class.getName()); |
||||
|
||||
private final AndroidLocator locator = new AndroidLocator(); |
||||
private final AndroidImageLoader imageLoader = new AndroidImageLoader(); |
||||
private final BinaryImporter modelLoader = new BinaryImporter(); |
||||
private final BitmapFontLoader fontLoader = new BitmapFontLoader(); |
||||
private final J3MLoader j3mLoader = new J3MLoader(); |
||||
private final J3MLoader j3mdLoader = new J3MLoader(); |
||||
private final GLSLLoader glslLoader = new GLSLLoader(); |
||||
|
||||
private final BinaryExporter exporter = new BinaryExporter(); |
||||
private final HashMap<AssetKey, Object> cache = new HashMap<AssetKey, Object>(); |
||||
|
||||
public AndroidAssetManager(){ |
||||
this(false); |
||||
} |
||||
|
||||
public AndroidAssetManager(boolean loadDefaults){ |
||||
if (loadDefaults){ |
||||
// AssetConfig cfg = new AssetConfig(this);
|
||||
// InputStream stream = AssetManager.class.getResourceAsStream("Desktop.cfg");
|
||||
// try{
|
||||
// cfg.loadText(stream);
|
||||
// }catch (IOException ex){
|
||||
// logger.log(Level.SEVERE, "Failed to load asset config", ex);
|
||||
// }finally{
|
||||
// if (stream != null)
|
||||
// try{
|
||||
// stream.close();
|
||||
// }catch (IOException ex){
|
||||
// }
|
||||
// }
|
||||
} |
||||
logger.info("AndroidAssetManager created."); |
||||
} |
||||
|
||||
public void registerLoader(String loaderClass, String ... extensions){ |
||||
} |
||||
|
||||
public void registerLocator(String rootPath, String locatorClass, String ... extensions){ |
||||
} |
||||
|
||||
private Object tryLoadFromHD(AssetKey key){ |
||||
if (!key.getExtension().equals("fnt")) |
||||
return null; |
||||
|
||||
File f = new File("/sdcard/" + key.getName() + ".opt"); |
||||
if (!f.exists()) |
||||
return null; |
||||
|
||||
try { |
||||
InputStream stream = new FileInputStream(f); |
||||
BitmapFont font = (BitmapFont) modelLoader.load(stream, null, null); |
||||
stream.close(); |
||||
return font; |
||||
} catch (IOException ex){ |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
private void tryPutToHD(AssetKey key, Object data){ |
||||
if (!key.getExtension().equals("fnt")) |
||||
return; |
||||
|
||||
File f = new File("/sdcard/" + key.getName() + ".opt"); |
||||
|
||||
try { |
||||
BitmapFont font = (BitmapFont) data; |
||||
OutputStream stream = new FileOutputStream(f); |
||||
exporter.save(font, stream); |
||||
stream.close(); |
||||
} catch (IOException ex){ |
||||
} |
||||
} |
||||
|
||||
public Object loadAsset(AssetKey key){ |
||||
logger.info("loadAsset(" + key + ")"); |
||||
Object asset; |
||||
// Object asset = tryLoadFromHD(key);
|
||||
// if (asset != null)
|
||||
// return asset;
|
||||
|
||||
if (key.shouldCache()){ |
||||
asset = cache.get(key); |
||||
if (asset != null) |
||||
return key.createClonedInstance(asset); |
||||
} |
||||
// find resource
|
||||
AssetInfo info = locator.locate(this, key); |
||||
if (info == null){ |
||||
logger.log(Level.WARNING, "Cannot locate resource: "+key.getName()); |
||||
return null; |
||||
} |
||||
|
||||
String ex = key.getExtension(); |
||||
logger.log(Level.INFO, "Loading asset: "+key.getName()); |
||||
try{ |
||||
if (ex.equals("png") || ex.equals("jpg") |
||||
|| ex.equals("jpeg") || ex.equals("j3i")){ |
||||
Image image; |
||||
if (ex.equals("j3i")){ |
||||
image = (Image) modelLoader.load(info); |
||||
}else{ |
||||
image = (Image) imageLoader.load(info); |
||||
} |
||||
TextureKey tkey = (TextureKey) key; |
||||
asset = image; |
||||
Texture tex = (Texture) tkey.postProcess(asset); |
||||
tex.setMagFilter(Texture.MagFilter.Nearest); |
||||
tex.setAnisotropicFilter(0); |
||||
if (tex.getMinFilter().usesMipMapLevels()){ |
||||
tex.setMinFilter(Texture.MinFilter.NearestNearestMipMap); |
||||
}else{ |
||||
tex.setMinFilter(Texture.MinFilter.NearestNoMipMaps); |
||||
} |
||||
asset = tex; |
||||
}else if (ex.equals("j3o")){ |
||||
asset = modelLoader.load(info); |
||||
}else if (ex.equals("fnt")){ |
||||
asset = fontLoader.load(info); |
||||
}else if (ex.equals("j3md")){ |
||||
asset = j3mdLoader.load(info); |
||||
}else if (ex.equals("j3m")){ |
||||
asset = j3mLoader.load(info); |
||||
}else{ |
||||
logger.info("loading asset as glsl shader ..."); |
||||
asset = glslLoader.load(info); |
||||
// logger.log(Level.WARNING, "No loader registered for type: "+ex);
|
||||
// return null;
|
||||
} |
||||
|
||||
if (key.shouldCache()) |
||||
cache.put(key, asset); |
||||
|
||||
// tryPutToHD(key, asset);
|
||||
|
||||
return key.createClonedInstance(asset); |
||||
} catch (Exception e){ |
||||
logger.log(Level.WARNING, "Failed to load resource: "+key.getName(), e); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public AssetInfo locateAsset(AssetKey<?> key){ |
||||
AssetInfo info = locator.locate(this, key); |
||||
if (info == null){ |
||||
logger.log(Level.WARNING, "Cannot locate resource: "+key.getName()); |
||||
return null; |
||||
} |
||||
return info; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
public Object loadAsset(String name) { |
||||
return loadAsset(new AssetKey(name)); |
||||
} |
||||
|
||||
public Spatial loadModel(String name) { |
||||
return (Spatial) loadAsset(name); |
||||
} |
||||
|
||||
public Material loadMaterial(String name) { |
||||
return (Material) loadAsset(name); |
||||
} |
||||
|
||||
public BitmapFont loadFont(String name){ |
||||
return (BitmapFont) loadAsset(name); |
||||
} |
||||
|
||||
public Texture loadTexture(TextureKey key){ |
||||
return (Texture) loadAsset(key); |
||||
} |
||||
|
||||
public Texture loadTexture(String name){ |
||||
return loadTexture(new TextureKey(name, false)); |
||||
} |
||||
|
||||
public Shader loadShader(ShaderKey key){ |
||||
logger.info("loadShader(" + key + ")"); |
||||
|
||||
String vertName = key.getVertName(); |
||||
String fragName = key.getFragName(); |
||||
|
||||
String vertSource = (String) loadAsset(new AssetKey(vertName)); |
||||
String fragSource = (String) loadAsset(new AssetKey(fragName)); |
||||
|
||||
Shader s = new Shader(key.getLanguage()); |
||||
s.addSource(Shader.ShaderType.Vertex, vertName, vertSource, key.getDefines().getCompiled()); |
||||
s.addSource(Shader.ShaderType.Fragment, fragName, fragSource, key.getDefines().getCompiled()); |
||||
|
||||
logger.info("returing shader: [" + s + "]"); |
||||
return s; |
||||
} |
||||
|
||||
|
||||
public void registerLocator(String rootPath, String locatorClassName) { |
||||
throw new UnsupportedOperationException("Not supported yet."); |
||||
} |
||||
|
||||
public AudioData loadAudio(AudioKey key) { |
||||
throw new UnsupportedOperationException("Not supported yet."); |
||||
} |
||||
|
||||
public AudioData loadAudio(String name) { |
||||
throw new UnsupportedOperationException("Not supported yet."); |
||||
} |
||||
|
||||
public Spatial loadModel(ModelKey key) { |
||||
throw new UnsupportedOperationException("Not supported yet."); |
||||
} |
||||
|
||||
/* new */ |
||||
|
||||
private AssetEventListener eventListener = null; |
||||
|
||||
public void setAssetEventListener(AssetEventListener listener){ |
||||
eventListener = listener; |
||||
} |
||||
|
||||
public void registerLocator(String rootPath, Class<? extends AssetLocator> locatorClass){ |
||||
logger.warning("not implemented."); |
||||
} |
||||
|
||||
public void registerLoader(Class<? extends AssetLoader> loader, String ... extensions){ |
||||
logger.warning("not implemented."); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,62 @@ |
||||
package com.jme3.asset.plugins; |
||||
|
||||
import android.content.res.AssetManager; |
||||
import android.content.res.Resources; |
||||
import com.jme3.asset.AssetInfo; |
||||
import com.jme3.asset.AssetKey; |
||||
import com.jme3.asset.AssetLocator; |
||||
import com.jme3.system.JmeSystem; |
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.util.logging.Logger; |
||||
|
||||
public class AndroidLocator implements AssetLocator { |
||||
|
||||
private static final Logger logger = Logger.getLogger(AndroidLocator.class.getName()); |
||||
private Resources resources; |
||||
private AssetManager androidManager; |
||||
|
||||
private class AndroidAssetInfo extends AssetInfo { |
||||
|
||||
private final InputStream in; |
||||
|
||||
public AndroidAssetInfo(com.jme3.asset.AssetManager manager, AssetKey key, |
||||
InputStream in){ |
||||
super(manager, key); |
||||
this.in = in; |
||||
} |
||||
|
||||
@Override |
||||
public InputStream openStream() { |
||||
return in; |
||||
} |
||||
} |
||||
|
||||
|
||||
public AndroidLocator(){ |
||||
resources = JmeSystem.getResources(); |
||||
androidManager = resources.getAssets(); |
||||
} |
||||
|
||||
public void setRootPath(String rootPath) { |
||||
} |
||||
|
||||
public AssetInfo locate(com.jme3.asset.AssetManager manager, AssetKey key) { |
||||
InputStream in = null; |
||||
try { |
||||
in = androidManager.open(key.getName()); |
||||
if (in == null) |
||||
return null; |
||||
|
||||
return new AndroidAssetInfo(manager, key, in); |
||||
} catch (IOException ex) { |
||||
if (in != null) |
||||
try { |
||||
in.close(); |
||||
} catch (IOException ex1) { |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,448 @@ |
||||
package com.jme3.input.android; |
||||
|
||||
import java.util.List; |
||||
import java.util.ArrayList; |
||||
|
||||
import android.content.Context; |
||||
import android.opengl.GLSurfaceView; |
||||
import android.util.AttributeSet; |
||||
import android.view.KeyEvent; |
||||
import android.view.MotionEvent; |
||||
import com.jme3.input.KeyInput; |
||||
import com.jme3.input.MouseInput; |
||||
import com.jme3.input.RawInputListener; |
||||
import com.jme3.input.event.KeyInputEvent; |
||||
import com.jme3.input.event.MouseButtonEvent; |
||||
import com.jme3.input.event.MouseMotionEvent; |
||||
|
||||
public class AndroidInput extends GLSurfaceView implements KeyInput, MouseInput { |
||||
|
||||
private RawInputListener listener; |
||||
private int lastX = -1, lastY = -1; |
||||
|
||||
private static final char[] ANDROID_TO_JME_CHR = { |
||||
0x0,// unknown
|
||||
0x0,// soft left
|
||||
0x0,// soft right
|
||||
0x0,// home
|
||||
0x0,// back
|
||||
0x0,// call
|
||||
0x0,// endcall
|
||||
'0', |
||||
'1', |
||||
'2', |
||||
'3', |
||||
'4', |
||||
'5', |
||||
'6', |
||||
'7', |
||||
'8', |
||||
'9', |
||||
'*', |
||||
'#', |
||||
0x0,//dpad_up
|
||||
0x0,//dpad_down
|
||||
0x0,//dpad_left
|
||||
0x0,//dpad_right
|
||||
0x0,//dpad_center
|
||||
0x0,//volume up
|
||||
0x0,//volume down
|
||||
0x0,//power
|
||||
0x0,//camera
|
||||
0x0,//clear
|
||||
'a', |
||||
'b', |
||||
'c', |
||||
'd', |
||||
'e', |
||||
'f', |
||||
'g', |
||||
'h', |
||||
'i', |
||||
'j', |
||||
'k', |
||||
'l', |
||||
'm', |
||||
'n', |
||||
'o', |
||||
'p', |
||||
'q', |
||||
'r', |
||||
's', |
||||
't', |
||||
'u', |
||||
'v', |
||||
'w', |
||||
'x', |
||||
'y', |
||||
'z', |
||||
',', |
||||
'.', |
||||
|
||||
0x0,//left alt
|
||||
0x0,//right alt
|
||||
0x0,//left ctrl
|
||||
0x0,//right ctrl
|
||||
|
||||
// 0x0,//fn
|
||||
// 0x0,//cap
|
||||
|
||||
'\t', |
||||
' ', |
||||
0x0,//sym(bol)
|
||||
0x0,//explorer
|
||||
0x0,//envelope
|
||||
'\n',//newline
|
||||
0x0,//delete
|
||||
'`', |
||||
'-', |
||||
'=', |
||||
'[', |
||||
']', |
||||
'\\',//backslash
|
||||
';', |
||||
'\'',//apostrophe
|
||||
'/',//slash
|
||||
'@',//at
|
||||
0x0,//num
|
||||
0x0,//headset hook
|
||||
0x0,//focus
|
||||
0x0, |
||||
0x0,//menu
|
||||
0x0,//notification
|
||||
0x0,//search
|
||||
0x0,//media play/pause
|
||||
0x0,//media stop
|
||||
0x0,//media next
|
||||
0x0,//media previous
|
||||
0x0,//media rewind
|
||||
0x0,//media fastforward
|
||||
0x0,//mute
|
||||
}; |
||||
|
||||
private static final int[] ANDROID_TO_JME = { |
||||
0x0, // unknown
|
||||
0x0, // key code soft left
|
||||
0x0, // key code soft right
|
||||
KeyInput.KEY_HOME, |
||||
KeyInput.KEY_ESCAPE, // key back
|
||||
0x0, // key call
|
||||
0x0, // key endcall
|
||||
KeyInput.KEY_0, |
||||
KeyInput.KEY_1, |
||||
KeyInput.KEY_2, |
||||
KeyInput.KEY_3, |
||||
KeyInput.KEY_4, |
||||
KeyInput.KEY_5, |
||||
KeyInput.KEY_6, |
||||
KeyInput.KEY_7, |
||||
KeyInput.KEY_8, |
||||
KeyInput.KEY_9, |
||||
KeyInput.KEY_MULTIPLY, |
||||
0x0, // key pound
|
||||
KeyInput.KEY_UP, |
||||
KeyInput.KEY_DOWN, |
||||
KeyInput.KEY_LEFT, |
||||
KeyInput.KEY_RIGHT, |
||||
KeyInput.KEY_RETURN, // dpad center
|
||||
0x0, // volume up
|
||||
0x0, // volume down
|
||||
KeyInput.KEY_POWER, // power (?)
|
||||
0x0, // camera
|
||||
0x0, // clear
|
||||
KeyInput.KEY_A, |
||||
KeyInput.KEY_B, |
||||
KeyInput.KEY_C, |
||||
KeyInput.KEY_D, |
||||
KeyInput.KEY_E, |
||||
KeyInput.KEY_F, |
||||
KeyInput.KEY_G, |
||||
KeyInput.KEY_H, |
||||
KeyInput.KEY_I, |
||||
KeyInput.KEY_J, |
||||
KeyInput.KEY_K, |
||||
KeyInput.KEY_L, |
||||
KeyInput.KEY_M, |
||||
KeyInput.KEY_N, |
||||
KeyInput.KEY_O, |
||||
KeyInput.KEY_P, |
||||
KeyInput.KEY_Q, |
||||
KeyInput.KEY_R, |
||||
KeyInput.KEY_S, |
||||
KeyInput.KEY_T, |
||||
KeyInput.KEY_U, |
||||
KeyInput.KEY_V, |
||||
KeyInput.KEY_W, |
||||
KeyInput.KEY_X, |
||||
KeyInput.KEY_Y, |
||||
KeyInput.KEY_Z, |
||||
KeyInput.KEY_COMMA, |
||||
KeyInput.KEY_PERIOD, |
||||
|
||||
KeyInput.KEY_LMENU, |
||||
KeyInput.KEY_RMENU, |
||||
|
||||
KeyInput.KEY_LSHIFT, |
||||
KeyInput.KEY_RSHIFT, |
||||
|
||||
// 0x0, // fn
|
||||
// 0x0, // cap (?)
|
||||
|
||||
KeyInput.KEY_TAB, |
||||
KeyInput.KEY_SPACE, |
||||
0x0, // sym (?) symbol
|
||||
0x0, // explorer
|
||||
0x0, // envelope
|
||||
KeyInput.KEY_RETURN, // newline/enter
|
||||
KeyInput.KEY_DELETE, |
||||
KeyInput.KEY_GRAVE, |
||||
KeyInput.KEY_MINUS, |
||||
KeyInput.KEY_EQUALS, |
||||
|
||||
KeyInput.KEY_LBRACKET, |
||||
KeyInput.KEY_RBRACKET, |
||||
|
||||
KeyInput.KEY_BACKSLASH, |
||||
KeyInput.KEY_SEMICOLON, |
||||
KeyInput.KEY_APOSTROPHE, |
||||
KeyInput.KEY_SLASH, |
||||
KeyInput.KEY_AT, // at (@)
|
||||
KeyInput.KEY_NUMLOCK, //0x0, // num
|
||||
0x0, //headset hook
|
||||
0x0, //focus
|
||||
KeyInput.KEY_ADD, |
||||
KeyInput.KEY_LMETA, //menu
|
||||
0x0,//notification
|
||||
0x0,//search
|
||||
0x0,//media play/pause
|
||||
0x0,//media stop
|
||||
0x0,//media next
|
||||
0x0,//media previous
|
||||
0x0,//media rewind
|
||||
0x0,//media fastforward
|
||||
0x0,//mute
|
||||
}; |
||||
|
||||
// private int[] keyMap = {
|
||||
// 0x0,
|
||||
// KeyEvent.KEYCODE_BACK, // ESC key
|
||||
//
|
||||
// KeyEvent.KEYCODE_1,
|
||||
// KeyEvent.KEYCODE_2,
|
||||
// KeyEvent.KEYCODE_3,
|
||||
// KeyEvent.KEYCODE_4,
|
||||
// KeyEvent.KEYCODE_5,
|
||||
// KeyEvent.KEYCODE_6,
|
||||
// KeyEvent.KEYCODE_7,
|
||||
// KeyEvent.KEYCODE_8,
|
||||
// KeyEvent.KEYCODE_9,
|
||||
// KeyEvent.KEYCODE_0,
|
||||
// KeyEvent.KEYCODE_MINUS,
|
||||
// KeyEvent.KEYCODE_EQUALS,
|
||||
// KeyEvent.KEYCODE_BACK,
|
||||
// KeyEvent.KEYCODE_TAB,
|
||||
// KeyEvent.KEYCODE_Q,
|
||||
// KeyEvent.KEYCODE_W,
|
||||
// KeyEvent.KEYCODE_E,
|
||||
// KeyEvent.KEYCODE_R,
|
||||
// KeyEvent.KEYCODE_T,
|
||||
// KeyEvent.KEYCODE_Y,
|
||||
// KeyEvent.KEYCODE_U,
|
||||
// KeyEvent.KEYCODE_I,
|
||||
// KeyEvent.KEYCODE_O,
|
||||
// KeyEvent.KEYCODE_P,
|
||||
// KeyEvent.KEYCODE_LEFT_BRACKET,
|
||||
// KeyEvent.KEYCODE_RIGHT_BRACKET,
|
||||
// KeyEvent.KEYCODE_ENTER,
|
||||
// KeyEvent.KEYCODE_SOFT_LEFT, // Left Ctrl
|
||||
// KeyEvent.KEYCODE_A,
|
||||
// KeyEvent.KEYCODE_S,
|
||||
// KeyEvent.KEYCODE_D,
|
||||
// KeyEvent.KEYCODE_F,
|
||||
// KeyEvent.KEYCODE_G,
|
||||
// KeyEvent.KEYCODE_H,
|
||||
// KeyEvent.KEYCODE_J,
|
||||
// KeyEvent.KEYCODE_K,
|
||||
// KeyEvent.KEYCODE_L,
|
||||
// KeyEvent.KEYCODE_SEMICOLON,
|
||||
// KeyEvent.KEYCODE_APOSTROPHE,
|
||||
// KeyEvent.KEYCODE_GRAVE,
|
||||
// KeyEvent.KEYCODE_SHIFT_LEFT,
|
||||
// KeyEvent.KEYCODE_BACKSLASH,
|
||||
// KeyEvent.KEYCODE_Z,
|
||||
// KeyEvent.KEYCODE_X,
|
||||
// KeyEvent.KEYCODE_C,
|
||||
// KeyEvent.KEYCODE_V,
|
||||
// KeyEvent.KEYCODE_B,
|
||||
// KeyEvent.KEYCODE_N,
|
||||
// KeyEvent.KEYCODE_M,
|
||||
//
|
||||
// KeyEvent.KEYCODE_COMMA,
|
||||
// KeyEvent.KEYCODE_PERIOD,
|
||||
// KeyEvent.KEYCODE_SLASH,
|
||||
// KeyEvent.KEYCODE_SHIFT_RIGHT,
|
||||
// KeyEvent.KEYCODE_STAR,
|
||||
//
|
||||
// KeyEvent.KEYCODE_ALT_LEFT,
|
||||
// KeyEvent.KEYCODE_SPACE,
|
||||
//
|
||||
// 0x0, // no caps lock
|
||||
//
|
||||
// 0x0, // F1
|
||||
// 0x0, // F2
|
||||
// 0x0, // F3
|
||||
// 0x0, // F4
|
||||
// 0x0, // F5
|
||||
// 0x0, // F6
|
||||
// 0x0, // F7
|
||||
// 0x0, // F8
|
||||
// 0x0, // F9
|
||||
// 0x0, // F10
|
||||
//
|
||||
// KeyEvent.KEYCODE_NUM,
|
||||
// 0x0, // scroll lock
|
||||
//
|
||||
// 0x0, // numpad7
|
||||
// 0x0, // numpad8
|
||||
// 0x0, // numpad9
|
||||
//
|
||||
// KeyEvent.
|
||||
// }
|
||||
|
||||
public AndroidInput(Context ctx, AttributeSet attribs){ |
||||
super(ctx, attribs); |
||||
} |
||||
|
||||
public AndroidInput(Context ctx){ |
||||
super(ctx); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onTouchEvent(MotionEvent motionEvent){ |
||||
int newX = getWidth() - (int) motionEvent.getX(); |
||||
int newY = (int) motionEvent.getY(); |
||||
|
||||
|
||||
switch (motionEvent.getAction()){ |
||||
case MotionEvent.ACTION_DOWN: |
||||
MouseButtonEvent btn = new MouseButtonEvent(0, true, newX, newY); |
||||
btn.setTime(motionEvent.getEventTime()); |
||||
processEvent(btn); |
||||
// listener.onMouseButtonEvent(btn);
|
||||
lastX = -1; |
||||
lastY = -1; |
||||
return true; |
||||
case MotionEvent.ACTION_UP: |
||||
MouseButtonEvent btn2 = new MouseButtonEvent(0, false, newX, newY); |
||||
btn2.setTime(motionEvent.getEventTime()); |
||||
processEvent(btn2); |
||||
// listener.onMouseButtonEvent(btn2);
|
||||
lastX = -1; |
||||
lastY = -1; |
||||
return true; |
||||
case MotionEvent.ACTION_MOVE: |
||||
// int newX = getWidth() - (int) motionEvent.getX();
|
||||
// int newY = (int) motionEvent.getY();
|
||||
int dx; |
||||
int dy; |
||||
if (lastX != -1){ |
||||
dx = newX - lastX; |
||||
dy = newY - lastY; |
||||
}else{ |
||||
dx = 0; |
||||
dy = 0; |
||||
} |
||||
lastX = newX; |
||||
lastY = newY; |
||||
MouseMotionEvent mot = new MouseMotionEvent(newX, newY, dx, dy, 0, 0); |
||||
mot.setTime(motionEvent.getEventTime()); |
||||
processEvent(mot); |
||||
//listener.onMouseMotionEvent(mot);
|
||||
try{ |
||||
Thread.sleep(15); |
||||
} catch (InterruptedException ex) { |
||||
} |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onKeyDown (int keyCode, KeyEvent event) { |
||||
int jmeCode = ANDROID_TO_JME[keyCode]; |
||||
String str = event.getCharacters(); |
||||
char c = str != null && str.length() > 0 ? str.charAt(0) : 0x0; |
||||
KeyInputEvent evt = new KeyInputEvent(jmeCode, c, true, false); |
||||
processEvent(evt); |
||||
// listener.onKeyEvent(evt);
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onKeyUp (int keyCode, KeyEvent event) { |
||||
int jmeCode = ANDROID_TO_JME[keyCode]; |
||||
String str = event.getCharacters(); |
||||
char c = str != null && str.length() > 0 ? str.charAt(0) : 0x0; |
||||
KeyInputEvent evt = new KeyInputEvent(jmeCode, c, false, false); |
||||
processEvent(evt); |
||||
//listener.onKeyEvent(evt);
|
||||
return false; |
||||
} |
||||
|
||||
public void setCursorVisible(boolean visible){ |
||||
} |
||||
|
||||
public int getButtonCount(){ |
||||
return 255; |
||||
} |
||||
|
||||
public void initialize() { |
||||
} |
||||
|
||||
public void update() { |
||||
generateEvents(); |
||||
} |
||||
|
||||
public void destroy() { |
||||
} |
||||
|
||||
public boolean isInitialized() { |
||||
return true; |
||||
} |
||||
|
||||
// XXX: android does not have an Event interface?
|
||||
private List<Object> currentEvents = new ArrayList<Object>(); |
||||
|
||||
private final static int MAX_EVENTS = 1024; |
||||
|
||||
private void processEvent(Object event) { |
||||
synchronized (currentEvents) { |
||||
if (currentEvents.size() < MAX_EVENTS) |
||||
currentEvents.add(event); |
||||
} |
||||
} |
||||
|
||||
private void generateEvents() { |
||||
synchronized (currentEvents) { |
||||
for (Object event: currentEvents) { |
||||
if (event instanceof MouseButtonEvent) { |
||||
listener.onMouseButtonEvent((MouseButtonEvent) event); |
||||
} else if (event instanceof MouseMotionEvent) { |
||||
listener.onMouseMotionEvent((MouseMotionEvent) event); |
||||
} else if (event instanceof KeyInputEvent) { |
||||
listener.onKeyEvent((KeyInputEvent) event); |
||||
} |
||||
} |
||||
currentEvents.clear(); |
||||
} |
||||
} |
||||
|
||||
public void setInputListener(RawInputListener listener) { |
||||
this.listener = listener; |
||||
} |
||||
|
||||
public long getInputTimeNanos() { |
||||
return System.nanoTime(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,991 @@ |
||||
package com.jme3.renderer.android; |
||||
|
||||
import com.jme3.light.DirectionalLight; |
||||
import com.jme3.light.Light; |
||||
import com.jme3.light.LightList; |
||||
import com.jme3.light.PointLight; |
||||
import com.jme3.material.RenderState; |
||||
import com.jme3.math.ColorRGBA; |
||||
import com.jme3.math.Matrix4f; |
||||
import com.jme3.renderer.Caps; |
||||
import com.jme3.renderer.GLObjectManager; |
||||
import com.jme3.renderer.IDList; |
||||
import com.jme3.renderer.RenderContext; |
||||
import com.jme3.renderer.Renderer; |
||||
import com.jme3.renderer.Statistics; |
||||
import com.jme3.scene.Mesh; |
||||
import com.jme3.scene.Mesh.Mode; |
||||
import com.jme3.scene.VertexBuffer; |
||||
import com.jme3.scene.VertexBuffer.Type; |
||||
import com.jme3.scene.VertexBuffer.Usage; |
||||
import com.jme3.shader.Shader; |
||||
import com.jme3.shader.Shader.ShaderSource; |
||||
import com.jme3.texture.FrameBuffer; |
||||
import com.jme3.texture.Image; |
||||
import com.jme3.texture.Texture; |
||||
import com.jme3.texture.Texture.WrapAxis; |
||||
import com.jme3.util.BufferUtils; |
||||
import com.jme3.util.IntMap; |
||||
import com.jme3.util.IntMap.Entry; |
||||
import java.nio.Buffer; |
||||
import java.nio.ByteBuffer; |
||||
import java.nio.FloatBuffer; |
||||
import java.nio.IntBuffer; |
||||
import java.util.Collection; |
||||
import java.util.EnumSet; |
||||
import java.util.logging.Logger; |
||||
import javax.microedition.khronos.opengles.GL10; |
||||
import javax.microedition.khronos.opengles.GL11; |
||||
import javax.microedition.khronos.opengles.GL11Ext; |
||||
|
||||
public final class OGLESRenderer implements Renderer { |
||||
|
||||
private static final Logger logger = Logger.getLogger(OGLESRenderer.class.getName()); |
||||
|
||||
private Matrix4f worldMatrix = new Matrix4f(); |
||||
private Matrix4f viewMatrix = new Matrix4f(); |
||||
private Matrix4f projMatrix = new Matrix4f(); |
||||
private FloatBuffer fb16 = BufferUtils.createFloatBuffer(16); |
||||
private float[] fa16 = new float[16]; |
||||
private IntBuffer intBuf1 = BufferUtils.createIntBuffer(1); |
||||
private GL10 gl; |
||||
private GL11 gl11; |
||||
private GL11Ext glExt; |
||||
|
||||
private RenderContext context = new RenderContext(); |
||||
private GLObjectManager objManager = new GLObjectManager(); |
||||
|
||||
private EnumSet<Caps> caps = EnumSet.noneOf(Caps.class); |
||||
private boolean powerOf2 = false; |
||||
|
||||
private final Statistics statistics = new Statistics(); |
||||
private int vpX, vpY, vpW, vpH; |
||||
|
||||
public OGLESRenderer(GL10 gl){ |
||||
setGL(gl); |
||||
} |
||||
|
||||
public void setGL(GL10 gl){ |
||||
this.gl = gl; |
||||
if (gl instanceof GL11){ |
||||
gl11 = (GL11) gl; |
||||
if (gl instanceof GL11Ext){ |
||||
glExt = (GL11Ext) gl; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void initialize(){ |
||||
logger.info("Vendor: "+gl.glGetString(gl.GL_VENDOR)); |
||||
logger.info("Renderer: "+gl.glGetString(gl.GL_RENDERER)); |
||||
logger.info("Version: "+gl.glGetString(gl.GL_VERSION)); |
||||
|
||||
String extensions = gl.glGetString(gl.GL_EXTENSIONS); |
||||
if (extensions.contains("GL_OES_texture_npot")) |
||||
powerOf2 = true; |
||||
|
||||
applyRenderState(RenderState.DEFAULT); |
||||
// gl.glClearDepthf(1.0f);
|
||||
gl.glDisable(GL10.GL_DITHER); |
||||
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); |
||||
} |
||||
|
||||
public Statistics getStatistics() { |
||||
return null; |
||||
} |
||||
|
||||
public void setClipRect(int x, int y, int width, int height) { |
||||
} |
||||
|
||||
public void clearClipRect() { |
||||
} |
||||
|
||||
public void resetGLObjects() { |
||||
} |
||||
|
||||
public EnumSet<Caps> getCaps() { |
||||
return caps; |
||||
} |
||||
|
||||
public void setBackgroundColor(ColorRGBA color) { |
||||
gl.glClearColor(color.r, color.g, color.b, color.a); |
||||
} |
||||
|
||||
public void cleanup(){ |
||||
objManager.deleteAllObjects(this); |
||||
} |
||||
|
||||
public void clearBuffers(boolean color, boolean depth, boolean stencil) { |
||||
int bits = 0; |
||||
if (color) bits = gl.GL_COLOR_BUFFER_BIT; |
||||
if (depth) bits |= gl.GL_DEPTH_BUFFER_BIT; |
||||
if (stencil) bits |= gl.GL_STENCIL_BUFFER_BIT; |
||||
if (bits != 0) gl.glClear(bits); |
||||
} |
||||
|
||||
public void applyRenderState(RenderState state){ |
||||
// TODO: is wireframe supported under OGL ES?
|
||||
|
||||
// if (state.isWireframe() && !context.wireframe){
|
||||
// gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE);
|
||||
// context.wireframe = true;
|
||||
// }else if (!state.isWireframe() && context.wireframe){
|
||||
// gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL);
|
||||
// context.wireframe = false;
|
||||
// }
|
||||
|
||||
if (state.isDepthTest() && !context.depthTestEnabled){ |
||||
gl.glEnable(gl.GL_DEPTH_TEST); |
||||
gl.glDepthFunc(gl.GL_LEQUAL); |
||||
context.depthTestEnabled = true; |
||||
}else if (!state.isDepthTest() && context.depthTestEnabled){ |
||||
gl.glDisable(gl.GL_DEPTH_TEST); |
||||
context.depthTestEnabled = false; |
||||
} |
||||
if (state.isAlphaTest() && !context.alphaTestEnabled){ |
||||
gl.glEnable(gl.GL_ALPHA_TEST); |
||||
gl.glAlphaFunc(gl.GL_GREATER, state.getAlphaFallOff()); |
||||
context.alphaTestEnabled = true; |
||||
}else if (!state.isAlphaTest() && context.alphaTestEnabled){ |
||||
gl.glDisable(gl.GL_ALPHA_TEST); |
||||
context.alphaTestEnabled = false; |
||||
} |
||||
if (state.isDepthWrite() && !context.depthWriteEnabled){ |
||||
gl.glDepthMask(true); |
||||
context.depthWriteEnabled = true; |
||||
}else if (!state.isDepthWrite() && context.depthWriteEnabled){ |
||||
gl.glDepthMask(false); |
||||
context.depthWriteEnabled = false; |
||||
} |
||||
if (state.isColorWrite() && !context.colorWriteEnabled){ |
||||
gl.glColorMask(true,true,true,true); |
||||
context.colorWriteEnabled = true; |
||||
}else if (!state.isColorWrite() && context.colorWriteEnabled){ |
||||
gl.glColorMask(false,false,false,false); |
||||
context.colorWriteEnabled = false; |
||||
} |
||||
if (state.isPolyOffset()){ |
||||
if (!context.polyOffsetEnabled){ |
||||
gl.glEnable(gl.GL_POLYGON_OFFSET_FILL); |
||||
gl.glPolygonOffset(state.getPolyOffsetFactor(), |
||||
state.getPolyOffsetUnits()); |
||||
context.polyOffsetEnabled = true; |
||||
context.polyOffsetFactor = state.getPolyOffsetFactor(); |
||||
context.polyOffsetUnits = state.getPolyOffsetUnits(); |
||||
}else{ |
||||
if (state.getPolyOffsetFactor() != context.polyOffsetFactor |
||||
|| state.getPolyOffsetUnits() != context.polyOffsetUnits){ |
||||
gl.glPolygonOffset(state.getPolyOffsetFactor(), |
||||
state.getPolyOffsetUnits()); |
||||
context.polyOffsetFactor = state.getPolyOffsetFactor(); |
||||
context.polyOffsetUnits = state.getPolyOffsetUnits(); |
||||
} |
||||
} |
||||
}else{ |
||||
if (context.polyOffsetEnabled){ |
||||
gl.glDisable(gl.GL_POLYGON_OFFSET_FILL); |
||||
context.polyOffsetEnabled = false; |
||||
context.polyOffsetFactor = 0; |
||||
context.polyOffsetUnits = 0; |
||||
} |
||||
} |
||||
if (state.getFaceCullMode() != context.cullMode){ |
||||
if (state.getFaceCullMode() == RenderState.FaceCullMode.Off) |
||||
gl.glDisable(gl.GL_CULL_FACE); |
||||
else |
||||
gl.glEnable(gl.GL_CULL_FACE); |
||||
|
||||
switch (state.getFaceCullMode()){ |
||||
case Off: |
||||
break; |
||||
case Back: |
||||
gl.glCullFace(gl.GL_BACK); |
||||
break; |
||||
case Front: |
||||
gl.glCullFace(gl.GL_FRONT); |
||||
break; |
||||
case FrontAndBack: |
||||
gl.glCullFace(gl.GL_FRONT_AND_BACK); |
||||
break; |
||||
default: |
||||
throw new UnsupportedOperationException("Unrecognized face cull mode: "+ |
||||
state.getFaceCullMode()); |
||||
} |
||||
|
||||
context.cullMode = state.getFaceCullMode(); |
||||
} |
||||
|
||||
if (state.getBlendMode() != context.blendMode){ |
||||
if (state.getBlendMode() == RenderState.BlendMode.Off) |
||||
gl.glDisable(gl.GL_BLEND); |
||||
else |
||||
gl.glEnable(gl.GL_BLEND); |
||||
|
||||
switch (state.getBlendMode()){ |
||||
case Off: |
||||
break; |
||||
case Additive: |
||||
gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE); |
||||
break; |
||||
case Alpha: |
||||
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA); |
||||
break; |
||||
case PremultAlpha: |
||||
gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA); |
||||
break; |
||||
case Modulate: |
||||
gl.glBlendFunc(gl.GL_DST_COLOR, gl.GL_ZERO); |
||||
break; |
||||
case ModulateX2: |
||||
gl.glBlendFunc(gl.GL_DST_COLOR, gl.GL_SRC_COLOR); |
||||
break; |
||||
default: |
||||
throw new UnsupportedOperationException("Unrecognized blend mode: "+ |
||||
state.getBlendMode()); |
||||
} |
||||
|
||||
context.blendMode = state.getBlendMode(); |
||||
} |
||||
} |
||||
|
||||
public void onFrame() { |
||||
objManager.deleteUnused(this); |
||||
} |
||||
|
||||
public void setDepthRange(float start, float end) { |
||||
gl.glDepthRangef(start, end); |
||||
} |
||||
|
||||
public void setViewPort(int x, int y, int width, int height){ |
||||
gl.glViewport(x, y, width, height); |
||||
vpX = x; |
||||
vpY = y; |
||||
vpW = width; |
||||
vpH = height; |
||||
} |
||||
|
||||
public void setViewProjectionMatrices(Matrix4f viewMatrix, Matrix4f projMatrix){ |
||||
this.viewMatrix.set(viewMatrix); |
||||
this.projMatrix.set(projMatrix); |
||||
|
||||
if (context.matrixMode != gl.GL_PROJECTION){ |
||||
gl.glMatrixMode(gl.GL_PROJECTION); |
||||
context.matrixMode = gl.GL_PROJECTION; |
||||
} |
||||
|
||||
projMatrix.fillFloatArray(fa16, true); |
||||
gl.glLoadMatrixf(fa16, 0); |
||||
|
||||
// gl.glMatrixMode(gl.GL_MODELVIEW);
|
||||
// gl.glLoadIdentity();
|
||||
// gl.glLoadMatrixf(storeMatrix(viewMatrix, fb16));
|
||||
} |
||||
|
||||
public void setWorldMatrix(Matrix4f worldMatrix) { |
||||
this.worldMatrix.set(worldMatrix); |
||||
|
||||
if (context.matrixMode != gl.GL_MODELVIEW){ |
||||
gl.glMatrixMode(gl.GL_MODELVIEW); |
||||
context.matrixMode = gl.GL_MODELVIEW; |
||||
} |
||||
|
||||
viewMatrix.fillFloatArray(fa16, true); |
||||
gl.glLoadMatrixf(fa16, 0); |
||||
worldMatrix.fillFloatArray(fa16, true); |
||||
gl.glMultMatrixf(fa16, 0); |
||||
} |
||||
|
||||
public void setMatrixPalette(Matrix4f[] offsetMatrices){ |
||||
if (glExt == null) |
||||
throw new UnsupportedOperationException("Requires GL_OES_compressed_paletted_texture"); |
||||
|
||||
if (context.matrixMode != glExt.GL_MATRIX_PALETTE_OES){ |
||||
gl.glMatrixMode(glExt.GL_MATRIX_PALETTE_OES); |
||||
context.matrixMode = glExt.GL_MATRIX_PALETTE_OES; |
||||
} |
||||
|
||||
for (int i = 0; i < offsetMatrices.length; i++){ |
||||
Matrix4f offsetMat = offsetMatrices[i]; |
||||
glExt.glCurrentPaletteMatrixOES(i); |
||||
|
||||
offsetMat.fillFloatArray(fa16, true); |
||||
gl.glLoadMatrixf(fa16, 0); |
||||
} |
||||
} |
||||
|
||||
public void setLighting(LightList list) { |
||||
if (list.size() == 0) { |
||||
// turn off lighting
|
||||
gl.glDisable(gl.GL_LIGHTING); |
||||
return; |
||||
} |
||||
|
||||
gl.glEnable(gl.GL_LIGHTING); |
||||
gl.glShadeModel(gl.GL_SMOOTH); |
||||
|
||||
float[] temp = new float[4]; |
||||
|
||||
// reset model view to specify
|
||||
// light positions in world space
|
||||
// instead of model space
|
||||
gl.glPushMatrix(); |
||||
gl.glLoadIdentity(); |
||||
|
||||
for (int i = 0; i < list.size()+1; i++){ |
||||
if (list.size() <= i){ |
||||
// goes beyond the num lights we need
|
||||
// disable it
|
||||
gl.glDisable(gl.GL_LIGHT0 + i); |
||||
break; |
||||
} |
||||
|
||||
Light l = list.get(i); |
||||
int lightId = gl.GL_LIGHT0 + i; |
||||
|
||||
ColorRGBA color = l.getColor(); |
||||
color.toArray(temp); |
||||
|
||||
gl.glEnable(lightId); |
||||
gl.glLightfv(lightId, gl.GL_DIFFUSE, temp, 0); |
||||
gl.glLightfv(lightId, gl.GL_SPECULAR, temp, 0); |
||||
|
||||
ColorRGBA.Black.toArray(temp); |
||||
gl.glLightfv(lightId, gl.GL_AMBIENT, temp, 0); |
||||
|
||||
switch (l.getType()){ |
||||
case Directional: |
||||
DirectionalLight dl = (DirectionalLight) l; |
||||
dl.getDirection().toArray(temp); |
||||
temp[3] = 0f; // marks to GL its a directional light
|
||||
gl.glLightfv(lightId, gl.GL_POSITION, temp, 0); |
||||
break; |
||||
case Point: |
||||
PointLight pl = (PointLight) l; |
||||
pl.getPosition().toArray(temp); |
||||
temp[3] = 1f; // marks to GL its a point light
|
||||
gl.glLightfv(lightId, gl.GL_POSITION, temp, 0); |
||||
break; |
||||
} |
||||
|
||||
} |
||||
|
||||
// restore modelview to original value
|
||||
gl.glPopMatrix(); |
||||
} |
||||
|
||||
public void updateShaderSourceData(ShaderSource source) { |
||||
} |
||||
|
||||
public void deleteShaderSource(ShaderSource source) { |
||||
} |
||||
|
||||
public void updateShaderData(Shader shader) { |
||||
} |
||||
|
||||
public void setShader(Shader shader) { |
||||
} |
||||
|
||||
public void deleteShader(Shader shader) { |
||||
} |
||||
|
||||
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst) { |
||||
} |
||||
|
||||
public void setFrameBuffer(FrameBuffer fb) { |
||||
} |
||||
|
||||
public void updateFrameBuffer(FrameBuffer fb) { |
||||
} |
||||
|
||||
public void deleteFrameBuffer(FrameBuffer fb) { |
||||
} |
||||
|
||||
/** |
||||
* Warning: documentation states that this method returns data in BGRA format, |
||||
* it actually returns data in RGBA format. |
||||
* @param fb |
||||
* @param byteBuf |
||||
*/ |
||||
public void readFrameBuffer(FrameBuffer fb, ByteBuffer byteBuf) { |
||||
if (fb == null){ |
||||
gl.glReadPixels(vpX, vpY, vpW, vpH, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, byteBuf); |
||||
}else{ |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
} |
||||
|
||||
private int convertTextureType(Texture.Type type){ |
||||
switch (type){ |
||||
case TwoDimensional: |
||||
return gl.GL_TEXTURE_2D; |
||||
default: |
||||
throw new UnsupportedOperationException("Unknown texture type: "+type); |
||||
} |
||||
} |
||||
|
||||
private int convertMagFilter(Texture.MagFilter filter){ |
||||
switch (filter){ |
||||
case Bilinear: |
||||
return gl.GL_LINEAR; |
||||
case Nearest: |
||||
return gl.GL_NEAREST; |
||||
default: |
||||
throw new UnsupportedOperationException("Unknown mag filter: "+filter); |
||||
} |
||||
} |
||||
|
||||
private int convertMinFilter(Texture.MinFilter filter){ |
||||
switch (filter){ |
||||
case Trilinear: |
||||
return gl.GL_LINEAR_MIPMAP_LINEAR; |
||||
case BilinearNearestMipMap: |
||||
return gl.GL_LINEAR_MIPMAP_NEAREST; |
||||
case NearestLinearMipMap: |
||||
return gl.GL_NEAREST_MIPMAP_LINEAR; |
||||
case NearestNearestMipMap: |
||||
return gl.GL_NEAREST_MIPMAP_NEAREST; |
||||
case BilinearNoMipMaps: |
||||
return gl.GL_LINEAR; |
||||
case NearestNoMipMaps: |
||||
return gl.GL_NEAREST; |
||||
default: |
||||
throw new UnsupportedOperationException("Unknown min filter: "+filter); |
||||
} |
||||
} |
||||
|
||||
private int convertWrapMode(Texture.WrapMode mode){ |
||||
switch (mode){ |
||||
// case BorderClamp:
|
||||
// return gl.GL_CLAMP_TO_BORDER;
|
||||
// case Clamp:
|
||||
// return gl.GL_CLAMP;
|
||||
case EdgeClamp: |
||||
return gl.GL_CLAMP_TO_EDGE; |
||||
case Repeat: |
||||
return gl.GL_REPEAT; |
||||
// case MirroredRepeat:
|
||||
// return gl.GL_MIRRORED_REPEAT;
|
||||
default: |
||||
throw new UnsupportedOperationException("Unknown wrap mode: "+mode); |
||||
} |
||||
} |
||||
|
||||
public void updateTextureData(Texture tex){ |
||||
int texId = tex.getId(); |
||||
if (texId == -1){ |
||||
// create texture
|
||||
gl.glGenTextures(1, intBuf1); |
||||
texId = intBuf1.get(0); |
||||
tex.setId(texId); |
||||
objManager.registerForCleanup(tex); |
||||
} |
||||
|
||||
// bind texture
|
||||
int target = convertTextureType(tex.getType()); |
||||
if (context.boundTextures[0] != tex){ |
||||
if (context.boundTextureUnit != 0){ |
||||
gl.glActiveTexture(gl.GL_TEXTURE0); |
||||
context.boundTextureUnit = 0; |
||||
} |
||||
|
||||
gl.glBindTexture(target, texId); |
||||
context.boundTextures[0] = tex; |
||||
} |
||||
|
||||
// filter things
|
||||
int minFilter = convertMinFilter(tex.getMinFilter()); |
||||
int magFilter = convertMagFilter(tex.getMagFilter()); |
||||
gl.glTexParameterx(target, gl.GL_TEXTURE_MIN_FILTER, minFilter); |
||||
gl.glTexParameterx(target, gl.GL_TEXTURE_MAG_FILTER, magFilter); |
||||
|
||||
// repeat modes
|
||||
switch (tex.getType()){ |
||||
case TwoDimensional: |
||||
gl.glTexParameterx(target, gl.GL_TEXTURE_WRAP_T, convertWrapMode(tex.getWrap(WrapAxis.T))); |
||||
// fall down here is intentional..
|
||||
// case OneDimensional:
|
||||
gl.glTexParameterx(target, gl.GL_TEXTURE_WRAP_S, convertWrapMode(tex.getWrap(WrapAxis.S))); |
||||
break; |
||||
default: |
||||
throw new UnsupportedOperationException("Unknown texture type: "+tex.getType()); |
||||
} |
||||
|
||||
Image img = tex.getImage(); |
||||
if (img != null){ |
||||
boolean generateMips = false; |
||||
if (!img.hasMipmaps() && tex.getMinFilter().usesMipMapLevels()){ |
||||
// No pregenerated mips available,
|
||||
// generate from base level if required
|
||||
if (gl11 != null){ |
||||
gl.glTexParameterx(target, GL11.GL_GENERATE_MIPMAP, gl.GL_TRUE); |
||||
}else{ |
||||
generateMips = true; |
||||
} |
||||
} |
||||
|
||||
TextureUtil.uploadTexture(gl, img, tex.getImageDataIndex(), generateMips, powerOf2); |
||||
} |
||||
|
||||
tex.clearUpdateNeeded(); |
||||
} |
||||
|
||||
private void checkTexturingUsed(){ |
||||
IDList textureList = context.textureIndexList; |
||||
// old mesh used texturing, new mesh doesn't use it
|
||||
// should actually go through entire oldLen and
|
||||
// disable texturing for each unit.. but that's for later.
|
||||
if (textureList.oldLen > 0 && textureList.newLen == 0){ |
||||
gl.glDisable(gl.GL_TEXTURE_2D); |
||||
} |
||||
} |
||||
|
||||
public void setTexture(int unit, Texture tex){ |
||||
if (tex.isUpdateNeeded()) |
||||
updateTextureData(tex); |
||||
|
||||
int texId = tex.getId(); |
||||
assert texId != -1; |
||||
|
||||
Texture[] textures = context.boundTextures; |
||||
|
||||
int type = convertTextureType(tex.getType()); |
||||
if (!context.textureIndexList.moveToNew(unit)){ |
||||
if (context.boundTextureUnit != unit){ |
||||
gl.glActiveTexture(gl.GL_TEXTURE0 + unit); |
||||
context.boundTextureUnit = unit; |
||||
} |
||||
|
||||
gl.glEnable(type); |
||||
} |
||||
|
||||
if (textures[unit] != tex){ |
||||
if (context.boundTextureUnit != unit){ |
||||
gl.glActiveTexture(gl.GL_TEXTURE0 + unit); |
||||
context.boundTextureUnit = unit; |
||||
} |
||||
|
||||
gl.glBindTexture(type, texId); |
||||
textures[unit] = tex; |
||||
} |
||||
} |
||||
|
||||
public void clearTextureUnits(){ |
||||
IDList textureList = context.textureIndexList; |
||||
Texture[] textures = context.boundTextures; |
||||
for (int i = 0; i < textureList.oldLen; i++){ |
||||
int idx = textureList.oldList[i]; |
||||
|
||||
if (context.boundTextureUnit != idx){ |
||||
gl.glActiveTexture(gl.GL_TEXTURE0 + idx); |
||||
context.boundTextureUnit = idx; |
||||
} |
||||
gl.glDisable(convertTextureType(textures[idx].getType())); |
||||
textures[idx] = null; |
||||
} |
||||
context.textureIndexList.copyNewToOld(); |
||||
} |
||||
|
||||
public void deleteTexture(Texture tex){ |
||||
int texId = tex.getId(); |
||||
if (texId != -1){ |
||||
intBuf1.put(0, texId); |
||||
intBuf1.position(0).limit(1); |
||||
gl.glDeleteTextures(1, intBuf1); |
||||
tex.resetObject(); |
||||
} |
||||
} |
||||
|
||||
private int convertUsage(Usage usage){ |
||||
switch (usage){ |
||||
case Static: |
||||
return gl11.GL_STATIC_DRAW; |
||||
case Dynamic: |
||||
case Stream: |
||||
return gl11.GL_DYNAMIC_DRAW; |
||||
default: |
||||
throw new RuntimeException("Unknown usage type: "+usage); |
||||
} |
||||
} |
||||
|
||||
public void updateBufferData(VertexBuffer vb) { |
||||
int bufId = vb.getId(); |
||||
if (bufId == -1){ |
||||
// create buffer
|
||||
gl11.glGenBuffers(1, intBuf1); |
||||
bufId = intBuf1.get(0); |
||||
vb.setId(bufId); |
||||
objManager.registerForCleanup(vb); |
||||
} |
||||
|
||||
int target; |
||||
if (vb.getBufferType() == VertexBuffer.Type.Index){ |
||||
target = gl11.GL_ELEMENT_ARRAY_BUFFER; |
||||
if (context.boundElementArrayVBO != bufId){ |
||||
gl11.glBindBuffer(target, bufId); |
||||
context.boundElementArrayVBO = bufId; |
||||
} |
||||
}else{ |
||||
target = gl11.GL_ARRAY_BUFFER; |
||||
if (context.boundArrayVBO != bufId){ |
||||
gl11.glBindBuffer(target, bufId); |
||||
context.boundArrayVBO = bufId; |
||||
} |
||||
} |
||||
|
||||
int usage = convertUsage(vb.getUsage()); |
||||
Buffer data = vb.getData(); |
||||
data.rewind(); |
||||
|
||||
gl11.glBufferData(target, |
||||
data.capacity() * vb.getFormat().getComponentSize(), |
||||
data, |
||||
usage); |
||||
|
||||
vb.clearUpdateNeeded(); |
||||
} |
||||
|
||||
public void deleteBuffer(VertexBuffer vb) { |
||||
int bufId = vb.getId(); |
||||
if (bufId != -1){ |
||||
// delete buffer
|
||||
intBuf1.put(0, bufId); |
||||
intBuf1.position(0).limit(1); |
||||
gl11.glDeleteBuffers(1, intBuf1); |
||||
vb.resetObject(); |
||||
} |
||||
} |
||||
|
||||
private int convertArrayType(VertexBuffer.Type type){ |
||||
switch (type){ |
||||
case Position: |
||||
return gl.GL_VERTEX_ARRAY; |
||||
case Normal: |
||||
return gl.GL_NORMAL_ARRAY; |
||||
case TexCoord: |
||||
return gl.GL_TEXTURE_COORD_ARRAY; |
||||
case Color: |
||||
return gl.GL_COLOR_ARRAY; |
||||
default: |
||||
return -1; // unsupported
|
||||
} |
||||
} |
||||
|
||||
private int convertVertexFormat(VertexBuffer.Format fmt){ |
||||
switch (fmt){ |
||||
case Byte: |
||||
return gl.GL_BYTE; |
||||
case Float: |
||||
return gl.GL_FLOAT; |
||||
case Short: |
||||
return gl.GL_SHORT; |
||||
case UnsignedByte: |
||||
return gl.GL_UNSIGNED_BYTE; |
||||
case UnsignedShort: |
||||
return gl.GL_UNSIGNED_SHORT; |
||||
case Int: |
||||
return gl.GL_FIXED; |
||||
default: |
||||
throw new UnsupportedOperationException("Unrecognized vertex format: "+fmt); |
||||
} |
||||
} |
||||
|
||||
private int convertElementMode(Mesh.Mode mode){ |
||||
switch (mode){ |
||||
case Points: |
||||
return gl.GL_POINTS; |
||||
case Lines: |
||||
return gl.GL_LINES; |
||||
case LineLoop: |
||||
return gl.GL_LINE_LOOP; |
||||
case LineStrip: |
||||
return gl.GL_LINE_STRIP; |
||||
case Triangles: |
||||
return gl.GL_TRIANGLES; |
||||
case TriangleFan: |
||||
return gl.GL_TRIANGLE_FAN; |
||||
case TriangleStrip: |
||||
return gl.GL_TRIANGLE_STRIP; |
||||
default: |
||||
throw new UnsupportedOperationException("Unrecognized mesh mode: "+mode); |
||||
} |
||||
} |
||||
|
||||
private void setVertexAttribVBO(VertexBuffer vb, VertexBuffer idb){ |
||||
int arrayType = convertArrayType(vb.getBufferType()); |
||||
if (arrayType == -1) |
||||
return; // unsupported
|
||||
|
||||
if (vb.isUpdateNeeded() && idb == null) |
||||
updateBufferData(vb); |
||||
|
||||
int bufId = idb != null ? idb.getId() : vb.getId(); |
||||
if (context.boundArrayVBO != bufId){ |
||||
gl11.glBindBuffer(gl11.GL_ARRAY_BUFFER, bufId); |
||||
context.boundArrayVBO = bufId; |
||||
} |
||||
|
||||
gl.glEnableClientState(arrayType); |
||||
context.boundAttribs[vb.getBufferType().ordinal()] = vb; |
||||
|
||||
if (vb.getBufferType() == Type.Normal){ |
||||
// normalize if requested
|
||||
if (vb.isNormalized() && !context.normalizeEnabled){ |
||||
gl.glEnable(gl.GL_NORMALIZE); |
||||
context.normalizeEnabled = true; |
||||
}else if (!vb.isNormalized() && context.normalizeEnabled){ |
||||
gl.glDisable(gl.GL_NORMALIZE); |
||||
context.normalizeEnabled = false; |
||||
} |
||||
} |
||||
|
||||
int comps = vb.getNumComponents(); |
||||
int type = convertVertexFormat(vb.getFormat()); |
||||
|
||||
switch (vb.getBufferType()){ |
||||
case Position: |
||||
gl11.glVertexPointer(comps, type, vb.getStride(), vb.getOffset()); |
||||
break; |
||||
case Normal: |
||||
gl11.glNormalPointer(type, vb.getStride(), vb.getOffset()); |
||||
break; |
||||
case Color: |
||||
gl11.glColorPointer(comps, type, vb.getStride(), vb.getOffset()); |
||||
break; |
||||
case TexCoord: |
||||
gl11.glTexCoordPointer(comps, type, vb.getStride(), vb.getOffset()); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
private void drawTriangleListVBO(VertexBuffer indexBuf, Mesh mesh, int count){ |
||||
if (indexBuf.getBufferType() != VertexBuffer.Type.Index) |
||||
throw new IllegalArgumentException("Only index buffers are allowed as triangle lists."); |
||||
|
||||
if (indexBuf.isUpdateNeeded()) |
||||
updateBufferData(indexBuf); |
||||
|
||||
int bufId = indexBuf.getId(); |
||||
assert bufId != -1; |
||||
|
||||
if (context.boundElementArrayVBO != bufId){ |
||||
gl11.glBindBuffer(gl11.GL_ELEMENT_ARRAY_BUFFER, bufId); |
||||
context.boundElementArrayVBO = bufId; |
||||
} |
||||
|
||||
if (mesh.getMode() == Mode.Hybrid){ |
||||
int[] modeStart = mesh.getModeStart(); |
||||
int[] elementLengths = mesh.getElementLengths(); |
||||
|
||||
int elMode = convertElementMode(Mode.Triangles); |
||||
int fmt = convertVertexFormat(indexBuf.getFormat()); |
||||
int elSize = indexBuf.getFormat().getComponentSize(); |
||||
// int listStart = modeStart[0];
|
||||
int stripStart = modeStart[1]; |
||||
int fanStart = modeStart[2]; |
||||
int curOffset = 0; |
||||
for (int i = 0; i < elementLengths.length; i++){ |
||||
if (i == stripStart){ |
||||
elMode = convertElementMode(Mode.TriangleStrip); |
||||
}else if (i == fanStart){ |
||||
elMode = convertElementMode(Mode.TriangleStrip); |
||||
} |
||||
int elementLength = elementLengths[i]; |
||||
gl11.glDrawElements(elMode, |
||||
elementLength, |
||||
fmt, |
||||
curOffset); |
||||
curOffset += elementLength * elSize; |
||||
} |
||||
}else{ |
||||
gl11.glDrawElements(convertElementMode(mesh.getMode()), |
||||
indexBuf.getData().capacity(), |
||||
convertVertexFormat(indexBuf.getFormat()), |
||||
0); |
||||
} |
||||
} |
||||
|
||||
public void setVertexAttrib(VertexBuffer vb, VertexBuffer idb) { |
||||
int arrayType = convertArrayType(vb.getBufferType()); |
||||
if (arrayType == -1) |
||||
return; // unsupported
|
||||
|
||||
gl.glEnableClientState(arrayType); |
||||
context.boundAttribs[vb.getBufferType().ordinal()] = vb; |
||||
|
||||
if (vb.getBufferType() == Type.Normal){ |
||||
// normalize if requested
|
||||
if (vb.isNormalized() && !context.normalizeEnabled){ |
||||
gl.glEnable(gl.GL_NORMALIZE); |
||||
context.normalizeEnabled = true; |
||||
}else if (!vb.isNormalized() && context.normalizeEnabled){ |
||||
gl.glDisable(gl.GL_NORMALIZE); |
||||
context.normalizeEnabled = false; |
||||
} |
||||
} |
||||
|
||||
// NOTE: Use data from interleaved buffer if specified
|
||||
Buffer data = idb != null ? idb.getData() : vb.getData(); |
||||
int comps = vb.getNumComponents(); |
||||
int type = convertVertexFormat(vb.getFormat()); |
||||
data.clear(); |
||||
data.position(vb.getOffset()); |
||||
|
||||
switch (vb.getBufferType()){ |
||||
case Position: |
||||
gl.glVertexPointer(comps, type, vb.getStride(), data); |
||||
break; |
||||
case Normal: |
||||
gl.glNormalPointer(type, vb.getStride(), data); |
||||
break; |
||||
case Color: |
||||
gl.glColorPointer(comps, type, vb.getStride(), data); |
||||
break; |
||||
case TexCoord: |
||||
gl.glTexCoordPointer(comps, type, vb.getStride(), data); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
public void setVertexAttrib(VertexBuffer vb){ |
||||
setVertexAttrib(vb, null); |
||||
} |
||||
|
||||
public void clearVertexAttribs() { |
||||
for (int i = 0; i < 16; i++){ |
||||
VertexBuffer vb = context.boundAttribs[i]; |
||||
if (vb != null){ |
||||
int arrayType = convertArrayType(vb.getBufferType()); |
||||
gl.glDisableClientState(arrayType); |
||||
context.boundAttribs[vb.getBufferType().ordinal()] = null; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void drawTriangleList(VertexBuffer indexBuf, Mesh mesh, int count) { |
||||
Mesh.Mode mode = mesh.getMode(); |
||||
|
||||
Buffer indexData = indexBuf.getData(); |
||||
indexData.clear(); |
||||
if (mesh.getMode() == Mode.Hybrid){ |
||||
int[] modeStart = mesh.getModeStart(); |
||||
int[] elementLengths = mesh.getElementLengths(); |
||||
|
||||
int elMode = convertElementMode(Mode.Triangles); |
||||
int fmt = convertVertexFormat(indexBuf.getFormat()); |
||||
// int elSize = indexBuf.getFormat().getComponentSize();
|
||||
// int listStart = modeStart[0];
|
||||
int stripStart = modeStart[1]; |
||||
int fanStart = modeStart[2]; |
||||
int curOffset = 0; |
||||
for (int i = 0; i < elementLengths.length; i++){ |
||||
if (i == stripStart){ |
||||
elMode = convertElementMode(Mode.TriangleStrip); |
||||
}else if (i == fanStart){ |
||||
elMode = convertElementMode(Mode.TriangleStrip); |
||||
} |
||||
int elementLength = elementLengths[i]; |
||||
indexData.position(curOffset); |
||||
gl.glDrawElements(elMode, |
||||
elementLength, |
||||
fmt, |
||||
indexData); |
||||
curOffset += elementLength; |
||||
} |
||||
}else{ |
||||
gl.glDrawElements(convertElementMode(mode), |
||||
indexData.capacity(), |
||||
convertVertexFormat(indexBuf.getFormat()), |
||||
indexData); |
||||
} |
||||
} |
||||
|
||||
private void renderMeshDefault(Mesh mesh, int lod, int count) { |
||||
VertexBuffer indices = null; |
||||
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData); |
||||
IntMap<VertexBuffer> buffers = mesh.getBuffers(); |
||||
if (mesh.getNumLodLevels() > 0){ |
||||
indices = mesh.getLodLevel(lod); |
||||
}else{ |
||||
indices = buffers.get(Type.Index.ordinal()); |
||||
} |
||||
for (Entry<VertexBuffer> entry : buffers){ |
||||
VertexBuffer vb = entry.getValue(); |
||||
|
||||
if (vb.getBufferType() == Type.InterleavedData |
||||
|| vb.getUsage() == Usage.CpuOnly) // ignore cpu-only buffers
|
||||
continue; |
||||
|
||||
if (vb.getBufferType() == Type.Index){ |
||||
indices = vb; |
||||
}else{ |
||||
if (vb.getStride() == 0){ |
||||
// not interleaved
|
||||
setVertexAttrib(vb); |
||||
}else{ |
||||
// interleaved
|
||||
setVertexAttrib(vb, interleavedData); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (indices != null){ |
||||
drawTriangleList(indices, mesh, count); |
||||
}else{ |
||||
gl.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount()); |
||||
} |
||||
clearVertexAttribs(); |
||||
clearTextureUnits(); |
||||
} |
||||
|
||||
private void renderMeshVBO(Mesh mesh, int lod, int count){ |
||||
VertexBuffer indices = null; |
||||
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData); |
||||
if (interleavedData != null && interleavedData.isUpdateNeeded()){ |
||||
updateBufferData(interleavedData); |
||||
} |
||||
IntMap<VertexBuffer> buffers = mesh.getBuffers(); |
||||
if (mesh.getNumLodLevels() > 0){ |
||||
indices = mesh.getLodLevel(lod); |
||||
}else{ |
||||
indices = buffers.get(Type.Index.ordinal()); |
||||
} |
||||
for (Entry<VertexBuffer> entry : buffers){ |
||||
VertexBuffer vb = entry.getValue(); |
||||
|
||||
if (vb.getBufferType() == Type.InterleavedData |
||||
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|
||||
|| vb.getBufferType() == Type.Index) |
||||
continue; |
||||
|
||||
if (vb.getStride() == 0){ |
||||
// not interleaved
|
||||
setVertexAttribVBO(vb, null); |
||||
}else{ |
||||
// interleaved
|
||||
setVertexAttribVBO(vb, interleavedData); |
||||
} |
||||
} |
||||
|
||||
if (indices != null){ |
||||
drawTriangleListVBO(indices, mesh, count); |
||||
}else{ |
||||
gl.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount()); |
||||
} |
||||
clearVertexAttribs(); |
||||
clearTextureUnits(); |
||||
} |
||||
|
||||
public void renderMesh(Mesh mesh, int lod, int count){ |
||||
// check if texturing is used for new model, if not
|
||||
// disable texturing entirely.
|
||||
checkTexturingUsed(); |
||||
if (gl11 != null){ |
||||
// use vbo
|
||||
renderMeshVBO(mesh, lod, count); |
||||
}else{ |
||||
// use vertex arrays
|
||||
renderMeshDefault(mesh, lod, count); |
||||
} |
||||
} |
||||
|
||||
} |
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue