diff options
author | Julien Gouesse <[email protected]> | 2012-11-16 18:03:18 +0100 |
---|---|---|
committer | Julien Gouesse <[email protected]> | 2012-11-16 18:03:18 +0100 |
commit | 297e62437a7aca9e10ade35ba2103721d6459363 (patch) | |
tree | 24290880fe331898e2ed21b0653e61841ad3f933 | |
parent | f79ddc350593a07864b7925761fc81140d8e9f39 (diff) |
Switch to JOGL 2.0 Release Candidate 11. The original code of this port
was hosted on http://sourceforge.net/projects/ardor3d-jogl2/
113 files changed, 2278 insertions, 1175 deletions
diff --git a/trunk/ardor3d-jogl/.classpath b/trunk/ardor3d-jogl/.classpath index 9f624f9..1a5b322 100644 --- a/trunk/ardor3d-jogl/.classpath +++ b/trunk/ardor3d-jogl/.classpath @@ -1,13 +1,9 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry combineaccessrules="false" kind="src" path="/ardor3d-core"/>
- <classpathentry kind="lib" path="lib/jogl/gluegen-rt.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/jogl/jogl.jar">
- <attributes>
- <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="ardor3d-jogl/lib/jogl/native/windows-amd64"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/main/java"/> + <classpathentry combineaccessrules="false" kind="src" path="/ardor3d-core"/> + <classpathentry exported="true" kind="lib" path="lib/jogl/gluegen-rt.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry exported="true" kind="lib" path="lib/jogl/jogl-all.jar"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/trunk/ardor3d-jogl/lib/jogl/COPYRIGHT.txt b/trunk/ardor3d-jogl/lib/jogl/COPYRIGHT.txt deleted file mode 100644 index 360d374..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/COPYRIGHT.txt +++ /dev/null @@ -1,31 +0,0 @@ - -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. - diff --git a/trunk/ardor3d-jogl/lib/jogl/LICENSE-JOGL-1.1.2-pre-20080523.txt b/trunk/ardor3d-jogl/lib/jogl/LICENSE-JOGL-1.1.2-pre-20080523.txt deleted file mode 100644 index cd35e88..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/LICENSE-JOGL-1.1.2-pre-20080523.txt +++ /dev/null @@ -1,152 +0,0 @@ -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. diff --git a/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-linux-amd64.jar b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-linux-amd64.jar Binary files differnew file mode 100644 index 0000000..98177cc --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-linux-amd64.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-linux-i586.jar b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-linux-i586.jar Binary files differnew file mode 100644 index 0000000..668bbbb --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-linux-i586.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-macosx-universal.jar b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-macosx-universal.jar Binary files differnew file mode 100644 index 0000000..11999bc --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-macosx-universal.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-solaris-amd64.jar b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-solaris-amd64.jar Binary files differnew file mode 100644 index 0000000..c9c75eb --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-solaris-amd64.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-solaris-i586.jar b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-solaris-i586.jar Binary files differnew file mode 100644 index 0000000..ccc064d --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-solaris-i586.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-windows-amd64.jar b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-windows-amd64.jar Binary files differnew file mode 100644 index 0000000..43c1a95 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-windows-amd64.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-windows-i586.jar b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-windows-i586.jar Binary files differnew file mode 100644 index 0000000..b9aa134 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt-natives-windows-i586.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/gluegen-rt.jar b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt.jar Binary files differindex 2251781..a9957e6 100644 --- a/trunk/ardor3d-jogl/lib/jogl/gluegen-rt.jar +++ b/trunk/ardor3d-jogl/lib/jogl/gluegen-rt.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-linux-amd64.jar b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-linux-amd64.jar Binary files differnew file mode 100644 index 0000000..0f914e2 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-linux-amd64.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-linux-i586.jar b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-linux-i586.jar Binary files differnew file mode 100644 index 0000000..e969c9b --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-linux-i586.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-macosx-universal.jar b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-macosx-universal.jar Binary files differnew file mode 100644 index 0000000..32f1567 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-macosx-universal.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-solaris-amd64.jar b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-solaris-amd64.jar Binary files differnew file mode 100644 index 0000000..cee93dd --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-solaris-amd64.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-solaris-i586.jar b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-solaris-i586.jar Binary files differnew file mode 100644 index 0000000..8f2dc08 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-solaris-i586.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-windows-amd64.jar b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-windows-amd64.jar Binary files differnew file mode 100644 index 0000000..8ca3682 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-windows-amd64.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-windows-i586.jar b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-windows-i586.jar Binary files differnew file mode 100644 index 0000000..1ff1289 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/jogl-all-natives-windows-i586.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/jogl-all.jar b/trunk/ardor3d-jogl/lib/jogl/jogl-all.jar Binary files differnew file mode 100644 index 0000000..977f5f1 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/jogl-all.jar diff --git a/trunk/ardor3d-jogl/lib/jogl/jogl.jar b/trunk/ardor3d-jogl/lib/jogl/jogl.jar Binary files differdeleted file mode 100644 index 7293e6d..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/jogl.jar +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libgluegen-rt.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libgluegen-rt.so Binary files differnew file mode 100644 index 0000000..e24d5e0 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libgluegen-rt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libjogl_desktop.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libjogl_desktop.so Binary files differnew file mode 100644 index 0000000..f91d7c6 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libjogl_desktop.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libnativewindow_awt.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libnativewindow_awt.so Binary files differnew file mode 100644 index 0000000..be10b14 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libnativewindow_awt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libnativewindow_x11.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libnativewindow_x11.so Binary files differnew file mode 100644 index 0000000..53100af --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libnativewindow_x11.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libnewt.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libnewt.so Binary files differnew file mode 100644 index 0000000..d757938 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-amd64/libnewt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libgluegen-rt.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libgluegen-rt.so Binary files differindex 1482430..b58b5e1 100644 --- a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libgluegen-rt.so +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libgluegen-rt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl.so Binary files differdeleted file mode 100644 index 51adbdb..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl.so +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl_awt.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl_awt.so Binary files differdeleted file mode 100644 index 7ea1354..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl_awt.so +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl_cg.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl_cg.so Binary files differdeleted file mode 100644 index 95a0374..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl_cg.so +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl_desktop.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl_desktop.so Binary files differnew file mode 100644 index 0000000..1fe60d5 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libjogl_desktop.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libnativewindow_awt.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libnativewindow_awt.so Binary files differnew file mode 100644 index 0000000..1a5446d --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libnativewindow_awt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libnativewindow_x11.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libnativewindow_x11.so Binary files differnew file mode 100644 index 0000000..9e18ccd --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libnativewindow_x11.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libnewt.so b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libnewt.so Binary files differnew file mode 100644 index 0000000..9d00b7d --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/linux-i586/libnewt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libgluegen-rt.jnilib b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libgluegen-rt.jnilib Binary files differindex 1956280..4d5eac6 100644 --- a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libgluegen-rt.jnilib +++ b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libgluegen-rt.jnilib diff --git a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl.jnilib b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl.jnilib Binary files differdeleted file mode 100644 index 85dac01..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl.jnilib +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl_awt.jnilib b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl_awt.jnilib Binary files differdeleted file mode 100644 index 2f16fbf..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl_awt.jnilib +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl_cg.jnilib b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl_cg.jnilib Binary files differdeleted file mode 100644 index 5627121..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl_cg.jnilib +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl_desktop.jnilib b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl_desktop.jnilib Binary files differnew file mode 100644 index 0000000..ebc22dc --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libjogl_desktop.jnilib diff --git a/trunk/ardor3d-jogl/src/main/native/win32/gluegen-rt.dll b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libnativewindow_awt.jnilib Binary files differindex 9b373f3..9060779 100644 --- a/trunk/ardor3d-jogl/src/main/native/win32/gluegen-rt.dll +++ b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libnativewindow_awt.jnilib diff --git a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libnativewindow_macosx.jnilib b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libnativewindow_macosx.jnilib Binary files differnew file mode 100644 index 0000000..9b5c146 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libnativewindow_macosx.jnilib diff --git a/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libnewt.jnilib b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libnewt.jnilib Binary files differnew file mode 100644 index 0000000..2396a03 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/macosx-universal/libnewt.jnilib diff --git a/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libgluegen-rt.so b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libgluegen-rt.so Binary files differnew file mode 100644 index 0000000..b949c18 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libgluegen-rt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libjogl_desktop.so b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libjogl_desktop.so Binary files differnew file mode 100644 index 0000000..956e497 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libjogl_desktop.so diff --git a/trunk/ardor3d-jogl/src/main/native/macosx/libgluegen-rt.jnilib b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libnativewindow_awt.so Binary files differindex 1956280..3e1f1d4 100644 --- a/trunk/ardor3d-jogl/src/main/native/macosx/libgluegen-rt.jnilib +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libnativewindow_awt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libnativewindow_x11.so b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libnativewindow_x11.so Binary files differnew file mode 100644 index 0000000..7bb9279 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libnativewindow_x11.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libnewt.so b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libnewt.so Binary files differnew file mode 100644 index 0000000..2b84891 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-amd64/libnewt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libgluegen-rt.so b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libgluegen-rt.so Binary files differnew file mode 100644 index 0000000..3d40b91 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libgluegen-rt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libjogl_desktop.so b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libjogl_desktop.so Binary files differnew file mode 100644 index 0000000..cb9a072 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libjogl_desktop.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libnativewindow_awt.so b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libnativewindow_awt.so Binary files differnew file mode 100644 index 0000000..48189d0 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libnativewindow_awt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libnativewindow_x11.so b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libnativewindow_x11.so Binary files differnew file mode 100644 index 0000000..9693dc2 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libnativewindow_x11.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libnewt.so b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libnewt.so Binary files differnew file mode 100644 index 0000000..3ab2e58 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/solaris-i586/libnewt.so diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/gluegen-rt.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/gluegen-rt.dll Binary files differindex a7eb6f5..9ea63b1 100644 --- a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/gluegen-rt.dll +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/gluegen-rt.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl.dll Binary files differdeleted file mode 100644 index 990986f..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl.dll +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl_awt.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl_awt.dll Binary files differdeleted file mode 100644 index d247b4a..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl_awt.dll +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl_cg.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl_cg.dll Binary files differdeleted file mode 100644 index 9e2f371..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl_cg.dll +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl_desktop.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl_desktop.dll Binary files differnew file mode 100644 index 0000000..2b27820 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/jogl_desktop.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/nativewindow_awt.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/nativewindow_awt.dll Binary files differnew file mode 100644 index 0000000..bf67563 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/nativewindow_awt.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/nativewindow_win32.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/nativewindow_win32.dll Binary files differnew file mode 100644 index 0000000..044d080 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/nativewindow_win32.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/newt.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/newt.dll Binary files differnew file mode 100644 index 0000000..aa7e2f9 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-amd64/newt.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/gluegen-rt.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/gluegen-rt.dll Binary files differnew file mode 100644 index 0000000..409fd66 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/gluegen-rt.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/jogl_desktop.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/jogl_desktop.dll Binary files differnew file mode 100644 index 0000000..415602e --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/jogl_desktop.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/nativewindow_awt.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/nativewindow_awt.dll Binary files differnew file mode 100644 index 0000000..d3868c7 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/nativewindow_awt.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/nativewindow_win32.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/nativewindow_win32.dll Binary files differnew file mode 100644 index 0000000..a9c0174 --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/nativewindow_win32.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/newt.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/newt.dll Binary files differnew file mode 100644 index 0000000..46f5f8e --- /dev/null +++ b/trunk/ardor3d-jogl/lib/jogl/native/windows-i586/newt.dll diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/gluegen-rt.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/gluegen-rt.dll Binary files differdeleted file mode 100644 index 9b373f3..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/gluegen-rt.dll +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/jogl.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/jogl.dll Binary files differdeleted file mode 100644 index ce466f0..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/jogl.dll +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/jogl_awt.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/jogl_awt.dll Binary files differdeleted file mode 100644 index 2f0b6a6..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/jogl_awt.dll +++ /dev/null diff --git a/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/jogl_cg.dll b/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/jogl_cg.dll Binary files differdeleted file mode 100644 index 985781d..0000000 --- a/trunk/ardor3d-jogl/lib/jogl/native/windows_i586/jogl_cg.dll +++ /dev/null diff --git a/trunk/ardor3d-jogl/pom.xml b/trunk/ardor3d-jogl/pom.xml index 3a04710..fffd522 100644 --- a/trunk/ardor3d-jogl/pom.xml +++ b/trunk/ardor3d-jogl/pom.xml @@ -29,23 +29,26 @@ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>net.java.dev.jogl</groupId>
- <artifactId>jogl</artifactId>
+ <groupId>org.jogamp.gluegen</groupId>
+ <artifactId>gluegen-rt-main</artifactId>
+ <version>2.0-rc11</version>
</dependency>
- <!--
- NOTE: This code commented out by Petter 090224, since it isn't really ready to be used,
- and since it is at the moment more work than it is worth to get it ready. Later on, when
- we have solved some more fundamental problems, it is probably time to revisit this.
- -->
-
- <!-- dependency>
- <groupId>net.java.dev.jogl</groupId>
- <artifactId>jogl-natives</artifactId>
- </dependency -->
<dependency>
- <groupId>com.projectdarkstar.ext.net.java.dev.gluegen</groupId>
- <artifactId>gluegen-rt</artifactId>
+ <groupId>org.jogamp.jogl</groupId>
+ <artifactId>jogl-all-main</artifactId>
+ <version>2.0-rc11</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.jogamp.joal</groupId>
+ <artifactId>joal-main</artifactId>
+ <version>2.0-rc11</version>
</dependency>
+ <dependency>
+ <groupId>org.jogamp.jocl</groupId>
+ <artifactId>jocl-main</artifactId>
+ <version>2.0-rc11</version>
+ </dependency> -->
</dependencies>
</project>
diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/CapsUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/CapsUtil.java index 48e594d..c23b8a0 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/CapsUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/CapsUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.framework.jogl; import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; import com.ardor3d.framework.DisplaySettings; import com.ardor3d.util.Ardor3dException; @@ -30,7 +31,7 @@ public class CapsUtil { throw new Ardor3dException("Invalid pixel depth: " + settings.getColorDepth()); } - final GLCapabilities caps = new GLCapabilities(); + final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); caps.setHardwareAccelerated(true); caps.setDoubleBuffered(true); caps.setAlphaBits(settings.getAlphaBits()); diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java index dd5cc8e..5c95cd8 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,13 +11,18 @@ package com.ardor3d.framework.jogl; import java.util.concurrent.CountDownLatch; - -import javax.media.opengl.GLCanvas; - +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLRunnable; +import javax.media.opengl.awt.GLCanvas; import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.DisplaySettings; +/** + * FIXME there is still a deadlock when using several instances of this class in the same container, see JOGL bug 572 + * Rather use JoglNewtAwtCanvas in this case. + * + */ public class JoglAwtCanvas extends GLCanvas implements Canvas { private static final long serialVersionUID = 1L; @@ -26,9 +31,12 @@ public class JoglAwtCanvas extends GLCanvas implements Canvas { private boolean _inited = false; private final DisplaySettings _settings; + + private final JoglDrawerRunnable _drawerGLRunnable; public JoglAwtCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer) { super(CapsUtil.getCapsForSettings(settings)); + _drawerGLRunnable = new JoglDrawerRunnable(canvasRenderer); _settings = settings; _canvasRenderer = canvasRenderer; @@ -37,17 +45,29 @@ public class JoglAwtCanvas extends GLCanvas implements Canvas { setSize(_settings.getWidth(), _settings.getHeight()); setIgnoreRepaint(true); setAutoSwapBufferMode(false); - - _canvasRenderer.setContext(getContext()); } @MainThread public void init() { - if (_inited) { + if (_inited) { return; } - - _canvasRenderer.init(_settings, true); // true - do swap in renderer. + + // Make the window visible to realize the OpenGL surface. + setVisible(true); + + // Request the focus here as it cannot work when the window is not visible + requestFocus(); + + _canvasRenderer.setContext(getContext()); + + invoke(true, new GLRunnable() { + @Override + public boolean run(GLAutoDrawable glAutoDrawable) { + _canvasRenderer.init(_settings, true);// true - do swap in renderer. + return true; + } + }); _inited = true; } @@ -57,7 +77,7 @@ public class JoglAwtCanvas extends GLCanvas implements Canvas { } if (isShowing()) { - _canvasRenderer.draw(); + invoke(true, _drawerGLRunnable); } if (latch != null) { latch.countDown(); diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvas.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvas.java index 0a85152..c08396b 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvas.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvas.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -27,8 +27,10 @@ import java.util.concurrent.CountDownLatch; import java.util.logging.Level; import java.util.logging.Logger; +import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLContext; import javax.media.opengl.GLException; +import javax.media.opengl.GLRunnable; import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.CanvasRenderer; @@ -84,7 +86,7 @@ public class JoglCanvas extends Frame implements NativeCanvas { @Override public void addFocusListener(final FocusListener l) { - _glCanvas.addFocusListener(l); // To change body of overridden methods use File | Settings | File Templates. + _glCanvas.addFocusListener(l); } @MainThread @@ -268,13 +270,16 @@ public class JoglCanvas extends Frame implements NativeCanvas { } public void setIcon(final Image[] iconImages) { - // TODO Auto-generated method stub + // FIXME not implemented } public void setVSyncEnabled(final boolean enabled) { - if (GLContext.getCurrent() != null) { - // Release the OpenGL resources. - GLContext.getCurrent().getGL().setSwapInterval(enabled ? 1 : 0); - } + _glCanvas.invoke(true, new GLRunnable() { + @Override + public boolean run(GLAutoDrawable glAutoDrawable) { + _glCanvas.getGL().setSwapInterval(enabled ? 1 : 0); + return false; + } + }); } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java index 555ceda..e6d8b00 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java @@ -1,5 +1,5 @@ /**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2010 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -12,10 +12,12 @@ package com.ardor3d.framework.jogl; import java.util.logging.Logger;
-import javax.media.opengl.DebugGL;
+import javax.media.opengl.DebugGL2;
import javax.media.opengl.GL;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLException;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.glu.GLU;
import com.ardor3d.annotation.MainThread;
@@ -38,22 +40,6 @@ public class JoglCanvasRenderer implements CanvasRenderer { private static final Logger LOGGER = Logger.getLogger(JoglCanvasRenderer.class.getName());
- // NOTE: This code commented out by Petter 090224, since it isn't really ready to be used,
- // and since it is at the moment more work than it is worth to get it ready. Later on, when
- // we have solved some more fundamental problems, it is probably time to revisit this.
-
- // ensure availability of JOGL natives
- // {
- // final String[] libraryPaths = JoglLibraryPaths.getLibraryPaths(System.getProperty("os.name"), System
- // .getProperty("os.arch"));
- //
- // try {
- // NativeLoader.makeLibrariesAvailable(libraryPaths);
- // } catch (final Exception e) {
- // ; // ignore
- // }
- // }
-
protected Scene _scene;
protected Camera _camera;
protected boolean _doSwap;
@@ -83,20 +69,27 @@ public class JoglCanvasRenderer implements CanvasRenderer { }
public void makeCurrentContext() throws Ardor3dException {
- int value;
- int attempt = 1;
- while ((value = _context.makeCurrent()) == GLContext.CONTEXT_NOT_CURRENT) {
- if (attempt == MAX_CONTEXT_GRAB_ATTEMPTS) {
- // failed, throw exception
- throw new Ardor3dException("Failed to claim OpenGL context.");
- }
- attempt++;
- try {
- Thread.sleep(5);
- } catch (final InterruptedException e1) {
- e1.printStackTrace();
- }
+ int value = GLContext.CONTEXT_NOT_CURRENT;
+ int attempt = 0;
+ do {
+ try {
+ value = _context.makeCurrent();
+ } catch(GLException gle) {
+ gle.printStackTrace();
+ } finally {
+ attempt++;
+ if (attempt == MAX_CONTEXT_GRAB_ATTEMPTS) {
+ // failed, throw exception
+ throw new Ardor3dException("Failed to claim OpenGL context.");
+ }
+ }
+ try {
+ Thread.sleep(5);
+ } catch (final InterruptedException e1) {
+ e1.printStackTrace();
+ }
}
+ while(value == GLContext.CONTEXT_NOT_CURRENT);
if (value == GLContext.CONTEXT_CURRENT_NEW) {
ContextManager.getCurrentContext().contextLost();
@@ -109,8 +102,12 @@ public class JoglCanvasRenderer implements CanvasRenderer { }
public void releaseCurrentContext() {
- if (_context.equals(GLContext.getCurrent())) {
- _context.release();
+ if (_context.equals(GLContext.getCurrent())) {
+ try {
+ _context.release();
+ } catch(GLException gle) {
+ gle.printStackTrace();
+ }
}
}
@@ -123,50 +120,55 @@ public class JoglCanvasRenderer implements CanvasRenderer { public void init(final DisplaySettings settings, final boolean doSwap) {
_doSwap = doSwap;
if (_context == null) {
- _context = GLDrawableFactory.getFactory().createExternalGLContext();
+ _context = GLDrawableFactory.getFactory(GLProfile.getMaxFixedFunc(true)).createExternalGLContext();
}
_context.makeCurrent();
- // Look up a shared context, if a shared JoglCanvasRenderer is given.
- RenderContext sharedContext = null;
- if (settings.getShareContext() != null) {
- sharedContext = ContextManager.getContextForKey(settings.getShareContext().getRenderContext()
- .getContextKey());
- }
-
- final ContextCapabilities caps = createContextCapabilities();
- _currentContext = new RenderContext(_context, caps, sharedContext);
-
- ContextManager.addContext(_context, _currentContext);
- ContextManager.switchContext(_context);
-
- _renderer = new JoglRenderer();
-
- if (settings.getSamples() != 0 && caps.isMultisampleSupported()) {
- final GL gl = GLU.getCurrentGL();
- gl.glEnable(GL.GL_MULTISAMPLE);
- }
-
- _renderer.setBackgroundColor(ColorRGBA.BLACK);
-
- if (_camera == null) {
- /** Set up how our camera sees. */
- _camera = new Camera(settings.getWidth(), settings.getHeight());
- _camera.setFrustumPerspective(45.0f, (float) settings.getWidth() / (float) settings.getHeight(), 1, 1000);
- _camera.setProjectionMode(ProjectionMode.Perspective);
-
- final Vector3 loc = new Vector3(0.0f, 0.0f, 10.0f);
- final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f);
- final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f);
- final Vector3 dir = new Vector3(0.0f, 0f, -1.0f);
- /** Move our camera to a correct place and orientation. */
- _camera.setFrame(loc, left, up, dir);
- } else {
- // use new width and height to set ratio.
- _camera.setFrustumPerspective(_camera.getFovY(),
- (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), _camera
- .getFrustumFar());
+ try {
+
+ // Look up a shared context, if a shared JoglCanvasRenderer is given.
+ RenderContext sharedContext = null;
+ if (settings.getShareContext() != null) {
+ sharedContext = ContextManager.getContextForKey(settings.getShareContext().getRenderContext()
+ .getContextKey());
+ }
+
+ final ContextCapabilities caps = createContextCapabilities();
+ _currentContext = new RenderContext(_context, caps, sharedContext);
+
+ ContextManager.addContext(_context, _currentContext);
+ ContextManager.switchContext(_context);
+
+ _renderer = new JoglRenderer();
+
+ if (settings.getSamples() != 0 && caps.isMultisampleSupported()) {
+ final GL gl = GLU.getCurrentGL();
+ gl.glEnable(GL.GL_MULTISAMPLE);
+ }
+
+ _renderer.setBackgroundColor(ColorRGBA.BLACK);
+
+ if (_camera == null) {
+ /** Set up how our camera sees. */
+ _camera = new Camera(settings.getWidth(), settings.getHeight());
+ _camera.setFrustumPerspective(45.0f, (float) settings.getWidth() / (float) settings.getHeight(), 1, 1000);
+ _camera.setProjectionMode(ProjectionMode.Perspective);
+
+ final Vector3 loc = new Vector3(0.0f, 0.0f, 10.0f);
+ final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f);
+ final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f);
+ final Vector3 dir = new Vector3(0.0f, 0f, -1.0f);
+ /** Move our camera to a correct place and orientation. */
+ _camera.setFrame(loc, left, up, dir);
+ } else {
+ // use new width and height to set ratio.
+ _camera.setFrustumPerspective(_camera.getFovY(),
+ (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), _camera
+ .getFrustumFar());
+ }
+ } finally {
+ _context.release();
}
}
@@ -188,7 +190,7 @@ public class JoglCanvasRenderer implements CanvasRenderer { // Enable Debugging if requested.
if (_useDebug != _debugEnabled) {
- _context.setGL(new DebugGL(_context.getGL()));
+ _context.setGL(new DebugGL2(_context.getGL().getGL2()));
_debugEnabled = true;
LOGGER.info("DebugGL Enabled");
diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglDrawerRunnable.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglDrawerRunnable.java new file mode 100644 index 0000000..a3c00e8 --- /dev/null +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglDrawerRunnable.java @@ -0,0 +1,19 @@ +package com.ardor3d.framework.jogl; + +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLRunnable; + +public class JoglDrawerRunnable implements GLRunnable { + + private final JoglCanvasRenderer _canvasRenderer; + + public JoglDrawerRunnable(final JoglCanvasRenderer canvasRenderer) { + _canvasRenderer = canvasRenderer; + } + + @Override + public boolean run(GLAutoDrawable glAutoDrawable) { + _canvasRenderer.draw(); + return true; + } +}
\ No newline at end of file diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglLibraryPaths.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglLibraryPaths.java index ba92685..668e74e 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglLibraryPaths.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglLibraryPaths.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java new file mode 100644 index 0000000..60e8a67 --- /dev/null +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2008-2011 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.framework.jogl; + +import java.util.concurrent.CountDownLatch; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLRunnable; +import com.ardor3d.annotation.MainThread; +import com.ardor3d.framework.Canvas; +import com.ardor3d.framework.DisplaySettings; +import com.jogamp.newt.awt.NewtCanvasAWT; +import com.jogamp.newt.opengl.GLWindow; + + +public class JoglNewtAwtCanvas extends NewtCanvasAWT implements Canvas, NewtWindowContainer { + + private static final long serialVersionUID = 1L; + + private final JoglCanvasRenderer _canvasRenderer; + private boolean _inited = false; + + private final DisplaySettings _settings; + + private final JoglDrawerRunnable _drawerGLRunnable; + + public JoglNewtAwtCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer) { + super(GLWindow.create(CapsUtil.getCapsForSettings(settings))); + _drawerGLRunnable = new JoglDrawerRunnable(canvasRenderer); + getNewtWindow().setUndecorated(true); + _settings = settings; + _canvasRenderer = canvasRenderer; + + setFocusable(true); + setSize(_settings.getWidth(), _settings.getHeight()); + setIgnoreRepaint(true); + getNewtWindow().setAutoSwapBufferMode(false); + } + + @MainThread + public void init() { + if (_inited) { + return; + } + + // Make the window visible to realize the OpenGL surface. + setVisible(true); + // Request the focus here as it cannot work when the window is not visible + requestFocus(); + /** + * I do not understand why I cannot get the context earlier, I failed in + * getting it from addNotify() and setVisible(true) + * */ + _canvasRenderer.setContext(getNewtWindow().getContext()); + + getNewtWindow().invoke(true, new GLRunnable() { + @Override + public boolean run(GLAutoDrawable glAutoDrawable) { + _canvasRenderer.init(_settings, true);// true - do swap in renderer. + return true; + } + }); + _inited = true; + } + + public void draw(final CountDownLatch latch) { + if (!_inited) { + init(); + } + + if (isShowing()) { + getNewtWindow().invoke(true, _drawerGLRunnable); + } + if (latch != null) { + latch.countDown(); + } + } + + public JoglCanvasRenderer getCanvasRenderer() { + return _canvasRenderer; + } + + @Override + public GLWindow getNewtWindow() { + return (GLWindow) getNEWTChild(); + } +} diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java new file mode 100644 index 0000000..8fe2e49 --- /dev/null +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java @@ -0,0 +1,240 @@ +/** + * Copyright (c) 2008-2011 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.framework.jogl; + +import java.util.List; +import java.util.concurrent.CountDownLatch; +import javax.media.nativewindow.util.Dimension; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLContext; +import javax.media.opengl.GLRunnable; +import com.ardor3d.annotation.MainThread; +import com.ardor3d.framework.DisplaySettings; +import com.ardor3d.framework.NativeCanvas; +import com.ardor3d.image.Image; +import com.jogamp.newt.Screen; +import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.event.KeyListener; +import com.jogamp.newt.event.MouseListener; +import com.jogamp.newt.event.WindowAdapter; +import com.jogamp.newt.event.WindowEvent; +import com.jogamp.newt.event.WindowListener; +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.newt.util.ScreenModeUtil; + + +public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer { + + private final JoglCanvasRenderer _canvasRenderer; + private boolean _inited = false; + private boolean _isClosing = false; + + private final DisplaySettings _settings; + + private final JoglDrawerRunnable _drawerGLRunnable; + + private final GLWindow _newtWindow; + + public JoglNewtWindow(final JoglCanvasRenderer canvasRenderer, final DisplaySettings settings) { + _newtWindow = GLWindow.create(CapsUtil.getCapsForSettings(settings)); + _drawerGLRunnable = new JoglDrawerRunnable(canvasRenderer); + _settings = settings; + _canvasRenderer = canvasRenderer; + setAutoSwapBufferMode(false); + } + + /** + * Applies all settings not related to OpenGL (screen resolution, + * screen size, etc...) + * */ + private void applySettings() { + _newtWindow.setUndecorated(_settings.isFullScreen()); + _newtWindow.setFullscreen(_settings.isFullScreen()); + //FIXME Ardor3D does not allow to change the resolution + /** + * uses the filtering relying on resolution with the size to fetch only the screen + * mode matching with the current resolution + */ + if (_settings.isFullScreen()) { + Screen screen = _newtWindow.getScreen(); + List<ScreenMode> screenModes = screen.getScreenModes(); + //the resolution is provided by the user + Dimension dimension=new Dimension(_settings.getWidth(),_settings.getHeight()); + screenModes = ScreenModeUtil.filterByResolution(screenModes,dimension); + screenModes = ScreenModeUtil.getHighestAvailableBpp(screenModes); + if (_settings.getFrequency() > 0) { + screenModes = ScreenModeUtil.filterByRate(screenModes, _settings.getFrequency()); + } else { + screenModes = ScreenModeUtil.getHighestAvailableRate(screenModes); + } + screen.setCurrentScreenMode(screenModes.get(0)); + } + } + + public void addKeyListener(KeyListener keyListener) { + _newtWindow.addKeyListener(keyListener); + } + + public void addMouseListener(MouseListener mouseListener) { + _newtWindow.addMouseListener(mouseListener); + } + + public void addWindowListener(WindowListener windowListener) { + _newtWindow.addWindowListener(windowListener); + } + + public GLContext getContext() { + return _newtWindow.getContext(); + } + + public int getWidth() { + return _newtWindow.getWidth(); + } + + public int getHeight() { + return _newtWindow.getHeight(); + } + + public int getX() { + return _newtWindow.getX(); + } + + public int getY() { + return _newtWindow.getY(); + } + + public boolean isVisible() { + return _newtWindow.isVisible(); + } + + public void setSize(int width, int height) { + _newtWindow.setTopLevelSize(width, height); + } + + public void setVisible(boolean visible) { + _newtWindow.setVisible(visible); + } + + public void setAutoSwapBufferMode(boolean autoSwapBufferModeEnabled) { + _newtWindow.setAutoSwapBufferMode(autoSwapBufferModeEnabled); + } + + @MainThread + public void init() { + if (_inited) { + return; + } + + _newtWindow.addWindowListener(new WindowAdapter() { + @Override + public void windowDestroyNotify(final WindowEvent e) { + _isClosing = true; + } + +// public void windowResized(final WindowEvent e) { +// _newtWindow.invoke(true, new GLRunnable() { +// +// @Override +// public boolean run(GLAutoDrawable glAutoDrawable) { +// _canvasRenderer._camera.resize(_newtWindow.getWidth(), _newtWindow.getHeight()); +// _canvasRenderer._camera.setFrustumPerspective(_canvasRenderer._camera.getFovY(), +// (float) _newtWindow.getWidth() / (float) _newtWindow.getHeight(), +// _canvasRenderer._camera.getFrustumNear(), +// _canvasRenderer._camera.getFrustumFar()); +// return true; +// } +// }); +// } + }); + + // Set the size very early to prevent the default one from being used (typically when exiting full screen mode) + setSize(_settings.getWidth(), _settings.getHeight()); + // Make the window visible to realize the OpenGL surface. + setVisible(true); + // Request the focus here as it cannot work when the window is not visible + _newtWindow.requestFocus(); + applySettings(); + + _canvasRenderer.setContext(getContext()); + + _newtWindow.invoke(true, new GLRunnable() { + @Override + public boolean run(GLAutoDrawable glAutoDrawable) { + _canvasRenderer.init(_settings, true);// true - do swap in renderer. + return true; + } + }); + _inited = true; + } + + public void draw(final CountDownLatch latch) { + if (!_inited) { + init(); + } + + if (/*isShowing()*/isVisible()) { + _newtWindow.invoke(true, _drawerGLRunnable); + } + if (latch != null) { + latch.countDown(); + } + } + + public JoglCanvasRenderer getCanvasRenderer() { + return _canvasRenderer; + } + + @Override + public void close() { + _newtWindow.destroy(); + } + + @Override + public boolean isActive() { + return _newtWindow.hasFocus(); + } + + @Override + public boolean isClosing() { + return _isClosing; + } + + @Override + public void setVSyncEnabled(final boolean enabled) { + _newtWindow.invoke(true, new GLRunnable() { + @Override + public boolean run(GLAutoDrawable glAutoDrawable) { + _newtWindow.getGL().setSwapInterval(enabled ? 1 : 0); + return false; + } + }); + } + + @Override + public void setTitle(String title) { + _newtWindow.setTitle(title); + } + + @Override + public void setIcon(Image[] iconImages) { + //FIXME not supported by NEWT + } + + @Override + public void moveWindowTo(int locX, int locY) { + _newtWindow.setPosition(locX, locY); + } + + @Override + public GLWindow getNewtWindow() { + return _newtWindow; + } +} diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/NewtWindowContainer.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/NewtWindowContainer.java new file mode 100644 index 0000000..3687c37 --- /dev/null +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/NewtWindowContainer.java @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2008-2011 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.framework.jogl; + +import com.jogamp.newt.opengl.GLWindow; + + +public interface NewtWindowContainer{ + public GLWindow getNewtWindow(); +} diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtFocusWrapper.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtFocusWrapper.java new file mode 100644 index 0000000..be2101d --- /dev/null +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtFocusWrapper.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2008-2011 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.input.jogl; + +import com.ardor3d.framework.jogl.NewtWindowContainer; +import com.ardor3d.input.FocusWrapper; +import com.jogamp.newt.event.WindowAdapter; +import com.jogamp.newt.event.WindowEvent; +import com.jogamp.newt.opengl.GLWindow; + + +public class JoglNewtFocusWrapper extends WindowAdapter implements FocusWrapper { + + protected volatile boolean _focusLost = false; + + protected final GLWindow _newtWindow; + + public JoglNewtFocusWrapper(final NewtWindowContainer newtWindowContainer) { + _newtWindow = newtWindowContainer.getNewtWindow(); + } + + @Override + public void windowGainedFocus(final WindowEvent e) { + // do nothing + } + + @Override + public void windowLostFocus(final WindowEvent e) { + _focusLost = true; + } + + @Override + public boolean getAndClearFocusLost() { + final boolean result = _focusLost; + + _focusLost = false; + + return result; + } + + @Override + public void init() { + _newtWindow.addWindowListener(this); + } + +} diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java new file mode 100644 index 0000000..a37a7b2 --- /dev/null +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKey.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) 2008-2011 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.input.jogl; + +import com.jogamp.newt.event.KeyEvent; +import com.ardor3d.input.Key; + + +public enum JoglNewtKey { + + ZERO(KeyEvent.VK_0, Key.ZERO), // + ONE(KeyEvent.VK_1, Key.ONE), // + TWO(KeyEvent.VK_2, Key.TWO), // + THREE(KeyEvent.VK_3, Key.THREE), // + FOUR(KeyEvent.VK_4, Key.FOUR), // + FIVE(KeyEvent.VK_5, Key.FIVE), // + SIX(KeyEvent.VK_6, Key.SIX), // + SEVEN(KeyEvent.VK_7, Key.SEVEN), // + EIGHT(KeyEvent.VK_8, Key.EIGHT), // + NINE(KeyEvent.VK_9, Key.NINE), // + A(KeyEvent.VK_A, Key.A), // + ADD(KeyEvent.VK_ADD, Key.NUMPADADD), // + AT(KeyEvent.VK_AT, Key.AT), // + B(KeyEvent.VK_B, Key.B), // + BACK_QUOTE(KeyEvent.VK_BACK_QUOTE, Key.GRAVE), // + BACK_SPACE(KeyEvent.VK_BACK_SPACE, Key.BACK), // + BACK_SLASH(KeyEvent.VK_BACK_SLASH, Key.BACKSLASH), // + C(KeyEvent.VK_C, Key.C), // + CAPS_LOCK(KeyEvent.VK_CAPS_LOCK, Key.CAPITAL), // + CIRCUMFLEX(KeyEvent.VK_CIRCUMFLEX, Key.CIRCUMFLEX), // + COLON(KeyEvent.VK_COLON, Key.COLON), // + COMMA(KeyEvent.VK_COMMA, Key.COMMA), // + CONVERT(KeyEvent.VK_CONVERT, Key.CONVERT), // + D(KeyEvent.VK_D, Key.D), // + DECIMAL(KeyEvent.VK_DECIMAL, Key.DECIMAL), // + DELETE(KeyEvent.VK_DELETE, Key.DELETE), // + DIVIDE(KeyEvent.VK_DIVIDE, Key.DIVIDE), // + DOWN(KeyEvent.VK_DOWN, Key.DOWN), // + E(KeyEvent.VK_E, Key.E), // + END(KeyEvent.VK_END, Key.END), // + EQUALS(KeyEvent.VK_EQUALS, Key.EQUALS), // + ESCAPE(KeyEvent.VK_ESCAPE, Key.ESCAPE), // + F(KeyEvent.VK_F, Key.F), // + F1(KeyEvent.VK_F1, Key.F1), // + F2(KeyEvent.VK_F2, Key.F2), // + F3(KeyEvent.VK_F3, Key.F3), // + F4(KeyEvent.VK_F4, Key.F4), // + F5(KeyEvent.VK_F5, Key.F5), // + F6(KeyEvent.VK_F6, Key.F6), // + F7(KeyEvent.VK_F7, Key.F7), // + F8(KeyEvent.VK_F8, Key.F8), // + F9(KeyEvent.VK_F9, Key.F9), // + F10(KeyEvent.VK_F10, Key.F10), // + F11(KeyEvent.VK_F11, Key.F11), // + F12(KeyEvent.VK_F12, Key.F12), // + F13(KeyEvent.VK_F13, Key.F13), // + F14(KeyEvent.VK_F14, Key.F14), // + F15(KeyEvent.VK_F15, Key.F15), // + G(KeyEvent.VK_G, Key.G), // + H(KeyEvent.VK_H, Key.H), // + HOME(KeyEvent.VK_HOME, Key.HOME), // + I(KeyEvent.VK_I, Key.I), // + INSERT(KeyEvent.VK_INSERT, Key.INSERT), // + J(KeyEvent.VK_J, Key.J), // + K(KeyEvent.VK_K, Key.K), // + KANA(KeyEvent.VK_KANA, Key.KANA), // + KANJI(KeyEvent.VK_KANJI, Key.KANJI), // + L(KeyEvent.VK_L, Key.L), // + OPEN_BRACKET(KeyEvent.VK_OPEN_BRACKET, Key.LBRACKET), // + CONTROL(KeyEvent.VK_CONTROL, Key.LCONTROL), // + LEFT(KeyEvent.VK_LEFT, Key.LEFT), // + ALT(KeyEvent.VK_ALT, Key.LMENU), // + META(KeyEvent.VK_META, Key.LMETA), // + SHIFT(KeyEvent.VK_SHIFT, Key.LSHIFT), // + M(KeyEvent.VK_M, Key.M), // + MINUS(KeyEvent.VK_MINUS, Key.MINUS), // + MULTIPLY(KeyEvent.VK_MULTIPLY, Key.MULTIPLY), // + N(KeyEvent.VK_N, Key.N), // + PAGE_DOWN(KeyEvent.VK_PAGE_DOWN, Key.PAGEDOWN_NEXT), // + NONCONVERT(KeyEvent.VK_NONCONVERT, Key.NOCONVERT), // + NUM_LOCK(KeyEvent.VK_NUM_LOCK, Key.NUMLOCK), // + NUMPAD0(KeyEvent.VK_NUMPAD0, Key.NUMPAD0), // + NUMPAD1(KeyEvent.VK_NUMPAD1, Key.NUMPAD1), // + NUMPAD2(KeyEvent.VK_NUMPAD2, Key.NUMPAD2), // + NUMPAD3(KeyEvent.VK_NUMPAD3, Key.NUMPAD3), // + NUMPAD4(KeyEvent.VK_NUMPAD4, Key.NUMPAD4), // + NUMPAD5(KeyEvent.VK_NUMPAD5, Key.NUMPAD5), // + NUMPAD6(KeyEvent.VK_NUMPAD6, Key.NUMPAD6), // + NUMPAD7(KeyEvent.VK_NUMPAD7, Key.NUMPAD7), // + NUMPAD8(KeyEvent.VK_NUMPAD8, Key.NUMPAD8), // + NUMPAD9(KeyEvent.VK_NUMPAD9, Key.NUMPAD9), // + O(KeyEvent.VK_O, Key.O), // + P(KeyEvent.VK_P, Key.P), // + PAUSE(KeyEvent.VK_PAUSE, Key.PAUSE), // + PERIOD(KeyEvent.VK_PERIOD, Key.PERIOD), // + PAGE_UP(KeyEvent.VK_PAGE_UP, Key.PAGEUP_PRIOR), // + Q(KeyEvent.VK_Q, Key.Q), // + QUOTE(KeyEvent.VK_QUOTE, Key.APOSTROPHE), // + R(KeyEvent.VK_R, Key.R), // + CLOSE_BRACKET(KeyEvent.VK_CLOSE_BRACKET, Key.RBRACKET), // + ENTER(KeyEvent.VK_ENTER, Key.RETURN), // + RIGHT(KeyEvent.VK_RIGHT, Key.RIGHT), // + S(KeyEvent.VK_S, Key.S), // + SCROLL_LOCK(KeyEvent.VK_SCROLL_LOCK, Key.SCROLL), // + SEMICOLON(KeyEvent.VK_SEMICOLON, Key.SEMICOLON), // + SLASH(KeyEvent.VK_SLASH, Key.SLASH), // + SPACE(KeyEvent.VK_SPACE, Key.SPACE), // + STOP(KeyEvent.VK_STOP, Key.STOP), // + PRINTSCREEN(KeyEvent.VK_PRINTSCREEN, Key.SYSRQ), // + T(KeyEvent.VK_T, Key.T), // + TAB(KeyEvent.VK_TAB, Key.TAB), // + U(KeyEvent.VK_U, Key.U), // + UNDERSCORE(KeyEvent.VK_UNDERSCORE, Key.UNDERLINE), // + UP(KeyEvent.VK_UP, Key.UP), // + V(KeyEvent.VK_V, Key.V), // + W(KeyEvent.VK_W, Key.W), // + X(KeyEvent.VK_X, Key.X), // + Y(KeyEvent.VK_Y, Key.Y), // + Z(KeyEvent.VK_Z, Key.Z), // + UNDEFINED(KeyEvent.VK_UNDEFINED, Key.UNKNOWN); + + private final int _newtCode; + private final Key _key; + + private JoglNewtKey(final int newtCode, final Key key) { + _newtCode = newtCode; + _key = key; + } + + public static Key findByCode(final int newtCode) { + for (final JoglNewtKey ak : values()) { + if (ak._newtCode == newtCode) { + return ak._key; + } + } + + return Key.UNKNOWN; + } + + public int getNewtCode() { + return _newtCode; + } +} diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java new file mode 100644 index 0000000..478ad19 --- /dev/null +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) 2008-2011 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.input.jogl; + +import java.util.EnumSet; +import java.util.LinkedList; +import com.ardor3d.annotation.GuardedBy; +import com.ardor3d.framework.jogl.NewtWindowContainer; +import com.ardor3d.input.Key; +import com.ardor3d.input.KeyEvent; +import com.ardor3d.input.KeyState; +import com.ardor3d.input.KeyboardWrapper; +import com.google.common.base.Preconditions; +import com.google.common.collect.AbstractIterator; +import com.google.common.collect.PeekingIterator; +import com.jogamp.newt.event.InputEvent; +import com.jogamp.newt.event.KeyListener; +import com.jogamp.newt.event.WindowAdapter; +import com.jogamp.newt.event.WindowEvent; +import com.jogamp.newt.opengl.GLWindow; + + +public class JoglNewtKeyboardWrapper implements KeyboardWrapper, KeyListener { + + @GuardedBy("this") + protected final LinkedList<KeyEvent> _upcomingEvents = new LinkedList<KeyEvent>(); + + @GuardedBy("this") + protected JoglNewtKeyboardIterator _currentIterator = null; + + protected final GLWindow _newtWindow; + + protected boolean _consumeEvents = false; + + protected final EnumSet<Key> _pressedList = EnumSet.noneOf(Key.class); + + public JoglNewtKeyboardWrapper(final NewtWindowContainer newtWindowContainer) { + _newtWindow = Preconditions.checkNotNull(newtWindowContainer.getNewtWindow(), "newtWindow"); + } + + public void init() { + _newtWindow.addKeyListener(this); + _newtWindow.addWindowListener(new WindowAdapter() { + public void windowLostFocus(final WindowEvent e) {} + + public void windowGainedFocus(final WindowEvent e) { + _pressedList.clear(); + } + }); + } + + public synchronized PeekingIterator<KeyEvent> getEvents() { + if (_currentIterator == null || !_currentIterator.hasNext()) { + _currentIterator = new JoglNewtKeyboardIterator(); + } + + return _currentIterator; + } + + public synchronized void keyTyped(final com.jogamp.newt.event.KeyEvent e) { + if (_consumeEvents) { + e.setAttachment(InputEvent.consumedTag); + // ignore this event + } + } + + public synchronized void keyPressed(final com.jogamp.newt.event.KeyEvent e) { + final Key pressed = fromKeyEventToKey(e); + if (!_pressedList.contains(pressed)) { + _upcomingEvents.add(new KeyEvent(pressed, KeyState.DOWN, e.getKeyChar())); + _pressedList.add(pressed); + } + if (_consumeEvents) { + e.setAttachment(InputEvent.consumedTag); + // ignore this event + } + } + + public synchronized void keyReleased(final com.jogamp.newt.event.KeyEvent e) { + final Key released = fromKeyEventToKey(e); + _upcomingEvents.add(new KeyEvent(released, KeyState.UP, e.getKeyChar())); + _pressedList.remove(released); + if (_consumeEvents) { + e.setAttachment(InputEvent.consumedTag); + // ignore this event + } + } + + /** + * Convert from NEWT key event to Ardor3D Key. Override to provide additional or custom behavior. + * + * @param e + * the NEWT KeyEvent received by the input system. + * @return an Ardor3D Key, to be forwarded to the Predicate/Trigger system. + */ + public synchronized Key fromKeyEventToKey(final com.jogamp.newt.event.KeyEvent e) { + return JoglNewtKey.findByCode(e.getKeyCode()); + } + + private class JoglNewtKeyboardIterator extends AbstractIterator<KeyEvent> implements PeekingIterator<KeyEvent> { + @Override + protected KeyEvent computeNext() { + synchronized (JoglNewtKeyboardWrapper.this) { + if (_upcomingEvents.isEmpty()) { + return endOfData(); + } + + return _upcomingEvents.poll(); + } + } + } + + public boolean isConsumeEvents() { + return _consumeEvents; + } + + public void setConsumeEvents(final boolean consumeEvents) { + _consumeEvents = consumeEvents; + } +} diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java new file mode 100644 index 0000000..272f2b0 --- /dev/null +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2008-2011 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.input.jogl; + +import com.ardor3d.framework.jogl.NewtWindowContainer; +import com.ardor3d.input.GrabbedState; +import com.ardor3d.input.MouseCursor; +import com.ardor3d.input.MouseManager; +import com.jogamp.newt.opengl.GLWindow; + + +public class JoglNewtMouseManager implements MouseManager{ + + /** our current grabbed state */ + private GrabbedState _grabbedState; + + private GLWindow _newtWindow; + + public JoglNewtMouseManager(final NewtWindowContainer newtWindowContainer) { + _newtWindow = newtWindowContainer.getNewtWindow(); + } + + @Override + public void setCursor(MouseCursor cursor) { + //FIXME not supported by NEWT + } + + @Override + public void setPosition(final int x, final int y) { + _newtWindow.warpPointer(x, _newtWindow.getHeight() - y); + } + + @Override + public void setGrabbed(GrabbedState grabbedState) { + // check if we should be here. + if (_grabbedState == grabbedState) { + return; + } + + // remember our grabbed state mode. + _grabbedState = grabbedState; + if (grabbedState == GrabbedState.GRABBED) { + //FIXME remember our old cursor + + // set our cursor to be invisible + _newtWindow.setPointerVisible(false); + } + else { + //FIXME restore our old cursor + + // set our cursor to be visible + _newtWindow.setPointerVisible(true); + } + } + + @Override + public GrabbedState getGrabbed() { + return _grabbedState; + } + + @Override + public boolean isSetPositionSupported() { + return true; + } + + @Override + public boolean isSetGrabbedSupported() { + return true; + } + +} diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java new file mode 100644 index 0000000..bbd9d09 --- /dev/null +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java @@ -0,0 +1,310 @@ +/** + * Copyright (c) 2008-2011 Ardor Labs, Inc. + * + * This file is part of Ardor3D. + * + * Ardor3D is free software: you can redistribute it and/or modify it + * under the terms of its license which may be found in the accompanying + * LICENSE file or at <http://www.ardor3d.com/LICENSE>. + */ + +package com.ardor3d.input.jogl; + +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.LinkedList; +import com.ardor3d.annotation.GuardedBy; +import com.ardor3d.framework.jogl.NewtWindowContainer; +import com.ardor3d.input.ButtonState; +import com.ardor3d.input.GrabbedState; +import com.ardor3d.input.MouseButton; +import com.ardor3d.input.MouseManager; +import com.ardor3d.input.MouseState; +import com.ardor3d.input.MouseWrapper; +import com.google.common.collect.AbstractIterator; +import com.google.common.collect.EnumMultiset; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Multiset; +import com.google.common.collect.PeekingIterator; +import com.jogamp.newt.event.InputEvent; +import com.jogamp.newt.event.MouseEvent; +import com.jogamp.newt.event.MouseListener; +import com.jogamp.newt.opengl.GLWindow; + +import static com.google.common.base.Preconditions.checkNotNull; + + +public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { + + @GuardedBy("this") + protected final LinkedList<MouseState> _upcomingEvents = Lists.newLinkedList(); + + @GuardedBy("this") + protected JoglNewtMouseIterator _currentIterator = null; + + @GuardedBy("this") + protected MouseState _lastState = null; + + protected final GLWindow _newtWindow; + + protected final MouseManager _manager; + + protected boolean _consumeEvents = false; + + protected final Multiset<MouseButton> _clicks = EnumMultiset.create(MouseButton.class); + protected final EnumMap<MouseButton, Long> _lastClickTime = Maps.newEnumMap(MouseButton.class); + protected final EnumSet<MouseButton> _clickArmed = EnumSet.noneOf(MouseButton.class); + + protected int _ignoreX = Integer.MAX_VALUE; + protected int _ignoreY = Integer.MAX_VALUE; + + public JoglNewtMouseWrapper(final NewtWindowContainer newtWindowContainer, final MouseManager manager) { + _newtWindow = checkNotNull(newtWindowContainer.getNewtWindow(), "newtWindow"); + _manager = manager; + for (final MouseButton mb : MouseButton.values()) { + _lastClickTime.put(mb, 0L); + } + } + + @Override + public void init() { + _newtWindow.addMouseListener(this); + } + + @Override + public synchronized PeekingIterator<MouseState> getEvents() { + expireClickEvents(); + + if (_currentIterator == null || !_currentIterator.hasNext()) { + _currentIterator = new JoglNewtMouseIterator(); + } + + return _currentIterator; + } + + private void expireClickEvents() { + if (!_clicks.isEmpty()) { + for (final MouseButton mb : MouseButton.values()) { + if (System.currentTimeMillis() - _lastClickTime.get(mb) > MouseState.CLICK_TIME_MS) { + _clicks.setCount(mb, 0); + } + } + } + } + + @Override + public synchronized void mousePressed(MouseEvent me) { + final MouseButton b = getButtonForEvent(me); + if (_clickArmed.contains(b)) { + _clicks.setCount(b, 0); + } + _clickArmed.add(b); + _lastClickTime.put(b, System.currentTimeMillis()); + + initState(me); + if (_consumeEvents) { + me.setAttachment(InputEvent.consumedTag); + } + + final EnumMap<MouseButton, ButtonState> buttons = _lastState.getButtonStates(); + + setStateForButton(me, buttons, ButtonState.DOWN); + + addNewState(me, buttons, null); + } + + @Override + public synchronized void mouseReleased(MouseEvent me) { + initState(me); + if (_consumeEvents) { + me.setAttachment(InputEvent.consumedTag); + } + + final EnumMap<MouseButton, ButtonState> buttons = _lastState.getButtonStates(); + + setStateForButton(me, buttons, ButtonState.UP); + + final MouseButton b = getButtonForEvent(me); + if (_clickArmed.contains(b) && (System.currentTimeMillis() - _lastClickTime.get(b) <= MouseState.CLICK_TIME_MS)) { + _clicks.add(b); // increment count of clicks for button b. + // XXX: Note the double event add... this prevents sticky click counts, but is it the best way? + addNewState(me, buttons, EnumMultiset.create(_clicks)); + } else { + _clicks.setCount(b, 0); // clear click count for button b. + } + _clickArmed.remove(b); + + addNewState(me, buttons, null); + } + + @Override + public synchronized void mouseDragged(MouseEvent me) { + mouseMoved(me); + } + + @Override + public synchronized void mouseMoved(MouseEvent me) { + _clickArmed.clear(); + _clicks.clear(); + + // check that we have a valid _lastState + initState(me); + if (_consumeEvents) { + me.setAttachment(InputEvent.consumedTag); + } + + // remember our current ardor3d position + final int oldX = _lastState.getX(), oldY = _lastState.getY(); + + // check the state against the "ignore next" values + if (_ignoreX != Integer.MAX_VALUE // shortcut to prevent dx/dy calculations + && (_ignoreX == getDX(me) && _ignoreY == getDY(me))) { + + // we matched, so we'll consider this a "mouse pointer reset move" + // so reset ignore to let the next move event through. + _ignoreX = Integer.MAX_VALUE; + _ignoreY = Integer.MAX_VALUE; + + // exit without adding an event to our queue + return; + } + + // save our old "last state." + final MouseState _savedState = _lastState; + + // Add our latest state info to the queue + addNewState(me, _lastState.getButtonStates(), null); + + // If we have a valid move... should always be the case, but occasionally something slips through. + if (_lastState.getDx() != 0 || _lastState.getDy() != 0) { + + // Ask our manager if we're currently "captured" + if (_manager.getGrabbed() == GrabbedState.GRABBED) { + + // if so, set "ignore next" to the inverse of this move + _ignoreX = -_lastState.getDx(); + _ignoreY = -_lastState.getDy(); + + // Move us back to our last position. + _manager.setPosition(oldX, oldY); + + // And finally, revert our _lastState. + _lastState = _savedState; + } else { + // otherwise, set us to not ignore anything. This may be unnecessary, but prevents any possible + // "ignore" bleeding. + _ignoreX = Integer.MAX_VALUE; + _ignoreY = Integer.MAX_VALUE; + } + } + } + + @Override + public void mouseWheelMoved(MouseEvent me) { + initState(me); + + addNewState(me, _lastState.getButtonStates(), null); + if (_consumeEvents) { + me.setAttachment(InputEvent.consumedTag); + } + } + + private void initState(final MouseEvent mouseEvent) { + if (_lastState == null) { + _lastState = new MouseState(mouseEvent.getX(), getArdor3DY(mouseEvent), 0, 0, 0, null, null); + } + } + + private void addNewState(final MouseEvent mouseEvent, final EnumMap<MouseButton, ButtonState> enumMap, + final Multiset<MouseButton> clicks) { + final MouseState newState = new MouseState(mouseEvent.getX(), getArdor3DY(mouseEvent), getDX(mouseEvent), + getDY(mouseEvent), mouseEvent.getWheelRotation(), enumMap, clicks); + + synchronized (JoglNewtMouseWrapper.this) { + _upcomingEvents.add(newState); + } + _lastState = newState; + } + + private int getDX(final MouseEvent me) { + return me.getX() - _lastState.getX(); + } + + private int getDY(final MouseEvent me) { + return getArdor3DY(me) - _lastState.getY(); + } + + /** + * @param e + * our mouseEvent + * @return the Y coordinate of the event, flipped relative to the component since we expect an origin in the lower + * left corner. + */ + private int getArdor3DY(final MouseEvent me) { + return _newtWindow.getHeight() - me.getY(); + } + + private void setStateForButton(final MouseEvent e, final EnumMap<MouseButton, ButtonState> buttons, + final ButtonState buttonState) { + final MouseButton button = getButtonForEvent(e); + buttons.put(button, buttonState); + } + + private MouseButton getButtonForEvent(final MouseEvent me) { + MouseButton button; + switch(me.getButton()) { + case MouseEvent.BUTTON1: + button = MouseButton.LEFT; + break; + case MouseEvent.BUTTON2: + button = MouseButton.MIDDLE; + break; + case MouseEvent.BUTTON3: + button = MouseButton.RIGHT; + break; + default: + throw new RuntimeException("unknown button: " + me.getButton()); + } + return button; + } + + private class JoglNewtMouseIterator extends AbstractIterator<MouseState> implements PeekingIterator<MouseState> { + + @Override + protected MouseState computeNext() { + synchronized (JoglNewtMouseWrapper.this) { + if (_upcomingEvents.isEmpty()) { + return endOfData(); + } + return _upcomingEvents.poll(); + } + } + } + + @Override + public synchronized void mouseClicked(MouseEvent me) { + // Yes, we could use the click count here, but in the interests of this working the same way as SWT and Native, + // we + // will do it the same way they do it. + + } + + @Override + public synchronized void mouseEntered(MouseEvent me) { + // ignore this + } + + @Override + public synchronized void mouseExited(MouseEvent me) { + // ignore this + } + + public boolean isConsumeEvents() { + return _consumeEvents; + } + + public void setConsumeEvents(final boolean consumeEvents) { + _consumeEvents = consumeEvents; + } +} diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java index 61716d7..7bc4e01 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglContextCapabilities.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -14,6 +14,10 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES1; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.GLAutoDrawable; import com.ardor3d.renderer.ContextCapabilities; @@ -55,13 +59,13 @@ public class JoglContextCapabilities extends ContextCapabilities { _supportsTextureLodBias = gl.isExtensionAvailable("GL_EXT_texture_lod_bias"); if (_supportsTextureLodBias) { - gl.glGetIntegerv(GL.GL_MAX_TEXTURE_LOD_BIAS_EXT, buf); + gl.glGetIntegerv(GL2GL3.GL_MAX_TEXTURE_LOD_BIAS, buf); _maxTextureLodBias = buf.get(0); } else { _maxTextureLodBias = 0f; } - gl.glGetIntegerv(GL.GL_MAX_CLIP_PLANES, buf); + gl.glGetIntegerv(GL2ES1.GL_MAX_CLIP_PLANES, buf); _maxUserClipPlanes = buf.get(0); _glslSupported = gl.isExtensionAvailable("GL_ARB_shader_objects") @@ -70,11 +74,12 @@ public class JoglContextCapabilities extends ContextCapabilities { _geometryShader4Supported = gl.isExtensionAvailable("GL_ARB_geometry_shader4") && _glslSupported; - _geometryInstancingSupported = gl.isExtensionAvailable("GL_EXT_draw_instanced") - || gl.isExtensionAvailable("GL_VERSION_3_0"); - + _geometryInstancingSupported = gl.isExtensionAvailable("GL_EXT_draw_instanced") || gl.isExtensionAvailable("GL_VERSION_3_0"); + + _tessellationShadersSupported = gl.isExtensionAvailable("GL_ARB_tessellation_shader") && _glslSupported; + if (_glslSupported) { - gl.glGetIntegerv(GL.GL_MAX_VERTEX_ATTRIBS_ARB, buf); + gl.glGetIntegerv(GL2.GL_MAX_VERTEX_ATTRIBS_ARB, buf); _maxGLSLVertexAttribs = buf.get(0); } @@ -85,7 +90,7 @@ public class JoglContextCapabilities extends ContextCapabilities { _fboSupported = gl.isExtensionAvailable("GL_EXT_framebuffer_object"); if (_fboSupported) { if (gl.isExtensionAvailable("GL_ARB_draw_buffers")) { - gl.glGetIntegerv(GL.GL_MAX_COLOR_ATTACHMENTS_EXT, buf); + gl.glGetIntegerv(GL2ES2.GL_MAX_COLOR_ATTACHMENTS, buf); _maxFBOColorAttachments = buf.get(0); } else { _maxFBOColorAttachments = 1; @@ -94,7 +99,7 @@ public class JoglContextCapabilities extends ContextCapabilities { // Max multisample samples. if (gl.isExtensionAvailable("GL_EXT_framebuffer_multisample") && gl.isExtensionAvailable("GL_EXT_framebuffer_blit")) { - gl.glGetIntegerv(GL.GL_MAX_SAMPLES_EXT, buf); + gl.glGetIntegerv(GL2GL3.GL_MAX_SAMPLES, buf); _maxFBOSamples = buf.get(0); } else { _maxFBOSamples = 0; @@ -107,7 +112,7 @@ public class JoglContextCapabilities extends ContextCapabilities { _stencilWrapSupport = gl.isExtensionAvailable("GL_EXT_stencil_wrap"); // number of available auxiliary draw buffers - gl.glGetIntegerv(GL.GL_AUX_BUFFERS, buf); + gl.glGetIntegerv(GL2.GL_AUX_BUFFERS, buf); _numAuxDrawBuffers = buf.get(0); // max texture size. @@ -117,11 +122,11 @@ public class JoglContextCapabilities extends ContextCapabilities { // Check for support of multitextures. _supportsMultiTexture = gl.isExtensionAvailable("GL_ARB_multitexture"); - // Support for texture formats - _supportsFloatTextures = gl.isExtensionAvailable("GL_ARB_texture_float"); - _supportsIntegerTextures = gl.isExtensionAvailable("GL_EXT_texture_integer"); - _supportsOneTwoComponentTextures = gl.isExtensionAvailable("GL_ARB_texture_rg"); - + // Support for texture formats + _supportsFloatTextures = gl.isExtensionAvailable("GL_ARB_texture_float"); + _supportsIntegerTextures = gl.isExtensionAvailable("GL_EXT_texture_integer"); + _supportsOneTwoComponentTextures = gl.isExtensionAvailable("GL_ARB_texture_rg"); + // Check for support of fixed function dot3 environment settings _supportsEnvDot3 = gl.isExtensionAvailable("GL_ARB_texture_env_dot3"); @@ -137,7 +142,7 @@ public class JoglContextCapabilities extends ContextCapabilities { // If we do support multitexturing, find out how many textures we // can handle. if (_supportsMultiTexture) { - gl.glGetIntegerv(GL.GL_MAX_TEXTURE_UNITS, buf); + gl.glGetIntegerv(GL2ES1.GL_MAX_TEXTURE_UNITS, buf); _numFixedTexUnits = buf.get(0); } else { _numFixedTexUnits = 1; @@ -147,11 +152,11 @@ public class JoglContextCapabilities extends ContextCapabilities { // fragment shaders if (gl.isExtensionAvailable("GL_ARB_shader_objects") && gl.isExtensionAvailable("GL_ARB_vertex_shader") && gl.isExtensionAvailable("GL_ARB_fragment_shader")) { - gl.glGetIntegerv(GL.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, buf); + gl.glGetIntegerv(GL2ES2.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, buf); _numVertexTexUnits = buf.get(0); - gl.glGetIntegerv(GL.GL_MAX_TEXTURE_IMAGE_UNITS_ARB, buf); + gl.glGetIntegerv(GL2ES2.GL_MAX_TEXTURE_IMAGE_UNITS, buf); _numFragmentTexUnits = buf.get(0); - gl.glGetIntegerv(GL.GL_MAX_TEXTURE_COORDS_ARB, buf); + gl.glGetIntegerv(GL2.GL_MAX_TEXTURE_COORDS, buf); _numFragmentTexCoordUnits = buf.get(0); } else { // based on nvidia dev doc: @@ -167,8 +172,8 @@ public class JoglContextCapabilities extends ContextCapabilities { } // Now determine the maximum number of supported texture units - _numTotalTexUnits = Math.max(_numFragmentTexCoordUnits, - Math.max(_numFixedTexUnits, Math.max(_numFragmentTexUnits, _numVertexTexUnits))); + _numTotalTexUnits = Math.max(_numFragmentTexCoordUnits, Math.max(_numFixedTexUnits, Math.max( + _numFragmentTexUnits, _numVertexTexUnits))); // Check for S3 texture compression capability. _supportsS3TCCompression = gl.isExtensionAvailable("GL_EXT_texture_compression_s3tc"); @@ -231,7 +236,7 @@ public class JoglContextCapabilities extends ContextCapabilities { if (_glslSupported) { try { - _shadingLanguageVersion = gl.glGetString(GL.GL_SHADING_LANGUAGE_VERSION); + _shadingLanguageVersion = gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION); } catch (final Exception e) { _shadingLanguageVersion = "Unable to retrieve shading language version."; } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java index 9003eb4..63eb6ee 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -20,6 +20,7 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLPbuffer; +import javax.media.opengl.GLProfile; import javax.media.opengl.glu.GLU; import com.ardor3d.framework.DisplaySettings; @@ -98,8 +99,8 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer { // Initialize our texture with some default data. final int internalFormat = JoglTextureUtil.getGLInternalFormat(tex.getTextureStoreFormat()); final int dataFormat = JoglTextureUtil.getGLPixelFormatFromStoreFormat(tex.getTextureStoreFormat()); - final int pixelDataType = JoglTextureUtil.getGLPixelDataType(tex.getRenderedTexturePixelDataType()); - + final int pixelDataType = JoglTextureUtil.getGLPixelDataType(tex.getRenderedTexturePixelDataType()); + gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, internalFormat, _width, _height, 0, dataFormat, pixelDataType, null); // Setup filtering and wrap @@ -261,8 +262,8 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer { } // Make our GLPbuffer... - final GLDrawableFactory fac = GLDrawableFactory.getFactory(); - final GLCapabilities caps = new GLCapabilities(); + final GLDrawableFactory fac = GLDrawableFactory.getFactory(GLProfile.getMaxFixedFunc(true)); + final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); caps.setHardwareAccelerated(true); caps.setDoubleBuffered(true); caps.setAlphaBits(_settings.getAlphaBits()); @@ -271,7 +272,7 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer { caps.setSampleBuffers(_settings.getSamples() != 0); caps.setStencilBits(_settings.getStencilBits()); caps.setDoubleBuffered(false); - _pbuffer = fac.createGLPbuffer(caps, null, _width, _height, _parentContext); + _pbuffer = fac.createGLPbuffer(null, caps, null, _width, _height, _parentContext); _context = _pbuffer.getContext(); _context.makeCurrent(); diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java index 88c9bbf..7812aa6 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -20,8 +20,15 @@ import java.util.List; import java.util.logging.Logger; import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES1; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.GLContext; import javax.media.opengl.GLException; +import javax.media.opengl.fixedfunc.GLLightingFunc; +import javax.media.opengl.fixedfunc.GLMatrixFunc; +import javax.media.opengl.fixedfunc.GLPointerFunc; import javax.media.opengl.glu.GLU; import com.ardor3d.image.ImageDataFormat; @@ -83,12 +90,12 @@ import com.ardor3d.scene.state.jogl.JoglZBufferStateUtil; import com.ardor3d.scene.state.jogl.util.JoglRendererUtil; import com.ardor3d.scene.state.jogl.util.JoglTextureUtil; import com.ardor3d.scenegraph.AbstractBufferData; -import com.ardor3d.scenegraph.AbstractBufferData.VBOAccessMode; import com.ardor3d.scenegraph.FloatBufferData; import com.ardor3d.scenegraph.IndexBufferData; import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.Renderable; import com.ardor3d.scenegraph.Spatial; +import com.ardor3d.scenegraph.AbstractBufferData.VBOAccessMode; import com.ardor3d.scenegraph.hint.NormalsMode; import com.ardor3d.util.Ardor3dException; import com.ardor3d.util.Constants; @@ -183,7 +190,7 @@ public class JoglRenderer extends AbstractRenderer { } if ((buffers & Renderer.BUFFER_ACCUMULATION) != 0) { - clear |= GL.GL_ACCUM_BUFFER_BIT; + clear |= GL2.GL_ACCUM_BUFFER_BIT; } final RenderContext context = ContextManager.getCurrentContext(); @@ -240,16 +247,16 @@ public class JoglRenderer extends AbstractRenderer { } // set up ortho mode final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - JoglRendererUtil.switchMode(matRecord, GL.GL_PROJECTION); - gl.glPushMatrix(); - gl.glLoadIdentity(); + JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_PROJECTION); + gl.getGL2().glPushMatrix(); + gl.getGL2().glLoadIdentity(); final Camera camera = Camera.getCurrentCamera(); final double viewportWidth = camera.getWidth() * (camera.getViewPortRight() - camera.getViewPortLeft()); final double viewportHeight = camera.getHeight() * (camera.getViewPortTop() - camera.getViewPortBottom()); - gl.glOrtho(0, viewportWidth, 0, viewportHeight, -1, 1); - JoglRendererUtil.switchMode(matRecord, GL.GL_MODELVIEW); - gl.glPushMatrix(); - gl.glLoadIdentity(); + gl.getGL2().glOrtho(0, viewportWidth, 0, viewportHeight, -1, 1); + JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW); + gl.getGL2().glPushMatrix(); + gl.getGL2().glLoadIdentity(); _inOrthoMode = true; } @@ -262,10 +269,10 @@ public class JoglRenderer extends AbstractRenderer { // remove ortho mode, and go back to original // state final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - JoglRendererUtil.switchMode(matRecord, GL.GL_PROJECTION); - gl.glPopMatrix(); - JoglRendererUtil.switchMode(matRecord, GL.GL_MODELVIEW); - gl.glPopMatrix(); + JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_PROJECTION); + gl.getGL2().glPopMatrix(); + JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW); + gl.getGL2().glPopMatrix(); _inOrthoMode = false; } @@ -296,7 +303,7 @@ public class JoglRenderer extends AbstractRenderer { * re-initializes the GL context for rendering of another piece of geometry. */ protected void postdrawGeometry(final Mesh g) { - // Nothing to do here yet + // Nothing to do here yet } public void flushGraphics() { @@ -324,72 +331,72 @@ public class JoglRenderer extends AbstractRenderer { if (!(scale.getX() == 1.0 && scale.getY() == 1.0 && scale.getZ() == 1.0)) { if (scale.getX() == scale.getY() && scale.getY() == scale.getZ() && caps.isOpenGL1_2Supported() - && rendRecord.getNormalMode() != GL.GL_RESCALE_NORMAL) { - if (rendRecord.getNormalMode() == GL.GL_NORMALIZE) { - gl.glDisable(GL.GL_NORMALIZE); + && rendRecord.getNormalMode() != GL2ES1.GL_RESCALE_NORMAL) { + if (rendRecord.getNormalMode() == GLLightingFunc.GL_NORMALIZE) { + gl.glDisable(GLLightingFunc.GL_NORMALIZE); } - gl.glEnable(GL.GL_RESCALE_NORMAL); - rendRecord.setNormalMode(GL.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() != GL.GL_NORMALIZE) { - if (rendRecord.getNormalMode() == GL.GL_RESCALE_NORMAL) { - gl.glDisable(GL.GL_RESCALE_NORMAL); + gl.glEnable(GL2ES1.GL_RESCALE_NORMAL); + rendRecord.setNormalMode(GL2ES1.GL_RESCALE_NORMAL); + } else if (rendRecord.getNormalMode() != GLLightingFunc.GL_NORMALIZE) { + if (rendRecord.getNormalMode() == GL2ES1.GL_RESCALE_NORMAL) { + gl.glDisable(GL2ES1.GL_RESCALE_NORMAL); } - gl.glEnable(GL.GL_NORMALIZE); - rendRecord.setNormalMode(GL.GL_NORMALIZE); + gl.glEnable(GLLightingFunc.GL_NORMALIZE); + rendRecord.setNormalMode(GLLightingFunc.GL_NORMALIZE); } } else { - if (rendRecord.getNormalMode() == GL.GL_RESCALE_NORMAL) { - gl.glDisable(GL.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() == GL.GL_NORMALIZE) { - gl.glDisable(GL.GL_NORMALIZE); + if (rendRecord.getNormalMode() == GL2ES1.GL_RESCALE_NORMAL) { + gl.glDisable(GL2ES1.GL_RESCALE_NORMAL); + } else if (rendRecord.getNormalMode() == GLLightingFunc.GL_NORMALIZE) { + gl.glDisable(GLLightingFunc.GL_NORMALIZE); } rendRecord.setNormalMode(GL.GL_ZERO); } } else { if (!worldTransform.getMatrix().isIdentity()) { // *might* be scaled... - if (rendRecord.getNormalMode() != GL.GL_NORMALIZE) { - if (rendRecord.getNormalMode() == GL.GL_RESCALE_NORMAL) { - gl.glDisable(GL.GL_RESCALE_NORMAL); + if (rendRecord.getNormalMode() != GLLightingFunc.GL_NORMALIZE) { + if (rendRecord.getNormalMode() == GL2ES1.GL_RESCALE_NORMAL) { + gl.glDisable(GL2ES1.GL_RESCALE_NORMAL); } - gl.glEnable(GL.GL_NORMALIZE); - rendRecord.setNormalMode(GL.GL_NORMALIZE); + gl.glEnable(GLLightingFunc.GL_NORMALIZE); + rendRecord.setNormalMode(GLLightingFunc.GL_NORMALIZE); } } else { // not scaled - if (rendRecord.getNormalMode() == GL.GL_RESCALE_NORMAL) { - gl.glDisable(GL.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() == GL.GL_NORMALIZE) { - gl.glDisable(GL.GL_NORMALIZE); + if (rendRecord.getNormalMode() == GL2ES1.GL_RESCALE_NORMAL) { + gl.glDisable(GL2ES1.GL_RESCALE_NORMAL); + } else if (rendRecord.getNormalMode() == GLLightingFunc.GL_NORMALIZE) { + gl.glDisable(GLLightingFunc.GL_NORMALIZE); } rendRecord.setNormalMode(GL.GL_ZERO); } } break; case AlwaysNormalize: - if (rendRecord.getNormalMode() != GL.GL_NORMALIZE) { - if (rendRecord.getNormalMode() == GL.GL_RESCALE_NORMAL) { - gl.glDisable(GL.GL_RESCALE_NORMAL); + if (rendRecord.getNormalMode() != GLLightingFunc.GL_NORMALIZE) { + if (rendRecord.getNormalMode() == GL2ES1.GL_RESCALE_NORMAL) { + gl.glDisable(GL2ES1.GL_RESCALE_NORMAL); } - gl.glEnable(GL.GL_NORMALIZE); - rendRecord.setNormalMode(GL.GL_NORMALIZE); + gl.glEnable(GLLightingFunc.GL_NORMALIZE); + rendRecord.setNormalMode(GLLightingFunc.GL_NORMALIZE); } break; case UseProvided: default: - if (rendRecord.getNormalMode() == GL.GL_RESCALE_NORMAL) { - gl.glDisable(GL.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() == GL.GL_NORMALIZE) { - gl.glDisable(GL.GL_NORMALIZE); + if (rendRecord.getNormalMode() == GL2ES1.GL_RESCALE_NORMAL) { + gl.glDisable(GL2ES1.GL_RESCALE_NORMAL); + } else if (rendRecord.getNormalMode() == GLLightingFunc.GL_NORMALIZE) { + gl.glDisable(GLLightingFunc.GL_NORMALIZE); } rendRecord.setNormalMode(GL.GL_ZERO); break; } } else { - if (rendRecord.getNormalMode() == GL.GL_RESCALE_NORMAL) { - gl.glDisable(GL.GL_RESCALE_NORMAL); - } else if (rendRecord.getNormalMode() == GL.GL_NORMALIZE) { - gl.glDisable(GL.GL_NORMALIZE); + if (rendRecord.getNormalMode() == GL2ES1.GL_RESCALE_NORMAL) { + gl.glDisable(GL2ES1.GL_RESCALE_NORMAL); + } else if (rendRecord.getNormalMode() == GLLightingFunc.GL_NORMALIZE) { + gl.glDisable(GLLightingFunc.GL_NORMALIZE); } rendRecord.setNormalMode(GL.GL_ZERO); } @@ -398,10 +405,10 @@ public class JoglRenderer extends AbstractRenderer { public void applyDefaultColor(final ReadOnlyColorRGBA defaultColor) { final GL gl = GLU.getCurrentGL(); if (defaultColor != null) { - gl.glColor4f(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(), - defaultColor.getAlpha()); + gl.getGL2().glColor4f(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(), defaultColor + .getAlpha()); } else { - gl.glColor4f(1, 1, 1, 1); + gl.getGL2().glColor4f(1, 1, 1, 1); } } @@ -424,7 +431,7 @@ public class JoglRenderer extends AbstractRenderer { final GL gl = GLU.getCurrentGL(); for (final Integer i : ids) { if (i != null && i != 0) { - gl.glDeleteLists(i, 1); + gl.getGL2().glDeleteLists(i, 1); } } } @@ -530,12 +537,12 @@ public class JoglRenderer extends AbstractRenderer { } // Grab pixel format - final int pixelFormat; - if (destination.getImage() != null) { - pixelFormat = JoglTextureUtil.getGLPixelFormat(destination.getImage().getDataFormat()); - } else { - pixelFormat = JoglTextureUtil.getGLPixelFormatFromStoreFormat(destination.getTextureStoreFormat()); - } + final int pixelFormat; + if (destination.getImage() != null) { + pixelFormat = JoglTextureUtil.getGLPixelFormat(destination.getImage().getDataFormat()); + } else { + pixelFormat = JoglTextureUtil.getGLPixelFormatFromStoreFormat(destination.getTextureStoreFormat()); + } // bind... JoglTextureStateUtil.doTextureBind(destination, 0, false); @@ -546,20 +553,20 @@ public class JoglRenderer extends AbstractRenderer { gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, alignment); } if (origRowLength != rowLength) { - gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, rowLength); + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, rowLength); } if (origSkipPixels != srcOffsetX) { - gl.glPixelStorei(GL.GL_UNPACK_SKIP_PIXELS, srcOffsetX); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, srcOffsetX); } // NOTE: The below will be skipped for texture types that don't support them because we are passing in 0's. if (origSkipRows != srcOffsetY) { - gl.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, srcOffsetY); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, srcOffsetY); } if (origImageHeight != imageHeight) { - gl.glPixelStorei(GL.GL_UNPACK_IMAGE_HEIGHT, imageHeight); + gl.glPixelStorei(GL2GL3.GL_UNPACK_IMAGE_HEIGHT, imageHeight); } if (origSkipImages != srcOffsetZ) { - gl.glPixelStorei(GL.GL_UNPACK_SKIP_IMAGES, srcOffsetZ); + gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_IMAGES, srcOffsetZ); } // Upload the image region into the texture. @@ -570,11 +577,11 @@ public class JoglRenderer extends AbstractRenderer { GL.GL_UNSIGNED_BYTE, source); break; case OneDimensional: - gl.glTexSubImage1D(GL.GL_TEXTURE_1D, 0, dstOffsetX, dstWidth, pixelFormat, GL.GL_UNSIGNED_BYTE, + gl.getGL2GL3().glTexSubImage1D(GL2GL3.GL_TEXTURE_1D, 0, dstOffsetX, dstWidth, pixelFormat, GL.GL_UNSIGNED_BYTE, source); break; case ThreeDimensional: - gl.glTexSubImage3D(GL.GL_TEXTURE_3D, 0, dstOffsetX, dstOffsetY, dstOffsetZ, dstWidth, dstHeight, + gl.getGL2GL3().glTexSubImage3D(GL2ES2.GL_TEXTURE_3D, 0, dstOffsetX, dstOffsetY, dstOffsetZ, dstWidth, dstHeight, dstDepth, pixelFormat, GL.GL_UNSIGNED_BYTE, source); break; case CubeMap: @@ -592,23 +599,23 @@ public class JoglRenderer extends AbstractRenderer { } // Restore row length. if (origRowLength != rowLength) { - gl.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, origRowLength); + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, origRowLength); } // Restore skip pixels. if (origSkipPixels != srcOffsetX) { - gl.glPixelStorei(GL.GL_UNPACK_SKIP_PIXELS, origSkipPixels); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, origSkipPixels); } // Restore skip rows. if (origSkipRows != srcOffsetY) { - gl.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, origSkipRows); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, origSkipRows); } // Restore image height. if (origImageHeight != imageHeight) { - gl.glPixelStorei(GL.GL_UNPACK_IMAGE_HEIGHT, origImageHeight); + gl.glPixelStorei(GL2GL3.GL_UNPACK_IMAGE_HEIGHT, origImageHeight); } // Restore skip images. if (origSkipImages != srcOffsetZ) { - gl.glPixelStorei(GL.GL_UNPACK_SKIP_IMAGES, origSkipImages); + gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_IMAGES, origSkipImages); } } } @@ -646,9 +653,9 @@ public class JoglRenderer extends AbstractRenderer { transform.getGLApplyMatrix(_transformBuffer); final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - JoglRendererUtil.switchMode(matRecord, GL.GL_MODELVIEW); - gl.glPushMatrix(); - gl.glMultMatrixf(_transformBuffer); + JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW); + gl.getGL2().glPushMatrix(); + gl.getGL2().glMultMatrixf(_transformBuffer); return true; } } @@ -659,8 +666,8 @@ public class JoglRenderer extends AbstractRenderer { final GL gl = GLU.getCurrentGL(); final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - JoglRendererUtil.switchMode(matRecord, GL.GL_MODELVIEW); - gl.glPopMatrix(); + JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW); + gl.getGL2().glPopMatrix(); } public void setupVertexData(final FloatBufferData vertexBufferData) { @@ -669,11 +676,11 @@ public class JoglRenderer extends AbstractRenderer { final FloatBuffer vertexBuffer = vertexBufferData != null ? vertexBufferData.getBuffer() : null; if (vertexBuffer == null) { - gl.glDisableClientState(GL.GL_VERTEX_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); } else { - gl.glEnableClientState(GL.GL_VERTEX_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); vertexBuffer.rewind(); - gl.glVertexPointer(vertexBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, vertexBuffer); + gl.getGL2().glVertexPointer(vertexBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, vertexBuffer); } } @@ -683,11 +690,11 @@ public class JoglRenderer extends AbstractRenderer { final FloatBuffer normalBuffer = normalBufferData != null ? normalBufferData.getBuffer() : null; if (normalBuffer == null) { - gl.glDisableClientState(GL.GL_NORMAL_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY); } else { - gl.glEnableClientState(GL.GL_NORMAL_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY); normalBuffer.rewind(); - gl.glNormalPointer(GL.GL_FLOAT, 0, normalBuffer); + gl.getGL2().glNormalPointer(GL.GL_FLOAT, 0, normalBuffer); } } @@ -697,11 +704,11 @@ public class JoglRenderer extends AbstractRenderer { final FloatBuffer colorBuffer = colorBufferData != null ? colorBufferData.getBuffer() : null; if (colorBuffer == null) { - gl.glDisableClientState(GL.GL_COLOR_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY); } else { - gl.glEnableClientState(GL.GL_COLOR_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY); colorBuffer.rewind(); - gl.glColorPointer(colorBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, colorBuffer); + gl.getGL2().glColorPointer(colorBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, colorBuffer); } } @@ -711,11 +718,11 @@ public class JoglRenderer extends AbstractRenderer { final FloatBuffer fogBuffer = fogBufferData != null ? fogBufferData.getBuffer() : null; if (fogBuffer == null) { - gl.glDisableClientState(GL.GL_FOG_COORDINATE_ARRAY); + gl.getGL2GL3().glDisableClientState(GL2.GL_FOG_COORDINATE_ARRAY); } else { - gl.glEnableClientState(GL.GL_FOG_COORDINATE_ARRAY); + gl.getGL2GL3().glEnableClientState(GL2.GL_FOG_COORDINATE_ARRAY); fogBuffer.rewind(); - gl.glFogCoordPointer(GL.GL_FLOAT, 0, fogBuffer); + gl.getGL2().glFogCoordPointer(GL.GL_FLOAT, 0, fogBuffer); } } @@ -748,7 +755,7 @@ public class JoglRenderer extends AbstractRenderer { enabledTextures &= ~(2 << i); // disable state - gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); continue; } @@ -757,7 +764,7 @@ public class JoglRenderer extends AbstractRenderer { if (!valid || !wasOn) { // enable state - gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); // enable bit in tracking int enabledTextures |= (2 << i); @@ -766,9 +773,9 @@ public class JoglRenderer extends AbstractRenderer { final FloatBufferData textureBufferData = textureCoords.get(i); final FloatBuffer textureBuffer = textureBufferData.getBuffer(); - gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); textureBuffer.rewind(); - gl.glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, textureBuffer); + gl.getGL2().glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, textureBuffer); } } } @@ -795,7 +802,7 @@ public class JoglRenderer extends AbstractRenderer { if (primcount < 0) { gl.glDrawElements(glIndexMode, indices.getBufferLimit(), type, indices.getBuffer()); } else { - gl.glDrawElementsInstancedEXT(glIndexMode, indices.getBufferLimit(), type, indices.getBuffer(), + gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, indices.getBufferLimit(), type, indices.getBuffer(), primcount); } @@ -816,7 +823,7 @@ public class JoglRenderer extends AbstractRenderer { if (primcount < 0) { gl.glDrawElements(glIndexMode, count, type, indices.getBuffer()); } else { - gl.glDrawElementsInstancedEXT(glIndexMode, count, type, indices.getBuffer(), primcount); + gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, count, type, indices.getBuffer(), primcount); } if (Constants.stats) { @@ -855,7 +862,7 @@ public class JoglRenderer extends AbstractRenderer { rendRecord.invalidateVBO(); JoglRendererUtil.setBoundVBO(rendRecord, vboID); - gl.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, dataBuffer.limit() * data.getByteCount(), dataBuffer, + gl.glBufferData(GL.GL_ARRAY_BUFFER, dataBuffer.limit() * data.getByteCount(), dataBuffer, getGLVBOAccessMode(data.getVboAccessMode())); } else { throw new Ardor3dException("Attempting to create a vbo id for an AbstractBufferData with no Buffer value."); @@ -870,7 +877,7 @@ public class JoglRenderer extends AbstractRenderer { final Buffer dataBuffer = data.getBuffer(); dataBuffer.rewind(); JoglRendererUtil.setBoundVBO(rendRecord, vboID); - gl.glBufferSubDataARB(GL.GL_ARRAY_BUFFER_ARB, offsetBytes, dataBuffer.limit() * data.getByteCount(), + gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offsetBytes, dataBuffer.limit() * data.getByteCount(), dataBuffer); data.setNeedsRefresh(false); } @@ -890,7 +897,7 @@ public class JoglRenderer extends AbstractRenderer { final Buffer dataBuffer = data.getBuffer(); dataBuffer.rewind(); JoglRendererUtil.setBoundElementVBO(rendRecord, vboID); - gl.glBufferSubDataARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, 0, dataBuffer.limit() * data.getByteCount(), + gl.glBufferSubData(GL.GL_ELEMENT_ARRAY_BUFFER, 0, dataBuffer.limit() * data.getByteCount(), dataBuffer); data.setNeedsRefresh(false); } @@ -907,7 +914,7 @@ public class JoglRenderer extends AbstractRenderer { rendRecord.invalidateVBO(); JoglRendererUtil.setBoundElementVBO(rendRecord, vboID); - gl.glBufferDataARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, dataBuffer.limit() * data.getByteCount(), dataBuffer, + gl.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER, dataBuffer.limit() * data.getByteCount(), dataBuffer, getGLVBOAccessMode(data.getVboAccessMode())); } else { throw new Ardor3dException("Attempting to create a vbo id for a IndexBufferData with no Buffer value."); @@ -924,11 +931,11 @@ public class JoglRenderer extends AbstractRenderer { final int vboID = setupVBO(data, context); if (vboID != 0) { - gl.glEnableClientState(GL.GL_VERTEX_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); JoglRendererUtil.setBoundVBO(rendRecord, vboID); - gl.glVertexPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0); + gl.getGL2().glVertexPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0); } else { - gl.glDisableClientState(GL.GL_VERTEX_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); } } @@ -941,11 +948,11 @@ public class JoglRenderer extends AbstractRenderer { final int vboID = setupVBO(data, context); if (vboID != 0) { - gl.glEnableClientState(GL.GL_NORMAL_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY); JoglRendererUtil.setBoundVBO(rendRecord, vboID); - gl.glNormalPointer(GL.GL_FLOAT, 0, 0); + gl.getGL2().glNormalPointer(GL.GL_FLOAT, 0, 0); } else { - gl.glDisableClientState(GL.GL_NORMAL_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY); } } @@ -958,11 +965,11 @@ public class JoglRenderer extends AbstractRenderer { final int vboID = setupVBO(data, context); if (vboID != 0) { - gl.glEnableClientState(GL.GL_COLOR_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY); JoglRendererUtil.setBoundVBO(rendRecord, vboID); - gl.glColorPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0); + gl.getGL2().glColorPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0); } else { - gl.glDisableClientState(GL.GL_COLOR_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY); } } @@ -980,11 +987,11 @@ public class JoglRenderer extends AbstractRenderer { final int vboID = setupVBO(data, context); if (vboID != 0) { - gl.glEnableClientState(GL.GL_FOG_COORDINATE_ARRAY_EXT); + gl.getGL2GL3().glEnableClientState(GL2.GL_FOG_COORDINATE_ARRAY); JoglRendererUtil.setBoundVBO(rendRecord, vboID); - gl.glFogCoordPointerEXT(GL.GL_FLOAT, 0, 0); + gl.getGL2().glFogCoordPointer(GL.GL_FLOAT, 0, 0); } else { - gl.glDisableClientState(GL.GL_FOG_COORDINATE_ARRAY_EXT); + gl.getGL2GL3().glDisableClientState(GL2.GL_FOG_COORDINATE_ARRAY); } } @@ -1016,7 +1023,7 @@ public class JoglRenderer extends AbstractRenderer { enabledTextures &= ~(2 << i); // disable state - gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); continue; } @@ -1034,14 +1041,14 @@ public class JoglRenderer extends AbstractRenderer { enabledTextures |= (2 << i); // enable state - gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); } // set our active vbo JoglRendererUtil.setBoundVBO(rendRecord, vboID); // send data - gl.glTexCoordPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0); + gl.getGL2().glTexCoordPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0); } // Not a good vbo, disable it. else { @@ -1050,7 +1057,7 @@ public class JoglRenderer extends AbstractRenderer { enabledTextures &= ~(2 << i); // disable state - gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); } } } @@ -1090,20 +1097,20 @@ public class JoglRenderer extends AbstractRenderer { if (normalCoords != null) { updateVBO(normalCoords, rendRecord, vboID, offsetBytes); - gl.glNormalPointer(GL.GL_FLOAT, 0, offsetBytes); - gl.glEnableClientState(GL.GL_NORMAL_ARRAY); + gl.getGL2().glNormalPointer(GL.GL_FLOAT, 0, offsetBytes); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY); offsetBytes += normalCoords.getBufferLimit() * 4; } else { - gl.glDisableClientState(GL.GL_NORMAL_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY); } if (colorCoords != null) { updateVBO(colorCoords, rendRecord, vboID, offsetBytes); - gl.glColorPointer(colorCoords.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes); - gl.glEnableClientState(GL.GL_COLOR_ARRAY); + gl.getGL2().glColorPointer(colorCoords.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY); offsetBytes += colorCoords.getBufferLimit() * 4; } else { - gl.glDisableClientState(GL.GL_COLOR_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY); } if (textureCoords != null) { @@ -1129,7 +1136,7 @@ public class JoglRenderer extends AbstractRenderer { enabledTextures &= ~(2 << i); // disable state - gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); continue; } @@ -1146,11 +1153,11 @@ public class JoglRenderer extends AbstractRenderer { enabledTextures |= (2 << i); // enable state - gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); } // send data - gl.glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes); + gl.getGL2().glTexCoordPointer(textureBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes); offsetBytes += textureBufferData.getBufferLimit() * 4; } } @@ -1162,10 +1169,10 @@ public class JoglRenderer extends AbstractRenderer { if (vertexCoords != null) { updateVBO(vertexCoords, rendRecord, vboID, offsetBytes); - gl.glVertexPointer(vertexCoords.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes); - gl.glEnableClientState(GL.GL_VERTEX_ARRAY); + gl.getGL2().glVertexPointer(vertexCoords.getValuesPerTuple(), GL.GL_FLOAT, 0, offsetBytes); + gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); } else { - gl.glDisableClientState(GL.GL_VERTEX_ARRAY); + gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); } } @@ -1191,19 +1198,21 @@ public class JoglRenderer extends AbstractRenderer { rendRecord.invalidateVBO(); JoglRendererUtil.setBoundVBO(rendRecord, vboID); - gl.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, bufferSize, null, getGLVBOAccessMode(interleaved.getVboAccessMode())); + gl + .glBufferData(GL.GL_ARRAY_BUFFER, bufferSize, null, getGLVBOAccessMode(interleaved + .getVboAccessMode())); int offset = 0; if (normalCoords != null) { normalCoords.getBuffer().rewind(); - gl.glBufferSubDataARB(GL.GL_ARRAY_BUFFER_ARB, offset, normalCoords.getBufferLimit() * 4, - normalCoords.getBuffer()); + gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, normalCoords.getBufferLimit() * 4, normalCoords + .getBuffer()); offset += normalCoords.getBufferLimit() * 4; } if (colorCoords != null) { colorCoords.getBuffer().rewind(); - gl.glBufferSubDataARB(GL.GL_ARRAY_BUFFER_ARB, offset, colorCoords.getBufferLimit() * 4, - colorCoords.getBuffer()); + gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, colorCoords.getBufferLimit() * 4, colorCoords + .getBuffer()); offset += colorCoords.getBufferLimit() * 4; } if (textureCoords != null) { @@ -1218,7 +1227,7 @@ public class JoglRenderer extends AbstractRenderer { final FloatBuffer textureBuffer = textureBufferData != null ? textureBufferData.getBuffer() : null; if (textureBuffer != null) { textureBuffer.rewind(); - gl.glBufferSubDataARB(GL.GL_ARRAY_BUFFER_ARB, offset, textureBufferData.getBufferLimit() * 4, + gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, textureBufferData.getBufferLimit() * 4, textureBuffer); offset += textureBufferData.getBufferLimit() * 4; } @@ -1227,8 +1236,8 @@ public class JoglRenderer extends AbstractRenderer { } if (vertexCoords != null) { vertexCoords.getBuffer().rewind(); - gl.glBufferSubDataARB(GL.GL_ARRAY_BUFFER_ARB, offset, vertexCoords.getBufferLimit() * 4, - vertexCoords.getBuffer()); + gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offset, vertexCoords.getBufferLimit() * 4, vertexCoords + .getBuffer()); } interleaved.setNeedsRefresh(false); @@ -1253,8 +1262,8 @@ public class JoglRenderer extends AbstractRenderer { if (primcount < 0) { gl.glDrawElements(glIndexMode, indices.getBufferLimit(), type, 0); } else { - gl.glDrawElementsInstancedEXT(glIndexMode, indices.getBufferLimit(), type, indices.getBuffer(), - primcount); + gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, indices.getBufferLimit(), type, indices.getBuffer(), + primcount); } if (Constants.stats) { @@ -1278,7 +1287,7 @@ public class JoglRenderer extends AbstractRenderer { } else { final int previousPos = indices.getBuffer().position(); indices.getBuffer().position(offset * byteSize); - gl.glDrawElementsInstancedEXT(glIndexMode, count, type, indices.getBuffer(), primcount); + gl.getGL2GL3().glDrawElementsInstanced(glIndexMode, count, type, indices.getBuffer(), primcount); indices.getBuffer().position(previousPos); } @@ -1305,7 +1314,7 @@ public class JoglRenderer extends AbstractRenderer { if (primcount < 0) { gl.glDrawArrays(glIndexMode, 0, vertexBuffer.getTupleCount()); } else { - gl.glDrawArraysInstancedEXT(glIndexMode, 0, vertexBuffer.getTupleCount(), primcount); + gl.getGL2GL3().glDrawArraysInstanced(glIndexMode, 0, vertexBuffer.getTupleCount(), primcount); } if (Constants.stats) { @@ -1322,7 +1331,7 @@ public class JoglRenderer extends AbstractRenderer { if (primcount < 0) { gl.glDrawArrays(glIndexMode, offset, count); } else { - gl.glDrawArraysInstancedEXT(glIndexMode, offset, count, primcount); + gl.getGL2GL3().glDrawArraysInstanced(glIndexMode, offset, count, primcount); } if (Constants.stats) { @@ -1342,7 +1351,7 @@ public class JoglRenderer extends AbstractRenderer { final GL gl = GLU.getCurrentGL(); final IntBuffer idBuff = BufferUtils.createIntBuffer(1); - gl.glGenBuffersARB(1, idBuff); + gl.glGenBuffers(1, idBuff); return idBuff.get(0); } @@ -1354,34 +1363,34 @@ public class JoglRenderer extends AbstractRenderer { } private static int getGLVBOAccessMode(final VBOAccessMode vboAccessMode) { - int glMode = GL.GL_STATIC_DRAW_ARB; + int glMode = GL.GL_STATIC_DRAW; switch (vboAccessMode) { case StaticDraw: - glMode = GL.GL_STATIC_DRAW_ARB; + glMode = GL.GL_STATIC_DRAW; break; case StaticRead: - glMode = GL.GL_STATIC_READ_ARB; + glMode = GL2GL3.GL_STATIC_READ; break; case StaticCopy: - glMode = GL.GL_STATIC_COPY_ARB; + glMode = GL2GL3.GL_STATIC_COPY; break; case DynamicDraw: - glMode = GL.GL_DYNAMIC_DRAW_ARB; + glMode = GL.GL_DYNAMIC_DRAW; break; case DynamicRead: - glMode = GL.GL_DYNAMIC_READ_ARB; + glMode = GL2GL3.GL_DYNAMIC_READ; break; case DynamicCopy: - glMode = GL.GL_DYNAMIC_COPY_ARB; + glMode = GL2GL3.GL_DYNAMIC_COPY; break; case StreamDraw: - glMode = GL.GL_STREAM_DRAW_ARB; + glMode = GL2ES2.GL_STREAM_DRAW; break; case StreamRead: - glMode = GL.GL_STREAM_READ_ARB; + glMode = GL2GL3.GL_STREAM_READ; break; case StreamCopy: - glMode = GL.GL_STREAM_COPY_ARB; + glMode = GL2GL3.GL_STREAM_COPY; break; } return glMode; @@ -1400,10 +1409,10 @@ public class JoglRenderer extends AbstractRenderer { glMode = GL.GL_TRIANGLE_FAN; break; case Quads: - glMode = GL.GL_QUADS; + glMode = GL2.GL_QUADS; break; case QuadStrip: - glMode = GL.GL_QUAD_STRIP; + glMode = GL2.GL_QUAD_STRIP; break; case Lines: glMode = GL.GL_LINES; @@ -1435,28 +1444,28 @@ public class JoglRenderer extends AbstractRenderer { public void setModelViewMatrix(final FloatBuffer matrix) { final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - JoglRendererUtil.switchMode(matRecord, GL.GL_MODELVIEW); + JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW); loadMatrix(matrix); } public void setProjectionMatrix(final FloatBuffer matrix) { final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); - JoglRendererUtil.switchMode(matRecord, GL.GL_PROJECTION); + JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_PROJECTION); loadMatrix(matrix); } private void loadMatrix(final FloatBuffer matrix) { - GLU.getCurrentGL().glLoadMatrixf(matrix); + GLU.getCurrentGL().getGL2().glLoadMatrixf(matrix); } public FloatBuffer getModelViewMatrix(final FloatBuffer store) { - return getMatrix(GL.GL_MODELVIEW_MATRIX, store); + return getMatrix(GLMatrixFunc.GL_MODELVIEW_MATRIX, store); } public FloatBuffer getProjectionMatrix(final FloatBuffer store) { - return getMatrix(GL.GL_PROJECTION_MATRIX, store); + return getMatrix(GLMatrixFunc.GL_PROJECTION_MATRIX, store); } private FloatBuffer getMatrix(final int matrixType, final FloatBuffer store) { @@ -1481,47 +1490,48 @@ public class JoglRenderer extends AbstractRenderer { if (record.getDrawBufferTarget() != target) { int buffer = GL.GL_BACK; switch (target) { + case None: case Back: break; case Front: buffer = GL.GL_FRONT; break; case BackLeft: - buffer = GL.GL_BACK_LEFT; + buffer = GL2GL3.GL_BACK_LEFT; break; case BackRight: - buffer = GL.GL_BACK_RIGHT; + buffer = GL2GL3.GL_BACK_RIGHT; break; case FrontLeft: - buffer = GL.GL_FRONT_LEFT; + buffer = GL2GL3.GL_FRONT_LEFT; break; case FrontRight: - buffer = GL.GL_FRONT_RIGHT; + buffer = GL2GL3.GL_FRONT_RIGHT; break; case FrontAndBack: buffer = GL.GL_FRONT_AND_BACK; break; case Left: - buffer = GL.GL_LEFT; + buffer = GL2GL3.GL_LEFT; break; case Right: - buffer = GL.GL_RIGHT; + buffer = GL2GL3.GL_RIGHT; break; case Aux0: - buffer = GL.GL_AUX0; + buffer = GL2.GL_AUX0; break; case Aux1: - buffer = GL.GL_AUX1; + buffer = GL2.GL_AUX1; break; case Aux2: - buffer = GL.GL_AUX2; + buffer = GL2.GL_AUX2; break; case Aux3: - buffer = GL.GL_AUX3; + buffer = GL2.GL_AUX3; break; } - GLU.getCurrentGL().glDrawBuffer(buffer); + GLU.getCurrentGL().getGL2GL3().glDrawBuffer(buffer); record.setDrawBufferTarget(target); } } @@ -1539,18 +1549,18 @@ public class JoglRenderer extends AbstractRenderer { if (stipplePattern != (short) 0xFFFF) { if (!lineRecord.isValid() || !lineRecord.stippled) { - gl.glEnable(GL.GL_LINE_STIPPLE); + gl.glEnable(GL2.GL_LINE_STIPPLE); lineRecord.stippled = true; } if (!lineRecord.isValid() || stippleFactor != lineRecord.stippleFactor || stipplePattern != lineRecord.stipplePattern) { - gl.glLineStipple(stippleFactor, stipplePattern); + gl.getGL2().glLineStipple(stippleFactor, stipplePattern); lineRecord.stippleFactor = stippleFactor; lineRecord.stipplePattern = stipplePattern; } } else if (!lineRecord.isValid() || lineRecord.stippled) { - gl.glDisable(GL.GL_LINE_STIPPLE); + gl.glDisable(GL2.GL_LINE_STIPPLE); lineRecord.stippled = false; } @@ -1581,21 +1591,21 @@ public class JoglRenderer extends AbstractRenderer { final GL gl = GLU.getCurrentGL(); // TODO: make this into a pointrecord call - gl.glPointSize(pointSize); + gl.getGL2GL3().glPointSize(pointSize); if (antialiased) { - gl.glEnable(GL.GL_POINT_SMOOTH); - gl.glHint(GL.GL_POINT_SMOOTH_HINT, GL.GL_NICEST); + gl.glEnable(GL2ES1.GL_POINT_SMOOTH); + gl.glHint(GL2ES1.GL_POINT_SMOOTH_HINT, GL.GL_NICEST); } if (isSprite && context.getCapabilities().isPointSpritesSupported()) { - gl.glEnable(GL.GL_POINT_SPRITE_ARB); - gl.glTexEnvi(GL.GL_POINT_SPRITE_ARB, GL.GL_COORD_REPLACE_ARB, GL.GL_TRUE); + gl.glEnable(GL2ES1.GL_POINT_SPRITE); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_POINT_SPRITE, GL2ES1.GL_COORD_REPLACE, GL.GL_TRUE); } if (useDistanceAttenuation && context.getCapabilities().isPointParametersSupported()) { - gl.glPointParameterfvARB(GL.GL_POINT_DISTANCE_ATTENUATION_ARB, attenuationCoefficients); - gl.glPointParameterfARB(GL.GL_POINT_SIZE_MIN_ARB, minPointSize); - gl.glPointParameterfARB(GL.GL_POINT_SIZE_MAX_ARB, maxPointSize); + gl.getGL2GL3().glPointParameterfv(GL2ES1.GL_POINT_DISTANCE_ATTENUATION, attenuationCoefficients); + gl.getGL2GL3().glPointParameterf(GL2ES1.GL_POINT_SIZE_MIN, minPointSize); + gl.getGL2GL3().glPointParameterf(GL2ES1.GL_POINT_SIZE_MAX, maxPointSize); } } @@ -1675,9 +1685,9 @@ public class JoglRenderer extends AbstractRenderer { public int startDisplayList() { final GL gl = GLU.getCurrentGL(); - final int id = gl.glGenLists(1); + final int id = gl.getGL2().glGenLists(1); - gl.glNewList(id, GL.GL_COMPILE); + gl.getGL2().glNewList(id, GL2.GL_COMPILE); return id; } @@ -1686,7 +1696,7 @@ public class JoglRenderer extends AbstractRenderer { * Ends a display list. Will likely cause an OpenGL exception is a display list is not currently being generated. */ public void endDisplayList() { - GLU.getCurrentGL().glEndList(); + GLU.getCurrentGL().getGL2().glEndList(); } /** @@ -1695,7 +1705,7 @@ public class JoglRenderer extends AbstractRenderer { public void renderDisplayList(final int displayListID) { final GL gl = GLU.getCurrentGL(); - gl.glCallList(displayListID); + gl.getGL2().glCallList(displayListID); } public void clearClips() { @@ -1740,7 +1750,7 @@ public class JoglRenderer extends AbstractRenderer { public void checkAndSetTextureArrayUnit(final int unit, final GL gl, final RendererRecord record, final ContextCapabilities caps) { if (record.getCurrentTextureArraysUnit() != unit && caps.isMultitextureSupported()) { - gl.glClientActiveTexture(GL.GL_TEXTURE0 + unit); + gl.getGL2().glClientActiveTexture(GL.GL_TEXTURE0 + unit); record.setCurrentTextureArraysUnit(unit); } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java index 3110ff0..99719df 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -16,6 +16,8 @@ import java.util.List; import java.util.logging.Logger; import javax.media.opengl.GL; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import com.ardor3d.framework.Scene; @@ -59,7 +61,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { if (caps.getMaxFBOColorAttachments() > 1) { _attachBuffer = BufferUtils.createIntBuffer(caps.getMaxFBOColorAttachments()); for (int i = 0; i < caps.getMaxFBOColorAttachments(); i++) { - _attachBuffer.put(GL.GL_COLOR_ATTACHMENT0_EXT + i); + _attachBuffer.put(GL.GL_COLOR_ATTACHMENT0 + i); } } } @@ -99,7 +101,8 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { final int pixelDataType = JoglTextureUtil.getGLPixelDataType(tex.getRenderedTexturePixelDataType()); if (tex.getType() == Type.TwoDimensional) { - gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, internalFormat, _width, _height, 0, dataFormat, pixelDataType, null); + gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, internalFormat, _width, _height, 0, dataFormat, pixelDataType, + null); } else { for (final Face face : Face.values()) { gl.glTexImage2D(JoglTextureStateUtil.getGLCubeMapFace(face), 0, internalFormat, _width, _height, 0, @@ -109,7 +112,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { // Initialize mipmapping for this texture, if requested if (tex.getMinificationFilter().usesMipMapLevels()) { - gl.glGenerateMipmapEXT(JoglTextureStateUtil.getGLType(tex.getType())); + gl.glGenerateMipmap(JoglTextureStateUtil.getGLType(tex.getType())); } // Setup filtering and wrap @@ -197,10 +200,10 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { while (colorsAdded < maxDrawBuffers && !colors.isEmpty()) { final Texture tex = colors.removeFirst(); if (tex.getType() == Type.TwoDimensional) { - gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT + colorsAdded, + gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0 + colorsAdded, GL.GL_TEXTURE_2D, tex.getTextureIdForContext(context.getGlContextRep()), 0); } else if (tex.getType() == Type.CubeMap) { - gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT + colorsAdded, + gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0 + colorsAdded, JoglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), tex.getTextureIdForContext(context.getGlContextRep()), 0); } else { @@ -214,10 +217,10 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { final Texture tex = depths.removeFirst(); // Set up our depth texture if (tex.getType() == Type.TwoDimensional) { - gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, + gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_TEXTURE_2D, tex.getTextureIdForContext(context.getGlContextRep()), 0); } else if (tex.getType() == Type.CubeMap) { - gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, + gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, JoglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), tex.getTextureIdForContext(context.getGlContextRep()), 0); } else { @@ -226,13 +229,13 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { _usingDepthRB = false; } else if (!_usingDepthRB) { // setup our default depth render buffer if not already set - gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, - GL.GL_RENDERBUFFER_EXT, _depthRBID); + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, + GL.GL_RENDERBUFFER, _depthRBID); _usingDepthRB = true; } setDrawBuffers(colorsAdded); - setReadBuffer(colorsAdded != 0 ? GL.GL_COLOR_ATTACHMENT0_EXT : GL.GL_NONE); + setReadBuffer(colorsAdded != 0 ? GL.GL_COLOR_ATTACHMENT0 : GL.GL_NONE); // Check FBO complete checkFBOComplete(_fboID); @@ -253,10 +256,9 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { final Texture tex = texs.get(x); if (tex.getMinificationFilter().usesMipMapLevels()) { JoglTextureStateUtil.doTextureBind(tex, 0, true); - gl.glGenerateMipmapEXT(JoglTextureStateUtil.getGLType(tex.getType())); + gl.glGenerateMipmap(JoglTextureStateUtil.getGLType(tex.getType())); } } - } finally { ContextManager.getCurrentContext().popFBOTextureRenderer(); } @@ -271,15 +273,15 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { if (tex.getTextureStoreFormat().isDepthFormat()) { // No color buffer - gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, GL.GL_RENDERBUFFER_EXT, + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, GL.GL_RENDERBUFFER, 0); // Setup depth texture into FBO if (tex.getType() == Type.TwoDimensional) { - gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_TEXTURE_2D, + gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_TEXTURE_2D, textureId, 0); } else if (tex.getType() == Type.CubeMap) { - gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, + gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, JoglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), textureId, 0); } else { throw new IllegalArgumentException("Can not render to texture of type: " + tex.getType()); @@ -290,21 +292,21 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { } else { // Set color texture into FBO if (tex.getType() == Type.TwoDimensional) { - gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, GL.GL_TEXTURE_2D, + gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, GL.GL_TEXTURE_2D, textureId, 0); } else if (tex.getType() == Type.CubeMap) { - gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, + gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, JoglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), textureId, 0); } else { throw new IllegalArgumentException("Can not render to texture of type: " + tex.getType()); } // setup depth RB - gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_RENDERBUFFER_EXT, + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, _depthRBID); - setDrawBuffer(GL.GL_COLOR_ATTACHMENT0_EXT); - setReadBuffer(GL.GL_COLOR_ATTACHMENT0_EXT); + setDrawBuffer(GL.GL_COLOR_ATTACHMENT0); + setReadBuffer(GL.GL_COLOR_ATTACHMENT0); } // Check FBO complete @@ -314,25 +316,25 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { private void setReadBuffer(final int attachVal) { final GL gl = GLU.getCurrentGL(); - gl.glReadBuffer(attachVal); + gl.getGL2GL3().glReadBuffer(attachVal); } private void setDrawBuffer(final int attachVal) { final GL gl = GLU.getCurrentGL(); - gl.glDrawBuffer(attachVal); + gl.getGL2GL3().glDrawBuffer(attachVal); } private void setDrawBuffers(final int maxEntry) { final GL gl = GLU.getCurrentGL(); if (maxEntry <= 1) { - setDrawBuffer(maxEntry != 0 ? GL.GL_COLOR_ATTACHMENT0_EXT : GL.GL_NONE); + setDrawBuffer(maxEntry != 0 ? GL.GL_COLOR_ATTACHMENT0 : GL.GL_NONE); } else { // We should only get to this point if we support ARBDrawBuffers. _attachBuffer.clear(); _attachBuffer.limit(maxEntry); - gl.glDrawBuffersARB(_attachBuffer.limit(), _attachBuffer); // TODO Check <size> + gl.getGL2GL3().glDrawBuffers(_attachBuffer.limit(), _attachBuffer); // TODO Check <size> } } @@ -343,7 +345,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { // automatically generate mipmaps for our texture. if (tex.getMinificationFilter().usesMipMapLevels()) { JoglTextureStateUtil.doTextureBind(tex, 0, true); - gl.glGenerateMipmapEXT(JoglTextureStateUtil.getGLType(tex.getType())); + gl.glGenerateMipmap(JoglTextureStateUtil.getGLType(tex.getType())); } } @@ -351,21 +353,21 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { protected void setMSFBO() { final GL gl = GLU.getCurrentGL(); - gl.glBindFramebufferEXT(GL.GL_DRAW_FRAMEBUFFER_EXT, _msfboID); + gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, _msfboID); } @Override protected void blitMSFBO() { final GL gl = GLU.getCurrentGL(); - gl.glBindFramebufferEXT(GL.GL_READ_FRAMEBUFFER_EXT, _msfboID); - gl.glBindFramebufferEXT(GL.GL_DRAW_FRAMEBUFFER_EXT, _fboID); - gl.glBlitFramebufferEXT(0, 0, _width, _height, 0, 0, _width, _height, GL.GL_COLOR_BUFFER_BIT + gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, _msfboID); + gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, _fboID); + gl.getGL2GL3().glBlitFramebuffer(0, 0, _width, _height, 0, 0, _width, _height, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT, GL.GL_NEAREST); - gl.glBindFramebufferEXT(GL.GL_READ_FRAMEBUFFER_EXT, 0); - gl.glBindFramebufferEXT(GL.GL_DRAW_FRAMEBUFFER_EXT, 0); - gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0); + gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); } /** @@ -377,32 +379,32 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { public static void checkFBOComplete(final int fboID) { final GL gl = GLU.getCurrentGL(); - final int status = gl.glCheckFramebufferStatusEXT(GL.GL_FRAMEBUFFER_EXT); + final int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); switch (status) { - case GL.GL_FRAMEBUFFER_COMPLETE_EXT: + case GL.GL_FRAMEBUFFER_COMPLETE: break; - case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: + case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: throw new IllegalStateException("FrameBuffer: " + fboID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception"); - case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: + case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: throw new IllegalStateException("FrameBuffer: " + fboID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception"); - case GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: + case GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: throw new IllegalStateException("FrameBuffer: " + fboID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT exception"); - case GL.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: + case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: throw new IllegalStateException("FrameBuffer: " + fboID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception"); - case GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: + case GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS: throw new IllegalStateException("FrameBuffer: " + fboID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT exception"); - case GL.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: + case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: throw new IllegalStateException("FrameBuffer: " + fboID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception"); - case GL.GL_FRAMEBUFFER_UNSUPPORTED_EXT: + case GL.GL_FRAMEBUFFER_UNSUPPORTED: throw new IllegalStateException("FrameBuffer: " + fboID + ", has caused a GL_FRAMEBUFFER_UNSUPPORTED_EXT exception"); - case GL.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT: + case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: throw new IllegalStateException("FrameBuffer: " + fboID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT exception."); default: @@ -443,67 +445,67 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { final IntBuffer buffer = BufferUtils.createIntBuffer(1); // Create our texture binding FBO - gl.glGenFramebuffersEXT(1, buffer); // generate id + gl.glGenFramebuffers(1, buffer); // generate id _fboID = buffer.get(0); // Create a depth renderbuffer to use for RTT use - gl.glGenRenderbuffersEXT(1, buffer); // generate id + gl.glGenRenderbuffers(1, buffer); // generate id _depthRBID = buffer.get(0); - gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, _depthRBID); - int format = GL.GL_DEPTH_COMPONENT; + gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, _depthRBID); + int format = GL2ES2.GL_DEPTH_COMPONENT; if (_supportsDepthTexture && _depthBits > 0) { switch (_depthBits) { case 16: - format = GL.GL_DEPTH_COMPONENT16_ARB; + format = GL.GL_DEPTH_COMPONENT16; break; case 24: - format = GL.GL_DEPTH_COMPONENT24_ARB; + format = GL.GL_DEPTH_COMPONENT24; break; case 32: - format = GL.GL_DEPTH_COMPONENT32_ARB; + format = GL.GL_DEPTH_COMPONENT32; break; default: // stick with the "undefined" GL_DEPTH_COMPONENT } } - gl.glRenderbufferStorageEXT(GL.GL_RENDERBUFFER_EXT, format, _width, _height); + gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, format, _width, _height); // unbind... - gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, 0); - gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0); + gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, 0); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // If we support it, rustle up a multisample framebuffer + renderbuffers if (_samples != 0 && _supportsMultisample) { // create ms framebuffer object - gl.glGenFramebuffersEXT(1, buffer); + gl.glGenFramebuffers(1, buffer); _msfboID = buffer.get(0); // create ms renderbuffers - gl.glGenRenderbuffersEXT(1, buffer); // generate id + gl.glGenRenderbuffers(1, buffer); // generate id _mscolorRBID = buffer.get(0); - gl.glGenRenderbuffersEXT(1, buffer); // generate id + gl.glGenRenderbuffers(1, buffer); // generate id _msdepthRBID = buffer.get(0); // set up renderbuffer properties - gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, _mscolorRBID); - gl.glRenderbufferStorageMultisampleEXT(GL.GL_RENDERBUFFER_EXT, _samples, GL.GL_RGBA, _width, _height); + gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, _mscolorRBID); + gl.getGL2GL3().glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, _samples, GL.GL_RGBA, _width, _height); - gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, _msdepthRBID); - gl.glRenderbufferStorageMultisampleEXT(GL.GL_RENDERBUFFER_EXT, _samples, format, _width, _height); + gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, _msdepthRBID); + gl.getGL2GL3().glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, _samples, format, _width, _height); - gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, 0); + gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, 0); - gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, _msfboID); - gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, - GL.GL_RENDERBUFFER_EXT, _mscolorRBID); - gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, - GL.GL_RENDERBUFFER_EXT, _msdepthRBID); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, _msfboID); + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, + GL.GL_RENDERBUFFER, _mscolorRBID); + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, + GL.GL_RENDERBUFFER, _msdepthRBID); // check for errors checkFBOComplete(_msfboID); // release - gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); } } @@ -524,7 +526,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { gl.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(), _backgroundColor.getAlpha()); - gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, _fboID); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, _fboID); ContextManager.getCurrentContext().pushEnforcedStates(); ContextManager.getCurrentContext().clearEnforcedStates(); ContextManager.getCurrentContext().enforceStates(_enforcedStates); @@ -539,7 +541,7 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { if (_active == 1) { final ReadOnlyColorRGBA bgColor = _parentRenderer.getBackgroundColor(); gl.glClearColor(bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue(), bgColor.getAlpha()); - gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); ContextManager.getCurrentContext().popEnforcedStates(); if (_neededClip) { @@ -556,14 +558,14 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer { final IntBuffer id = BufferUtils.createIntBuffer(1); id.put(_fboID); id.rewind(); - gl.glDeleteFramebuffersEXT(id.limit(), id); + gl.glDeleteFramebuffers(id.limit(), id); } if (_depthRBID != 0) { final IntBuffer id = BufferUtils.createIntBuffer(1); id.put(_depthRBID); id.rewind(); - gl.glDeleteRenderbuffersEXT(id.limit(), id); + gl.glDeleteRenderbuffers(id.limit(), id); } } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRendererProvider.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRendererProvider.java index a725a16..b2d433c 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRendererProvider.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRendererProvider.java @@ -1,5 +1,5 @@ /**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2010 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java index e4b29da..39f0221 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglBlendStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,9 @@ package com.ardor3d.scene.state.jogl; import javax.media.opengl.GL; +import javax.media.opengl.GL2ES1; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import com.ardor3d.math.type.ReadOnlyColorRGBA; @@ -79,7 +82,7 @@ public abstract class JoglBlendStateUtil { if (caps.isSeparateBlendEquationsSupported()) { final int blendEqAlpha = getGLEquationValue(state.getBlendEquationAlpha(), caps); if (record.blendEqRGB != blendEqRGB || record.blendEqAlpha != blendEqAlpha) { - gl.glBlendEquationSeparateEXT(blendEqRGB, blendEqAlpha); + gl.glBlendEquationSeparate(blendEqRGB, blendEqAlpha); record.blendEqRGB = blendEqRGB; record.blendEqAlpha = blendEqAlpha; } @@ -101,7 +104,7 @@ public abstract class JoglBlendStateUtil { final int blendEqRGB = getGLEquationValue(state.getBlendEquationRGB(), caps); if (caps.isSeparateBlendEquationsSupported()) { final int blendEqAlpha = getGLEquationValue(state.getBlendEquationAlpha(), caps); - gl.glBlendEquationSeparateEXT(blendEqRGB, blendEqAlpha); + gl.glBlendEquationSeparate(blendEqRGB, blendEqAlpha); record.blendEqRGB = blendEqRGB; record.blendEqAlpha = blendEqAlpha; } else if (caps.isBlendEquationSupported()) { @@ -125,7 +128,7 @@ public abstract class JoglBlendStateUtil { if (applyConstant && caps.isConstantBlendColorSupported()) { final ReadOnlyColorRGBA constant = state.getConstantColor(); if (!record.isValid() || (caps.isConstantBlendColorSupported() && !record.blendColor.equals(constant))) { - gl.glBlendColor(constant.getRed(), constant.getGreen(), constant.getBlue(), constant.getAlpha()); + gl.getGL2GL3().glBlendColor(constant.getRed(), constant.getGreen(), constant.getBlue(), constant.getAlpha()); record.blendColor.set(constant); } } @@ -143,7 +146,7 @@ public abstract class JoglBlendStateUtil { final int glDstAlpha = getGLDstValue(state.getDestinationFunctionAlpha(), caps); if (record.srcFactorRGB != glSrcRGB || record.dstFactorRGB != glDstRGB || record.srcFactorAlpha != glSrcAlpha || record.dstFactorAlpha != glDstAlpha) { - gl.glBlendFuncSeparateEXT(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha); + gl.glBlendFuncSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha); record.srcFactorRGB = glSrcRGB; record.dstFactorRGB = glDstRGB; record.srcFactorAlpha = glSrcAlpha; @@ -162,7 +165,7 @@ public abstract class JoglBlendStateUtil { if (caps.isSeparateBlendFunctionsSupported()) { final int glSrcAlpha = getGLSrcValue(state.getSourceFunctionAlpha(), caps); final int glDstAlpha = getGLDstValue(state.getDestinationFunctionAlpha(), caps); - gl.glBlendFuncSeparateEXT(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha); + gl.glBlendFuncSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha); record.srcFactorRGB = glSrcRGB; record.dstFactorRGB = glDstRGB; record.srcFactorAlpha = glSrcAlpha; @@ -268,22 +271,22 @@ public abstract class JoglBlendStateUtil { return GL.GL_SRC_ALPHA_SATURATE; case ConstantColor: if (caps.isConstantBlendColorSupported()) { - return GL.GL_CONSTANT_COLOR; + return GL2ES2.GL_CONSTANT_COLOR; } // FALLS THROUGH case OneMinusConstantColor: if (caps.isConstantBlendColorSupported()) { - return GL.GL_ONE_MINUS_CONSTANT_COLOR; + return GL2ES2.GL_ONE_MINUS_CONSTANT_COLOR; } // FALLS THROUGH case ConstantAlpha: if (caps.isConstantBlendColorSupported()) { - return GL.GL_CONSTANT_ALPHA; + return GL2ES2.GL_CONSTANT_ALPHA; } // FALLS THROUGH case OneMinusConstantAlpha: if (caps.isConstantBlendColorSupported()) { - return GL.GL_ONE_MINUS_CONSTANT_ALPHA; + return GL2ES2.GL_ONE_MINUS_CONSTANT_ALPHA; } // FALLS THROUGH case One: @@ -310,22 +313,22 @@ public abstract class JoglBlendStateUtil { return GL.GL_ONE_MINUS_DST_ALPHA; case ConstantColor: if (caps.isConstantBlendColorSupported()) { - return GL.GL_CONSTANT_COLOR; + return GL2ES2.GL_CONSTANT_COLOR; } // FALLS THROUGH case OneMinusConstantColor: if (caps.isConstantBlendColorSupported()) { - return GL.GL_ONE_MINUS_CONSTANT_COLOR; + return GL2ES2.GL_ONE_MINUS_CONSTANT_COLOR; } // FALLS THROUGH case ConstantAlpha: if (caps.isConstantBlendColorSupported()) { - return GL.GL_CONSTANT_ALPHA; + return GL2ES2.GL_CONSTANT_ALPHA; } // FALLS THROUGH case OneMinusConstantAlpha: if (caps.isConstantBlendColorSupported()) { - return GL.GL_ONE_MINUS_CONSTANT_ALPHA; + return GL2ES2.GL_ONE_MINUS_CONSTANT_ALPHA; } // FALLS THROUGH case One: @@ -338,12 +341,12 @@ public abstract class JoglBlendStateUtil { switch (eq) { case Min: if (caps.isMinMaxBlendEquationsSupported()) { - return GL.GL_MIN; + return GL2GL3.GL_MIN; } // FALLS THROUGH case Max: if (caps.isMinMaxBlendEquationsSupported()) { - return GL.GL_MAX; + return GL2GL3.GL_MAX; } else { return GL.GL_FUNC_ADD; } @@ -368,30 +371,30 @@ public abstract class JoglBlendStateUtil { if (record.isValid()) { if (enabled) { if (!record.testEnabled) { - gl.glEnable(GL.GL_ALPHA_TEST); + gl.glEnable(GL2ES1.GL_ALPHA_TEST); record.testEnabled = true; } final int glFunc = getGLFuncValue(state.getTestFunction()); if (record.alphaFunc != glFunc || record.alphaRef != state.getReference()) { - gl.glAlphaFunc(glFunc, state.getReference()); + gl.getGL2().glAlphaFunc(glFunc, state.getReference()); record.alphaFunc = glFunc; record.alphaRef = state.getReference(); } } else if (record.testEnabled) { - gl.glDisable(GL.GL_ALPHA_TEST); + gl.glDisable(GL2ES1.GL_ALPHA_TEST); record.testEnabled = false; } } else { if (enabled) { - gl.glEnable(GL.GL_ALPHA_TEST); + gl.glEnable(GL2ES1.GL_ALPHA_TEST); record.testEnabled = true; final int glFunc = getGLFuncValue(state.getTestFunction()); - gl.glAlphaFunc(glFunc, state.getReference()); + gl.getGL2().glAlphaFunc(glFunc, state.getReference()); record.alphaFunc = glFunc; record.alphaRef = state.getReference(); } else { - gl.glDisable(GL.GL_ALPHA_TEST); + gl.glDisable(GL2ES1.GL_ALPHA_TEST); record.testEnabled = false; } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java index 591d6f1..df673aa 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglClipStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.scene.state.jogl; import javax.media.opengl.GL; +import javax.media.opengl.GL2ES1; import javax.media.opengl.glu.GLU; import com.ardor3d.renderer.ContextCapabilities; @@ -53,18 +54,18 @@ public abstract class JoglClipStateUtil { if (enable) { if (!record.isValid() || !record.planeEnabled[planeIndex]) { - gl.glEnable(GL.GL_CLIP_PLANE0 + planeIndex); + gl.glEnable(GL2ES1.GL_CLIP_PLANE0 + planeIndex); record.planeEnabled[planeIndex] = true; } record.buf.rewind(); record.buf.put(state.getPlaneEquations(planeIndex)); record.buf.flip(); - gl.glClipPlane(GL.GL_CLIP_PLANE0 + planeIndex, record.buf); + gl.getGL2().glClipPlane(GL2ES1.GL_CLIP_PLANE0 + planeIndex, record.buf); } else { if (!record.isValid() || record.planeEnabled[planeIndex]) { - gl.glDisable(GL.GL_CLIP_PLANE0 + planeIndex); + gl.glDisable(GL2ES1.GL_CLIP_PLANE0 + planeIndex); record.planeEnabled[planeIndex] = false; } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java index b056612..a0316e0 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglColorMaskStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java index c19c1e8..d93eb33 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglCullStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java index 04619cb..19b1b0f 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFogStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,8 @@ package com.ardor3d.scene.state.jogl; import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES1; import javax.media.opengl.glu.GLU; import com.ardor3d.math.type.ReadOnlyColorRGBA; @@ -41,23 +43,23 @@ public abstract class JoglFogStateUtil { if (record.isValid()) { if (record.fogStart != state.getStart()) { - gl.glFogf(GL.GL_FOG_START, state.getStart()); + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_START, state.getStart()); record.fogStart = state.getStart(); } if (record.fogEnd != state.getEnd()) { - gl.glFogf(GL.GL_FOG_END, state.getEnd()); + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_END, state.getEnd()); record.fogEnd = state.getEnd(); } if (record.density != state.getDensity()) { - gl.glFogf(GL.GL_FOG_DENSITY, state.getDensity()); + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_DENSITY, state.getDensity()); record.density = state.getDensity(); } } else { - gl.glFogf(GL.GL_FOG_START, state.getStart()); + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_START, state.getStart()); record.fogStart = state.getStart(); - gl.glFogf(GL.GL_FOG_END, state.getEnd()); + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_END, state.getEnd()); record.fogEnd = state.getEnd(); - gl.glFogf(GL.GL_FOG_DENSITY, state.getDensity()); + gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_DENSITY, state.getDensity()); record.density = state.getDensity(); } @@ -80,17 +82,17 @@ public abstract class JoglFogStateUtil { if (record.isValid()) { if (enable && !record.enabled) { - gl.glEnable(GL.GL_FOG); + gl.glEnable(GL2ES1.GL_FOG); record.enabled = true; } else if (!enable && record.enabled) { - gl.glDisable(GL.GL_FOG); + gl.glDisable(GL2ES1.GL_FOG); record.enabled = false; } } else { if (enable) { - gl.glEnable(GL.GL_FOG); + gl.glEnable(GL2ES1.GL_FOG); } else { - gl.glDisable(GL.GL_FOG); + gl.glDisable(GL2ES1.GL_FOG); } record.enabled = enable; } @@ -105,7 +107,7 @@ public abstract class JoglFogStateUtil { record.colorBuff.put(record.fogColor.getRed()).put(record.fogColor.getGreen()).put( record.fogColor.getBlue()).put(record.fogColor.getAlpha()); record.colorBuff.flip(); - gl.glFogfv(GL.GL_FOG_COLOR, record.colorBuff); + gl.getGL2ES1().glFogfv(GL2ES1.GL_FOG_COLOR, record.colorBuff); } } @@ -116,9 +118,9 @@ public abstract class JoglFogStateUtil { if (caps.isFogCoordinatesSupported()) { if (!record.isValid() || !source.equals(record.source)) { if (source == CoordinateSource.Depth) { - gl.glFogi(GL.GL_FOG_COORDINATE_SOURCE_EXT, GL.GL_FRAGMENT_DEPTH_EXT); + gl.getGL2().glFogi(GL2.GL_FOG_COORDINATE_SOURCE, GL2.GL_FRAGMENT_DEPTH); } else { - gl.glFogi(GL.GL_FOG_COORDINATE_SOURCE_EXT, GL.GL_FOG_COORDINATE_EXT); + gl.getGL2().glFogi(GL2.GL_FOG_COORDINATE_SOURCE, GL2.GL_FOG_COORDINATE); } } } @@ -130,18 +132,18 @@ public abstract class JoglFogStateUtil { int glMode = 0; switch (densityFunction) { case Exponential: - glMode = GL.GL_EXP; + glMode = GL2ES1.GL_EXP; break; case Linear: glMode = GL.GL_LINEAR; break; case ExponentialSquared: - glMode = GL.GL_EXP2; + glMode = GL2ES1.GL_EXP2; break; } if (!record.isValid() || record.fogMode != glMode) { - gl.glFogi(GL.GL_FOG_MODE, glMode); + gl.getGL2().glFogi(GL2ES1.GL_FOG_MODE, glMode); record.fogMode = glMode; } } @@ -160,7 +162,7 @@ public abstract class JoglFogStateUtil { } if (!record.isValid() || record.fogHint != glHint) { - gl.glHint(GL.GL_FOG_HINT, glHint); + gl.glHint(GL2ES1.GL_FOG_HINT, glHint); record.fogHint = glHint; } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java index ebda6a0..5b8d068 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglFragmentProgramStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -15,6 +15,7 @@ import java.nio.IntBuffer; import java.util.logging.Logger; import javax.media.opengl.GL; +import javax.media.opengl.GL2; import javax.media.opengl.glu.GLU; import com.ardor3d.renderer.ContextCapabilities; @@ -39,9 +40,9 @@ public final class JoglFragmentProgramStateUtil { if (gl.glGetError() == GL.GL_INVALID_OPERATION) { // retrieve the error position final IntBuffer errorloc = BufferUtils.createIntBuffer(16); - gl.glGetIntegerv(GL.GL_PROGRAM_ERROR_POSITION_ARB, errorloc); // TODO Check for integer + gl.glGetIntegerv(GL2.GL_PROGRAM_ERROR_POSITION_ARB, errorloc); // TODO Check for integer - logger.severe("Error " + gl.glGetString(GL.GL_PROGRAM_ERROR_STRING_ARB) + " in fragment program on line " + logger.severe("Error " + gl.glGetString(GL2.GL_PROGRAM_ERROR_STRING_ARB) + " in fragment program on line " + errorloc.get(0)); } } @@ -51,13 +52,13 @@ public final class JoglFragmentProgramStateUtil { final IntBuffer buf = BufferUtils.createIntBuffer(1); - gl.glGenProgramsARB(buf.limit(), buf); // TODO Check <size> - gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, buf.get(0)); + gl.getGL2().glGenProgramsARB(buf.limit(), buf); // TODO Check <size> + gl.getGL2().glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, buf.get(0)); final byte array[] = new byte[program.limit()]; program.rewind(); program.get(array); - gl.glProgramStringARB(GL.GL_FRAGMENT_PROGRAM_ARB, GL.GL_PROGRAM_FORMAT_ASCII_ARB, array.length, new String( + gl.getGL2().glProgramStringARB(GL2.GL_FRAGMENT_PROGRAM_ARB, GL2.GL_PROGRAM_FORMAT_ASCII_ARB, array.length, new String( array)); // TODO Check cost of using non-buffer checkProgramError(); @@ -88,8 +89,8 @@ public final class JoglFragmentProgramStateUtil { } } - gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB); - gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, state._getProgramID()); + gl.glEnable(GL2.GL_FRAGMENT_PROGRAM_ARB); + gl.getGL2().glBindProgramARB(GL2.GL_FRAGMENT_PROGRAM_ARB, state._getProgramID()); // load environmental parameters... // TODO: Reevaluate how this is done. @@ -104,7 +105,7 @@ public final class JoglFragmentProgramStateUtil { // no parameters are used for (int i = 0; i < state._getParameters().length; i++) { if (state._getParameters()[i] != null) { - gl.glProgramLocalParameter4fARB(GL.GL_FRAGMENT_PROGRAM_ARB, i, + gl.getGL2().glProgramLocalParameter4fARB(GL2.GL_FRAGMENT_PROGRAM_ARB, i, state._getParameters()[i][0], state._getParameters()[i][1], state ._getParameters()[i][2], state._getParameters()[i][3]); } @@ -112,7 +113,7 @@ public final class JoglFragmentProgramStateUtil { } } else { - gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); + gl.glDisable(GL2.GL_FRAGMENT_PROGRAM_ARB); } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java index c608883..3050d67 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglLightStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,9 @@ package com.ardor3d.scene.state.jogl; import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES1; +import javax.media.opengl.fixedfunc.GLLightingFunc; import javax.media.opengl.glu.GLU; import com.ardor3d.light.DirectionalLight; @@ -164,9 +167,9 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || lr.isEnabled() != enable) { if (enable) { - gl.glEnable(GL.GL_LIGHT0 + index); + gl.glEnable(GLLightingFunc.GL_LIGHT0 + index); } else { - gl.glDisable(GL.GL_LIGHT0 + index); + gl.glDisable(GLLightingFunc.GL_LIGHT0 + index); } lr.setEnabled(enable); @@ -178,9 +181,9 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || record.isEnabled() != enable) { if (enable) { - gl.glEnable(GL.GL_LIGHTING); + gl.glEnable(GLLightingFunc.GL_LIGHTING); } else { - gl.glDisable(GL.GL_LIGHTING); + gl.glDisable(GLLightingFunc.GL_LIGHTING); } record.setEnabled(enable); } @@ -191,9 +194,9 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || record.isTwoSidedOn() != twoSided) { if (twoSided) { - gl.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_TRUE); + gl.getGL2().glLightModeli(GL2ES1.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_TRUE); } else { - gl.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_FALSE); + gl.getGL2().glLightModeli(GL2ES1.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_FALSE); } record.setTwoSidedOn(twoSided); } @@ -204,9 +207,9 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || record.isLocalViewer() != localViewer) { if (localViewer) { - gl.glLightModeli(GL.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_TRUE); + gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_TRUE); } else { - gl.glLightModeli(GL.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_FALSE); + gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL.GL_FALSE); } record.setLocalViewer(localViewer); } @@ -217,9 +220,9 @@ public abstract class JoglLightStateUtil { if (!record.isValid() || record.isSeparateSpecular() != separateSpecularOn) { if (separateSpecularOn) { - gl.glLightModeli(GL.GL_LIGHT_MODEL_COLOR_CONTROL, GL.GL_SEPARATE_SPECULAR_COLOR); + gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SEPARATE_SPECULAR_COLOR); } else { - gl.glLightModeli(GL.GL_LIGHT_MODEL_COLOR_CONTROL, GL.GL_SINGLE_COLOR); + gl.getGL2().glLightModeli(GL2.GL_LIGHT_MODEL_COLOR_CONTROL, GL2.GL_SINGLE_COLOR); } record.setSeparateSpecular(separateSpecularOn); } @@ -235,7 +238,7 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(globalAmbient.getBlue()); record.lightBuffer.put(globalAmbient.getAlpha()); record.lightBuffer.flip(); - gl.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, record.lightBuffer); // TODO Check for float + gl.getGL2().glLightModelfv(GL2ES1.GL_LIGHT_MODEL_AMBIENT, record.lightBuffer); // TODO Check for float record.globalAmbient.set(globalAmbient); } } @@ -251,7 +254,7 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(ambient.getBlue()); record.lightBuffer.put(ambient.getAlpha()); record.lightBuffer.flip(); - gl.glLightfv(GL.GL_LIGHT0 + index, GL.GL_AMBIENT, record.lightBuffer); // TODO Check for float + gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_AMBIENT, record.lightBuffer); // TODO Check for float lr.ambient.set(ambient); } } @@ -267,7 +270,7 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(diffuse.getBlue()); record.lightBuffer.put(diffuse.getAlpha()); record.lightBuffer.flip(); - gl.glLightfv(GL.GL_LIGHT0 + index, GL.GL_DIFFUSE, record.lightBuffer); // TODO Check for float + gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_DIFFUSE, record.lightBuffer); // TODO Check for float lr.diffuse.set(diffuse); } } @@ -283,7 +286,7 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(specular.getBlue()); record.lightBuffer.put(specular.getAlpha()); record.lightBuffer.flip(); - gl.glLightfv(GL.GL_LIGHT0 + index, GL.GL_SPECULAR, record.lightBuffer); // TODO Check for float + gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPECULAR, record.lightBuffer); // TODO Check for float lr.specular.set(specular); } } @@ -315,12 +318,12 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(positionZ); record.lightBuffer.put(positionW); record.lightBuffer.flip(); - gl.glLightfv(GL.GL_LIGHT0 + index, GL.GL_POSITION, record.lightBuffer); + gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_POSITION, record.lightBuffer); lr.position.set(positionX, positionY, positionZ, positionW); - if (!Camera.getCurrentCamera().isFrameDirty()) { - lr.modelViewMatrix.set(modelViewMatrix); - } + if (!Camera.getCurrentCamera().isFrameDirty()) { + lr.modelViewMatrix.set(modelViewMatrix); + } } } @@ -343,14 +346,14 @@ public abstract class JoglLightStateUtil { record.lightBuffer.put(directionZ); record.lightBuffer.put(value); record.lightBuffer.flip(); - gl.glLightfv(GL.GL_LIGHT0 + index, GL.GL_SPOT_DIRECTION, record.lightBuffer); // TODO Check for float + gl.getGL2().glLightfv(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_DIRECTION, record.lightBuffer); // TODO Check for float } private static void setConstant(final int index, final float constant, final LightRecord lr, final boolean force) { final GL gl = GLU.getCurrentGL(); if (force || constant != lr.getConstant()) { - gl.glLightf(GL.GL_LIGHT0 + index, GL.GL_CONSTANT_ATTENUATION, constant); + gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_CONSTANT_ATTENUATION, constant); lr.setConstant(constant); } } @@ -359,7 +362,7 @@ public abstract class JoglLightStateUtil { final GL gl = GLU.getCurrentGL(); if (force || linear != lr.getLinear()) { - gl.glLightf(GL.GL_LIGHT0 + index, GL.GL_LINEAR_ATTENUATION, linear); + gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_LINEAR_ATTENUATION, linear); lr.setLinear(linear); } } @@ -368,7 +371,7 @@ public abstract class JoglLightStateUtil { final GL gl = GLU.getCurrentGL(); if (force || quad != lr.getQuadratic()) { - gl.glLightf(GL.GL_LIGHT0 + index, GL.GL_QUADRATIC_ATTENUATION, quad); + gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_QUADRATIC_ATTENUATION, quad); lr.setQuadratic(quad); } } @@ -392,7 +395,7 @@ public abstract class JoglLightStateUtil { final GL gl = GLU.getCurrentGL(); if (!record.isValid() || lr.getSpotExponent() != exponent) { - gl.glLightf(GL.GL_LIGHT0 + index, GL.GL_SPOT_EXPONENT, exponent); + gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_EXPONENT, exponent); lr.setSpotExponent(exponent); } } @@ -402,7 +405,7 @@ public abstract class JoglLightStateUtil { final GL gl = GLU.getCurrentGL(); if (!record.isValid() || lr.getSpotCutoff() != cutoff) { - gl.glLightf(GL.GL_LIGHT0 + index, GL.GL_SPOT_CUTOFF, cutoff); + gl.getGL2().glLightf(GLLightingFunc.GL_LIGHT0 + index, GLLightingFunc.GL_SPOT_CUTOFF, cutoff); lr.setSpotCutoff(cutoff); } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java index cc6b956..4a20143 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglMaterialStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.scene.state.jogl; import javax.media.opengl.GL; +import javax.media.opengl.fixedfunc.GLLightingFunc; import javax.media.opengl.glu.GLU; import com.ardor3d.math.type.ReadOnlyColorRGBA; @@ -73,7 +74,7 @@ public abstract class JoglMaterialStateUtil { record.tempColorBuff.put(frontColor.getRed()).put(frontColor.getGreen()).put(frontColor.getBlue()) .put(frontColor.getAlpha()); record.tempColorBuff.flip(); - gl.glMaterialfv(getGLMaterialFace(MaterialFace.FrontAndBack), glMat, record.tempColorBuff); + gl.getGL2().glMaterialfv(getGLMaterialFace(MaterialFace.FrontAndBack), glMat, record.tempColorBuff); record.setColor(MaterialFace.FrontAndBack, glMatColor, frontColor); } } @@ -84,7 +85,7 @@ public abstract class JoglMaterialStateUtil { record.tempColorBuff.put(frontColor.getRed()).put(frontColor.getGreen()).put(frontColor.getBlue()) .put(frontColor.getAlpha()); record.tempColorBuff.flip(); - gl.glMaterialfv(getGLMaterialFace(MaterialFace.Front), glMat, record.tempColorBuff); + gl.getGL2().glMaterialfv(getGLMaterialFace(MaterialFace.Front), glMat, record.tempColorBuff); record.setColor(MaterialFace.Front, glMatColor, frontColor); } } @@ -95,7 +96,7 @@ public abstract class JoglMaterialStateUtil { record.tempColorBuff.put(backColor.getRed()).put(backColor.getGreen()).put(backColor.getBlue()) .put(backColor.getAlpha()); record.tempColorBuff.flip(); - gl.glMaterialfv(getGLMaterialFace(MaterialFace.Back), glMat, record.tempColorBuff); + gl.getGL2().glMaterialfv(getGLMaterialFace(MaterialFace.Back), glMat, record.tempColorBuff); record.setColor(MaterialFace.Back, glMatColor, backColor); } } @@ -118,6 +119,12 @@ public abstract class JoglMaterialStateUtil { return record.colorMaterial == ColorMaterial.Specular; case Emissive: return record.colorMaterial == ColorMaterial.Emissive; + case AmbientAndDiffuse: + break; + case None: + break; + default: + break; } return false; } @@ -128,13 +135,13 @@ public abstract class JoglMaterialStateUtil { final GL gl = GLU.getCurrentGL(); if (colorMaterial == ColorMaterial.None) { - gl.glDisable(GL.GL_COLOR_MATERIAL); + gl.glDisable(GLLightingFunc.GL_COLOR_MATERIAL); } else { final int glMat = getGLColorMaterial(colorMaterial); final int glFace = getGLMaterialFace(face); - gl.glColorMaterial(glFace, glMat); - gl.glEnable(GL.GL_COLOR_MATERIAL); + gl.getGL2().glColorMaterial(glFace, glMat); + gl.glEnable(GLLightingFunc.GL_COLOR_MATERIAL); record.resetColorsForCM(face, colorMaterial); } record.colorMaterial = colorMaterial; @@ -149,17 +156,17 @@ public abstract class JoglMaterialStateUtil { if (frontShininess == backShininess) { // consolidate to one call if (!record.isValid() || frontShininess != record.frontShininess || record.backShininess != backShininess) { - gl.glMaterialf(getGLMaterialFace(MaterialFace.FrontAndBack), GL.GL_SHININESS, frontShininess); + gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.FrontAndBack), GLLightingFunc.GL_SHININESS, frontShininess); record.backShininess = record.frontShininess = frontShininess; } } else { if (!record.isValid() || frontShininess != record.frontShininess) { - gl.glMaterialf(getGLMaterialFace(MaterialFace.Front), GL.GL_SHININESS, frontShininess); + gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Front), GLLightingFunc.GL_SHININESS, frontShininess); record.frontShininess = frontShininess; } if (!record.isValid() || backShininess != record.backShininess) { - gl.glMaterialf(getGLMaterialFace(MaterialFace.Back), GL.GL_SHININESS, backShininess); + gl.getGL2().glMaterialf(getGLMaterialFace(MaterialFace.Back), GLLightingFunc.GL_SHININESS, backShininess); record.backShininess = backShininess; } } @@ -175,15 +182,15 @@ public abstract class JoglMaterialStateUtil { case None: return GL.GL_NONE; case Ambient: - return GL.GL_AMBIENT; + return GLLightingFunc.GL_AMBIENT; case Diffuse: - return GL.GL_DIFFUSE; + return GLLightingFunc.GL_DIFFUSE; case AmbientAndDiffuse: - return GL.GL_AMBIENT_AND_DIFFUSE; + return GLLightingFunc.GL_AMBIENT_AND_DIFFUSE; case Emissive: - return GL.GL_EMISSION; + return GLLightingFunc.GL_EMISSION; case Specular: - return GL.GL_SPECULAR; + return GLLightingFunc.GL_SPECULAR; } throw new IllegalArgumentException("invalid color material setting: " + material); } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java index c209fcb..b2cd05a 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglOffsetStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.scene.state.jogl; import javax.media.opengl.GL; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import com.ardor3d.renderer.ContextManager; @@ -81,9 +82,9 @@ public abstract class JoglOffsetStateUtil { case Fill: return GL.GL_POLYGON_OFFSET_FILL; case Line: - return GL.GL_POLYGON_OFFSET_LINE; + return GL2GL3.GL_POLYGON_OFFSET_LINE; case Point: - return GL.GL_POLYGON_OFFSET_POINT; + return GL2GL3.GL_POLYGON_OFFSET_POINT; } throw new IllegalArgumentException("invalid type: " + type); } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java index 308e5fe..8c0f59f 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShaderObjectsStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2011 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -16,6 +16,10 @@ import java.util.List; import java.util.logging.Logger; import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL3; +import javax.media.opengl.GL4; import javax.media.opengl.glu.GLU; import com.ardor3d.renderer.ContextCapabilities; @@ -43,7 +47,7 @@ public abstract class JoglShaderObjectsStateUtil { } if (state._programID == -1) { - state._programID = gl.glCreateProgramObjectARB(); + state._programID = gl.getGL2().glCreateProgramObjectARB(); } if (state.getVertexShader() != null) { @@ -51,23 +55,23 @@ public abstract class JoglShaderObjectsStateUtil { removeVertShader(state); } - state._vertexShaderID = gl.glCreateShaderObjectARB(GL.GL_VERTEX_SHADER_ARB); + state._vertexShaderID = gl.getGL2().glCreateShaderObjectARB(GL2ES2.GL_VERTEX_SHADER); // Create the sources final byte array[] = new byte[state.getVertexShader().limit()]; state.getVertexShader().rewind(); state.getVertexShader().get(array); - gl.glShaderSourceARB(state._vertexShaderID, 1, new String[] { new String(array) }, + gl.getGL2().glShaderSourceARB(state._vertexShaderID, 1, new String[] { new String(array) }, new int[] { array.length }, 0); // Compile the vertex shader final IntBuffer compiled = BufferUtils.createIntBuffer(1); - gl.glCompileShaderARB(state._vertexShaderID); - gl.glGetObjectParameterivARB(state._vertexShaderID, GL.GL_OBJECT_COMPILE_STATUS_ARB, compiled); + gl.getGL2().glCompileShaderARB(state._vertexShaderID); + gl.getGL2().glGetObjectParameterivARB(state._vertexShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled); checkProgramError(compiled, state._vertexShaderID, state._vertexShaderName); // Attach the program - gl.glAttachObjectARB(state._programID, state._vertexShaderID); + gl.getGL2().glAttachObjectARB(state._programID, state._vertexShaderID); } else if (state._vertexShaderID != -1) { removeVertShader(state); state._vertexShaderID = -1; @@ -78,23 +82,23 @@ public abstract class JoglShaderObjectsStateUtil { removeFragShader(state); } - state._fragmentShaderID = gl.glCreateShaderObjectARB(GL.GL_FRAGMENT_SHADER_ARB); + state._fragmentShaderID = gl.getGL2().glCreateShaderObjectARB(GL2ES2.GL_FRAGMENT_SHADER); // Create the sources final byte array[] = new byte[state.getFragmentShader().limit()]; state.getFragmentShader().rewind(); state.getFragmentShader().get(array); - gl.glShaderSourceARB(state._fragmentShaderID, 1, new String[] { new String(array) }, + gl.getGL2().glShaderSourceARB(state._fragmentShaderID, 1, new String[] { new String(array) }, new int[] { array.length }, 0); // Compile the fragment shader final IntBuffer compiled = BufferUtils.createIntBuffer(1); - gl.glCompileShaderARB(state._fragmentShaderID); - gl.glGetObjectParameterivARB(state._fragmentShaderID, GL.GL_OBJECT_COMPILE_STATUS_ARB, compiled); - checkProgramError(compiled, state._fragmentShaderID, state._fragmentShaderName); + gl.getGL2().glCompileShaderARB(state._fragmentShaderID); + gl.getGL2().glGetObjectParameterivARB(state._fragmentShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled); + checkProgramError(compiled, state._fragmentShaderID, state._vertexShaderName); // Attach the program - gl.glAttachObjectARB(state._programID, state._fragmentShaderID); + gl.getGL2().glAttachObjectARB(state._programID, state._fragmentShaderID); } else if (state._fragmentShaderID != -1) { removeFragShader(state); state._fragmentShaderID = -1; @@ -106,30 +110,85 @@ public abstract class JoglShaderObjectsStateUtil { removeGeomShader(state); } - state._geometryShaderID = gl.glCreateShaderObjectARB(GL.GL_GEOMETRY_SHADER_EXT); + state._geometryShaderID = gl.getGL2().glCreateShaderObjectARB(GL3.GL_GEOMETRY_SHADER); // Create the sources final byte array[] = new byte[state.getGeometryShader().limit()]; state.getGeometryShader().rewind(); state.getGeometryShader().get(array); - gl.glShaderSourceARB(state._geometryShaderID, 1, new String[] { new String(array) }, + gl.getGL2().glShaderSourceARB(state._geometryShaderID, 1, new String[] { new String(array) }, new int[] { array.length }, 0); - // Compile the fragment shader + // Compile the geometry shader final IntBuffer compiled = BufferUtils.createIntBuffer(1); - gl.glCompileShaderARB(state._geometryShaderID); - gl.glGetObjectParameterivARB(state._geometryShaderID, GL.GL_OBJECT_COMPILE_STATUS_ARB, compiled); + gl.getGL2().glCompileShaderARB(state._geometryShaderID); + gl.getGL2().glGetObjectParameterivARB(state._geometryShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled); checkProgramError(compiled, state._geometryShaderID, state._geometryShaderName); // Attach the program - gl.glAttachObjectARB(state._programID, state._geometryShaderID); + gl.getGL2().glAttachObjectARB(state._programID, state._geometryShaderID); } else if (state._geometryShaderID != -1) { removeGeomShader(state); state._geometryShaderID = -1; } } + + if (caps.isTessellationShadersSupported()) { + if (state.getTessellationControlShader() != null) { + if (state._tessellationControlShaderID != -1) { + removeTessControlShader(state); + } + + state._tessellationControlShaderID = gl.getGL2().glCreateShaderObjectARB(GL3.GL_TESS_CONTROL_SHADER); + + // Create the sources + final byte array[] = new byte[state.getTessellationControlShader().limit()]; + state.getTessellationControlShader().rewind(); + state.getTessellationControlShader().get(array); + gl.getGL2().glShaderSourceARB(state._tessellationControlShaderID, 1, new String[] { new String(array) }, + new int[] { array.length }, 0); + + // Compile the tessellation control shader + final IntBuffer compiled = BufferUtils.createIntBuffer(1); + gl.getGL2().glCompileShaderARB(state._tessellationControlShaderID); + gl.getGL2().glGetObjectParameterivARB(state._tessellationControlShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled); + checkProgramError(compiled, state._tessellationControlShaderID, state._tessellationControlShaderName); + + // Attach the program + gl.getGL2().glAttachObjectARB(state._programID, state._tessellationControlShaderID); + } else if (state._tessellationControlShaderID != -1) { + removeTessControlShader(state); + state._tessellationControlShaderID = -1; + } + if (state.getTessellationEvaluationShader() != null) { + if (state._tessellationEvaluationShaderID != -1) { + removeTessEvalShader(state); + } + + state._tessellationEvaluationShaderID = gl.getGL2().glCreateShaderObjectARB(GL4.GL_TESS_CONTROL_SHADER); + + // Create the sources + final byte array[] = new byte[state.getTessellationEvaluationShader().limit()]; + state.getTessellationEvaluationShader().rewind(); + state.getTessellationEvaluationShader().get(array); + gl.getGL2().glShaderSourceARB(state._tessellationEvaluationShaderID, 1, new String[] { new String(array) }, + new int[] { array.length }, 0); - gl.glLinkProgramARB(state._programID); + // Compile the tessellation control shader + final IntBuffer compiled = BufferUtils.createIntBuffer(1); + gl.getGL2().glCompileShaderARB(state._tessellationEvaluationShaderID); + gl.getGL2().glGetObjectParameterivARB(state._tessellationEvaluationShaderID, GL2.GL_OBJECT_COMPILE_STATUS_ARB, compiled); + checkProgramError(compiled, state._tessellationEvaluationShaderID, state._tessellationEvaluationShaderName); + + // Attach the program + gl.getGL2().glAttachObjectARB(state._programID, state._tessellationEvaluationShaderID); + } else if (state._tessellationEvaluationShaderID != -1) { + removeTessEvalShader(state); + state._tessellationEvaluationShaderID = -1; + } + } + + gl.getGL2().glLinkProgramARB(state._programID); checkLinkError(state._programID); state.setNeedsRefresh(true); state._needSendShader = false; @@ -139,15 +198,15 @@ public abstract class JoglShaderObjectsStateUtil { final GL gl = GLU.getCurrentGL(); final IntBuffer compiled = BufferUtils.createIntBuffer(1); - gl.glGetObjectParameterivARB(programId, GL.GL_LINK_STATUS, compiled); + gl.getGL2().glGetObjectParameterivARB(programId, GL2ES2.GL_LINK_STATUS, compiled); if (compiled.get(0) == GL.GL_FALSE) { - gl.glGetObjectParameterivARB(programId, GL.GL_INFO_LOG_LENGTH, compiled); + gl.getGL2().glGetObjectParameterivARB(programId, GL2ES2.GL_INFO_LOG_LENGTH, compiled); final int length = compiled.get(0); String out = null; if (length > 0) { final ByteBuffer infoLog = BufferUtils.createByteBuffer(length); - gl.glGetInfoLogARB(programId, infoLog.limit(), compiled, infoLog); + gl.getGL2().glGetInfoLogARB(programId, infoLog.limit(), compiled, infoLog); final byte[] infoBytes = new byte[length]; infoLog.get(infoBytes); @@ -165,8 +224,8 @@ public abstract class JoglShaderObjectsStateUtil { final GL gl = GLU.getCurrentGL(); if (state._fragmentShaderID != -1) { - gl.glDetachObjectARB(state._programID, state._fragmentShaderID); - gl.glDeleteObjectARB(state._fragmentShaderID); + gl.getGL2().glDetachObjectARB(state._programID, state._fragmentShaderID); + gl.getGL2().glDeleteObjectARB(state._fragmentShaderID); } } @@ -175,8 +234,8 @@ public abstract class JoglShaderObjectsStateUtil { final GL gl = GLU.getCurrentGL(); if (state._vertexShaderID != -1) { - gl.glDetachObjectARB(state._programID, state._vertexShaderID); - gl.glDeleteObjectARB(state._vertexShaderID); + gl.getGL2().glDetachObjectARB(state._programID, state._vertexShaderID); + gl.getGL2().glDeleteObjectARB(state._vertexShaderID); } } @@ -185,8 +244,28 @@ public abstract class JoglShaderObjectsStateUtil { final GL gl = GLU.getCurrentGL(); if (state._geometryShaderID != -1) { - gl.glDetachObjectARB(state._programID, state._geometryShaderID); - gl.glDeleteObjectARB(state._geometryShaderID); + gl.getGL2().glDetachObjectARB(state._programID, state._geometryShaderID); + gl.getGL2().glDeleteObjectARB(state._geometryShaderID); + } + } + + /** Removes the tessellation control shader */ + private static void removeTessControlShader(final GLSLShaderObjectsState state) { + final GL gl = GLU.getCurrentGL(); + + if (state._tessellationControlShaderID != -1) { + gl.getGL2().glDetachObjectARB(state._programID, state._tessellationControlShaderID); + gl.getGL2().glDeleteObjectARB(state._tessellationControlShaderID); + } + } + + /** Removes the tessellation evaluation shader */ + private static void removeTessEvalShader(final GLSLShaderObjectsState state) { + final GL gl = GLU.getCurrentGL(); + + if (state._tessellationEvaluationShaderID != -1) { + gl.getGL2().glDetachObjectARB(state._programID, state._tessellationEvaluationShaderID); + gl.getGL2().glDeleteObjectARB(state._tessellationEvaluationShaderID); } } @@ -197,21 +276,20 @@ public abstract class JoglShaderObjectsStateUtil { * the compiler state for a given shader * @param id * shader's id - * @param shaderName */ private static void checkProgramError(final IntBuffer compiled, final int id, final String shaderName) { final GL gl = GLU.getCurrentGL(); if (compiled.get(0) == GL.GL_FALSE) { final IntBuffer iVal = BufferUtils.createIntBuffer(1); - gl.glGetObjectParameterivARB(id, GL.GL_OBJECT_INFO_LOG_LENGTH_ARB, iVal); + gl.getGL2().glGetObjectParameterivARB(id, GL2.GL_OBJECT_INFO_LOG_LENGTH_ARB, iVal); final int length = iVal.get(0); String out = null; if (length > 0) { final ByteBuffer infoLog = BufferUtils.createByteBuffer(length); - gl.glGetInfoLogARB(id, infoLog.limit(), iVal, infoLog); + gl.getGL2().glGetInfoLogARB(id, infoLog.limit(), iVal, infoLog); final byte[] infoBytes = new byte[length]; infoLog.get(infoBytes); @@ -220,7 +298,7 @@ public abstract class JoglShaderObjectsStateUtil { logger.severe(out); - final String nameString = shaderName.equals("") ? "" : " [ " + shaderName + " ]"; + final String nameString = shaderName.equals("") ? "" : " [ " + shaderName + " ]"; throw new Ardor3dException("Error compiling GLSL shader " + nameString + ": " + out); } } @@ -293,10 +371,10 @@ public abstract class JoglShaderObjectsStateUtil { for (int i = 0, maxI = record.enabledAttributes.size(); i < maxI; i++) { final ShaderVariable var = record.enabledAttributes.get(i); if (var.getSize() == 1) { - gl.glDisableVertexAttribArrayARB(var.variableID); + gl.getGL2().glDisableVertexAttribArrayARB(var.variableID); } else { for (int j = 0, maxJ = var.getSize(); j < maxJ; j++) { - gl.glDisableVertexAttribArrayARB(var.variableID + j); + gl.getGL2().glDisableVertexAttribArrayARB(var.variableID + j); } } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java index a5b1016..ba3dea0 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglShadingStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.scene.state.jogl; import javax.media.opengl.GL; +import javax.media.opengl.fixedfunc.GLLightingFunc; import javax.media.opengl.glu.GLU; import com.ardor3d.renderer.ContextManager; @@ -32,10 +33,10 @@ public abstract class JoglShadingStateUtil { context.setCurrentState(StateType.Shading, state); // If not enabled, we'll use smooth - final int toApply = state.isEnabled() ? getGLShade(state.getShadingMode()) : GL.GL_SMOOTH; + final int toApply = state.isEnabled() ? getGLShade(state.getShadingMode()) : GLLightingFunc.GL_SMOOTH; // only apply if we're different. Update record to reflect any changes. if (!record.isValid() || toApply != record.lastShade) { - gl.glShadeModel(toApply); + gl.getGL2().glShadeModel(toApply); record.lastShade = toApply; } @@ -47,9 +48,9 @@ public abstract class JoglShadingStateUtil { private static int getGLShade(final ShadingMode shadeMode) { switch (shadeMode) { case Smooth: - return GL.GL_SMOOTH; + return GLLightingFunc.GL_SMOOTH; case Flat: - return GL.GL_FLAT; + return GLLightingFunc.GL_FLAT; } throw new IllegalStateException("unknown shade mode: " + shadeMode); } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java index 2749f52..fd7204f 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglStencilStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.scene.state.jogl; import javax.media.opengl.GL; +import javax.media.opengl.GL2; import javax.media.opengl.glu.GLU; import com.ardor3d.renderer.ContextCapabilities; @@ -37,14 +38,14 @@ public abstract class JoglStencilStateUtil { setEnabled(state.isEnabled(), caps.isTwoSidedStencilSupported() ? state.isUseTwoSided() : false, record, caps); if (state.isEnabled()) { if (state.isUseTwoSided() && caps.isTwoSidedStencilSupported()) { - gl.glActiveStencilFaceEXT(GL.GL_BACK); + gl.getGL2().glActiveStencilFaceEXT(GL.GL_BACK); applyMask(state.getStencilWriteMaskBack(), record, 2); applyFunc(getGLStencilFunction(state.getStencilFunctionBack()), state.getStencilReferenceBack(), state .getStencilFuncMaskBack(), record, 2); applyOp(getGLStencilOp(state.getStencilOpFailBack(), caps), getGLStencilOp(state .getStencilOpZFailBack(), caps), getGLStencilOp(state.getStencilOpZPassBack(), caps), record, 2); - gl.glActiveStencilFaceEXT(GL.GL_FRONT); + gl.getGL2().glActiveStencilFaceEXT(GL.GL_FRONT); applyMask(state.getStencilWriteMaskFront(), record, 1); applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(), state.getStencilFuncMaskFront(), record, 1); @@ -94,14 +95,14 @@ public abstract class JoglStencilStateUtil { return GL.GL_KEEP; case DecrementWrap: if (caps.isStencilWrapSupported()) { - return GL.GL_DECR_WRAP_EXT; + return GL.GL_DECR_WRAP; } // FALLS THROUGH case Decrement: return GL.GL_DECR; case IncrementWrap: if (caps.isStencilWrapSupported()) { - return GL.GL_INCR_WRAP_EXT; + return GL.GL_INCR_WRAP; } // FALLS THROUGH case Increment: @@ -145,15 +146,15 @@ public abstract class JoglStencilStateUtil { if (caps.isTwoSidedStencilSupported()) { if (record.isValid()) { if (enable && !record.useTwoSided) { - gl.glEnable(GL.GL_STENCIL_TEST_TWO_SIDE_EXT); + gl.glEnable(GL2.GL_STENCIL_TEST_TWO_SIDE_EXT); } else if (!enable && record.useTwoSided) { - gl.glDisable(GL.GL_STENCIL_TEST_TWO_SIDE_EXT); + gl.glDisable(GL2.GL_STENCIL_TEST_TWO_SIDE_EXT); } } else { if (enable) { - gl.glEnable(GL.GL_STENCIL_TEST_TWO_SIDE_EXT); + gl.glEnable(GL2.GL_STENCIL_TEST_TWO_SIDE_EXT); } else { - gl.glDisable(GL.GL_STENCIL_TEST_TWO_SIDE_EXT); + gl.glDisable(GL2.GL_STENCIL_TEST_TWO_SIDE_EXT); } } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java index e81cb74..af0941d 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2011 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -16,11 +16,21 @@ import java.util.Collection; import java.util.logging.Logger; import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES1; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.GLException; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; +import javax.media.opengl.glu.gl2.GLUgl2; import com.ardor3d.image.Image; import com.ardor3d.image.Texture; +import com.ardor3d.image.Texture1D; +import com.ardor3d.image.Texture2D; +import com.ardor3d.image.Texture3D; +import com.ardor3d.image.TextureCubeMap; import com.ardor3d.image.Texture.ApplyMode; import com.ardor3d.image.Texture.CombinerFunctionAlpha; import com.ardor3d.image.Texture.CombinerFunctionRGB; @@ -30,10 +40,6 @@ import com.ardor3d.image.Texture.CombinerSource; import com.ardor3d.image.Texture.Type; import com.ardor3d.image.Texture.WrapAxis; import com.ardor3d.image.Texture.WrapMode; -import com.ardor3d.image.Texture1D; -import com.ardor3d.image.Texture2D; -import com.ardor3d.image.Texture3D; -import com.ardor3d.image.TextureCubeMap; import com.ardor3d.image.util.ImageUtils; import com.ardor3d.math.MathUtils; import com.ardor3d.math.type.ReadOnlyColorRGBA; @@ -41,8 +47,8 @@ import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; import com.ardor3d.renderer.jogl.JoglRenderer; -import com.ardor3d.renderer.state.RenderState.StateType; import com.ardor3d.renderer.state.TextureState; +import com.ardor3d.renderer.state.RenderState.StateType; import com.ardor3d.renderer.state.record.RendererRecord; import com.ardor3d.renderer.state.record.TextureRecord; import com.ardor3d.renderer.state.record.TextureStateRecord; @@ -121,7 +127,7 @@ public class JoglTextureStateUtil { final Texture.Type type = texture.getType(); final GL gl = GLU.getCurrentGL(); - final GLU glu = new GLU(); + final GLU glu = new GLUgl2(); // bind our texture id to this unit. doTextureBind(texture, unit, false); @@ -154,8 +160,9 @@ public class JoglTextureStateUtil { + image.getWidth() + " x " + image.getHeight()); } if (actualWidth > maxSize || actualHeight > maxSize) { - logger.warning("(card unsupported) Attempted to apply texture with size bigger than max texture size [" - + maxSize + "]: " + image.getWidth() + " x " + image.getHeight()); + logger + .warning("(card unsupported) Attempted to apply texture with size bigger than max texture size [" + + maxSize + "]: " + image.getWidth() + " x " + image.getHeight()); } int w = actualWidth; @@ -204,20 +211,19 @@ public class JoglTextureStateUtil { // ensure the buffer is ready for reading image.getData(0).rewind(); // send top level to card - gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), - image.getHeight(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), image.getWidth(), image.getHeight(), hasBorder ? 1 : 0, + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil + .getGLPixelDataType(image.getDataType()), image.getData(0)); break; case OneDimensional: // ensure the buffer is ready for reading image.getData(0).rewind(); // send top level to card - gl.glTexImage1D(GL.GL_TEXTURE_1D, 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), - hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), image.getWidth(), hasBorder ? 1 : 0, JoglTextureUtil + .getGLPixelFormat(image.getDataFormat()), JoglTextureUtil.getGLPixelDataType(image + .getDataType()), image.getData(0)); break; case ThreeDimensional: if (caps.isTexture3DSupported()) { @@ -244,10 +250,9 @@ public class JoglTextureStateUtil { data.flip(); } // send top level to card - gl.glTexImage3D(GL.GL_TEXTURE_3D, 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), image.getDepth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + gl.getGL2GL3().glTexImage3D(GL2.GL_TEXTURE_3D, 0, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), image.getWidth(), image.getHeight(), image.getDepth(), + hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); } else { logger.warning("This card does not support Texture3D."); @@ -261,17 +266,19 @@ public class JoglTextureStateUtil { // ensure the buffer is ready for reading image.getData(face.ordinal()).rewind(); // send top level to card - gl.glTexImage2D(getGLCubeMapFace(face), 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getWidth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), - image.getData(face.ordinal())); + gl.glTexImage2D(getGLCubeMapFace(face), 0, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), image.getWidth(), image.getWidth(), hasBorder ? 1 + : 0, JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil + .getGLPixelDataType(image.getDataType()), image.getData(face.ordinal())); } } else { logger.warning("This card does not support Cubemaps."); } break; + case Rectangle: + break; + default: + break; } } else if (texture.getMinificationFilter().usesMipMapLevels() && !image.hasMipmaps() && !texture.getTextureStoreFormat().isCompressed()) { @@ -283,7 +290,7 @@ public class JoglTextureStateUtil { if (caps.isAutomaticMipmapsSupported()) { // Flag the card to generate mipmaps - gl.glTexParameteri(getGLType(type), GL.GL_GENERATE_MIPMAP_SGIS, GL.GL_TRUE); + gl.glTexParameteri(getGLType(type), GL2ES1.GL_GENERATE_MIPMAP, GL.GL_TRUE); } switch (type) { @@ -292,18 +299,16 @@ public class JoglTextureStateUtil { image.getData(0).rewind(); if (caps.isAutomaticMipmapsSupported()) { // send top level to card - gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), image.getWidth(), image.getHeight(), hasBorder ? 1 : 0, + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil + .getGLPixelDataType(image.getDataType()), image.getData(0)); } else { // send to card - glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), image.getWidth(), image.getHeight(), JoglTextureUtil + .getGLPixelFormat(image.getDataFormat()), JoglTextureUtil.getGLPixelDataType(image + .getDataType()), image.getData(0)); } break; case OneDimensional: @@ -311,15 +316,15 @@ public class JoglTextureStateUtil { image.getData(0).rewind(); if (caps.isAutomaticMipmapsSupported()) { // send top level to card - gl.glTexImage1D(GL.GL_TEXTURE_1D, 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(0)); + gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, 0, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), image.getWidth(), hasBorder ? 1 : 0, JoglTextureUtil + .getGLPixelFormat(image.getDataFormat()), JoglTextureUtil.getGLPixelDataType(image + .getDataType()), image.getData(0)); } else { // Note: JOGL's GLU class does not support // gluBuild1DMipmaps. - logger.warning("non-fbo 1d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter."); + logger + .warning("non-fbo 1d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter."); return; } break; @@ -349,15 +354,16 @@ public class JoglTextureStateUtil { data.flip(); } // send top level to card - gl.glTexImage3D(GL.GL_TEXTURE_3D, 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getHeight(), image.getDepth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + gl.getGL2GL3().glTexImage3D(GL2ES2.GL_TEXTURE_3D, 0, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), image.getWidth(), image.getHeight(), image + .getDepth(), hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image + .getDataFormat()), JoglTextureUtil.getGLPixelDataType(image.getDataType()), + data); } else { // Note: JOGL's GLU class does not support // gluBuild3DMipmaps. - logger.warning("non-fbo 3d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter."); + logger + .warning("non-fbo 3d mipmap generation is not currently supported. Use DDS or a non-mipmap minification filter."); return; } } else { @@ -374,24 +380,22 @@ public class JoglTextureStateUtil { // ensure the buffer is ready for reading image.getData(face.ordinal()).rewind(); // send top level to card - gl.glTexImage2D(getGLCubeMapFace(face), 0, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getWidth(), hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), - image.getData(face.ordinal())); + gl.glTexImage2D(getGLCubeMapFace(face), 0, JoglTextureUtil + .getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), + image.getWidth(), hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image + .getDataFormat()), JoglTextureUtil.getGLPixelDataType(image + .getDataType()), image.getData(face.ordinal())); } } else { for (final TextureCubeMap.Face face : TextureCubeMap.Face.values()) { // ensure the buffer is ready for reading image.getData(face.ordinal()).rewind(); // send to card - glu.gluBuild2DMipmaps(getGLCubeMapFace(face), - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - image.getWidth(), image.getWidth(), - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), - image.getData(face.ordinal())); + glu.gluBuild2DMipmaps(getGLCubeMapFace(face), JoglTextureUtil + .getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), + image.getWidth(), JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + JoglTextureUtil.getGLPixelDataType(image.getDataType()), image.getData(face + .ordinal())); } } } else { @@ -399,10 +403,14 @@ public class JoglTextureStateUtil { return; } break; + case Rectangle: + break; + default: + break; } if (texture.getTextureMaxLevel() >= 0) { - gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAX_LEVEL, texture.getTextureMaxLevel()); + gl.glTexParameteri(GL.GL_TEXTURE_2D, GL2GL3.GL_TEXTURE_MAX_LEVEL, texture.getTextureMaxLevel()); } } else { // Here we handle textures that are either compressed or have predefined mipmaps. @@ -424,7 +432,7 @@ public class JoglTextureStateUtil { } // set max mip level - gl.glTexParameteri(getGLCubeMapFace(face), GL.GL_TEXTURE_MAX_LEVEL, max - 1); + gl.glTexParameteri(getGLCubeMapFace(face), GL2.GL_TEXTURE_MAX_LEVEL, max - 1); for (int m = 0; m < max; m++) { final int width = Math.max(1, image.getWidth() >> m); @@ -434,14 +442,13 @@ public class JoglTextureStateUtil { data.limit(pos + mipSizes[m]); if (texture.getTextureStoreFormat().isCompressed()) { - gl.glCompressedTexImage2D(getGLCubeMapFace(face), m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, hasBorder ? 1 : 0, mipSizes[m], data); + gl.glCompressedTexImage2D(getGLCubeMapFace(face), m, JoglTextureUtil + .getGLInternalFormat(texture.getTextureStoreFormat()), width, height, + hasBorder ? 1 : 0, mipSizes[m], data); } else { - gl.glTexImage2D(getGLCubeMapFace(face), m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), + gl.glTexImage2D(getGLCubeMapFace(face), m, JoglTextureUtil + .getGLInternalFormat(texture.getTextureStoreFormat()), width, height, + hasBorder ? 1 : 0, JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); } pos += mipSizes[m]; @@ -465,14 +472,20 @@ public class JoglTextureStateUtil { // Set max mip level switch (type) { case TwoDimensional: - gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAX_LEVEL, max - 1); + gl.glTexParameteri(GL.GL_TEXTURE_2D, GL2GL3.GL_TEXTURE_MAX_LEVEL, max - 1); break; case ThreeDimensional: - gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_MAX_LEVEL, max - 1); + gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL2GL3.GL_TEXTURE_MAX_LEVEL, max - 1); break; case OneDimensional: - gl.glTexParameteri(GL.GL_TEXTURE_1D, GL.GL_TEXTURE_MAX_LEVEL, max - 1); + gl.glTexParameteri(GL2GL3.GL_TEXTURE_1D, GL2GL3.GL_TEXTURE_MAX_LEVEL, max - 1); break; + case CubeMap: + break; + case Rectangle: + break; + default: + break; } if (type == Type.ThreeDimensional) { @@ -514,45 +527,48 @@ public class JoglTextureStateUtil { switch (type) { case TwoDimensional: if (texture.getTextureStoreFormat().isCompressed()) { - gl.glCompressedTexImage2D(GL.GL_TEXTURE_2D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, hasBorder ? 1 : 0, mipSizes[m], data); + gl.glCompressedTexImage2D(GL.GL_TEXTURE_2D, m, JoglTextureUtil + .getGLInternalFormat(texture.getTextureStoreFormat()), width, height, + hasBorder ? 1 : 0, mipSizes[m], data); } else { - gl.glTexImage2D(GL.GL_TEXTURE_2D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + gl.glTexImage2D(GL.GL_TEXTURE_2D, m, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), width, height, hasBorder ? 1 : 0, + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil + .getGLPixelDataType(image.getDataType()), data); } break; case OneDimensional: if (texture.getTextureStoreFormat().isCompressed()) { - gl.glCompressedTexImage1D(GL.GL_TEXTURE_1D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, hasBorder ? 1 : 0, mipSizes[m], data); + gl.getGL2GL3().glCompressedTexImage1D(GL2GL3.GL_TEXTURE_1D, m, JoglTextureUtil + .getGLInternalFormat(texture.getTextureStoreFormat()), width, hasBorder ? 1 + : 0, mipSizes[m], data); } else { - gl.glTexImage1D(GL.GL_TEXTURE_1D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + gl.getGL2GL3().glTexImage1D(GL2GL3.GL_TEXTURE_1D, m, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), width, hasBorder ? 1 : 0, JoglTextureUtil + .getGLPixelFormat(image.getDataFormat()), JoglTextureUtil + .getGLPixelDataType(image.getDataType()), data); } break; case ThreeDimensional: final int depth = Math.max(1, image.getDepth() >> m); // already checked for support above... if (texture.getTextureStoreFormat().isCompressed()) { - gl.glCompressedTexImage3D(GL.GL_TEXTURE_3D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, depth, hasBorder ? 1 : 0, mipSizes[m], data); + gl.getGL2GL3().glCompressedTexImage3D(GL2ES2.GL_TEXTURE_3D, m, JoglTextureUtil + .getGLInternalFormat(texture.getTextureStoreFormat()), width, height, + depth, hasBorder ? 1 : 0, mipSizes[m], data); } else { - gl.glTexImage3D(GL.GL_TEXTURE_3D, m, - JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), - width, height, depth, hasBorder ? 1 : 0, - JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), - JoglTextureUtil.getGLPixelDataType(image.getDataType()), data); + gl.getGL2GL3().glTexImage3D(GL2ES2.GL_TEXTURE_3D, m, JoglTextureUtil.getGLInternalFormat(texture + .getTextureStoreFormat()), width, height, depth, hasBorder ? 1 : 0, + JoglTextureUtil.getGLPixelFormat(image.getDataFormat()), JoglTextureUtil + .getGLPixelDataType(image.getDataType()), data); } break; + case CubeMap: + break; + case Rectangle: + break; + default: + break; } pos += mipSizes[m]; @@ -584,7 +600,7 @@ public class JoglTextureStateUtil { final int glHint = JoglTextureUtil.getPerspHint(state.getCorrectionType()); if (!record.isValid() || record.hint != glHint) { // set up correction mode - gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, glHint); + gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, glHint); record.hint = glHint; } @@ -768,7 +784,7 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || unitRecord.enabled[Type.OneDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); - gl.glDisable(GL.GL_TEXTURE_1D); + gl.glDisable(GL2GL3.GL_TEXTURE_1D); unitRecord.enabled[Type.OneDimensional.ordinal()] = false; } } @@ -777,7 +793,7 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || unitRecord.enabled[Type.ThreeDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); - gl.glDisable(GL.GL_TEXTURE_3D); + gl.glDisable(GL2ES2.GL_TEXTURE_3D); unitRecord.enabled[Type.ThreeDimensional.ordinal()] = false; } } @@ -807,7 +823,7 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || unitRecord.enabled[Type.OneDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); - gl.glDisable(GL.GL_TEXTURE_1D); + gl.glDisable(GL2GL3.GL_TEXTURE_1D); unitRecord.enabled[Type.OneDimensional.ordinal()] = false; } @@ -815,7 +831,7 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || unitRecord.enabled[Type.ThreeDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); - gl.glDisable(GL.GL_TEXTURE_3D); + gl.glDisable(GL2ES2.GL_TEXTURE_3D); unitRecord.enabled[Type.ThreeDimensional.ordinal()] = false; } } @@ -861,7 +877,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_RGB_SCALE, texture.getCombineScaleRGB().floatValue()); + gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_RGB_SCALE, texture.getCombineScaleRGB().floatValue()); unitRecord.envRGBScale = texture.getCombineScaleRGB(); } // Then Alpha Combine scale if (!unitRecord.isValid() || unitRecord.envAlphaScale != texture.getCombineScaleAlpha()) { @@ -869,7 +885,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_ALPHA_SCALE, texture.getCombineScaleAlpha().floatValue()); + gl.getGL2ES1().glTexEnvf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_ALPHA_SCALE, texture.getCombineScaleAlpha().floatValue()); unitRecord.envAlphaScale = texture.getCombineScaleAlpha(); } @@ -880,7 +896,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_COMBINE_RGB, JoglTextureUtil.getGLCombineFuncRGB(rgbCombineFunc)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_RGB, JoglTextureUtil.getGLCombineFuncRGB(rgbCombineFunc)); unitRecord.rgbCombineFunc = rgbCombineFunc; } @@ -890,7 +906,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_SOURCE0_RGB, JoglTextureUtil.getGLCombineSrc(combSrcRGB)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_RGB, JoglTextureUtil.getGLCombineSrc(combSrcRGB)); unitRecord.combSrcRGB0 = combSrcRGB; } @@ -900,7 +916,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_OPERAND0_RGB, JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_RGB, JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); unitRecord.combOpRGB0 = combOpRGB; } @@ -913,7 +929,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_SOURCE1_RGB, JoglTextureUtil.getGLCombineSrc(combSrcRGB)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_RGB, JoglTextureUtil.getGLCombineSrc(combSrcRGB)); unitRecord.combSrcRGB1 = combSrcRGB; } @@ -923,7 +939,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_OPERAND1_RGB, JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_RGB, JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); unitRecord.combOpRGB1 = combOpRGB; } @@ -936,7 +952,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_SOURCE2_RGB, JoglTextureUtil.getGLCombineSrc(combSrcRGB)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_RGB, JoglTextureUtil.getGLCombineSrc(combSrcRGB)); unitRecord.combSrcRGB2 = combSrcRGB; } @@ -946,7 +962,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_OPERAND2_RGB, JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_RGB, JoglTextureUtil.getGLCombineOpRGB(combOpRGB)); unitRecord.combOpRGB2 = combOpRGB; } @@ -960,8 +976,8 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_COMBINE_ALPHA, - JoglTextureUtil.getGLCombineFuncAlpha(alphaCombineFunc)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_COMBINE_ALPHA, JoglTextureUtil + .getGLCombineFuncAlpha(alphaCombineFunc)); unitRecord.alphaCombineFunc = alphaCombineFunc; } @@ -971,7 +987,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_SOURCE0_ALPHA, JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE0_ALPHA, JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); unitRecord.combSrcAlpha0 = combSrcAlpha; } @@ -981,7 +997,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_OPERAND0_ALPHA, JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND0_ALPHA, JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); unitRecord.combOpAlpha0 = combOpAlpha; } @@ -994,7 +1010,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_SOURCE1_ALPHA, JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE1_ALPHA, JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); unitRecord.combSrcAlpha1 = combSrcAlpha; } @@ -1004,7 +1020,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_OPERAND1_ALPHA, JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND1_ALPHA, JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); unitRecord.combOpAlpha1 = combOpAlpha; } @@ -1017,7 +1033,7 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_SOURCE2_ALPHA, JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2.GL_SOURCE2_ALPHA, JoglTextureUtil.getGLCombineSrc(combSrcAlpha)); unitRecord.combSrcAlpha2 = combSrcAlpha; } @@ -1027,8 +1043,8 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); checked = true; } - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_OPERAND2_ALPHA, - JoglTextureUtil.getGLCombineOpAlpha(combOpAlpha)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_OPERAND2_ALPHA, JoglTextureUtil + .getGLCombineOpAlpha(combOpAlpha)); unitRecord.combOpAlpha2 = combOpAlpha; } } @@ -1041,7 +1057,7 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || unitRecord.envMode != mode) { checkAndSetUnit(unit, record, caps); - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, JoglTextureUtil.getGLEnvMode(mode)); + gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, JoglTextureUtil.getGLEnvMode(mode)); unitRecord.envMode = mode; } } @@ -1054,10 +1070,10 @@ public class JoglTextureStateUtil { if (!unitRecord.isValid() || !unitRecord.blendColor.equals(texBlend)) { checkAndSetUnit(unit, record, caps); TextureRecord.colorBuffer.clear(); - TextureRecord.colorBuffer.put(texBlend.getRed()).put(texBlend.getGreen()).put(texBlend.getBlue()) - .put(texBlend.getAlpha()); + TextureRecord.colorBuffer.put(texBlend.getRed()).put(texBlend.getGreen()).put(texBlend.getBlue()).put( + texBlend.getAlpha()); TextureRecord.colorBuffer.rewind(); - gl.glTexEnvfv(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_COLOR, TextureRecord.colorBuffer); + gl.getGL2ES1().glTexEnvfv(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_COLOR, TextureRecord.colorBuffer); unitRecord.blendColor.set(texBlend); } } @@ -1071,7 +1087,7 @@ public class JoglTextureStateUtil { .getMaxLodBias(); if (!unitRecord.isValid() || unitRecord.lodBias != bias) { checkAndSetUnit(unit, record, caps); - gl.glTexEnvf(GL.GL_TEXTURE_FILTER_CONTROL_EXT, GL.GL_TEXTURE_LOD_BIAS_EXT, bias); + gl.getGL2ES1().glTexEnvf(GL2.GL_TEXTURE_FILTER_CONTROL, GL2GL3.GL_TEXTURE_LOD_BIAS, bias); unitRecord.lodBias = bias; } } @@ -1084,10 +1100,10 @@ public class JoglTextureStateUtil { final ReadOnlyColorRGBA texBorder = texture.getBorderColor(); if (!texRecord.isValid() || !texRecord.borderColor.equals(texBorder)) { TextureRecord.colorBuffer.clear(); - TextureRecord.colorBuffer.put(texBorder.getRed()).put(texBorder.getGreen()).put(texBorder.getBlue()) - .put(texBorder.getAlpha()); + TextureRecord.colorBuffer.put(texBorder.getRed()).put(texBorder.getGreen()).put(texBorder.getBlue()).put( + texBorder.getAlpha()); TextureRecord.colorBuffer.rewind(); - gl.glTexParameterfv(getGLType(texture.getType()), GL.GL_TEXTURE_BORDER_COLOR, TextureRecord.colorBuffer); + gl.glTexParameterfv(getGLType(texture.getType()), GL2GL3.GL_TEXTURE_BORDER_COLOR, TextureRecord.colorBuffer); texRecord.borderColor.set(texBorder); } } @@ -1110,17 +1126,17 @@ public class JoglTextureStateUtil { record.tmp_matrixBuffer.rewind(); texture.getTextureMatrix().toDoubleBuffer(record.tmp_matrixBuffer, true); record.tmp_matrixBuffer.rewind(); - gl.glLoadMatrixd(record.tmp_matrixBuffer); + gl.getGL2().glLoadMatrixd(record.tmp_matrixBuffer); record.units[unit].identityMatrix = false; } else if (needsReset) { checkAndSetUnit(unit, record, caps); JoglRendererUtil.switchMode(matRecord, GL.GL_TEXTURE); - gl.glLoadIdentity(); + gl.getGL2().glLoadIdentity(); record.units[unit].identityMatrix = true; } // Switch back to the modelview matrix for further operations - JoglRendererUtil.switchMode(matRecord, GL.GL_MODELVIEW); + JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW); } public static void applyTexCoordGeneration(final Texture texture, final TextureUnitRecord unitRecord, @@ -1134,47 +1150,47 @@ public class JoglTextureStateUtil { break; case SphereMap: // generate spherical texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL.GL_SPHERE_MAP) { + if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2.GL_SPHERE_MAP) { checkAndSetUnit(unit, record, caps); - gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); - unitRecord.textureGenSMode = GL.GL_SPHERE_MAP; + gl.getGL2().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP); + unitRecord.textureGenSMode = GL2.GL_SPHERE_MAP; - gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); - unitRecord.textureGenTMode = GL.GL_SPHERE_MAP; + gl.getGL2().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_SPHERE_MAP); + unitRecord.textureGenTMode = GL2.GL_SPHERE_MAP; } setTextureGen(unitRecord, unit, record, caps, true, true, false, false); break; case NormalMap: // generate normals based texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL.GL_NORMAL_MAP) { + if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2ES1.GL_NORMAL_MAP) { checkAndSetUnit(unit, record, caps); - gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP); - unitRecord.textureGenSMode = GL.GL_NORMAL_MAP; + gl.getGL2().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP); + unitRecord.textureGenSMode = GL2ES1.GL_NORMAL_MAP; - gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP); - unitRecord.textureGenTMode = GL.GL_NORMAL_MAP; + gl.getGL2().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP); + unitRecord.textureGenTMode = GL2ES1.GL_NORMAL_MAP; - gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP); - unitRecord.textureGenRMode = GL.GL_NORMAL_MAP; + gl.getGL2().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_NORMAL_MAP); + unitRecord.textureGenRMode = GL2ES1.GL_NORMAL_MAP; } setTextureGen(unitRecord, unit, record, caps, true, true, true, false); break; case ReflectionMap: // generate reflection texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL.GL_REFLECTION_MAP) { + if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2ES1.GL_REFLECTION_MAP) { checkAndSetUnit(unit, record, caps); - gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_REFLECTION_MAP); - unitRecord.textureGenSMode = GL.GL_REFLECTION_MAP; + gl.getGL2ES1().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_REFLECTION_MAP); + unitRecord.textureGenSMode = GL2ES1.GL_REFLECTION_MAP; - gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_REFLECTION_MAP); - unitRecord.textureGenTMode = GL.GL_REFLECTION_MAP; + gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_REFLECTION_MAP); + unitRecord.textureGenTMode = GL2ES1.GL_REFLECTION_MAP; - gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_REFLECTION_MAP); - unitRecord.textureGenRMode = GL.GL_REFLECTION_MAP; + gl.getGL2ES1().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2ES1.GL_REFLECTION_MAP); + unitRecord.textureGenRMode = GL2ES1.GL_REFLECTION_MAP; } setTextureGen(unitRecord, unit, record, caps, true, true, true, false); @@ -1184,28 +1200,28 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); // generate eye linear texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL.GL_EYE_LINEAR) { - gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); - unitRecord.textureGenSMode = GL.GL_EYE_LINEAR; + if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2.GL_EYE_LINEAR) { + gl.getGL2ES1().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + unitRecord.textureGenSMode = GL2.GL_EYE_LINEAR; - gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); - unitRecord.textureGenTMode = GL.GL_EYE_LINEAR; + gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + unitRecord.textureGenTMode = GL2.GL_EYE_LINEAR; - gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); - unitRecord.textureGenRMode = GL.GL_EYE_LINEAR; + gl.getGL2ES1().glTexGeni(GL2.GL_R, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + unitRecord.textureGenRMode = GL2.GL_EYE_LINEAR; - gl.glTexGeni(GL.GL_Q, GL.GL_TEXTURE_GEN_MODE, GL.GL_EYE_LINEAR); - unitRecord.textureGenQMode = GL.GL_EYE_LINEAR; + gl.getGL2ES1().glTexGeni(GL2.GL_Q, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_EYE_LINEAR); + unitRecord.textureGenQMode = GL2.GL_EYE_LINEAR; } record.prepPlane(texture.getEnvPlaneS(), TextureStateRecord.DEFAULT_S_PLANE); - gl.glTexGenfv(GL.GL_S, GL.GL_EYE_PLANE, record.plane); + gl.getGL2ES1().glTexGenfv(GL2.GL_S, GL2.GL_EYE_PLANE, record.plane); record.prepPlane(texture.getEnvPlaneT(), TextureStateRecord.DEFAULT_T_PLANE); - gl.glTexGenfv(GL.GL_T, GL.GL_EYE_PLANE, record.plane); + gl.getGL2ES1().glTexGenfv(GL2.GL_T, GL2.GL_EYE_PLANE, record.plane); record.prepPlane(texture.getEnvPlaneR(), TextureStateRecord.DEFAULT_R_PLANE); - gl.glTexGenfv(GL.GL_R, GL.GL_EYE_PLANE, record.plane); + gl.getGL2ES1().glTexGenfv(GL2.GL_R, GL2.GL_EYE_PLANE, record.plane); record.prepPlane(texture.getEnvPlaneQ(), TextureStateRecord.DEFAULT_Q_PLANE); - gl.glTexGenfv(GL.GL_Q, GL.GL_EYE_PLANE, record.plane); + gl.getGL2ES1().glTexGenfv(GL2.GL_Q, GL2.GL_EYE_PLANE, record.plane); setTextureGen(unitRecord, unit, record, caps, true, true, true, true); break; @@ -1214,28 +1230,28 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); // generate object linear texture coordinates - if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL.GL_OBJECT_LINEAR) { - gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_OBJECT_LINEAR); - unitRecord.textureGenSMode = GL.GL_OBJECT_LINEAR; + if (!unitRecord.isValid() || unitRecord.textureGenSMode != GL2.GL_OBJECT_LINEAR) { + gl.getGL2ES1().glTexGeni(GL2.GL_S, GL2ES1.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + unitRecord.textureGenSMode = GL2.GL_OBJECT_LINEAR; - gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_OBJECT_LINEAR); - unitRecord.textureGenTMode = GL.GL_OBJECT_LINEAR; + gl.getGL2ES1().glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + unitRecord.textureGenTMode = GL2.GL_OBJECT_LINEAR; - gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_OBJECT_LINEAR); - unitRecord.textureGenRMode = GL.GL_OBJECT_LINEAR; + gl.getGL2ES1().glTexGeni(GL2.GL_R, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + unitRecord.textureGenRMode = GL2.GL_OBJECT_LINEAR; - gl.glTexGeni(GL.GL_Q, GL.GL_TEXTURE_GEN_MODE, GL.GL_OBJECT_LINEAR); - unitRecord.textureGenQMode = GL.GL_OBJECT_LINEAR; + gl.getGL2ES1().glTexGeni(GL2.GL_Q, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); + unitRecord.textureGenQMode = GL2.GL_OBJECT_LINEAR; } record.prepPlane(texture.getEnvPlaneS(), TextureStateRecord.DEFAULT_S_PLANE); - gl.glTexGenfv(GL.GL_S, GL.GL_OBJECT_PLANE, record.plane); + gl.getGL2ES1().glTexGenfv(GL2.GL_S, GL2.GL_OBJECT_PLANE, record.plane); record.prepPlane(texture.getEnvPlaneT(), TextureStateRecord.DEFAULT_T_PLANE); - gl.glTexGenfv(GL.GL_T, GL.GL_OBJECT_PLANE, record.plane); + gl.getGL2ES1().glTexGenfv(GL2.GL_T, GL2.GL_OBJECT_PLANE, record.plane); record.prepPlane(texture.getEnvPlaneR(), TextureStateRecord.DEFAULT_R_PLANE); - gl.glTexGenfv(GL.GL_R, GL.GL_OBJECT_PLANE, record.plane); + gl.getGL2ES1().glTexGenfv(GL2.GL_R, GL2.GL_OBJECT_PLANE, record.plane); record.prepPlane(texture.getEnvPlaneQ(), TextureStateRecord.DEFAULT_Q_PLANE); - gl.glTexGenfv(GL.GL_Q, GL.GL_OBJECT_PLANE, record.plane); + gl.getGL2ES1().glTexGenfv(GL2.GL_Q, GL2.GL_OBJECT_PLANE, record.plane); setTextureGen(unitRecord, unit, record, caps, true, true, true, true); break; @@ -1251,56 +1267,56 @@ public class JoglTextureStateUtil { checkAndSetUnit(unit, record, caps); if (genS) { - gl.glEnable(GL.GL_TEXTURE_GEN_S); + gl.glEnable(GL2.GL_TEXTURE_GEN_S); } else { - gl.glDisable(GL.GL_TEXTURE_GEN_S); + gl.glDisable(GL2.GL_TEXTURE_GEN_S); } if (genT) { - gl.glEnable(GL.GL_TEXTURE_GEN_T); + gl.glEnable(GL2.GL_TEXTURE_GEN_T); } else { - gl.glDisable(GL.GL_TEXTURE_GEN_T); + gl.glDisable(GL2.GL_TEXTURE_GEN_T); } if (genR) { - gl.glEnable(GL.GL_TEXTURE_GEN_R); + gl.glEnable(GL2.GL_TEXTURE_GEN_R); } else { - gl.glDisable(GL.GL_TEXTURE_GEN_R); + gl.glDisable(GL2.GL_TEXTURE_GEN_R); } if (genQ) { - gl.glEnable(GL.GL_TEXTURE_GEN_Q); + gl.glEnable(GL2.GL_TEXTURE_GEN_Q); } else { - gl.glDisable(GL.GL_TEXTURE_GEN_Q); + gl.glDisable(GL2.GL_TEXTURE_GEN_Q); } } else { if (genS != unitRecord.textureGenS) { checkAndSetUnit(unit, record, caps); if (genS) { - gl.glEnable(GL.GL_TEXTURE_GEN_S); + gl.glEnable(GL2.GL_TEXTURE_GEN_S); } else { - gl.glDisable(GL.GL_TEXTURE_GEN_S); + gl.glDisable(GL2.GL_TEXTURE_GEN_S); } } if (genT != unitRecord.textureGenT) { checkAndSetUnit(unit, record, caps); if (genT) { - gl.glEnable(GL.GL_TEXTURE_GEN_T); + gl.glEnable(GL2.GL_TEXTURE_GEN_T); } else { - gl.glDisable(GL.GL_TEXTURE_GEN_T); + gl.glDisable(GL2.GL_TEXTURE_GEN_T); } } if (genR != unitRecord.textureGenR) { checkAndSetUnit(unit, record, caps); if (genR) { - gl.glEnable(GL.GL_TEXTURE_GEN_R); + gl.glEnable(GL2.GL_TEXTURE_GEN_R); } else { - gl.glDisable(GL.GL_TEXTURE_GEN_R); + gl.glDisable(GL2.GL_TEXTURE_GEN_R); } } if (genQ != unitRecord.textureGenQ) { checkAndSetUnit(unit, record, caps); if (genQ) { - gl.glEnable(GL.GL_TEXTURE_GEN_Q); + gl.glEnable(GL2.GL_TEXTURE_GEN_Q); } else { - gl.glDisable(GL.GL_TEXTURE_GEN_Q); + gl.glDisable(GL2.GL_TEXTURE_GEN_Q); } } } @@ -1347,7 +1363,7 @@ public class JoglTextureStateUtil { // set up magnification filter if (!texRecord.isValid() || texRecord.depthTextureMode != depthMode) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(getGLType(type), GL.GL_DEPTH_TEXTURE_MODE_ARB, depthMode); + gl.glTexParameteri(getGLType(type), GL2.GL_DEPTH_TEXTURE_MODE, depthMode); texRecord.depthTextureMode = depthMode; } } @@ -1357,7 +1373,7 @@ public class JoglTextureStateUtil { // set up magnification filter if (!texRecord.isValid() || texRecord.depthTextureCompareMode != depthCompareMode) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(getGLType(type), GL.GL_TEXTURE_COMPARE_MODE_ARB, depthCompareMode); + gl.glTexParameteri(getGLType(type), GL2ES2.GL_TEXTURE_COMPARE_MODE, depthCompareMode); texRecord.depthTextureCompareMode = depthCompareMode; } @@ -1365,7 +1381,7 @@ public class JoglTextureStateUtil { // set up magnification filter if (!texRecord.isValid() || texRecord.depthTextureCompareFunc != depthCompareFunc) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(getGLType(type), GL.GL_TEXTURE_COMPARE_FUNC_ARB, depthCompareFunc); + gl.glTexParameteri(getGLType(type), GL2ES2.GL_TEXTURE_COMPARE_FUNC, depthCompareFunc); texRecord.depthTextureCompareFunc = depthCompareFunc; } } @@ -1406,7 +1422,7 @@ public class JoglTextureStateUtil { if (caps.isAnisoSupported()) { float aniso = texture.getAnisotropicFilterPercent() * (caps.getMaxAnisotropic() - 1.0f); aniso += 1.0f; - if (!texRecord.isValid() || (texRecord.anisoLevel - aniso > MathUtils.ZERO_TOLERANCE)) { + if (!texRecord.isValid() || texRecord.anisoLevel != aniso) { checkAndSetUnit(unit, record, caps); gl.glTexParameterf(getGLType(type), GL.GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso); texRecord.anisoLevel = aniso; @@ -1437,17 +1453,17 @@ public class JoglTextureStateUtil { if (!texRecord.isValid() || texRecord.wrapS != wrapS) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_S, wrapS); + gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_S, wrapS); texRecord.wrapS = wrapS; } if (!texRecord.isValid() || texRecord.wrapT != wrapT) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_T, wrapT); + gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_T, wrapT); texRecord.wrapT = wrapT; } if (!texRecord.isValid() || texRecord.wrapR != wrapR) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(GL.GL_TEXTURE_3D, GL.GL_TEXTURE_WRAP_R, wrapR); + gl.glTexParameteri(GL2ES2.GL_TEXTURE_3D, GL2ES2.GL_TEXTURE_WRAP_R, wrapR); texRecord.wrapR = wrapR; } @@ -1470,7 +1486,7 @@ public class JoglTextureStateUtil { if (!texRecord.isValid() || texRecord.wrapS != wrapS) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(GL.GL_TEXTURE_1D, GL.GL_TEXTURE_WRAP_S, wrapS); + gl.glTexParameteri(GL2GL3.GL_TEXTURE_1D, GL.GL_TEXTURE_WRAP_S, wrapS); texRecord.wrapS = wrapS; } } @@ -1559,7 +1575,7 @@ public class JoglTextureStateUtil { } if (!texRecord.isValid() || texRecord.wrapR != wrapR) { checkAndSetUnit(unit, record, caps); - gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_WRAP_R, wrapR); + gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL2ES2.GL_TEXTURE_WRAP_R, wrapR); texRecord.wrapR = wrapR; } } @@ -1638,11 +1654,15 @@ public class JoglTextureStateUtil { case TwoDimensional: return GL.GL_TEXTURE_2D; case OneDimensional: - return GL.GL_TEXTURE_1D; + return GL2GL3.GL_TEXTURE_1D; case ThreeDimensional: - return GL.GL_TEXTURE_3D; + return GL2ES2.GL_TEXTURE_3D; case CubeMap: return GL.GL_TEXTURE_CUBE_MAP; + case Rectangle: + break; + default: + break; } throw new IllegalArgumentException("invalid texture type: " + type); } @@ -1671,38 +1691,38 @@ public class JoglTextureStateUtil { return GL.GL_REPEAT; case MirroredRepeat: if (caps.isTextureMirroredRepeatSupported()) { - return GL.GL_MIRRORED_REPEAT_ARB; + return GL.GL_MIRRORED_REPEAT; } else { return GL.GL_REPEAT; } case MirrorClamp: if (caps.isTextureMirrorClampSupported()) { - return GL.GL_MIRROR_CLAMP_EXT; + return GL2.GL_MIRROR_CLAMP_EXT; } // FALLS THROUGH case Clamp: - return GL.GL_CLAMP; + return GL2.GL_CLAMP; case MirrorBorderClamp: if (caps.isTextureMirrorBorderClampSupported()) { - return GL.GL_MIRROR_CLAMP_TO_BORDER_EXT; + return GL2.GL_MIRROR_CLAMP_TO_BORDER_EXT; } // FALLS THROUGH case BorderClamp: if (caps.isTextureBorderClampSupported()) { - return GL.GL_CLAMP_TO_BORDER; + return GL2GL3.GL_CLAMP_TO_BORDER; } else { - return GL.GL_CLAMP; + return GL2.GL_CLAMP; } case MirrorEdgeClamp: if (caps.isTextureMirrorEdgeClampSupported()) { - return GL.GL_MIRROR_CLAMP_TO_EDGE_EXT; + return GL2.GL_MIRROR_CLAMP_TO_EDGE_EXT; } // FALLS THROUGH case EdgeClamp: if (caps.isTextureEdgeClampSupported()) { return GL.GL_CLAMP_TO_EDGE; } else { - return GL.GL_CLAMP; + return GL2.GL_CLAMP; } } throw new IllegalArgumentException("invalid WrapMode type: " + wrap); diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java index a980b66..50258b8 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglVertexProgramStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -15,6 +15,7 @@ import java.nio.IntBuffer; import java.util.logging.Logger; import javax.media.opengl.GL; +import javax.media.opengl.GL2; import javax.media.opengl.glu.GLU; import com.ardor3d.renderer.ContextCapabilities; @@ -39,9 +40,9 @@ public abstract class JoglVertexProgramStateUtil { if (gl.glGetError() == GL.GL_INVALID_OPERATION) { // retrieve the error position final IntBuffer errorloc = BufferUtils.createIntBuffer(16); - gl.glGetIntegerv(GL.GL_PROGRAM_ERROR_POSITION_ARB, errorloc); // TODO Check for integer + gl.glGetIntegerv(GL2.GL_PROGRAM_ERROR_POSITION_ARB, errorloc); // TODO Check for integer - logger.severe("Error " + gl.glGetString(GL.GL_PROGRAM_ERROR_STRING_ARB) + " in vertex program on line " + logger.severe("Error " + gl.glGetString(GL2.GL_PROGRAM_ERROR_STRING_ARB) + " in vertex program on line " + errorloc.get(0)); } } @@ -51,14 +52,14 @@ public abstract class JoglVertexProgramStateUtil { final IntBuffer buf = BufferUtils.createIntBuffer(1); - gl.glGenProgramsARB(buf.limit(), buf); - gl.glBindProgramARB(GL.GL_VERTEX_PROGRAM_ARB, buf.get(0)); + gl.getGL2().glGenProgramsARB(buf.limit(), buf); + gl.getGL2().glBindProgramARB(GL2.GL_VERTEX_PROGRAM_ARB, buf.get(0)); final byte array[] = new byte[program.limit()]; program.rewind(); program.get(array); - gl - .glProgramStringARB(GL.GL_VERTEX_PROGRAM_ARB, GL.GL_PROGRAM_FORMAT_ASCII_ARB, array.length, new String( + gl.getGL2() + .glProgramStringARB(GL2.GL_VERTEX_PROGRAM_ARB, GL2.GL_PROGRAM_FORMAT_ASCII_ARB, array.length, new String( array)); checkProgramError(); @@ -90,13 +91,13 @@ public abstract class JoglVertexProgramStateUtil { } } - gl.glEnable(GL.GL_VERTEX_PROGRAM_ARB); - gl.glBindProgramARB(GL.GL_VERTEX_PROGRAM_ARB, state._getProgramID()); + gl.glEnable(GL2.GL_VERTEX_PROGRAM_ARB); + gl.getGL2().glBindProgramARB(GL2.GL_VERTEX_PROGRAM_ARB, state._getProgramID()); // load environmental parameters... for (int i = 0; i < VertexProgramState._getEnvParameters().length; i++) { if (VertexProgramState._getEnvParameters()[i] != null) { - gl.glProgramEnvParameter4fARB(GL.GL_VERTEX_PROGRAM_ARB, i, VertexProgramState + gl.getGL2().glProgramEnvParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, i, VertexProgramState ._getEnvParameters()[i][0], VertexProgramState._getEnvParameters()[i][1], VertexProgramState._getEnvParameters()[i][2], VertexProgramState ._getEnvParameters()[i][3]); @@ -108,7 +109,7 @@ public abstract class JoglVertexProgramStateUtil { // no parameters are used for (int i = 0; i < state._getParameters().length; i++) { if (state._getParameters()[i] != null) { - gl.glProgramLocalParameter4fARB(GL.GL_VERTEX_PROGRAM_ARB, i, + gl.getGL2().glProgramLocalParameter4fARB(GL2.GL_VERTEX_PROGRAM_ARB, i, state._getParameters()[i][0], state._getParameters()[i][1], state ._getParameters()[i][2], state._getParameters()[i][3]); } @@ -116,7 +117,7 @@ public abstract class JoglVertexProgramStateUtil { } } else { - gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB); + gl.glDisable(GL2.GL_VERTEX_PROGRAM_ARB); } } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java index cd6ee71..bf8b026 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglWireframeStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,6 +11,7 @@ package com.ardor3d.scene.state.jogl; import javax.media.opengl.GL; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import com.ardor3d.renderer.ContextManager; @@ -33,18 +34,18 @@ public abstract class JoglWireframeStateUtil { switch (state.getFace()) { case Front: - applyPolyMode(GL.GL_LINE, GL.GL_FILL, record); + applyPolyMode(GL2GL3.GL_LINE, GL2GL3.GL_FILL, record); break; case Back: - applyPolyMode(GL.GL_FILL, GL.GL_LINE, record); + applyPolyMode(GL2GL3.GL_FILL, GL2GL3.GL_LINE, record); break; case FrontAndBack: default: - applyPolyMode(GL.GL_LINE, GL.GL_LINE, record); + applyPolyMode(GL2GL3.GL_LINE, GL2GL3.GL_LINE, record); break; } } else { - applyPolyMode(GL.GL_FILL, GL.GL_FILL, record); + applyPolyMode(GL2GL3.GL_FILL, GL2GL3.GL_FILL, record); } if (!record.isValid()) { @@ -57,26 +58,26 @@ public abstract class JoglWireframeStateUtil { if (record.isValid()) { if (frontMode == backMode && (record.frontMode != frontMode || record.backMode != backMode)) { - gl.glPolygonMode(GL.GL_FRONT_AND_BACK, frontMode); + gl.getGL2GL3().glPolygonMode(GL.GL_FRONT_AND_BACK, frontMode); record.frontMode = frontMode; record.backMode = backMode; } else if (frontMode != backMode) { if (record.frontMode != frontMode) { - gl.glPolygonMode(GL.GL_FRONT, frontMode); + gl.getGL2GL3().glPolygonMode(GL.GL_FRONT, frontMode); record.frontMode = frontMode; } if (record.backMode != backMode) { - gl.glPolygonMode(GL.GL_BACK, backMode); + gl.getGL2GL3().glPolygonMode(GL.GL_BACK, backMode); record.backMode = backMode; } } } else { if (frontMode == backMode) { - gl.glPolygonMode(GL.GL_FRONT_AND_BACK, frontMode); + gl.getGL2GL3().glPolygonMode(GL.GL_FRONT_AND_BACK, frontMode); } else if (frontMode != backMode) { - gl.glPolygonMode(GL.GL_FRONT, frontMode); - gl.glPolygonMode(GL.GL_BACK, backMode); + gl.getGL2GL3().glPolygonMode(GL.GL_FRONT, frontMode); + gl.getGL2GL3().glPolygonMode(GL.GL_BACK, backMode); } record.frontMode = frontMode; record.backMode = backMode; diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java index 12f542a..b806b02 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglZBufferStateUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java index cab297a..21ef5df 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/shader/JoglShaderUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2011 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -13,6 +13,8 @@ package com.ardor3d.scene.state.jogl.shader; import java.util.logging.Logger; import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; import javax.media.opengl.glu.GLU; import com.ardor3d.renderer.ContextCapabilities; @@ -105,7 +107,7 @@ public abstract class JoglShaderUtil { final GL gl = GLU.getCurrentGL(); if (variable.variableID == -1) { - variable.variableID = gl.glGetUniformLocationARB(programID, variable.name); // TODO Check variable.name + variable.variableID = gl.getGL2GL3().glGetUniformLocation(programID, variable.name); // TODO Check variable.name if (variable.variableID == -1 && !variable.errorLogged) { logger.severe("Shader uniform [" + variable.name + "] could not be located in shader"); @@ -117,25 +119,25 @@ public abstract class JoglShaderUtil { private static void updateShaderUniform(final ShaderVariableInt shaderUniform) { final GL gl = GLU.getCurrentGL(); - gl.glUniform1iARB(shaderUniform.variableID, shaderUniform.value1); + gl.getGL2GL3().glUniform1i(shaderUniform.variableID, shaderUniform.value1); } private static void updateShaderUniform(final ShaderVariableInt2 shaderUniform) { final GL gl = GLU.getCurrentGL(); - gl.glUniform2iARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); + gl.getGL2GL3().glUniform2i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); } private static void updateShaderUniform(final ShaderVariableInt3 shaderUniform) { final GL gl = GLU.getCurrentGL(); - gl.glUniform3iARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3); + gl.getGL2GL3().glUniform3i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3); } private static void updateShaderUniform(final ShaderVariableInt4 shaderUniform) { final GL gl = GLU.getCurrentGL(); - gl.glUniform4iARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3, + gl.getGL2GL3().glUniform4i(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3, shaderUniform.value4); } @@ -144,16 +146,16 @@ public abstract class JoglShaderUtil { switch (shaderUniform.size) { case 1: - gl.glUniform1ivARB(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); + gl.getGL2GL3().glUniform1iv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); break; case 2: - gl.glUniform2ivARB(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); + gl.getGL2GL3().glUniform2iv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); break; case 3: - gl.glUniform3ivARB(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); + gl.getGL2GL3().glUniform3iv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); break; case 4: - gl.glUniform4ivARB(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); + gl.getGL2GL3().glUniform4iv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); break; default: throw new IllegalArgumentException("Wrong size: " + shaderUniform.size); @@ -163,25 +165,25 @@ public abstract class JoglShaderUtil { private static void updateShaderUniform(final ShaderVariableFloat shaderUniform) { final GL gl = GLU.getCurrentGL(); - gl.glUniform1fARB(shaderUniform.variableID, shaderUniform.value1); + gl.getGL2GL3().glUniform1f(shaderUniform.variableID, shaderUniform.value1); } private static void updateShaderUniform(final ShaderVariableFloat2 shaderUniform) { final GL gl = GLU.getCurrentGL(); - gl.glUniform2fARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); + gl.getGL2GL3().glUniform2f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2); } private static void updateShaderUniform(final ShaderVariableFloat3 shaderUniform) { final GL gl = GLU.getCurrentGL(); - gl.glUniform3fARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3); + gl.getGL2GL3().glUniform3f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3); } private static void updateShaderUniform(final ShaderVariableFloat4 shaderUniform) { final GL gl = GLU.getCurrentGL(); - gl.glUniform4fARB(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3, + gl.getGL2GL3().glUniform4f(shaderUniform.variableID, shaderUniform.value1, shaderUniform.value2, shaderUniform.value3, shaderUniform.value4); } @@ -190,16 +192,16 @@ public abstract class JoglShaderUtil { switch (shaderUniform.size) { case 1: - gl.glUniform1fvARB(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); + gl.getGL2GL3().glUniform1fv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); break; case 2: - gl.glUniform2fvARB(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); + gl.getGL2GL3().glUniform2fv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); break; case 3: - gl.glUniform3fvARB(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); + gl.getGL2GL3().glUniform3fv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); break; case 4: - gl.glUniform4fvARB(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); + gl.getGL2GL3().glUniform4fv(shaderUniform.variableID, shaderUniform.value.remaining(), shaderUniform.value); break; default: throw new IllegalArgumentException("Wrong size: " + shaderUniform.size); @@ -210,21 +212,21 @@ public abstract class JoglShaderUtil { final GL gl = GLU.getCurrentGL(); shaderUniform.matrixBuffer.rewind(); - gl.glUniformMatrix2fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, shaderUniform.matrixBuffer); + gl.getGL2GL3().glUniformMatrix2fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, shaderUniform.matrixBuffer); } private static void updateShaderUniform(final ShaderVariableMatrix3 shaderUniform) { final GL gl = GLU.getCurrentGL(); shaderUniform.matrixBuffer.rewind(); - gl.glUniformMatrix3fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, shaderUniform.matrixBuffer); + gl.getGL2GL3().glUniformMatrix3fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, shaderUniform.matrixBuffer); } private static void updateShaderUniform(final ShaderVariableMatrix4 shaderUniform) { final GL gl = GLU.getCurrentGL(); shaderUniform.matrixBuffer.rewind(); - gl.glUniformMatrix4fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, shaderUniform.matrixBuffer); + gl.getGL2GL3().glUniformMatrix4fv(shaderUniform.variableID, 1, shaderUniform.rowMajor, shaderUniform.matrixBuffer); } private static void updateShaderUniform(final ShaderVariableMatrix4Array shaderUniform) { @@ -232,7 +234,7 @@ public abstract class JoglShaderUtil { shaderUniform.matrixBuffer.rewind(); // count == number of matrices we are sending, or iotw, limit / 16 - gl.glUniformMatrix4fv(shaderUniform.variableID, shaderUniform.matrixBuffer.limit() >> 4, + gl.getGL2GL3().glUniformMatrix4fv(shaderUniform.variableID, shaderUniform.matrixBuffer.limit() >> 4, shaderUniform.rowMajor, shaderUniform.matrixBuffer); } @@ -248,7 +250,7 @@ public abstract class JoglShaderUtil { final GL gl = GLU.getCurrentGL(); if (variable.variableID == -1) { - variable.variableID = gl.glGetAttribLocationARB(programID, variable.name); // TODO Check variable.name + variable.variableID = gl.getGL2GL3().glGetAttribLocation(programID, variable.name); // TODO Check variable.name if (variable.variableID == -1 && !variable.errorLogged) { logger.severe("Shader attribute [" + variable.name + "] could not be located in shader"); @@ -305,7 +307,7 @@ public abstract class JoglShaderUtil { public static void useShaderProgram(final int id, final ShaderObjectsStateRecord record) { if (record.shaderId != id) { - GLU.getCurrentGL().glUseProgramObjectARB(id); + GLU.getCurrentGL().getGL2().glUseProgramObjectARB(id); record.shaderId = id; } } @@ -313,11 +315,11 @@ public abstract class JoglShaderUtil { private static void enableVertexAttribute(final ShaderVariable var, final ShaderObjectsStateRecord record) { if (!record.enabledAttributes.contains(var)) { if (var.getSize() == 1) { - GLU.getCurrentGL().glEnableVertexAttribArrayARB(var.variableID); + GLU.getCurrentGL().getGL2GL3().glEnableVertexAttribArray(var.variableID); } else { final GL gl = GLU.getCurrentGL(); for (int i = 0, max = var.getSize(); i < max; i++) { - gl.glEnableVertexAttribArrayARB(var.variableID + i); + gl.getGL2GL3().glEnableVertexAttribArray(var.variableID + i); } } record.enabledAttributes.add(var); @@ -331,11 +333,11 @@ public abstract class JoglShaderUtil { final RenderContext context = ContextManager.getCurrentContext(); final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - GLU.getCurrentGL().glVertexAttribPointerARB(variable.variableID, variable.size, GL.GL_FLOAT, + GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized, variable.stride, 0); } else { variable.data.getBuffer().rewind(); - GLU.getCurrentGL().glVertexAttribPointerARB(variable.variableID, variable.size, GL.GL_FLOAT, + GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, GL.GL_FLOAT, variable.normalized, variable.stride, variable.data.getBuffer()); } } @@ -353,11 +355,11 @@ public abstract class JoglShaderUtil { if (useVBO) { final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - gl.glVertexAttribPointerARB(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized, 0, pos); + gl.getGL2GL3().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized, 0, pos); } else { variable.data.getBuffer().limit(pos + length - 1); variable.data.getBuffer().position(pos); - gl.glVertexAttribPointerARB(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized, 0, + gl.getGL2GL3().glVertexAttribPointer(variable.variableID + i, size, GL.GL_FLOAT, variable.normalized, 0, variable.data.getBuffer()); } } @@ -370,11 +372,11 @@ public abstract class JoglShaderUtil { final RenderContext context = ContextManager.getCurrentContext(); final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - GLU.getCurrentGL().glVertexAttribPointerARB(variable.variableID, variable.size, + GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride, 0); } else { variable.data.getBuffer().rewind(); - GLU.getCurrentGL().glVertexAttribPointerARB(variable.variableID, variable.size, + GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_BYTE : GL.GL_BYTE, variable.normalized, variable.stride, variable.data.getBuffer()); } @@ -387,12 +389,12 @@ public abstract class JoglShaderUtil { final RenderContext context = ContextManager.getCurrentContext(); final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - GLU.getCurrentGL().glVertexAttribPointerARB(variable.variableID, variable.size, - variable.unsigned ? GL.GL_UNSIGNED_INT : GL.GL_INT, variable.normalized, variable.stride, 0); + GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, + variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, variable.stride, 0); } else { variable.data.getBuffer().rewind(); - GLU.getCurrentGL().glVertexAttribPointerARB(variable.variableID, variable.size, - variable.unsigned ? GL.GL_UNSIGNED_INT : GL.GL_INT, variable.normalized, variable.stride, + GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, + variable.unsigned ? GL.GL_UNSIGNED_INT : GL2ES2.GL_INT, variable.normalized, variable.stride, variable.data.getBuffer()); } } @@ -404,11 +406,11 @@ public abstract class JoglShaderUtil { final RenderContext context = ContextManager.getCurrentContext(); final int vboId = JoglRenderer.setupVBO(variable.data, context); JoglRendererUtil.setBoundVBO(context.getRendererRecord(), vboId); - GLU.getCurrentGL().glVertexAttribPointerARB(variable.variableID, variable.size, + GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, variable.stride, 0); } else { variable.data.getBuffer().rewind(); - GLU.getCurrentGL().glVertexAttribPointerARB(variable.variableID, variable.size, + GLU.getCurrentGL().getGL2GL3().glVertexAttribPointer(variable.variableID, variable.size, variable.unsigned ? GL.GL_UNSIGNED_SHORT : GL.GL_SHORT, variable.normalized, variable.stride, variable.data.getBuffer()); } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java index c763e63..88f006e 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglRendererUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -25,7 +25,7 @@ public abstract class JoglRendererUtil { final GL gl = GLU.getCurrentGL(); if (!rendRecord.isMatrixValid() || rendRecord.getMatrixMode() != mode) { - gl.glMatrixMode(mode); + gl.getGL2().glMatrixMode(mode); rendRecord.setMatrixMode(mode); rendRecord.setMatrixValid(true); } @@ -35,7 +35,7 @@ public abstract class JoglRendererUtil { final GL gl = GLU.getCurrentGL(); if (!rendRecord.isVboValid() || rendRecord.getCurrentVboId() != id) { - gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, id); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, id); rendRecord.setCurrentVboId(id); rendRecord.setVboValid(true); } @@ -45,7 +45,7 @@ public abstract class JoglRendererUtil { final GL gl = GLU.getCurrentGL(); if (!rendRecord.isElementVboValid() || rendRecord.getCurrentElementVboId() != id) { - gl.glBindBufferARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, id); + gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, id); rendRecord.setCurrentElementVboId(id); rendRecord.setElementVboValid(true); } diff --git a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java index 2733e72..504cb1b 100644 --- a/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java +++ b/trunk/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2008-2012 Ardor Labs, Inc. + * Copyright (c) 2008-2010 Ardor Labs, Inc. * * This file is part of Ardor3D. * @@ -11,9 +11,14 @@ package com.ardor3d.scene.state.jogl.util; import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES1; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; import com.ardor3d.image.ImageDataFormat; import com.ardor3d.image.PixelDataType; +import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.image.Texture.ApplyMode; import com.ardor3d.image.Texture.CombinerFunctionAlpha; import com.ardor3d.image.Texture.CombinerFunctionRGB; @@ -25,32 +30,27 @@ import com.ardor3d.image.Texture.DepthTextureCompareMode; import com.ardor3d.image.Texture.DepthTextureMode; import com.ardor3d.image.Texture.MagnificationFilter; import com.ardor3d.image.Texture.MinificationFilter; -import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.renderer.state.TextureState.CorrectionType; public abstract class JoglTextureUtil { public static int getGLInternalFormat(final TextureStoreFormat format) { switch (format) { - // first some frequently used formats + // first some frequently used formats case RGBA8: return GL.GL_RGBA8; case RGB8: return GL.GL_RGB8; case Alpha8: - return GL.GL_ALPHA8; + return GL2.GL_ALPHA8; case CompressedRGBA: - return GL.GL_COMPRESSED_RGBA; + return GL2GL3.GL_COMPRESSED_RGBA; case CompressedRGB: - return GL.GL_COMPRESSED_RGB; - case CompressedRG: - return 0x8226;// GL.GL_COMPRESSED_RG; - case CompressedRed: - return 0x8225;// GL.GL_COMPRESSED_RED; + return GL2GL3.GL_COMPRESSED_RGB; case CompressedLuminance: - return GL.GL_COMPRESSED_LUMINANCE; + return GL2.GL_COMPRESSED_LUMINANCE; case CompressedLuminanceAlpha: - return GL.GL_COMPRESSED_LUMINANCE_ALPHA; + return GL2.GL_COMPRESSED_LUMINANCE_ALPHA; case NativeDXT1: return GL.GL_COMPRESSED_RGB_S3TC_DXT1_EXT; case NativeDXT1A: @@ -60,59 +60,59 @@ public abstract class JoglTextureUtil { case NativeDXT5: return GL.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; case NativeLATC_L: - return GL.GL_COMPRESSED_LUMINANCE_LATC1_EXT; + return GL2.GL_COMPRESSED_LUMINANCE_LATC1_EXT; case NativeLATC_LA: - return GL.GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; + return GL2.GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; // The rest... case Alpha4: - return GL.GL_ALPHA4; + return GL2.GL_ALPHA4; case Alpha12: - return GL.GL_ALPHA12; + return GL2.GL_ALPHA12; case Alpha16: - return GL.GL_ALPHA16; + return GL2.GL_ALPHA16; case Luminance4: - return GL.GL_LUMINANCE4; + return GL2.GL_LUMINANCE4; case Luminance8: - return GL.GL_LUMINANCE8; + return GL2.GL_LUMINANCE8; case Luminance12: - return GL.GL_LUMINANCE12; + return GL2.GL_LUMINANCE12; case Luminance16: - return GL.GL_LUMINANCE16; + return GL2.GL_LUMINANCE16; case Intensity4: - return GL.GL_INTENSITY4; + return GL2.GL_INTENSITY4; case Intensity8: - return GL.GL_INTENSITY8; + return GL2.GL_INTENSITY8; case Intensity12: - return GL.GL_INTENSITY12; + return GL2.GL_INTENSITY12; case Intensity16: - return GL.GL_INTENSITY16; + return GL2.GL_INTENSITY16; case Luminance4Alpha4: - return GL.GL_LUMINANCE4_ALPHA4; + return GL2.GL_LUMINANCE4_ALPHA4; case Luminance6Alpha2: - return GL.GL_LUMINANCE6_ALPHA2; + return GL2.GL_LUMINANCE6_ALPHA2; case Luminance8Alpha8: - return GL.GL_LUMINANCE8_ALPHA8; + return GL2.GL_LUMINANCE8_ALPHA8; case Luminance12Alpha4: - return GL.GL_LUMINANCE12_ALPHA4; + return GL2.GL_LUMINANCE12_ALPHA4; case Luminance12Alpha12: - return GL.GL_LUMINANCE12_ALPHA12; + return GL2.GL_LUMINANCE12_ALPHA12; case Luminance16Alpha16: - return GL.GL_LUMINANCE16_ALPHA16; + return GL2.GL_LUMINANCE16_ALPHA16; case R3G3B2: - return GL.GL_R3_G3_B2; + return GL2GL3.GL_R3_G3_B2; case RGB4: - return GL.GL_RGB4; + return GL2GL3.GL_RGB4; case RGB5: - return GL.GL_RGB5; + return GL2GL3.GL_RGB5; case RGB10: return GL.GL_RGB10; case RGB12: - return GL.GL_RGB12; + return GL2GL3.GL_RGB12; case RGB16: - return GL.GL_RGB16; + return GL2GL3.GL_RGB16; case RGBA2: - return GL.GL_RGBA2; + return GL2GL3.GL_RGBA2; case RGBA4: return GL.GL_RGBA4; case RGB5A1: @@ -120,83 +120,93 @@ public abstract class JoglTextureUtil { case RGB10A2: return GL.GL_RGB10_A2; case RGBA12: - return GL.GL_RGBA12; + return GL2GL3.GL_RGBA12; case RGBA16: - return GL.GL_RGBA16; + return GL2GL3.GL_RGBA16; case Depth: - return GL.GL_DEPTH_COMPONENT; + return GL2ES2.GL_DEPTH_COMPONENT; case Depth16: - return GL.GL_DEPTH_COMPONENT16_ARB; + return GL.GL_DEPTH_COMPONENT16; case Depth24: - return GL.GL_DEPTH_COMPONENT24_ARB; + return GL.GL_DEPTH_COMPONENT24; case Depth32: - return GL.GL_DEPTH_COMPONENT32_ARB; + return GL.GL_DEPTH_COMPONENT32; case Depth32F: - return GL.GL_DEPTH_COMPONENT32F_NV; + return GL2GL3.GL_DEPTH_COMPONENT32F; case RGB16F: - return GL.GL_RGB16F_ARB; + return GL2ES2.GL_RGB16F; case RGB32F: - return GL.GL_RGB32F_ARB; + return GL.GL_RGB32F; case RGBA16F: - return GL.GL_RGBA16F_ARB; + return GL2ES2.GL_RGBA16F; case RGBA32F: - return GL.GL_RGBA32F_ARB; + return GL.GL_RGBA32F; case Alpha16F: - return GL.GL_ALPHA16F_ARB; + return GL2.GL_ALPHA16F; case Alpha32F: - return GL.GL_ALPHA32F_ARB; + return GL2.GL_ALPHA32F; case Luminance16F: - return GL.GL_LUMINANCE16F_ARB; + return GL2.GL_LUMINANCE16F; case Luminance32F: - return GL.GL_LUMINANCE32F_ARB; + return GL2.GL_LUMINANCE32F; case LuminanceAlpha16F: - return GL.GL_LUMINANCE_ALPHA16F_ARB; + return GL2.GL_LUMINANCE_ALPHA16F; case LuminanceAlpha32F: - return GL.GL_LUMINANCE_ALPHA32F_ARB; + return GL2.GL_LUMINANCE_ALPHA32F; case Intensity16F: - return GL.GL_INTENSITY16F_ARB; + return GL2.GL_INTENSITY16F; case Intensity32F: - return GL.GL_INTENSITY32F_ARB; - case R8: - return 0x8229;// GL.GL_R8; + return GL2.GL_INTENSITY32F; + case CompressedRG: + break; + case CompressedRed: + break; + case GuessCompressedFormat: + break; + case GuessNoCompressedFormat: + break; case R16: - return 0x822A;// GL.GL_R16; - case RG8: - return 0x822B;// GL.GL_RG8; - case RG16: - return 0x822C;// GL.GL_RG16; + break; case R16F: - return 0x822D;// GL.GL_R16F; - case R32F: - return 0x822E;// GL.GL_R32F; - case RG16F: - return 0x822F;// GL.GL_RG16F; - case RG32F: - return 0x8230;// GL.GL_RG32F; - case R8I: - return 0x8231;// GL.GL_R8I; - case R8UI: - return 0x8232;// GL.GL_R8UI; + break; case R16I: - return 0x8233;// GL.GL_R16I; + break; case R16UI: - return 0x8234;// GL.GL_R16UI; + break; + case R32F: + break; case R32I: - return 0x8235;// GL.GL_R32I; + break; case R32UI: - return 0x8236;// GL.GL_R32UI; - case RG8I: - return 0x8237;// GL.GL_RG8I; - case RG8UI: - return 0x8238;// GL.GL_RG8UI; + break; + case R8: + break; + case R8I: + break; + case R8UI: + break; + case RG16: + break; + case RG16F: + break; case RG16I: - return 0x8239;// GL.GL_RG16I; + break; case RG16UI: - return 0x823A;// GL.GL_RG16UI; + break; + case RG32F: + break; case RG32I: - return 0x823B;// GL.GL_RG32I; + break; case RG32UI: - return 0x823C;// GL.GL_RG32UI; + break; + case RG8: + break; + case RG8I: + break; + case RG8UI: + break; + default: + break; } throw new IllegalArgumentException("Incorrect format set: " + format); } @@ -208,41 +218,17 @@ public abstract class JoglTextureUtil { case Float: return GL.GL_FLOAT; case HalfFloat: - return GL.GL_HALF_FLOAT_ARB; + return GL.GL_HALF_FLOAT; case Short: return GL.GL_SHORT; case UnsignedShort: return GL.GL_UNSIGNED_SHORT; case Int: - return GL.GL_INT; + return GL2ES2.GL_INT; case UnsignedInt: return GL.GL_UNSIGNED_INT; case UnsignedByte: return GL.GL_UNSIGNED_BYTE; - case UnsignedByte_3_3_2: - return GL.GL_UNSIGNED_BYTE_3_3_2; - case UnsignedByte_2_3_3_Rev: - return GL.GL_UNSIGNED_BYTE_2_3_3_REV; - case UnsignedShort_5_6_5: - return GL.GL_UNSIGNED_SHORT_5_6_5; - case UnsignedShort_5_6_5_Rev: - return GL.GL_UNSIGNED_SHORT_5_6_5_REV; - case UnsignedShort_4_4_4_4: - return GL.GL_UNSIGNED_SHORT_4_4_4_4; - case UnsignedShort_4_4_4_4_Rev: - return GL.GL_UNSIGNED_SHORT_4_4_4_4_REV; - case UnsignedShort_5_5_5_1: - return GL.GL_UNSIGNED_SHORT_5_5_5_1; - case UnsignedShort_1_5_5_5_Rev: - return GL.GL_UNSIGNED_SHORT_1_5_5_5_REV; - case UnsignedInt_8_8_8_8: - return GL.GL_UNSIGNED_INT_8_8_8_8; - case UnsignedInt_8_8_8_8_Rev: - return GL.GL_UNSIGNED_INT_8_8_8_8_REV; - case UnsignedInt_10_10_10_2: - return GL.GL_UNSIGNED_INT_10_10_10_2; - case UnsignedInt_2_10_10_10_Rev: - return GL.GL_UNSIGNED_INT_2_10_10_10_REV; default: throw new Error("Unhandled type: " + type); } @@ -254,32 +240,46 @@ public abstract class JoglTextureUtil { return GL.GL_RGBA; case RGB: return GL.GL_RGB; - case RG: - return 0x8227;// GL.GL_RG; case Alpha: return GL.GL_ALPHA; case Luminance: return GL.GL_LUMINANCE; case Intensity: - return GL.GL_INTENSITY; + return GL2.GL_INTENSITY; case LuminanceAlpha: return GL.GL_LUMINANCE_ALPHA; case Depth: - return GL.GL_DEPTH_COMPONENT; + return GL2ES2.GL_DEPTH_COMPONENT; case BGR: - return GL.GL_BGR; + return GL2GL3.GL_BGR; case BGRA: - return GL.GL_BGRA; + return GL2.GL_BGRA; case Red: - return GL.GL_RED; + return GL2ES2.GL_RED; case Blue: - return GL.GL_BLUE; + return GL2GL3.GL_BLUE; case Green: - return GL.GL_GREEN; + return GL2GL3.GL_GREEN; case ColorIndex: - return GL.GL_COLOR_INDEX; + return GL2.GL_COLOR_INDEX; case StencilIndex: - return GL.GL_STENCIL_INDEX; + return GL2ES2.GL_STENCIL_INDEX; + case PrecompressedDXT1: + break; + case PrecompressedDXT1A: + break; + case PrecompressedDXT3: + break; + case PrecompressedDXT5: + break; + case PrecompressedLATC_L: + break; + case PrecompressedLATC_LA: + break; + case RG: + break; + default: + break; } throw new IllegalArgumentException("Incorrect format set: " + format); } @@ -334,7 +334,7 @@ public abstract class JoglTextureUtil { case Intensity16: case Intensity16F: case Intensity32F: - return GL.GL_INTENSITY; + return GL2.GL_INTENSITY; case Luminance4Alpha4: case Luminance6Alpha2: case Luminance8Alpha8: @@ -351,31 +351,57 @@ public abstract class JoglTextureUtil { case Depth24: case Depth32: case Depth32F: - return GL.GL_DEPTH_COMPONENT; - case R8: + return GL2ES2.GL_DEPTH_COMPONENT; + case CompressedRG: + break; + case CompressedRed: + break; + case GuessCompressedFormat: + break; + case GuessNoCompressedFormat: + break; case R16: + break; case R16F: - case R32F: - case R8I: - case R8UI: + break; case R16I: + break; case R16UI: + break; + case R32F: + break; case R32I: + break; case R32UI: - case CompressedRed: - return GL.GL_RED; - case RG8: + break; + case R8: + break; + case R8I: + break; + case R8UI: + break; case RG16: + break; case RG16F: - case RG32F: - case RG8I: - case RG8UI: + break; case RG16I: + break; case RG16UI: + break; + case RG32F: + break; case RG32I: + break; case RG32UI: - case CompressedRG: - return 0x8227; // Jogl1 missing GL_RG + break; + case RG8: + break; + case RG8I: + break; + case RG8UI: + break; + default: + break; } throw new IllegalArgumentException("Incorrect format set: " + format); } @@ -388,14 +414,14 @@ public abstract class JoglTextureUtil { return GL.GL_LUMINANCE; case Intensity: default: - return GL.GL_INTENSITY; + return GL2.GL_INTENSITY; } } public static int getGLDepthTextureCompareMode(final DepthTextureCompareMode mode) { switch (mode) { case RtoTexture: - return GL.GL_COMPARE_R_TO_TEXTURE_ARB; + return GL2.GL_COMPARE_R_TO_TEXTURE; case None: default: return GL.GL_NONE; @@ -448,13 +474,13 @@ public abstract class JoglTextureUtil { case Blend: return GL.GL_BLEND; case Combine: - return GL.GL_COMBINE; + return GL2ES1.GL_COMBINE; case Decal: - return GL.GL_DECAL; + return GL2ES1.GL_DECAL; case Add: - return GL.GL_ADD; + return GL2ES1.GL_ADD; case Modulate: - return GL.GL_MODULATE; + return GL2ES1.GL_MODULATE; } throw new IllegalArgumentException("invalid ApplyMode type: " + apply); } @@ -498,11 +524,11 @@ public abstract class JoglTextureUtil { case CurrentTexture: return GL.GL_TEXTURE; case PrimaryColor: - return GL.GL_PRIMARY_COLOR; + return GL2ES1.GL_PRIMARY_COLOR; case Constant: - return GL.GL_CONSTANT; + return GL2ES1.GL_CONSTANT; case Previous: - return GL.GL_PREVIOUS; + return GL2ES1.GL_PREVIOUS; case TextureUnit0: return GL.GL_TEXTURE0; case TextureUnit1: @@ -574,17 +600,17 @@ public abstract class JoglTextureUtil { public static int getGLCombineFuncAlpha(final CombinerFunctionAlpha combineFunc) { switch (combineFunc) { case Modulate: - return GL.GL_MODULATE; + return GL2ES1.GL_MODULATE; case Replace: return GL.GL_REPLACE; case Add: - return GL.GL_ADD; + return GL2ES1.GL_ADD; case AddSigned: - return GL.GL_ADD_SIGNED; + return GL2ES1.GL_ADD_SIGNED; case Subtract: - return GL.GL_SUBTRACT; + return GL2ES1.GL_SUBTRACT; case Interpolate: - return GL.GL_INTERPOLATE; + return GL2ES1.GL_INTERPOLATE; } throw new IllegalArgumentException("invalid CombinerFunctionAlpha type: " + combineFunc); } @@ -592,21 +618,21 @@ public abstract class JoglTextureUtil { public static int getGLCombineFuncRGB(final CombinerFunctionRGB combineFunc) { switch (combineFunc) { case Modulate: - return GL.GL_MODULATE; + return GL2ES1.GL_MODULATE; case Replace: return GL.GL_REPLACE; case Add: - return GL.GL_ADD; + return GL2ES1.GL_ADD; case AddSigned: - return GL.GL_ADD_SIGNED; + return GL2ES1.GL_ADD_SIGNED; case Subtract: - return GL.GL_SUBTRACT; + return GL2ES1.GL_SUBTRACT; case Interpolate: - return GL.GL_INTERPOLATE; + return GL2ES1.GL_INTERPOLATE; case Dot3RGB: - return GL.GL_DOT3_RGB; + return GL2ES1.GL_DOT3_RGB; case Dot3RGBA: - return GL.GL_DOT3_RGBA; + return GL2ES1.GL_DOT3_RGBA; } throw new IllegalArgumentException("invalid CombinerFunctionRGB type: " + combineFunc); } diff --git a/trunk/ardor3d-jogl/src/main/native/macosx/libjogl.jnilib b/trunk/ardor3d-jogl/src/main/native/macosx/libjogl.jnilib Binary files differdeleted file mode 100644 index 85dac01..0000000 --- a/trunk/ardor3d-jogl/src/main/native/macosx/libjogl.jnilib +++ /dev/null diff --git a/trunk/ardor3d-jogl/src/main/native/macosx/libjogl_awt.jnilib b/trunk/ardor3d-jogl/src/main/native/macosx/libjogl_awt.jnilib Binary files differdeleted file mode 100644 index 2f16fbf..0000000 --- a/trunk/ardor3d-jogl/src/main/native/macosx/libjogl_awt.jnilib +++ /dev/null diff --git a/trunk/ardor3d-jogl/src/main/native/macosx/libjogl_cg.jnilib b/trunk/ardor3d-jogl/src/main/native/macosx/libjogl_cg.jnilib Binary files differdeleted file mode 100644 index 5627121..0000000 --- a/trunk/ardor3d-jogl/src/main/native/macosx/libjogl_cg.jnilib +++ /dev/null diff --git a/trunk/ardor3d-jogl/src/main/native/win32/jogl.dll b/trunk/ardor3d-jogl/src/main/native/win32/jogl.dll Binary files differdeleted file mode 100644 index ce466f0..0000000 --- a/trunk/ardor3d-jogl/src/main/native/win32/jogl.dll +++ /dev/null diff --git a/trunk/ardor3d-jogl/src/main/native/win32/jogl_awt.dll b/trunk/ardor3d-jogl/src/main/native/win32/jogl_awt.dll Binary files differdeleted file mode 100644 index 2f0b6a6..0000000 --- a/trunk/ardor3d-jogl/src/main/native/win32/jogl_awt.dll +++ /dev/null diff --git a/trunk/ardor3d-jogl/src/main/native/win32/jogl_cg.dll b/trunk/ardor3d-jogl/src/main/native/win32/jogl_cg.dll Binary files differdeleted file mode 100644 index 985781d..0000000 --- a/trunk/ardor3d-jogl/src/main/native/win32/jogl_cg.dll +++ /dev/null |