Compare commits

...

92 Commits

Author SHA1 Message Date
Michael Pfaff fc8b1a9fbe
Add a module-info.java, use unfettered in MemoryUtilSun 2023-12-25 17:13:31 -05:00
Michael Pfaff 0c1e38ab31
Use tinsel and public unfettered lib 2023-10-22 13:00:08 -04:00
Michael Pfaff 184f0a9223
Better error messages 2023-07-16 12:20:20 -04:00
Michael Pfaff 8658d6ab16
Add jar step to build.sh 2023-06-25 21:36:14 -04:00
Michael Pfaff c0b72342e6
Configurable compiler on linux, dos2unix on a file, consistent indentation 2023-06-25 18:35:37 -04:00
Michael Pfaff 92d2a63abc
Fix macOS OpenAL library name 2022-11-21 13:54:28 -05:00
Michael Pfaff 1a95bee5f3
Improve library resolution 2022-11-21 13:51:53 -05:00
Michael Pfaff 641f37e8eb
Debugging 2022-11-19 14:08:48 -05:00
Michael Pfaff 33506fc029
Make Display.pollDevices() public 2022-11-19 00:37:15 -05:00
Michael Pfaff b184525212
Cleanup library resolution logic 2022-11-19 00:00:14 -05:00
Michael Pfaff b78e44c3bd
Add +NoGen suffix to build.sh 2022-11-19 00:00:05 -05:00
Michael Pfaff 61fa03042f
Disable some parallelization in the generator because java annotation processors are horribly thread-unsafe 2022-10-05 18:17:14 -04:00
Michael Pfaff f2ec595d8a
Fix typo in last commit 2022-10-05 18:11:53 -04:00
Michael Pfaff 02f595e0b9
Move more logging to Java side 2022-10-05 18:08:45 -04:00
Michael Pfaff e9b94885d9
Fix macOS 12.5.1 support 2022-09-26 23:23:48 -04:00
Michael Pfaff c7e9e36013
Make OpenGL function addresses public 2022-09-17 13:31:14 -04:00
Michael Pfaff 6511c09f7a
Make generated native methods public 2022-09-17 13:08:13 -04:00
Michael Pfaff c5508a6664
Add missing headers for windows 2022-09-16 09:24:17 -04:00
Michael Pfaff 8dbd70ee34
Try to optimize the builds a little bit more. There is a pretty rare race condition that causes a build failure (bad synchronization in the java compiler). 2022-09-12 21:08:44 -04:00
Michael Pfaff 2ca4ae367b
Add more missing headers 2022-09-12 11:08:09 -04:00
Michael Pfaff eca99cf7b3
Add more missing headers 2022-09-12 11:01:50 -04:00
Michael Pfaff 2f193265ca
Add more missing headers 2022-09-12 11:00:33 -04:00
Michael Pfaff 3e1bd16a37
Add more missing headers 2022-09-12 10:59:46 -04:00
Michael Pfaff 9131fb0fc8
Add more missing headers 2022-09-09 17:59:16 -04:00
Michael Pfaff 699e95a969
Add more missing headers 2022-09-09 17:58:34 -04:00
Michael Pfaff d80a9518f4
Add missing headers 2022-09-09 17:57:21 -04:00
Michael Pfaff 150fc50317
Support macOS versions with a patch number 2022-09-09 17:04:57 -04:00
Michael Pfaff fbc1c49513
Clean-up macos build 2022-09-09 12:04:53 -04:00
Michael Pfaff 71f1ffbcfd
Remove unused import 2022-09-09 09:47:33 -04:00
Michael Pfaff 49c273763a
Access WaveFileReader reflectively 2022-09-09 09:26:05 -04:00
Michael Pfaff 34e1bc3868
Remove unnecessary generator arg 2022-09-09 09:25:34 -04:00
Michael Pfaff 314078eb11
Fix generators (needed to flush PrintWriters, even though it's backed by an in-memory buffer) 2022-09-09 00:42:36 -04:00
Michael Pfaff 00d87d7003
Fix logging when a file is skipped 2022-09-08 22:22:16 -04:00
Michael Pfaff 83e0ecd95c
Remove unnecessary generator args 2022-09-08 22:20:31 -04:00
Michael Pfaff 7148fe1ec7
Fix validation timing 2022-09-08 13:40:36 -04:00
Michael Pfaff 0001c5897e
Change generator logging a bit and add novalidate flag 2022-09-08 13:37:32 -04:00
Michael Pfaff 74841b5262
Change SupportedSourceVersion annotation to 10 2022-09-08 13:18:53 -04:00
Michael Pfaff bc6c628f6e
Remove SupportedSourceVersion annotation 2022-09-08 13:14:22 -04:00
Michael Pfaff b418015c02
Increase parallelization 2022-09-08 12:22:31 -04:00
Michael Pfaff 6b8aad48ee
Prune .gitignore 2022-09-08 07:10:58 -04:00
Michael Pfaff 0ebbec4e7f
Optimize generators 2022-09-08 07:10:40 -04:00
Michael Pfaff 632dac735a
Make getFunctionAddress public 2022-09-03 14:34:06 -04:00
Michael Pfaff 58e900386a
Remove version check from build.xml 2022-08-26 15:04:17 -04:00
Michael Pfaff b7e7d97f20
Add stubs to source path for generators 2022-08-19 13:42:16 -04:00
Michael Pfaff 655dfda1fd
Update Java 2022-08-19 13:41:30 -04:00
Michael Pfaff db00d7f587
Clean-up, use stubs unfettered lib 2022-08-16 20:59:13 -04:00
Michael Pfaff c84c67d672
Clean-up library loading a bit 2022-08-16 20:34:35 -04:00
Michael Pfaff b53c59b989
Clean-up 2022-08-16 14:27:14 -04:00
Michael Pfaff 0b89143608
Optimize build configurations 2022-08-14 13:26:07 -04:00
Michael Pfaff 4f7fee2ed4
Remove a lot of synchronization 2022-08-14 13:21:03 -04:00
Michael Pfaff 68d112adec
Fixed generated C files output path
In addition to the main fix...

- refactored GeneratorVisitor a bit
- slightly improve context in a debug message
2022-08-10 21:01:25 -04:00
Michael Pfaff bc636fa213
Fixed default logger 2022-08-10 12:39:47 -04:00
Michael Pfaff 325db15a1d
More progress, nearly fixed native header generation
BufferUtils.c and CallbackUtil.c have been modified to not include the
generated header file. This is because `javac` is choosing to ignore
those files for generation of headers for unknown reasons.
2022-08-10 11:43:59 -04:00
Michael Pfaff 134263f5cd
More progress, Windows build is definitely broken for now 2022-08-09 21:59:46 -04:00
Michael Pfaff 119cfd7369
Fix ant package name in Containerfile 2022-03-29 13:49:52 -04:00
Michael Pfaff 9cb793315f
Refactor Linux build file similarly to macOS build file 2022-03-29 12:55:52 -04:00
Michael Pfaff 5f66c07685
Remove some leftover applet tests 2022-03-29 09:49:09 -04:00
Michael Pfaff 80ff887638
Deduplicate generator build scripts 2022-03-29 09:48:40 -04:00
Michael Pfaff 68e2ca0b76
Part 1/2
- Remove applet
- Remove webstart
- Refactor all generation to the `target` folder
- Remove eclipse-update
- Update java version in `.tool-versions`
- Update `.gitignore`
- Remove unused `res` folder
- Only macOS builds work currently
- TODO: finish the aforementioned changes to all other targets
- `build.sh` runs in headless mode to avoid the focus stealing and
  performance issues on macOS
2022-03-22 21:26:50 -04:00
Michael Pfaff 9ba07be839
Set JAVA_HOME if not already set in build.sh 2022-03-22 15:47:06 -04:00
Michael Pfaff 2bfd7e88c0
Increase optimization levels 2022-03-22 15:46:18 -04:00
Michael Pfaff fdaabdc249
Patch macOS build-script 2022-03-22 13:53:08 -04:00
Michael Pfaff 98c040138b
Ignore generated applet files 2022-02-05 12:15:29 -05:00
Michael Pfaff 229a1da41b
Added build script and update minimum versions to Java 1.8 2022-01-05 13:50:35 -05:00
Ioannis Tsakpinis 2df01dd762 Reset resizable state on destroy. Close #142 2016-12-08 21:50:34 +02:00
Ioannis Tsakpinis 8bb7dfefc6 Store XRandR frequencies in the original format to improve #64
Also, reset the screen configuration on exit only if there has been a display mode change.
2016-09-09 17:25:50 +03:00
Ioannis Tsakpinis d0c96dfef2 Add warnings that the project is not actively maintained 2016-07-14 21:41:59 +03:00
Ioannis Tsakpinis ff352b63dd Merge pull request #124 from chrobione/patch-1
Add mkdir bin to build-generator.xml
2015-12-27 14:54:12 +02:00
Ioannis Tsakpinis 669689f288 Merge pull request #123 from chrobione/patch-2
Update InfoUtilFactory.java
2015-12-27 14:51:49 +02:00
Chrobi 9fd235ddf6 Update InfoUtilFactory.java
Update `calculateImage2DSize` and `calculateImage3DSize` method calls per issue https://github.com/LWJGL/lwjgl/issues/74#issuecomment-167174311
2015-12-26 22:49:01 -07:00
Chrobi 5d716b2b5a Build Error because bin directory not found
From a `git clone` trying to `ant generate-all` on Ubuntu Linux on Odroid XU4 I got the error:  
lwjgl/platform_build/build-generator.xml:26 destination directory  lgwjgl/bin does exist or is not a directory.
2015-12-26 22:28:04 -07:00
Ioannis Tsakpinis a5d81379f7 Fix clCreateImage2D/3D checks 2015-10-11 22:52:50 +03:00
Ioannis Tsakpinis 6650201a6d NV_path_rendering fixes to make it usable 2015-07-28 12:00:33 +03:00
Ioannis Tsakpinis 40694134ab Simplify event to KeySym mapping. Fix #28 2015-05-22 23:48:47 +03:00
Ioannis Tsakpinis a5c4462a3e Ignore setDisplayMode when the Display parent is set. Fix #98 2015-05-20 15:24:16 +03:00
Ioannis Tsakpinis 1dbca8b623 Merge pull request #116 from tfg13/master
further fixes for exotic xrandr outputs
2015-05-14 01:20:20 +03:00
tulius 0b83683ed1 further fixes for exotic xrandr outputs 2015-04-29 21:14:04 +02:00
Ioannis Tsakpinis a33e83ee38 Merge pull request #114 from metc/master
Fix a `java.lang.NullPointerException`.
2015-04-29 20:23:49 +03:00
Christopher Métrailler 36e7e73043 Fix a `java.lang.NullPointerException`.
See this previous commit 093bfe9698 (diff-9db50c9a42c2d4171ea35b48e3bfcbd3R146)
2015-04-29 19:18:07 +02:00
Ioannis Tsakpinis ef5149a3c3 Merge pull request #113 from Blunderchips/master
Fixed typo in the constructor comments
2015-04-27 12:04:47 +03:00
Matthew 'siD' Van der Bijl 589ce0bd5c Fixed typo in the constructor comments
Fixed a typo above one of the constructors in the Vector2f class.
"Constructor for Vector3f." -> "Constructor for Vector2f."
2015-04-27 10:36:27 +02:00
Ioannis Tsakpinis e4b098c5e2 Do not reset cursor clipping when releasing mouse grab in fullscreen mode. Fix #106
Also refactored and optimized cursor handling.
2015-02-09 17:08:38 +02:00
Ioannis Tsakpinis ae4606c53f Bump version to 2.9.4 2015-01-19 20:41:13 +02:00
Ioannis Tsakpinis 70a8746f9a Fix window resizing when mouse is grabbed and optimize cursor clipping 2015-01-14 01:38:21 +02:00
Ioannis Tsakpinis 89b22fa151 Fix cursor stuttering/drifting with mouse grab and high keyboard repeat rates
In those situations we get multiple WM_MOUSEMOVE events per frame. The problem was that we moved the cursor back to the window center after every such event, right in the middle of the event loop. The fix was to only center the cursor once, after the event buffer has been drained.
2015-01-14 01:09:42 +02:00
Ioannis Tsakpinis 831ac15619 Reset mouse tracking state on window recreation 2015-01-07 20:23:22 +02:00
Ioannis Tsakpinis 67d29a75a0 Fix javadoc error 2015-01-07 20:22:38 +02:00
Ioannis Tsakpinis 301a37c5fe Revert 849511784b 2015-01-05 20:16:56 +02:00
Ioannis Tsakpinis ee2a1c79a3 Improvements to setTitle on Linux
WM_CLASS should not change after window creation. It's illegal (may only change while the window is in the Withdrawn state) and causes flickering issues on the taskbar.

The native setTitle implementation has been changed to use a better fallback when XChangeProperty fails and _NET_WM_ICON_NAME is also set, in addition to _NET_WM_NAME.
2014-12-30 14:50:40 +02:00
Ioannis Tsakpinis 85e5488e4d Enable parallel compilation 2014-12-30 14:35:00 +02:00
Ioannis Tsakpinis 54df7fb066 Fix nightly build link 2014-12-30 14:34:40 +02:00
Ioannis Tsakpinis 6ae9382a11 Bump version to 2.9.3 2014-12-30 14:33:04 +02:00
345 changed files with 7239 additions and 17514 deletions

17
.github/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1,17 @@
## WARNING
This is the repository of the original LWJGL, which is no longer actively maintained. Unless you have released a product that uses LWJGL 2.x, you should probably be looking at [LWJGL 3](https://github.com/LWJGL/lwjgl3).
If you decide to proceed, it is very likely that:
- LWJGL maintainers won't be able to address your issue. Your best hope is an external contribution, which happens very rarely.
- Your issue is not an issue in LWJGL 3.
- Your issue has already been fixed in LWJGL 3.
If it is impossible for you to migrate to LWJGL 3, make sure to:
- Describe your issue as clearly as possible.
- Include information about your system/environment.
- Include a minimal code sample that reproduces the issue.
In any case, feature requests will almost certainly be ignored. If you need new features, you're very welcome to open an issue in the LWJGL 3 repository.

19
.gitignore vendored
View File

@ -1,22 +1,5 @@
*.*~
.*.sw[a-p]
/.classpath
/.nbattrs
/.project
/bin
/dist
/doc/javadoc
/target
/libs
/src/generated
/src/native/generated
/src/native/common/Debug
/src/native/common/Release
/src/native/windows/Debug
/src/native/windows/Release
/temp
/src/native/*/org_lwjgl_*.h
/src/native/*/*/org_lwjgl_*.h
/src/native/linux/org_lwjgl_opengl_Display.c
nbproject/project.xml
/nbproject/private/

1
.tool-versions Normal file
View File

@ -0,0 +1 @@
java temurin-21.0.0+35.0.LTS

15
Containerfile Normal file
View File

@ -0,0 +1,15 @@
FROM docker.io/alpine:edge
ARG JDK=openjdk17-jdk
ENV JDK=$JDK
RUN apk --no-cache add build-base ${JDK} wget bash apache-ant git
COPY . /opt/lwjgl2
WORKDIR /opt/lwjgl2
RUN ant generate-all
RUN ant compile
RUN ant compile_native

View File

@ -1,13 +1,17 @@
LWJGL - Lightweight Java Game Library
[LEGACY] LWJGL - Lightweight Java Game Library
======
> **WARNING**
>
> This is the repository of the original LWJGL, which is no longer actively maintained. Unless you have released a product that uses LWJGL 2.x, you should probably be looking at [LWJGL 3](https://github.com/LWJGL/lwjgl3).
The Lightweight Java Game Library (LWJGL) is a solution aimed directly at professional and amateur Java programmers alike to enable commercial quality games to be written in Java.
LWJGL provides developers access to high performance crossplatform libraries such as OpenGL (Open Graphics Library), OpenCL (Open Computing Language) and OpenAL (Open Audio Library) allowing for state of the art 3D games and 3D sound.
Additionally LWJGL provides access to controllers such as Gamepads, Steering wheel and Joysticks.
All in a simple and straight forward API.
Website: [http://lwjgl.org](http://lwjgl.org)
Forum: [http://lwjgl.org/forum](http://lwjgl.org/forum)
Website: [http://legacy.lwjgl.org](http://legacy.lwjgl.org)
Forum: [http://forum.lwjgl.org](http://forum.lwjgl.org)
Bugs/Suggestions: [https://github.com/LWJGL/lwjgl/issues](https://github.com/LWJGL/lwjgl/issues)
Compilation

285
Tinsel.lua Normal file
View File

@ -0,0 +1,285 @@
local toolchain = path(ENV.JAVA_HOME)
local src_java = path("src/java")
local src_tmpl = path("src/templates")
local src_native = path("src/native")
local libs = path("libs")
local common_srcs = table.freeze({
-- common
"org/lwjgl/PointerWrapper.java",
"org/lwjgl/PointerWrapperAbstract.java",
"org/lwjgl/PointerBuffer.java",
-- opencl
"org/lwjgl/opencl/CLPlatform.java",
"org/lwjgl/opencl/CLDevice.java",
"org/lwjgl/opencl/CLContext.java",
"org/lwjgl/opencl/CLCommandQueue.java",
"org/lwjgl/opencl/CLMem.java",
"org/lwjgl/opencl/CLBuildProgramCallback.java",
"org/lwjgl/opencl/CLCompileProgramCallback.java",
"org/lwjgl/opencl/CLContextCallback.java",
"org/lwjgl/opencl/CLEventCallback.java",
"org/lwjgl/opencl/CLLinkProgramCallback.java",
"org/lwjgl/opencl/CLMemObjectDestructorCallback.java",
"org/lwjgl/opencl/CLPrintfCallback.java",
"org/lwjgl/opencl/CLProgramCallback.java",
"org/lwjgl/opencl/CLNativeKernel.java",
"org/lwjgl/opencl/CLFunctionAddress.java",
-- opengl
"org/lwjgl/opengl/GLSync.java",
"org/lwjgl/opengl/AMDDebugOutputCallback.java",
"org/lwjgl/opengl/ARBDebugOutputCallback.java",
"org/lwjgl/opengl/KHRDebugCallback.java",
-- opengles
"org/lwjgl/opengles/EGLImageOES.java",
"org/lwjgl/opengles/KHRDebugCallback.java",
})
common_srcs = map(common_srcs, function(p) return rootedpath(src_java, src_java .. p) end)
local sp = src_java.value
local compile_generators = task("compile_generators", function(env)
local java = require("!java")
java = java.withToolchain(toolchain)
local srcs_gen = walk_rootedpath{path = src_java .. "org/lwjgl/util/generator"}
-- compile common classes required by the generators
local out_common = java.compileJar(env:derive(), {
implicit = true,
srcs = common_srcs,
class_path = files({libs .. "unfettered.jar"}),
extra_args = {
"--source-path", sp,
},
})
-- compile the generators
local out_gen = java.compileJar(env:derive(), {
srcs = srcs_gen,
class_path = files({out_common.classes}),
extra_args = {
"--source-path", sp,
},
-- TODO: need to track source path
--__source_path = files()
})
return {out_common.classes, out_gen.classes}
end)
local generate = export(task("generate", function(env)
local java = require("!java")
java = java.withToolchain(toolchain)
-- all generator sources
local srcs_openal = walk_rootedpath{path = src_tmpl .. "org/lwjgl/openal"}
local srcs_opengl = walk_rootedpath{path = src_tmpl .. "org/lwjgl/opengl"}
local srcs_opencl = walk_rootedpath{path = src_tmpl .. "org/lwjgl/opencl"}
local srcs_opengles = walk_rootedpath{path = src_tmpl .. "org/lwjgl/opengles"}
local class_path = files(compile_generators())
local dest_props_java = {"genJavaPath"}
local dest_props_native = {"genNativePath"}
local function with_dest_props(input, dest_props)
input = table.clone(input)
input.dest_props = dest_props
return input
end
local function compile(input)
input.class_path = class_path
local env = env:derive()
return async(function()
local output = java.compile(env, input)
return map_rootedpath(output.root, output.files)
end)
--local output = java.compile(env, input)
--output = map_rootedpath(output.root, output.files)
--return async(function() return output end)
end
local gen_openal = {
srcs = srcs_openal,
extra_args = {
"--source-path", sp,
"-proc:only",
"-processor",
"org.lwjgl.util.generator.GeneratorProcessor",
"-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap",
"-Anovalidate=true",
},
}
local gen_openal_java = {compile(with_dest_props(gen_openal, dest_props_java))}
local gen_openal_native = compile(with_dest_props(gen_openal, dest_props_native))
local gen_opengl = {
srcs = srcs_opengl,
extra_args = {
"--source-path", sp,
"-proc:only",
"-processor",
"org.lwjgl.util.generator.GeneratorProcessor",
"-Acontextspecific",
"-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap",
"-Anovalidate=true",
},
}
local gen_opengl_java = {
compile(with_dest_props(gen_opengl, dest_props_java)),
compile(with_dest_props({
srcs = srcs_opengl,
extra_args = {
"--source-path", sp,
"-proc:only",
"-processor",
"org.lwjgl.util.generator.opengl.GLReferencesGeneratorProcessor",
"-Acontextspecific",
}
}, dest_props_java)),
compile(with_dest_props({
srcs = srcs_opengl,
extra_args = {
"--source-path", sp,
"-proc:only",
"-processor",
"org.lwjgl.util.generator.opengl.GLGeneratorProcessor",
"-Acontextspecific",
}
}, dest_props_java)),
}
local gen_opengl_native = compile(with_dest_props(gen_opengl, dest_props_native))
local gen_opencl = {
srcs = srcs_opencl,
extra_args = {
"--source-path", sp,
"-proc:only",
"-processor",
"org.lwjgl.util.generator.GeneratorProcessor",
"-Acontextspecific",
"-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap",
"-Anovalidate=true",
},
}
local gen_opencl_java = {
compile(with_dest_props(gen_opencl, dest_props_java)),
compile(with_dest_props({
srcs = srcs_opencl,
extra_args = {
"--source-path", sp,
"-proc:only",
"-processor",
"org.lwjgl.util.generator.opencl.CLGeneratorProcessor",
"-Acontextspecific",
}
}, dest_props_java)),
}
local gen_opencl_native = compile(with_dest_props(gen_opencl, dest_props_native))
local gen_opengles = {
srcs = srcs_opengles,
extra_args = {
"--source-path", sp,
"-proc:only",
"-processor",
"org.lwjgl.util.generator.GeneratorProcessor",
"-Atypemap=org.lwjgl.util.generator.opengl.GLESTypeMap",
"-Anovalidate=true",
},
}
local gen_opengles_java = {
compile(with_dest_props(gen_opengles, dest_props_java)),
compile(with_dest_props({
srcs = srcs_opengles,
extra_args = {
"--source-path", sp,
"-proc:only",
"-processor",
"org.lwjgl.util.generator.opengl.GLESGeneratorProcessor",
}
}, dest_props_java)),
}
local gen_opengles_native = compile(with_dest_props(gen_opengles, dest_props_native))
local gen_java = table.concat(gen_openal_java, gen_opengl_java, gen_opencl_java, gen_opengles_java)
local gen_native = {
gen_openal_native,
gen_opengl_native,
gen_opencl_native,
gen_opengles_native,
}
local gen_java, gen_native = await(async(function()
return table.concat(await(gen_java))
end), async(function()
return table.concat(await(gen_native))
end))
return { java = gen_java, native = gen_native }
end))
compile_java = export(task("compile_java", function(env)
local java = require("!java")
java = java.withToolchain(toolchain)
local srcs_root = src_java .. "org/lwjgl"
local ignore_a = srcs_root.value .. "/util/generator"
local ignore_b = srcs_root.value .. "/util/test"
local ignore_c = srcs_root.value .. "/test"
local ignore_d = srcs_root.value .. "/util/mapped"
local srcs = table.clone(walk_rootedpath{path = srcs_root})
filter(srcs, function(path)
local p = path.path.value
return not p:startswith(ignore_a, ignore_b, ignore_c, ignore_d)
end)
table.insert(srcs, rootedpath(path("src/module"), path("src/module") .. "module-info.java"))
push_all(srcs, generate().java)
table.freeze(srcs)
return java.compileJar(env:derive(), {
srcs = srcs,
class_path = files({
libs .. "unfettered.jar",
libs .. "jinput.jar",
libs .. "AppleJavaExtensions.jar",
}),
extra_args = {
"--add-reads", "lwjgl=ALL-UNNAMED",
},
})
end))
local build_symbol_list = task("build_symbol_list", function(env, srcs: {InputFile})
env:memoize(srcs, function(srcs, output)
local args = map(srcs, function(src) return src.path.value end)
local output = exec_with_output("nm", "-j", "-g", table.unpack(args))
check_status(output)
local pat = compile_regex("^_J(ava|NI|avaCritical)_.*$", {multi_line = true});
local buf = ""
pat.for_each_match(output.stdout, function(match)
buf ..= match .. "\n"
end)
intrinsic.io.write_file(output, buf)
end)
end)

View File

@ -1,70 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>AppletLoader</title>
</head>
<body>
<applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar, lzma.jar" codebase="." width="640" height="480">
<!-- The following tags are mandatory -->
<!-- Name of Applet, will be used as name of directory it is saved in, and will uniquely identify it in cache -->
<param name="al_title" value="appletloadertest">
<!-- Main Applet Class -->
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
<!-- List of Jars to add to classpath -->
<param name="al_jars" value="lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma">
<!-- signed windows natives jar in a jar -->
<param name="al_windows" value="windows_natives.jar.lzma">
<!-- signed linux natives jar in a jar -->
<param name="al_linux" value="linux_natives.jar.lzma">
<!-- signed mac osx natives jar in a jar -->
<param name="al_mac" value="macosx_natives.jar.lzma">
<!-- signed solaris natives jar in a jar -->
<param name="al_solaris" value="solaris_natives.jar.lzma">
<!-- Tags under here are optional -->
<!-- whether to use cache - defaults to true -->
<!-- <param name="al_cache" value="true"> -->
<!-- Version of Applet (case insensitive String), applet files not redownloaded if same version already in cache -->
<!-- <param name="al_version" value="0.1"> -->
<!-- Specify the minimum JRE version required by your applet, defaults to "1.5" -->
<!-- <param name="al_min_jre" value="1.6"> -->
<!-- background color to paint with, defaults to white -->
<!-- <param name="boxbgcolor" value="#000000"> -->
<!-- foreground color to paint with, defaults to black -->
<!-- <param name="boxfgcolor" value="#ffffff"> -->
<!-- logo to paint while loading, will be centered, defaults to "appletlogo.gif" -->
<!-- <param name="al_logo" value="appletlogo.gif"> -->
<!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done, defaults to "appletprogress.gif" -->
<!-- <param name="al_progressbar" value="appletprogress.gif"> -->
<!-- whether to run in debug mode -->
<!-- <param name="al_debug" value="true"> -->
<!-- whether to prepend host to cache path - defaults to true -->
<!-- <param name="al_prepend_host" value="true"> -->
<param name="separate_jvm" value="true">
</applet>
<p>
if <code>al_debug</code> is true the applet will load and extract resources with a delay, to be able to see the loader process.
</p>
</body>
</html>

View File

@ -1,5 +0,0 @@
keystore "lwjglkeystore";
grant SignedBy "lwjgl" {
permission java.security.AllPermission;
};

View File

@ -1,70 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>AppletLoader</title>
</head>
<body>
<applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar" codebase="." width="640" height="480">
<!-- The following tags are mandatory -->
<!-- Name of Applet, will be used as name of directory it is saved in, and will uniquely identify it in cache -->
<param name="al_title" value="appletloadertest">
<!-- Main Applet Class -->
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
<!-- List of Jars to add to classpath -->
<param name="al_jars" value="lwjgl_applet.jar, lwjgl.jar, jinput.jar, lwjgl_util.jar">
<!-- signed windows natives jar in a jar -->
<param name="al_windows" value="windows_natives.jar">
<!-- signed linux natives jar in a jar -->
<param name="al_linux" value="linux_natives.jar">
<!-- signed mac osx natives jar in a jar -->
<param name="al_mac" value="macosx_natives.jar">
<!-- signed solaris natives jar in a jar -->
<param name="al_solaris" value="solaris_natives.jar">
<!-- Tags under here are optional -->
<!-- whether to use cache - defaults to true -->
<!-- <param name="al_cache" value="true"> -->
<!-- Version of Applet (case insensitive String), applet files not redownloaded if same version already in cache -->
<!-- <param name="al_version" value="0.1"> -->
<!-- Specify the minimum JRE version required by your applet, defaults to "1.5" -->
<!-- <param name="al_min_jre" value="1.6"> -->
<!-- background color to paint with, defaults to white -->
<!-- <param name="boxbgcolor" value="#000000"> -->
<!-- foreground color to paint with, defaults to black -->
<!-- <param name="boxfgcolor" value="#ffffff"> -->
<!-- logo to paint while loading, will be centered, defaults to "appletlogo.gif" -->
<!-- <param name="al_logo" value="appletlogo.gif"> -->
<!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done, defaults to "appletprogress.gif" -->
<!-- <param name="al_progressbar" value="appletprogress.gif"> -->
<!-- whether to run in debug mode -->
<!-- <param name="al_debug" value="true"> -->
<!-- whether to prepend host to cache path - defaults to true -->
<!-- <param name="al_prepend_host" value="true"> -->
<param name="separate_jvm" value="true">
</applet>
<p>
if <code>al_debug</code> is true the applet will load and extract resources with a delay, to be able to see the loader process.
</p>
</body>
</html>

Binary file not shown.

18
build.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
# fixes the focus-stealing bug on macOS and seems to improve performance
export JAVA_TOOL_OPTIONS='-Djava.awt.headless=true'
# ensure that JAVA_HOME is set
export JAVA_HOME=${JAVA_HOME:-`asdf where java`}
ant generate-all
ant compile+NoGen
ant compile_native+NoGen
ant jars+NoDeps

619
build.xml
View File

@ -4,10 +4,7 @@
<import file="platform_build/build-definitions.xml"/>
<import file="platform_build/build-generator.xml"/>
<import file="platform_build/build-applet.xml"/>
<import file="platform_build/build-webstart.xml"/>
<import file="platform_build/build-maven.xml"/>
<import file="eclipse-update/org.lwjgl.build/build-updatesite.xml"/>
<!-- ================================================================== -->
<!-- Everything below this line is targets. -->
@ -18,49 +15,20 @@
<!-- Initialize build -->
<!-- ================================================================== -->
<target name="-initialize">
<mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
<mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing native bin folder" />
<mkdir dir="${lwjgl.bin}/lwjgles" taskname="initialiazing native OpenGL ES bin folder"/>
<mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" />
<mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" />
<mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" />
<mkdir dir="${lwjgl.res}" taskname="initialiazing res folder" />
<mkdir dir="${lwjgl.temp}" taskname="initialiazing temp folder" />
<mkdir dir="${lwjgl.temp}/jar" taskname="initialiazing temp/jar folder" />
<mkdir dir="${lwjgl.temp}/doc" taskname="initialiazing temp/doc folder" />
<mkdir dir="${lwjgl.temp}/res" taskname="initialiazing temp/res folder" />
<mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" />
<mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" />
<mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" />
<mkdir dir="${lwjgl.temp}/native/freebsd" taskname="initialiazing temp/freebsd folder" />
<mkdir dir="${lwjgl.temp}/native/openbsd" taskname="initialiazing temp/openbsd folder" />
<mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" />
<mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" />
<mkdir dir="${lwjgl.target.bundle}" taskname="initialiazing bundle folder" />
<mkdir dir="${lwjgl.target.natives}" taskname="initialiazing native libs folder" />
<mkdir dir="${lwjgl.target.jars}" taskname="initialiazing java libs folder" />
</target>
<!-- Cleans up any files created during the execution of this script -->
<target name="clean" description="Cleans all directories controlled by this ant script" depends="clean-java, clean-native"/>
<!-- Cleans up any non-native files created during the execution of this script -->
<target name="clean-java" description="Cleans non-native files generated by this ant script" depends="clean-generated">
<delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
<delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
<!-- Delete java classes only to avoid unnecessary native recompilation -->
<delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
</target>
<!-- Useful when we need to force native recompilation -->
<target name="clean-native" description="Cleans native files generated by this ant script" depends="clean-generated-native">
<delete dir="${lwjgl.bin}/lwjgl" quiet="true" failonerror="false" taskname="cleaning native bin folder" />
<delete dir="${lwjgl.bin}/lwjgles" quiet="true" failonerror="false" taskname="cleaning native OpenGL ES bin folder"/>
<target name="clean" description="Cleans all directories controlled by this ant script">
<delete dir="${lwjgl.target}" quiet="true" failonerror="false" taskname="cleaning target folder" />
</target>
<!-- Creates a distribution of LWJGL -->
<target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
<!-- Warn user -->
<echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux, ${lwjgl.lib}/freebsd and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/>
<input
message="All data in the ${lwjgl.dist} folder will be deleted. Continue? "
message="All data in the ${lwjgl.target} folder will be deleted. Continue? "
validargs="yes,no"
addproperty="do.delete"
/>
@ -70,8 +38,7 @@
<fail if="do.abort">Build aborted by user.</fail>
<!-- prepare -->
<delete dir="${lwjgl.dist}" quiet="true" failonerror="false" />
<antcall target="clean-java" />
<antcall target="clean" />
<antcall target="-initialize" />
<!-- compile and create debug jars -->
@ -79,26 +46,21 @@
<antcall target="compile" />
<antcall target="-createdebugjars" />
<!-- Generator will skip all templates if we don't clean -->
<delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" />
<!-- compile and create jars -->
<antcall target="generate-all" />
<antcall target="compile" />
<antcall target="-createjars" />
<antcall target="-jars_NoDEP" />
<antcall target="javadoc" />
<antcall target="applet-release" />
<!-- copy resources to res folder -->
<copy todir="${lwjgl.temp}/res">
<copy todir="${lwjgl.target.staging}/res">
<fileset dir="res"/>
</copy>
<!-- copy docs -->
<copy todir="${lwjgl.temp}/doc">
<fileset dir="${lwjgl.docs}">
<copy todir="${lwjgl.target.staging}/doc">
<fileset dir="${lwjgl.target.doc}">
<patternset refid="lwjgl-docs.fileset" />
</fileset>
</copy>
@ -109,31 +71,57 @@
<antcall target="-distribute" />
</target>
<target name="all" description="Creates the Java archives and the natives for the current platform" depends="jars, compile_native"/>
<target name="all" description="Creates the Java archives and the natives for the current platform">
<parallel>
<antcall target="jars" />
<antcall target="compile_native" />
</parallel>
</target>
<target name="jars+lwjgl+NoDeps" depends="-initialize">
<jar destfile="${lwjgl.target.jars}/lwjgl.jar" taskname="lwjgl.jar">
<fileset refid="lwjgl.fileset" />
<fileset refid="lwjgl.fileset.dependencies"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
</target>
<target name="jars+lwjgl_util+NoDeps" depends="-initialize">
<jar destfile="${lwjgl.target.jars}/lwjgl_util.jar" taskname="lwjgl_util.jar">
<fileset refid="lwjgl_util.fileset" />
</jar>
</target>
<target name="jars+lwjgl_test+NoDeps" depends="-initialize">
<jar destfile="${lwjgl.target.jars}/lwjgl_test.jar" taskname="lwjgl_test.jar">
<fileset refid="lwjgl_test.fileset" />
<fileset refid="lwjgl_test_extra.fileset" />
</jar>
</target>
<!-- Create ONLY the jar archives -->
<target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, generate-all, compile, -createjars">
<antcall target="-jars_NoDEP" />
<target name="jars+NoDeps" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize">
<parallel>
<antcall target="jars+lwjgl+NoDeps" />
<antcall target="jars+lwjgl_util+NoDeps" />
<antcall target="jars+lwjgl_test+NoDeps" />
</parallel>
</target>
<target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="generate-all, compile, jars+NoDeps">
</target>
<!-- Create ONLY the jar archives for the ES build -->
<target name="jars_es" description="Creates the Java archives ONLY for the ES build and places them in libs/"
depends="-initialize, generate-all, compile, -createjars_es">
<antcall target="-jars_NoDEP"/>
</target>
<target name="-jars_NoDEP">
<move todir="libs/">
<fileset dir="${lwjgl.temp}/jar">
<include name="*.jar"/>
</fileset>
</move>
</target>
<!-- Packages the java files -->
<target name="-createdebugjars">
<target name="-createdebugjars" depends="-initialize">
<!-- Create lwjgl.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl-debug.jar" taskname="lwjgl-debug.jar">
<jar destfile="${lwjgl.target.staging}/jar/lwjgl-debug.jar" taskname="lwjgl-debug.jar">
<fileset refid="lwjgl.fileset" />
<fileset refid="lwjgl.fileset.dependencies"/>
<manifest>
@ -142,49 +130,12 @@
</jar>
</target>
<!-- Packages the java files -->
<target name="-createjars">
<!-- Create lwjgl.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar">
<fileset refid="lwjgl.fileset" />
<fileset refid="lwjgl.fileset.dependencies"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<!-- Create lwjgl_util_applet.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl_util_applet.jar" taskname="lwjgl_util_applet.jar">
<fileset dir="${lwjgl.res}" includes="applet*"/>
<fileset refid="lwjgl_util_applet.fileset" />
<manifest>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Codebase" value="*"/>
<attribute name="Caller-Allowable-Codebase" value="*"/>
<attribute name="Application-Library-Allowable-Codebase" value="*"/>
</manifest>
</jar>
<!-- Create lwjgl_test.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar">
<fileset refid="lwjgl_test.fileset" />
<fileset refid="lwjgl_test_extra.fileset" />
</jar>
<!-- Create lwjgl_util.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl_util.jar" taskname="lwjgl_util.jar">
<fileset refid="lwjgl_util.fileset" />
</jar>
</target>
<!-- Packages the java files for the ES build -->
<target name="-createjars_es">
<!-- ================================================================== -->
<!-- Generate a list of the OpenGL extension classes -->
<!-- ================================================================== -->
<fileset id="opengl-template-fileset" dir="${lwjgl.src}/generated/org/lwjgl/opengl" includes="${opengl-template-pattern}"/>
<fileset id="opengl-template-fileset" dir="${lwjgl.target.gen.java}/org/lwjgl/opengl" includes="${opengl-template-pattern}"/>
<property name="opengl-template-files" refid="opengl-template-fileset"/>
<tempfile property="temp.file"/>
@ -203,9 +154,9 @@
<delete file="${temp.file}" />
<!-- Create lwjgl.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar">
<jar destfile="${lwjgl.target.staging}/jar/lwjgl.jar" taskname="lwjgl.jar">
<!-- Files to include in the lwjgl.jar file, for the ES build -->
<fileset dir="${lwjgl.bin}" excludes="${opengl-template-classes}">
<fileset dir="${lwjgl.target.gen.classes}" excludes="${opengl-template-classes}">
<patternset id="lwjgl_es.package.pattern">
<include name="org/**/*"/>
<exclude name="org/lwjgl/d3d/**"/>
@ -221,163 +172,208 @@
</jar>
<!-- Create lwjgl_test.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar">
<jar destfile="${lwjgl.target.staging}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar">
<fileset refid="lwjgl_test_es.fileset"/>
</jar>
</target>
<!-- Distributes files -->
<target name="-distribute">
<delete>
<fileset dir="${lwjgl.temp}/native/" includes="**/*"/>
</delete>
<copy todir="${lwjgl.temp}/jar">
<fileset dir="${lwjgl.lib}/" includes="*.jar"/>
</copy>
<copy todir="${lwjgl.temp}/native/windows">
<fileset dir="${lwjgl.lib}/windows">
<patternset refid="lwjgl-windows.fileset" />
</fileset>
</copy>
<copy todir="${lwjgl.temp}/native/linux">
<fileset dir="${lwjgl.lib}/linux">
<patternset refid="lwjgl-linux.fileset" />
</fileset>
</copy>
<copy todir="${lwjgl.temp}/native/freebsd" failonerror="false">
<fileset dir="${lwjgl.lib}/freebsd">
<patternset refid="lwjgl-freebsd.fileset" />
</fileset>
</copy>
<copy todir="${lwjgl.temp}/native/openbsd" failonerror="false">
<fileset dir="${lwjgl.lib}/openbsd">
<patternset refid="lwjgl-openbsd.fileset" />
</fileset>
</copy>
<copy todir="${lwjgl.temp}/native/macosx">
<fileset dir="${lwjgl.lib}/macosx">
<patternset refid="lwjgl-macosx.fileset" />
</fileset>
</copy>
<copy todir="${lwjgl.temp}/native/solaris">
<fileset dir="${lwjgl.lib}/solaris">
<patternset refid="lwjgl-solaris.fileset" />
</fileset>
</copy>
<!-- create base package -->
<zip destfile="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip">
<zipfileset dir="${lwjgl.temp}" prefix="lwjgl-${lwjgl.version}/">
<patternset refid="lwjgl_base"/>
</zipfileset>
</zip>
<!-- create applet package -->
<zip destfile="${lwjgl.dist}/lwjgl_applet-${lwjgl.version}.zip">
<zipfileset dir="." prefix="lwjgl_applet-${lwjgl.version}/">
<patternset refid="lwjgl_applet"/>
</zipfileset>
</zip>
</target>
<!-- Creates a versioned distribution of javadocs -->
<target name="-distribution_javadoc">
<zip destfile="${lwjgl.dist}/lwjgl-docs-${lwjgl.version}.zip" basedir="${lwjgl.docs}" includes="javadoc/**" />
</target>
<!-- Creates a versioned distribution of the source code -->
<target name="-distribution_source">
<zip destfile="${lwjgl.dist}/lwjgl-source-${lwjgl.version}.zip">
<fileset refid="lwjgl.source.fileset" />
</zip>
</target>
<!-- Generates the native headers from source files -->
<target name="headers" description="invokes javah on java classes" depends="compile">
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux">
<class name="org.lwjgl.LinuxSysImplementation" />
<class name="org.lwjgl.opengl.LinuxEvent" />
<class name="org.lwjgl.opengl.LinuxMouse" />
<class name="org.lwjgl.opengl.LinuxKeyboard" />
<class name="org.lwjgl.opengl.LinuxDisplay" />
<class name="org.lwjgl.opengl.LinuxPeerInfo" />
</javah>
<!--<target name="headers" description="invokes javah on java classes" depends="compile">
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src.java}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/linux"/>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux/opengl">
<class name="org.lwjgl.opengl.LinuxPbufferPeerInfo"/>
<class name="org.lwjgl.opengl.LinuxDisplayPeerInfo"/>
<class name="org.lwjgl.opengl.LinuxAWTGLCanvasPeerInfo"/>
<class name="org.lwjgl.opengl.LinuxContextImplementation"/>
<class name="org.lwjgl.opengl.LinuxCanvasImplementation"/>
</javah>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/LinuxSysImplementation.java"/>
<include name="org/lwjgl/opengl/LinuxEvent.java"/>
<include name="org/lwjgl/opengl/LinuxMouse.java"/>
<include name="org/lwjgl/opengl/LinuxKeyboard.java"/>
<include name="org/lwjgl/opengl/LinuxDisplay.java"/>
<include name="org/lwjgl/opengl/LinuxPeerInfo.java"/>
</fileset>
</src>
</javac>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows">
<class name="org.lwjgl.WindowsSysImplementation"/>
<class name="org.lwjgl.opengl.WindowsKeyboard" />
<class name="org.lwjgl.opengl.WindowsRegistry" />
<class name="org.lwjgl.opengl.WindowsDisplay"/>
<class name="org.lwjgl.opengl.WindowsDisplayPeerInfo"/>
<class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo"/>
</javah>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/linux/opengl"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/LinuxPbufferPeerInfo.java"/>
<include name="org/lwjgl/opengl/LinuxDisplayPeerInfo.java"/>
<include name="org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java"/>
<include name="org/lwjgl/opengl/LinuxContextImplementation.java"/>
<include name="org/lwjgl/opengl/LinuxCanvasImplementation.java"/>
</fileset>
</src>
</javac>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows/opengl">
<class name="org.lwjgl.opengl.WindowsPbufferPeerInfo"/>
<class name="org.lwjgl.opengl.WindowsPeerInfo"/>
<class name="org.lwjgl.opengl.WindowsContextImplementation"/>
</javah>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/windows"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/WindowsSysImplementation.java"/>
<include name="org/lwjgl/opengl/WindowsKeyboard.java"/>
<include name="org/lwjgl/opengl/WindowsRegistry.java"/>
<include name="org/lwjgl/opengl/WindowsDisplay.java"/>
<include name="org/lwjgl/opengl/WindowsDisplayPeerInfo.java"/>
<include name="org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java"/>
</fileset>
</src>
</javac>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows/opengles">
<class name="org.lwjgl.opengl.WindowsPeerInfo"/>
</javah>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/windows/opengl"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/WindowsPbufferPeerInfo.java"/>
<include name="org/lwjgl/opengl/WindowsPeerInfo.java"/>
<include name="org/lwjgl/opengl/WindowsContextImplementation.java"/>
</fileset>
</src>
</javac>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx">
<class name="org.lwjgl.MacOSXSysImplementation" />
<class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" />
<class name="org.lwjgl.opengl.MacOSXPeerInfo" />
<class name="org.lwjgl.opengl.MacOSXPbufferPeerInfo" />
<class name="org.lwjgl.opengl.MacOSXDisplay" />
<class name="org.lwjgl.opengl.MacOSXContextImplementation" />
<class name="org.lwjgl.opengl.MacOSXNativeKeyboard" />
<class name="org.lwjgl.opengl.MacOSXNativeMouse" />
<class name="org.lwjgl.opengl.MacOSXMouseEventQueue" />
</javah>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/windows/opengles"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/WindowsPeerInfo.java"/>
</fileset>
</src>
</javac>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}">
<class name="org.lwjgl.opengl.AWTSurfaceLock" />
<class name="org.lwjgl.DefaultSysImplementation" />
<class name="org.lwjgl.input.Cursor" />
<class name="org.lwjgl.input.Keyboard" />
<class name="org.lwjgl.input.Mouse" />
<class name="org.lwjgl.openal.AL" />
<class name="org.lwjgl.opencl.CL" />
<class name="org.lwjgl.opencl.CallbackUtil" />
<class name="org.lwjgl.BufferUtils" />
</javah>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/macosx"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/MacOSXSysImplementation.java"/>
<include name="org/lwjgl/opengl/MacOSXCanvasPeerInfo.java"/>
<include name="org/lwjgl/opengl/MacOSXPeerInfo.java"/>
<include name="org/lwjgl/opengl/MacOSXPbufferPeerInfo.java"/>
<include name="org/lwjgl/opengl/MacOSXDisplay.java"/>
<include name="org/lwjgl/opengl/MacOSXContextImplementation.java"/>
<include name="org/lwjgl/opengl/MacOSXNativeKeyboard.java"/>
<include name="org/lwjgl/opengl/MacOSXNativeMouse.java"/>
<include name="org/lwjgl/opengl/MacOSXMouseEventQueue.java"/>
</fileset>
</src>
</javac>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}/opengl">
<class name="org.lwjgl.opengl.GLContext"/>
<class name="org.lwjgl.opengl.Pbuffer"/>
<class name="org.lwjgl.opengl.CallbackUtil"/>
<class name="org.lwjgl.opengl.NVPresentVideoUtil"/>
<class name="org.lwjgl.opengl.NVVideoCaptureUtil"/>
</javah>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.target.gen.headers}"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/AWTSurfaceLock.java"/>
<include name="org/lwjgl/DefaultSysImplementation.java"/>
<include name="org/lwjgl/input/Cursor.java"/>
<include name="org/lwjgl/input/Keyboard.java"/>
<include name="org/lwjgl/input/Mouse.java"/>
<include name="org/lwjgl/openal/AL.java"/>
<include name="org/lwjgl/opencl/CL.java"/>
<include name="org/lwjgl/opencl/CallbackUtil.java"/>
<include name="org/lwjgl/BufferUtils.java"/>
</fileset>
</src>
</javac>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}/opengles">
<class name="org.lwjgl.opengles.EGL"/>
<class name="org.lwjgl.opengles.EGLKHRFenceSync"/>
<class name="org.lwjgl.opengles.EGLKHRReusableSync"/>
<class name="org.lwjgl.opengles.EGLNVSync"/>
<class name="org.lwjgl.opengles.GLContext"/>
<class name="org.lwjgl.opengles.CallbackUtil"/>
</javah>
</target>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.target.gen.headers}/opengl"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/GLContext.java"/>
<include name="org/lwjgl/opengl/Pbuffer.java"/>
<include name="org/lwjgl/opengl/CallbackUtil.java"/>
<include name="org/lwjgl/opengl/NVPresentVideoUtil.java"/>
<include name="org/lwjgl/opengl/NVVideoCaptureUtil.java"/>
</fileset>
</src>
</javac>
<target name="touch-version">
<touch file="${lwjgl.src.native}/windows/org_lwjgl_opengl_Display.c"/>
<touch file="${lwjgl.src.native}/linux/org_lwjgl_opengl_Display.c"/>
<touch file="${lwjgl.src.native}/macosx/org_lwjgl_opengl_Display.m"/>
</target>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.target.gen.headers}/opengles"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengles/EGL.java"/>
<include name="org/lwjgl/opengles/EGLKHRFenceSync.java"/>
<include name="org/lwjgl/opengles/EGLKHRReusableSync.java"/>
<include name="org/lwjgl/opengles/EGLNVSync.java"/>
<include name="org/lwjgl/opengles/GLContext.java"/>
<include name="org/lwjgl/opengles/CallbackUtil.java"/>
</fileset>
</src>
</javac>
</target>-->
<target name="version-mismatch">
<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/WindowsSysImplementation.java" property="lwjgl.java.windows.version">
@ -401,21 +397,21 @@
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="${lwjgl.src.native}/windows/org_lwjgl_WindowsSysImplementation.h" property="lwjgl.native.windows.version">
<loadfile srcfile="${lwjgl.target.gen.headers}/org_lwjgl_WindowsSysImplementation.h" property="lwjgl.native.windows.version">
<filterchain>
<tokenfilter>
<containsstring contains="#define org_lwjgl_WindowsSysImplementation_JNI_VERSION"/>
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="${lwjgl.src.native}/linux/org_lwjgl_LinuxSysImplementation.h" property="lwjgl.native.linux.version">
<loadfile srcfile="${lwjgl.target.gen.headers}/org_lwjgl_LinuxSysImplementation.h" property="lwjgl.native.linux.version">
<filterchain>
<tokenfilter>
<containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/>
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version">
<loadfile srcfile="${lwjgl.target.gen.headers}/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version">
<filterchain>
<tokenfilter>
<containsstring contains="#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION"/>
@ -436,50 +432,22 @@
</echo>
</target>
<macrodef name="version-check">
<attribute name="platform"/>
<sequential>
<java classname="org.lwjgl.test.NativeTest" logError="false" resultproperty="nativetest.res" outputproperty="nativetest.out" errorproperty="nativetest.err" fork="true">
<jvmarg value="-Djava.library.path=libs/@{platform}"/>
<jvmarg value="-Dorg.lwjgl.util.Debug=true"/>
<classpath>
<pathelement path="${lwjgl.bin}"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<fail message="Unable to load native library: ${nativetest.err}">
<condition>
<not>
<equals arg1="OK" arg2="${nativetest.out}"/>
</not>
</condition>
</fail>
<echo message="Successfully executed NativeTest"/>
</sequential>
</macrodef>
<!-- Compiles the Java source code -->
<target name="compile" description="Compiles the java source code" depends="-initialize">
<javac debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar:${lwjgl.lib}/asm-debug-all.jar" taskname="core">
<!--<compilerarg value="-Xlint:unchecked"/>-->
<src path="${lwjgl.src}/java/"/>
<src path="${lwjgl.src}/generated/"/>
<include name="org/lwjgl/*.java"/>
<include name="org/lwjgl/input/**"/>
<include name="org/lwjgl/opengl/**"/>
<include name="org/lwjgl/opengles/**"/>
<include name="org/lwjgl/openal/**"/>
<include name="org/lwjgl/opencl/**"/>
<include name="org/lwjgl/util/**"/>
<target name="compile+NoGen" description="Compiles the java source code" depends="-initialize">
<javac debug="yes" destdir="${lwjgl.target.gen.classes}" nativeHeaderDir="${lwjgl.target.gen.headers}" source="1.8" target="1.8" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar:${lwjgl.lib}/asm-debug-all.jar" taskname="core">
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.stubs}"/>
<src path="${lwjgl.src.java}"/>
<src path="${lwjgl.target.gen.java}"/>
<exclude name="org/lwjgl/util/generator/**"/>
</javac>
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.5" target="1.5" taskname="test" />
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.5" target="1.5" taskname="examples" />
</target>
<target name="compile_native" depends="-initialize, headers, touch-version, version-mismatch" description="Compiles the native files">
<target name="compile" description="Compiles the java source code" depends="generate-all, compile+NoGen"/>
<target name="compile_native+NoGen" depends="-initialize" description="Compiles the native files">
<condition property="lwjgl.platform.windows">
<os family="windows" />
</condition>
@ -511,59 +479,41 @@
<antcall target="-compile_native_macosx" />
</target>
<target name="compile_native" description="Compiles the java source code" depends="generate-all, version-mismatch, compile_native+NoGen"/>
<!-- Compiles LWJGL on Win32 platforms -->
<target name="-compile_native_win32" if="lwjgl.platform.windows">
<ant antfile="platform_build/windows_ant/build.xml" inheritAll="false"/>
<copy todir="${lwjgl.lib}/windows">
<fileset dir="${lwjgl.bin}/lwjgl" includes="lwjgl*.dll"/>
</copy>
<version-check platform="windows"/>
<ant antfile="platform_build/windows_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on Linux platforms -->
<target name="-compile_native_linux" if="lwjgl.platform.linux">
<ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/>
<copy todir="${lwjgl.lib}/linux">
<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
</copy>
<!-- headless issues <version-check platform="linux"/> -->
<ant antfile="platform_build/linux_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on FreeBSD platforms -->
<target name="-compile_native_freebsd" if="lwjgl.platform.freebsd">
<ant antfile="platform_build/bsd_ant/build.xml" inheritAll="false"/>
<copy todir="${lwjgl.lib}/freebsd">
<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
</copy>
<ant antfile="platform_build/bsd_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on OpenBSD platforms -->
<target name="-compile_native_openbsd" if="lwjgl.platform.openbsd">
<ant antfile="platform_build/bsd_ant/build.xml" inheritAll="false"/>
<copy todir="${lwjgl.lib}/openbsd">
<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
</copy>
<ant antfile="platform_build/bsd_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on solaris platforms -->
<target name="-compile_native_solaris" if="lwjgl.platform.solaris">
<!-- Reusing the linux ant task, but copy the output to solaris -->
<ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/>
<copy todir="${lwjgl.lib}/solaris">
<fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/>
</copy>
<version-check platform="solaris"/>
<ant antfile="platform_build/linux_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on Mac platforms -->
<target name="-compile_native_macosx" if="lwjgl.platform.macosx">
<ant antfile="platform_build/macosx_ant/build.xml" inheritAll="false"/>
<copy file="${lwjgl.bin}/lwjgl/liblwjgl.dylib" todir="${lwjgl.lib}/macosx"/>
<version-check platform="macosx"/>
<ant antfile="platform_build/macosx_ant/build.xml"/>
</target>
<target name="compile_native_es" depends="-initialize, headers, touch-version, version-mismatch" description="Compiles the native files">
<target name="compile_native_es" depends="-initialize, generate-all, version-mismatch" description="Compiles the native files">
<condition property="lwjgl.platform.windows">
<os family="windows"/>
</condition>
@ -577,18 +527,12 @@
<!-- Compiles LWJGL ES on Win32 platforms -->
<target name="-compile_native_win32_es" if="lwjgl.platform.windows">
<ant antfile="platform_build/windows_ant/build_es.xml" inheritAll="false"/>
<copy todir="${lwjgl.lib}/windows">
<fileset dir="${lwjgl.bin}/lwjgles" includes="lwjgl*.dll"/>
</copy>
<ant antfile="platform_build/windows_ant/build_es.xml"/>
</target>
<!-- Compiles LWJGL ES on Linux platforms -->
<target name="-compile_native_linux_es" if="lwjgl.platform.linux">
<ant antfile="platform_build/linux_ant/build_es.xml" inheritAll="false"/>
<copy todir="${lwjgl.lib}/linux">
<fileset dir="${lwjgl.bin}/lwjgles" includes="liblwjgl*.so"/>
</copy>
<ant antfile="platform_build/linux_ant/build_es.xml"/>
</target>
<target name="repack200" description="Pack200-repack a jar file">
@ -638,31 +582,24 @@
</antcall>
</target>
<target name="applettest" depends="applet">
<exec executable="appletviewer">
<arg value="-J-Djava.security.policy=applet/appletviewer.policy"/>
<arg path="applet/applet.html"/>
</exec>
</target>
<target name="runtest" depends="all">
<target name="runtest">
<fail message="test.mainclass is not set. Use 'ant -Dtest.mainclass=&lt;main-class&gt; runtest'" unless="test.mainclass"/>
<condition property="native_path" value="libs/windows">
<condition property="native_path" value="${lwjgl.target.natives}">
<os family="windows" />
</condition>
<condition property="native_path" value="libs/linux">
<condition property="native_path" value="${lwjgl.target.natives}">
<or>
<os name="Linux" />
<os name="SunOS" />
</or>
</condition>
<condition property="native_path" value="libs/macosx">
<condition property="native_path" value="${lwjgl.target.natives}">
<os name="Mac OS X" />
</condition>
<property name="native_path_expanded" location="${native_path}"/>
<java classname="${test.mainclass}" classpath="res:${lwjgl.lib}/lwjgl.jar:${lwjgl.lib}/lwjgl_util.jar:${lwjgl.lib}/lwjgl_test.jar:${lwjgl.lib}/jinput.jar" fork="true">
<java classname="${test.mainclass}" classpath="res:${lwjgl.target.jars}/lwjgl.jar:${lwjgl.target.jars}/lwjgl_util.jar:${lwjgl.target.jars}/lwjgl_test.jar:${lwjgl.lib}/jinput.jar" fork="true">
<sysproperty key="org.lwjgl.util.Debug" value="true"/>
<sysproperty key="java.library.path" value="${native_path_expanded}"/>
<arg line="${args}"/>
@ -671,22 +608,10 @@
<!-- Creates the Javadoc -->
<target name="javadoc" description="Creates javadoc from java source code">
<javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL API" useexternalfile="true">
<javadoc destdir="${lwjgl.target.doc}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.8" windowtitle="LWJGL API" useexternalfile="true">
<fileset refid="lwjgl.javadoc.fileset" />
<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
<!-- get and copy nightly binaries into libs folder -->
<target name="copy-nightly-binaries" depends="-initialize" description="Copies latest successful nightly binaries into appropriate libs folder">
<delete file="${lwjgl.temp}/lwjgl-${lwjgl.version}.zip" failonerror="false"/>
<get src="http://ci.newdawnsoftware.com/view/LWJGL/job/LWJGL-git-dist/lastSuccessfulBuild/artifact/dist/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}" verbose="true"/>
<unzip src="${lwjgl.temp}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.lib}" overwrite="true">
<patternset>
<include name="**/native/**/*lwjgl*"/>
</patternset>
<globmapper from="lwjgl-${lwjgl.version}/native/*" to="*"/>
</unzip>
</target>
</project>

1
doc/javadoc Symbolic link
View File

@ -0,0 +1 @@
../target/doc/javadoc

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="test/java"/>
<classpathentry kind="output" path="anttasks"/>
</classpath>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.lwjgl.build</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View File

@ -1,14 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL Updatesite Build
Bundle-SymbolicName: org.lwjgl.build
Bundle-Version: 1.0.0
Export-Package: org.lwjgl.ant
Import-Package: org.apache.tools.ant,
org.apache.tools.ant.taskdefs,
org.apache.tools.ant.types,
org.apache.tools.ant.types.selectors,
org.apache.tools.ant.util,
org.junit;version="4"
Bundle-Vendor: Lightweight Java Game Library Project
Require-Bundle: org.junit;bundle-version="4.8.1"

View File

@ -1,98 +0,0 @@
How to build the Eclipse update site
------------------------------------
Author: Jens von Pilgrim <developer@jevopi.de>
Building the Eclipse update site is fully integrated into the main LWJGL build script.
Here is how to build the update site:
Run main lwjgl ant script (LWJGL/build.xml) with target "eclipse-updatesite"
You will find the updatesite in
LWJGL/eclipse-update/org.lwjgl.build/build/plugins/org.lwjgl.updatesite
Note that there are two targets: eclipse-updatesite and
eclipse-updatesite-simple. The first one depends from the target "release",
defined in the main build file. However, if you are sure the relase target has
been called before, you may want to only create the update site without
building the release target again. In that case, you can all
eclipse-update-simple.
The update site build requires some Java classes to be precompiled. These classes
can be found in some zip archives in folder plugin-classes and anttasks.jar.
Building these classes requires Eclipse dependencies (in case of the
plugin-classes) or they define anttasks required to be present when running ant.
In order to build these classes, open all projects found in subfolder
LWJGL/eclipse-update in Eclipse: this way, all Eclipse classes will get
automatically compiled. Then run the ant script buildEclipseClasses.xml from
within Eclipse. Actually, this is rarely necessary as the archives are all
committed to the LWJGL SVN and will be present if you check out everything. You
only need to run that build if the Eclise plugin classes (or the anttasks) were
changed.
The build plugin is part of the LWJGL Eclipse plugins. The following plugins are
required:
org.lwjgl
Skeleton plugin, that is it contains the Eclipse Activator for setting up the
native library path, but the lwjgl jars are missing. These jars are added by
the build script later on
org.lwjgl.source
Skeleton plugin for sources, plugin.xml etc are already configured, but again
the sources itself are only added by the build script later on
org.lwjgl.doc
Skeleton plugin for documentation, Javadoc is added by build script, however
some Eclipse help files are already in place
org.lwjgl.info
This plugin was called org.lwjgl.test in the elder version. I renamed it as it
does not really contain a test but Eclipse views. Besides the spinning torus
test view, I added an info view printing out current version of driver etc.
and capabilities of user's OpenGL system
org.lwjgl.tools
This plugin contains a library set up for plain Java projects, in order to get
rid of defining additional parameters in the run configuration. It is
documented in the help files. I have sent you this plugin once, but it never
made it into the update site. Well, now it is in place
org.lwjgl.feature
Feature plugin referencing the core lwjgl plugin. It contains two
feature.xml definitions, one used for playing around in Eclipse, and a
template which is used by the build script. If you ever change something
here, pay attention to also change the template file.
org.lwjgl.feature.sdk
Feature plugin referencing the src, doc, tools and info lwjgl plugin.
It contains two feature.xml definitions, one used for playing around in
Eclipse, and a template which is used by the build script. If you ever change
something here, pay attention to also change the template file.
org.lwjgl.updatesite
Well, this is the updatesite. As in the feature project, site.xml comes
together with a template version used by the build script.
org.lwjgl.build -- THIS Plugin
This is the build script project. Although it is an Eclipse project, you can
simply run the build script with ant from command line. See later on.
Everything is created in LWJGL/eclipse-update/org.lwjgl.build/build.
Some additional remarks:
- The version number is automatically "normalized" to Eclipse standards,
that is 2.6 will become 2.6.0 with the current date and time added.
- The lwjgl-debug.jar is not added to the org.lwjgl plugin, as I do not know
how to select one or the other. But I have not further investigated in
that direction.
- Note that only the created plugin and feature jars are signed, and not the
nested lwjgl.jar etc., as I figure that you will sign these jars yourself
when creating the zip files.
- When testing the update site and the installation of plugins, pay attention
to the Eclipse P2 system, which caches a lot of things. Simply uninstalling
a plugin does not remove the plugins from the Eclipse installation. When
the very same version is re-installed, instead of loading new files from the
update site these pre-installed versions are reused! Since the date and time
is added to the plugin version number, this should cause no problems.
- default values for keystore, alias and passphrase are the same as in
lwjgl-applet

View File

@ -1,500 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Called from main build script.
Expects
lwjgl.version
to be set.
(C) 2011 LWJGL-Project
Author: Jens von Pilgrim, developer@jevopi.de
-->
<project default="eclipse-updatesite" basedir="." name="eclipse.antscript" xmlns:ant4eclipse="antlib:org.ant4eclipse" xmlns:antcontrib="antlib:net.sf.antcontrib">
<dirname property="eclipse.antscript.basedir" file="${ant.file.eclipse.antscript}" />
<property name="keystore" value="applet/lwjglkeystore" />
<property name="alias" value="lwjgl" />
<property name="password" value="123456" />
<property name="eclipse.updatesite" value="http://www.lwjgl.org/update/" />
<property name="eclipse.bundle.vendor" value="lwjgl.org" />
<taskdef name="packagelist" classname="org.lwjgl.ant.PackageList">
<classpath>
<pathelement location="${eclipse.antscript.basedir}/anttasks.jar" />
</classpath>
</taskdef>
<taskdef name="normalizeversion" classname="org.lwjgl.ant.NormalizeVersion">
<classpath>
<pathelement location="${eclipse.antscript.basedir}/anttasks.jar" />
</classpath>
</taskdef>
<taskdef name="publishBundlesAndFeatures" classname="org.lwjgl.ant.StandalonePublisher">
<classpath>
<pathelement location="${eclipse.antscript.basedir}/anttasks.jar" />
</classpath>
</taskdef>
<!-- properties imported from build-definitions.xml:
<property name="lwjgl.temp" location="temp" />
<property name="lwjgl.src" location="src" />
<property name="lwjgl.version" value="2.8.3" />
-->
<!-- where to build the update site and temporary build files -->
<property name="eclipse.build.path" value="${eclipse.antscript.basedir}/build" />
<property name="eclipse.build.temp" value="${eclipse.build.path}/temp" />
<property name="eclipse.build.plugins" value="${eclipse.build.path}/plugins" />
<property name="eclipse.prebuild-plugin-classes" value="${eclipse.antscript.basedir}/plugin-classes" />
<!-- from where to retrieve LWJGL files -->
<property name="eclipse.skeletons.dir" value="${eclipse.antscript.basedir}/.." />
<!-- base: ${lwjgl.temp} : <patternset refid="lwjgl_applet"/>
doc: basedir="${lwjgl.docs}" includes="javadoc/**"
source: refid="lwjgl.source.fileset"
-->
<property name="NL" value="&#10;" />
<target name="eclipse-updatesite">
<mkdir dir="${lwjgl.temp}"/>
<unzip dest="${lwjgl.temp}/eclipse" src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" />
<antcall target="eclipse-updatesite-simple" />
</target>
<target name="eclipse-updatesite-simple">
<normalizeversion version="${lwjgl.version}" property="eclipse.normversion" addDateQualifier="yes" />
<echo>Building plugins for version ${lwjgl.version}, normalized version ${eclipse.normversion}</echo>
<mkdir dir="${eclipse.build.temp}" />
<!-- *******************************************************************
*
* Assemble plugins
*
******************************************************************** -->
<!-- Main plugin: lwjgl.org -->
<!-- Copy plugin skeletons -->
<mkdir dir="${eclipse.build.plugins}" />
<copy todir="${eclipse.build.plugins}/org.lwjgl">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl" casesensitive="yes">
<exclude name="**/src/**" />
<exclude name="**/*.jar" />
<!-- do not copy jars used for development -->
<exclude name="**/build/**" />
<exclude name="**/build.properties" />
<!-- do not copy development settings -->
<exclude name="**/.settings/**" />
<exclude name="**/.classpath" />
<exclude name="**/.project" />
<!-- do not copy native libraries -->
<exclude name="**/native/**" />
</fileset>
</copy>
<!-- Copy LWJGL native files and classes -->
<copy todir="${eclipse.build.plugins}/org.lwjgl">
<fileset dir="${lwjgl.temp}/eclipse/lwjgl-${lwjgl.version}/">
<patternset refid="lwjgl_base"/>
</fileset>
</copy>
<move todir="${eclipse.build.plugins}/org.lwjgl">
<fileset dir="${eclipse.build.plugins}/org.lwjgl/jar">
<include name="**" />
<exclude name="lwjgl-debug.jar" />
</fileset>
</move>
<delete dir="${eclipse.build.plugins}/org.lwjgl/jar" />
<!-- unzip Eclipse dependent classes,
have to be previously built by buildEclipseClasses.xml, but
are also contained in SVN
-->
<unzip dest="${eclipse.build.plugins}/org.lwjgl" src="${eclipse.prebuild-plugin-classes}/org.lwjgl.zip" />
<!-- Sources plugin: lwjgl.org.source -->
<!-- Copy plugin skeletons -->
<copy todir="${eclipse.build.plugins}/org.lwjgl.source">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl.source" casesensitive="yes">
<exclude name="**/build.properties" />
<exclude name="**/.settings/**" />
<exclude name="**/.classpath" />
<exclude name="**/.project" />
</fileset>
</copy>
<!-- Create zip files containing the source -->
<property name="eclipse.org.lwjgl.src.dir" value="${eclipse.build.plugins}/org.lwjgl.source/src/org.lwjgl_${eclipse.normversion}" />
<mkdir dir="${eclipse.org.lwjgl.src.dir}" />
<!-- Build src zips for plugin org.lwjgl -->
<!-- lwjgl sources (only Java sources) -->
<zip destfile="${eclipse.org.lwjgl.src.dir}/lwjglsrc.zip">
<fileset dir="${lwjgl.src}/generated" />
<fileset dir="${lwjgl.src}/java">
<exclude name="org/lwjgl/util/**" />
</fileset>
</zip>
<zip destfile="${eclipse.org.lwjgl.src.dir}/lwjgl_utilsrc.zip">
<fileset dir="${lwjgl.src}/java">
<include name="org/lwjgl/util/**" />
<exclude name="org/lwjgl/util/applet/**" />
</fileset>
</zip>
<zip destfile="${eclipse.org.lwjgl.src.dir}/lwjgl_util_applet.zip">
<fileset dir="${lwjgl.src}/java">
<include name="org/lwjgl/util/applet/**" />
</fileset>
</zip>
<!-- and the Eclipse related sources -->
<zip destfile="${eclipse.org.lwjgl.src.dir}/lwjgl_eclipse.zip">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl/src/java" casesensitive="yes">
<include name="org/lwjgl/**" />
</fileset>
</zip>
<zip destfile="${eclipse.org.lwjgl.src.dir}/lwjgl_tools.zip">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl.tools/src/java" casesensitive="yes">
<include name="org/lwjgl/**" />
</fileset>
</zip>
<zip destfile="${eclipse.org.lwjgl.src.dir}/lwjgl_info.zip">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl.info/src/java" casesensitive="yes">
<include name="org/lwjgl/**" />
</fileset>
</zip>
<!-- Documentation plugin: lwjgl.org.doc -->
<!-- Copy plugin skeletons including Eclipse documentation-->
<copy todir="${eclipse.build.plugins}/org.lwjgl.doc">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl.doc" casesensitive="yes">
<exclude name="**/build.properties" />
<exclude name="**/.settings/**" />
<exclude name="**/.classpath" />
<exclude name="**/.project" />
</fileset>
</copy>
<copy todir="${eclipse.build.plugins}/org.lwjgl.doc">
<fileset dir="${lwjgl.docs}">
<exclude name="javadoc/**" />
</fileset>
</copy>
<!-- create JavaDoc archive -->
<zip destfile="${eclipse.build.plugins}/org.lwjgl.doc/doc.zip" basedir="${lwjgl.docs}" includes="javadoc/**" />
<!-- Information view plugin: org.lwjgl.info -->
<copy todir="${eclipse.build.plugins}/org.lwjgl.info">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl.info" casesensitive="yes">
<exclude name="**/src/**" />
<exclude name="**/build/**" />
<exclude name="**/build.properties" />
<exclude name="**/.settings/**" />
<exclude name="**/.classpath" />
<exclude name="**/.project" />
</fileset>
</copy>
<!-- unzip Eclipse dependent classes,
have to be previously built by buildEclipseClasses.xml, but
are also contained in SVN
-->
<unzip dest="${eclipse.build.plugins}/org.lwjgl.info" src="${eclipse.prebuild-plugin-classes}/org.lwjgl.info.zip" />
<!-- Tools plugin: org.lwjgl.tools -->
<copy todir="${eclipse.build.plugins}/org.lwjgl.tools">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl.tools" casesensitive="yes">
<exclude name="**/src/**" />
<exclude name="**/build/**" />
<exclude name="**/build.properties" />
<exclude name="**/.settings/**" />
<exclude name="**/.classpath" />
<exclude name="**/.project" />
</fileset>
</copy>
<!-- unzip Eclipse dependent classes,
have to be previously built by buildEclipseClasses.xml, but
are also contained in SVN
-->
<unzip dest="${eclipse.build.plugins}/org.lwjgl.tools" src="${eclipse.prebuild-plugin-classes}/org.lwjgl.tools.zip" />
<!-- Feature -->
<copy todir="${eclipse.build.plugins}/org.lwjgl.feature">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl.feature" casesensitive="yes">
<exclude name="**/build.properties" />
<exclude name="**/.settings/**" />
<exclude name="**/.classpath" />
<exclude name="**/.project" />
<exclude name="**/*.template" />
</fileset>
</copy>
<!-- Update Site -->
<copy todir="${eclipse.build.plugins}/org.lwjgl.updatesite">
<fileset dir="${eclipse.skeletons.dir}/org.lwjgl.updatesite" casesensitive="yes">
<exclude name="**/.settings/**" />
<exclude name="**/.classpath" />
<exclude name="**/.project" />
<exclude name="**/*.template" />
</fileset>
</copy>
<!-- *******************************************************************
*
* Build manifest files
*
******************************************************************** -->
<!-- Calculate package export and bundle class paths -->
<packagelist property="eclipse.bundle.export-package" pathsep=",${NL} ">
<fileset dir="${lwjgl.temp}/eclipse/lwjgl-${lwjgl.version}/jar">
<exclude name="**/lwjgl-debug.jar" />
</fileset>
<patternset>
<exclude name="**/test/**" />
<exclude name="**/examples/**" />
</patternset>
</packagelist>
<pathconvert property="eclipse.bundle.classpath.jars" pathsep=",${NL} ">
<map from="${lwjgl.temp}/eclipse/lwjgl-${lwjgl.version}/jar/" to="" />
<fileset dir="${lwjgl.temp}/eclipse/lwjgl-${lwjgl.version}/jar">
<exclude name="**/lwjgl-debug.jar" />
<exclude name="**/lwjgl_test.jar" />
</fileset>
</pathconvert>
<!-- *******************************************************************
*
* org.lwjgl
*
* Build manifest files, not using manifest task, since manifest wraps
* at the wrong positions (at least ant 1.7)
*
******************************************************************** -->
<echo file="${eclipse.build.plugins}/org.lwjgl/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL Lightweight Java Game Library
Bundle-SymbolicName: org.lwjgl
Bundle-Version: ${eclipse.normversion}
Bundle-Vendor: ${eclipse.bundle.vendor}
Bundle-Activator: org.lwjgl.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Export-Package: org.lwjgl.eclipse,${NL} ${eclipse.bundle.export-package}
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .,${NL} ${eclipse.bundle.classpath.jars}
</echo>
<!-- *******************************************************************
*
* org.lwjgl.doc
*
* Build manifest files, not using manifest task, since manifest wraps
* at the wrong positions (at least ant 1.7)
*
******************************************************************** -->
<echo file="${eclipse.build.plugins}/org.lwjgl.doc/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
Bundle-Vendor: ${eclipse.bundle.vendor}
Bundle-Version: ${eclipse.normversion}
Bundle-SymbolicName: org.lwjgl.doc;singleton:=true
Bundle-Localization: plugin
Require-Bundle: org.eclipse.help;bundle-version="3.2.0"
Eclipse-LazyStart: true
</echo>
<!-- *******************************************************************
*
* org.lwjgl.source
*
* Build manifest files, not using manifest task, since manifest wraps
* at the wrong positions (at least ant 1.7)
*
******************************************************************** -->
<!-- Build manfest -->
<!-- not using manifest task, since manifest wraps at the wrong positions -->
<echo file="${eclipse.build.plugins}/org.lwjgl.source/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL Sources
Bundle-Vendor: ${eclipse.bundle.vendor}
Bundle-Version: ${eclipse.normversion}
Bundle-SymbolicName: org.lwjgl.source;singleton:=true
Bundle-Localization: plugin
</echo>
<!-- *******************************************************************
*
* org.lwjgl.info
*
* Build manifest files, not using manifest task, since manifest wraps
* at the wrong positions (at least ant 1.7)
*
******************************************************************** -->
<echo file="${eclipse.build.plugins}/org.lwjgl.info/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL Test and Info View
Bundle-Vendor: ${eclipse.bundle.vendor}
Bundle-Version: ${eclipse.normversion}
Bundle-SymbolicName: org.lwjgl.info;singleton:=true
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.views,
org.eclipse.core.resources,
org.lwjgl
Bundle-RequiredExecutionEnvironment: J2SE-1.5
</echo>
<!-- Files are already in place -->
<!-- *******************************************************************
*
* org.lwjgl.tools
*
* Build manifest files, not using manifest task, since manifest wraps
* at the wrong positions (at least ant 1.7)
*
******************************************************************** -->
<!-- Build plugin org.lwjgl.tools -->
<echo file="${eclipse.build.plugins}/org.lwjgl.tools/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL Tools Plug-in
Bundle-SymbolicName: org.lwjgl.tools;singleton:=true
Bundle-Version: ${eclipse.normversion}
Bundle-Vendor: ${eclipse.bundle.vendor}
Bundle-Activator: org.lwjgl.tools.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources;bundle-version="3.4.0",
org.eclipse.jdt.core;bundle-version="3.4.0",
org.eclipse.jdt.ui;bundle-version="3.4.0",
org.lwjgl;bundle-version="${eclipse.normversion}",
org.eclipse.jdt.launching;bundle-version="3.4.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
</echo>
<!-- Files are already in place -->
<!-- Create features -->
<!-- *******************************************************************
*
* org.lwjgl.feature
*
******************************************************************** -->
<!-- Build org.lwjgl.feature -->
<copy file="${eclipse.skeletons.dir}/org.lwjgl.feature/feature.xml.template" tofile="${eclipse.build.plugins}/org.lwjgl.feature/feature.xml" encoding="UTF-8" overwrite="true">
<filterset>
<filter token="VERSION" value="${eclipse.normversion}" />
<filter token="PROVIDERNAME" value="${eclipse.bundle.vendor}" />
<filter token="UPDATEURL" value="${eclipse.updatesite}" />
</filterset>
</copy>
<!-- *******************************************************************
*
* org.lwjgl.feature.sdk
*
******************************************************************** -->
<!-- Build org.lwjgl.feature -->
<copy file="${eclipse.skeletons.dir}/org.lwjgl.feature.sdk/feature.xml.template" tofile="${eclipse.build.plugins}/org.lwjgl.feature.sdk/feature.xml" encoding="UTF-8" overwrite="true">
<filterset>
<filter token="VERSION" value="${eclipse.normversion}" />
<filter token="PROVIDERNAME" value="${eclipse.bundle.vendor}" />
<filter token="UPDATEURL" value="${eclipse.updatesite}" />
</filterset>
</copy>
<!-- *******************************************************************
*
* Build update site, i.e. zip all plugins and feature with version
* number to appropriate place
*
******************************************************************** -->
<!-- Build update site -->
<copy file="${eclipse.skeletons.dir}/org.lwjgl.updatesite/site.xml.template" tofile="${eclipse.build.plugins}/org.lwjgl.updatesite/site.xml" encoding="UTF-8" overwrite="true">
<filterset>
<filter token="VERSION" value="${eclipse.normversion}" />
<filter token="PROVIDERNAME" value="${eclipse.bundle.vendor}" />
<filter token="UPDATEURL" value="${eclipse.updatesite}" />
</filterset>
</copy>
<mkdir dir="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins" />
<mkdir dir="${eclipse.build.plugins}/org.lwjgl.updatesite/features" />
<jar destfile="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl_${eclipse.normversion}.jar" manifest="${eclipse.build.plugins}/org.lwjgl/META-INF/MANIFEST.MF">
<fileset dir="${eclipse.build.plugins}/org.lwjgl" casesensitive="yes" />
</jar>
<jar destfile="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.doc_${eclipse.normversion}.jar" manifest="${eclipse.build.plugins}/org.lwjgl.doc/META-INF/MANIFEST.MF">
<fileset dir="${eclipse.build.plugins}/org.lwjgl.doc" casesensitive="yes" />
</jar>
<jar destfile="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.source_${eclipse.normversion}.jar" manifest="${eclipse.build.plugins}/org.lwjgl.source/META-INF/MANIFEST.MF">
<fileset dir="${eclipse.build.plugins}/org.lwjgl.source" casesensitive="yes" />
</jar>
<jar destfile="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.info_${eclipse.normversion}.jar" manifest="${eclipse.build.plugins}/org.lwjgl.info/META-INF/MANIFEST.MF">
<fileset dir="${eclipse.build.plugins}/org.lwjgl.info" casesensitive="yes" />
</jar>
<jar destfile="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.tools_${eclipse.normversion}.jar" manifest="${eclipse.build.plugins}/org.lwjgl.tools/META-INF/MANIFEST.MF">
<fileset dir="${eclipse.build.plugins}/org.lwjgl.tools" casesensitive="yes" />
</jar>
<jar destfile="${eclipse.build.plugins}/org.lwjgl.updatesite/features/org.lwjgl_${eclipse.normversion}.jar">
<fileset dir="${eclipse.build.plugins}/org.lwjgl.feature" casesensitive="yes" />
</jar>
<jar destfile="${eclipse.build.plugins}/org.lwjgl.updatesite/features/org.lwjgl.sdk_${eclipse.normversion}.jar">
<fileset dir="${eclipse.build.plugins}/org.lwjgl.feature.sdk" casesensitive="yes" />
</jar>
<!-- *******************************************************************
*
* Sign plugins and feature
*
******************************************************************** -->
<signjar jar="${eclipse.build.plugins}/org.lwjgl.updatesite/features/org.lwjgl_${eclipse.normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${password}" />
<signjar jar="${eclipse.build.plugins}/org.lwjgl.updatesite/features/org.lwjgl.sdk_${eclipse.normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${password}" />
<signjar jar="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl_${eclipse.normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${password}" />
<signjar jar="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.doc_${eclipse.normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${password}" />
<signjar jar="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.source_${eclipse.normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${password}" />
<signjar jar="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.info_${eclipse.normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${password}" />
<signjar jar="${eclipse.build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.tools_${eclipse.normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${password}" />
<!-- *******************************************************************
*
* Publish plugins and feature
* content.xml/jar and artifacts.xml/jar, required for some newer featues
* and tools such as Eclipse Tycho.
*
******************************************************************** -->
<publishBundlesAndFeatures compressed="true"
updatesitefolder="${eclipse.build.plugins}/org.lwjgl.updatesite"
repositoryname="lwjgl.org"
repositoryuri="${eclipse.updatesite}" />
<echo>Created Eclipse update site: ${eclipse.build.plugins}/org.lwjgl.updatesite</echo>
</target>
<target name="eclipse-clean">
<delete dir="${eclipse.build.path}" />
</target>
<target name="eclipse-help">
<echo>This plugin is to be called from main LWJGL build.xml file.</echo>
<echo>It creates the update site, the result will be found in</echo>
<echo>${eclipse.build.plugins}/org.lwjgl.updatesite</echo>
<echo>For more information, read READ.ME</echo>
</target>
</project>

View File

@ -1,3 +0,0 @@
source.. = src/java/
bin.includes = META-INF/,\
.

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
ant
(C) 2011 LWJGL-Project
Author: Jens von Pilgrim, developer@jevopi.de
-->
<project default="buildClasses" basedir="." name="Build Eclipse classes" xmlns:ant4eclipse="antlib:org.ant4eclipse" xmlns:antcontrib="antlib:net.sf.antcontrib">
<property name="plugin.lwjgl.org" value="org.lwjgl" />
<property name="plugin.lwjgl.org.info" value="org.lwjgl.info" />
<property name="plugin.lwjgl.org.tools" value="org.lwjgl.tools" />
<property name="classes.folder" value="build/classes" />
<property name="plugin.build.folder" value="plugin-classes" />
<!--
<property name="" value="" />
-->
<target name="init">
<echo></echo>
</target>
<target name="buildClasses" depends="init">
<mkdir dir="${plugin.build.folder}" />
<zip basedir="../${plugin.lwjgl.org}/${classes.folder}" destfile="${plugin.build.folder}/${plugin.lwjgl.org}.zip" />
<zip basedir="../${plugin.lwjgl.org.info}/${classes.folder}" destfile="${plugin.build.folder}/${plugin.lwjgl.org.info}.zip" />
<zip basedir="../${plugin.lwjgl.org.tools}/${classes.folder}" destfile="${plugin.build.folder}/${plugin.lwjgl.org.tools}.zip" />
<jar basedir="anttasks" destfile="anttasks.jar" />
</target>
<target name="clean">
<delete dir="${plugin.build.folder}" />
</target>
<target name="help">
<echo>Call this ant script in order to create archives containing the classes of all</echo>
<echo>Eclipes plugin related classes, such as Activors.</echo>
<echo>This build file removes the burden of building Eclipse dependent classes from</echo>
<echo>within the main build script</echo>
</target>
</project>

View File

@ -1,237 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl.ant;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
/**
* Normalizes a version number and stores result in a property. The version
* number is normalized as "%n.%n.%n", e.g. "2.6" becomes "2.6.0"
*
* @author Jens von Pilgrim
* @since Nov 14, 2010
* @see http://wiki.eclipse.org/index.php/Version_Numbering
*/
public class NormalizeVersion extends Task {
public final static String SEGMENTS[] = { "major", "minor", "service",
"qualifier" };
public final static String VERSION_QUALIFIER_PATTERN = "yyyyMMdd-HHmm";
/**
* name of the property to set
*/
protected String property;
protected String version;
protected boolean addDateQualifier = false;
/**
* @return the addQualifier
*/
public boolean isAddDateQualifier() {
return addDateQualifier;
}
/**
* @param i_addQualifier the addQualifier to set
*/
public void setAddDateQualifier(boolean i_addDateQualifier) {
addDateQualifier = i_addDateQualifier;
}
/**
* @return the property
*/
public String getProperty() {
return property;
}
/**
* @param i_property the property to set
*/
public void setProperty(String i_property) {
property = i_property;
}
/**
* @return the versionNumber
*/
public String getVersion() {
return version;
}
/**
* @param i_versionNumber the versionNumber to set
*/
public void setVersion(String version) {
this.version = version;
}
/**
* check for errors
* @throws BuildException if we are not configured right
*/
private void validate() {
//validation
if (property == null) {
throw new BuildException("attribute property missing");
}
if (version == null) {
throw new BuildException("attribute version missing");
}
String s = getVersion().trim();
int sn = 0;
boolean qualifier = false;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '.') {
sn++;
} else {
qualifier = !Character.isDigit(s.charAt(i));
if (sn < 1 && !Character.isDigit(s.charAt(i))) {
throw new BuildException(
"Wrong version format, must contain only digits in the "
+ SEGMENTS[sn] + " segment, was "
+ s.substring(0, i) + ">>" + s.charAt(i)
+ "<<" + s.substring(i + 1));
}
}
}
if ((sn > 2 || qualifier) && isAddDateQualifier()) {
throw new BuildException(
"Cannot add date qualifier, qualifier already specified");
}
}
/**
* Sets given property with normalized version number accoring to
* major.minor.service[.qualifier]
* {@inheritDoc}
* @see org.apache.tools.ant.Task#execute()
*/
@Override
public void execute() throws BuildException {
validate();
//now exit here if the property is already set
if (getProject().getProperty(property) != null) {
return;
}
String normalizedVersionNumber = doExecute();
getProject().setNewProperty(property, normalizedVersionNumber);
}
/**
* @return
*/
protected String doExecute() {
String s = getVersion().trim();
StringBuilder n = new StringBuilder();
int snIndex = 0;
boolean qualifier = false;
String digits = "";
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (Character.isDigit(c) && !qualifier) {
digits += c;
} else if (c == '.') {
if (qualifier) {
throw new BuildException(
"Wrong format, qualifier must not contain a dot in "
+ s);
}
if (snIndex < 3) {
if (digits.length() > 0) {
if (snIndex > 0)
n.append('.');
n.append(digits);
digits = "";
snIndex++;
}
} else {
throw new BuildException(
"Wrong format, expected digit, was " + c
+ " at pos " + i + " of " + s);
}
} else if (Character.isJavaIdentifierPart(c)) {
if (digits.length() > 0) {
throw new BuildException(
"Wrong format, qualifier must not start with digits in "
+ s);
}
if (!qualifier) {
switch (snIndex) {
case 0: // e.g. "beta"
n.append("0");
break;
case 1: // e.g. "1.beta
n.append(".0");
case 2: // e.g. "1.2.beta
n.append(".0");
}
qualifier = true;
n.append('.');
}
n.append(c);
}
}
if (!qualifier) {
if (digits.length() > 0) {
if (snIndex > 0)
n.append('.');
n.append(digits);
snIndex++;
}
switch (snIndex) {
case 0: // e.g. ""
n.append("0");
break;
case 1: // e.g. "1.beta
n.append(".0");
case 2: // e.g. "1.2.beta
n.append(".0");
}
if (isAddDateQualifier())
n.append(createDateQualifier());
} else {
if (isAddDateQualifier()) {
throw new BuildException(
"Cannot add date qualifier, qualifier already specified");
}
}
return n.toString();
}
/**
* @return
*/
private String createDateQualifier() {
return ".v"
+ new SimpleDateFormat(VERSION_QUALIFIER_PATTERN)
.format(new Date());
}
}

View File

@ -1,270 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl.ant;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Expand;
import org.apache.tools.ant.types.PatternSet;
import org.apache.tools.ant.types.selectors.SelectorUtils;
import org.apache.tools.ant.util.FileNameMapper;
import org.apache.tools.ant.util.FileUtils;
/**
* Ant task extracting package names (or generally directory names) into given
* property.
*
* Parameters:
* - just like unzip, except dest can be null and is ignored otherwise
* - property - name of property storing the resulting list
* - pathsep - path separator, default ","
* - dirsep - directory separator, default "."
* - includeemptydirs -- whether to include empty directories, default: false
*
* @author Jens von Pilgrim
* @since 12.09.2007
*/
public class PackageList extends Expand {
/**
* The property to receive the conversion
*/
private String property = null;
/**
* User override on path sep char
*/
private String pathSep = ",";
/**
* User override on directory sep char
*/
private String dirSep = ".";
private boolean includeemptydirs = false;
class IntegerContainer {
int value;
public void inc() {
value++;
}
};
TreeMap<String, IntegerContainer> packagelist = new TreeMap<String, IntegerContainer>();
/**
* {@inheritDoc}
* @see org.apache.tools.ant.taskdefs.Expand#execute()
*/
@Override
public void execute() throws BuildException {
setDest(new File(" no file, files are only listed internaly"));
super.execute();
StringBuffer strb = new StringBuffer();
for (String name : packagelist.keySet()) {
// System.out.println("name: " + name + " (" +packagelist.get(name).value + ")" );
if (includeemptydirs || packagelist.get(name).value > 0) {
if (strb.length() > 0) {
strb.append(pathSep);
}
StringTokenizer stDirectory = new StringTokenizer(name, "/",
true);
while (stDirectory.hasMoreTokens()) {
String token = stDirectory.nextToken();
strb.append("/".equals(token) ? dirSep : token);
}
}
}
if (property != null) {
String value = strb.toString();
getProject().setNewProperty(property, value);
}
}
private Vector<PatternSet> patternsets = new Vector<PatternSet>();
/**
* Add a patternset.
* @param set a pattern set
*/
public void addPatternset(PatternSet set) {
super.addPatternset(set);
patternsets.addElement(set);
}
/**
* {@inheritDoc}
* @see org.apache.tools.ant.taskdefs.Expand#extractFile(org.apache.tools.ant.util.FileUtils, java.io.File, java.io.File, java.io.InputStream, java.lang.String, java.util.Date, boolean, org.apache.tools.ant.util.FileNameMapper)
*/
@Override
protected void extractFile(FileUtils i_fileUtils, File i_srcF, File i_dir,
InputStream i_compressedInputStream, String i_entryName,
Date i_entryDate, boolean i_isDirectory, FileNameMapper i_mapper)
throws IOException {
if (!matchPatterns(i_entryName)) {
//Do not process this file
return;
}
String strDir = getDir(i_isDirectory, i_entryName);
if (strDir != null && !"META-INF".equals(strDir)) {
if (!packagelist.containsKey(strDir)) {
packagelist.put(strDir, new IntegerContainer());
}
if (!i_isDirectory) {
packagelist.get(strDir).inc();
}
}
}
/**
* @param i_entryName
*/
private boolean matchPatterns(String i_entryName) {
if (patternsets != null && patternsets.size() > 0) {
boolean included = false;
String name = i_entryName.replace('/', File.separatorChar).replace(
'\\', File.separatorChar);
Set<String> includePatterns = new HashSet<String>();
Set<String> excludePatterns = new HashSet<String>();
for (int v = 0, size = patternsets.size(); v < size; v++) {
PatternSet p = (PatternSet) patternsets.elementAt(v);
String[] incls = p.getIncludePatterns(getProject());
if (incls == null || incls.length == 0) {
// no include pattern implicitly means includes="**"
incls = new String[] { "**" };
}
for (int w = 0; w < incls.length; w++) {
String pattern = incls[w].replace('/', File.separatorChar)
.replace('\\', File.separatorChar);
if (pattern.endsWith(File.separator)) {
pattern += "**";
}
includePatterns.add(pattern);
}
String[] excls = p.getExcludePatterns(getProject());
if (excls != null) {
for (int w = 0; w < excls.length; w++) {
String pattern = excls[w].replace('/',
File.separatorChar).replace('\\',
File.separatorChar);
if (pattern.endsWith(File.separator)) {
pattern += "**";
}
excludePatterns.add(pattern);
}
}
}
for (Iterator<String> iter = includePatterns.iterator(); !included
&& iter.hasNext();) {
String pattern = iter.next();
included = SelectorUtils.matchPath(pattern, name);
}
for (Iterator<String> iter = excludePatterns.iterator(); included
&& iter.hasNext();) {
String pattern = iter.next();
included = !SelectorUtils.matchPath(pattern, name);
}
return included;
}
return true;
}
/**
* @param i_isDirectory
* @param i_entryName
* @return
*/
private String getDir(boolean i_isDirectory, String i_entryName) {
if (i_entryName == null)
return null;
int iIndex = i_entryName.lastIndexOf('/');
if (iIndex >= 0) {
return i_entryName.substring(0, iIndex);
}
if (i_isDirectory) {
return i_entryName;
}
return null;
}
/**
* Set the name of the property into which the converted path will be placed.
* @param p the property name.
*/
public void setProperty(String p) {
property = p;
}
/**
* Set the default path separator string; defaults to current JVM
* {@link java.io.File#pathSeparator File.pathSeparator}.
* @param sep path separator string.
*/
public void setPathSep(String sep) {
pathSep = sep;
}
/**
* Set the default directory separator string;
* defaults to current JVM {@link java.io.File#separator File.separator}.
* @param sep directory separator string.
*/
public void setDirSep(String sep) {
dirSep = sep;
}
/**
* Simple getter for attribute includeemptydirs.
* @return the includeemptydirs
*/
public boolean isIncludeemptydirs() {
return includeemptydirs;
}
/**
* Simple setter for attribute includeemptydirs.
* @param i_includeemptydirs the includeemptydirs to set
*/
public void setIncludeemptydirs(boolean i_includeemptydirs) {
includeemptydirs = i_includeemptydirs;
}
}

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
Nov 15, 2010 9:45:57 PM
project
description
jpilgrim
====================================================================== -->
<project name="project" default="default">
<description>
description
</description>
<taskdef name="normalizeVersion" classname="de.jevopi.ant.NormalizeVersion" >
<classpath>
<pathelement location="../../build/classes"/>
</classpath>
</taskdef>
<!-- =================================
target: default
================================= -->
<target name="default" depends="depends" description="description">
<normalizeVersion property="norm" version="1.2" />
<echo>${norm}</echo>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: depends
- - - - - - - - - - - - - - - - - -->
<target name="depends">
</target>
</project>

View File

@ -1,108 +0,0 @@
/*******************************************************************************
* Copyright (c) 2008 Jens von Pilgrim and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Project: de.jevopi.anttasks
* File: NormalizeVersionTest.java
* Date: Nov 14, 2010
*******************************************************************************/
package org.lwjgl.ant;
import org.junit.Assert;
import org.apache.tools.ant.BuildException;
import org.junit.Test;
/**
* NormalizeVersionTest
* There should really be more documentation here.
*
* @author Jens von Pilgrim
* @version $Revision$
* @since Nov 14, 2010
*/
public class NormalizeVersionTest {
@Test
public void testNormalizer() {
NormalizeVersion t = new NormalizeVersion();
t.setProperty("normalized");
t.setVersion("1");
Assert.assertEquals("1.0.0", t.doExecute());
t.setVersion("1.2");
Assert.assertEquals("1.2.0", t.doExecute());
t.setVersion("1.2.3");
Assert.assertEquals("1.2.3", t.doExecute());
t.setVersion("1.2.3.beta");
Assert.assertEquals("1.2.3.beta", t.doExecute());
t.setVersion("1.2.beta");
Assert.assertEquals("1.2.0.beta", t.doExecute());
}
@Test(expected= BuildException.class) public void tooManyDots() {
NormalizeVersion t = new NormalizeVersion();
t.setProperty("normalized");
t.setVersion("1.2.3.4.5");
t.doExecute();
}
@Test(expected= BuildException.class) public void qualifierWithNumber() {
NormalizeVersion t = new NormalizeVersion();
t.setProperty("normalized");
t.setVersion("1.2beta");
t.doExecute();
}
@Test
public void testQualifier() {
NormalizeVersion t = new NormalizeVersion();
t.setProperty("normalized");
t.setAddDateQualifier(true);
t.setVersion("1");
String s = t.doExecute();
Assert.assertEquals(20, s.length());
Assert.assertTrue(s.startsWith("1.0.0"));
t.setVersion("1.2");
s = t.doExecute();
Assert.assertEquals(20, s.length());
Assert.assertTrue(s.startsWith("1.2.0"));
t.setVersion("1.2.3");
s = t.doExecute();
Assert.assertEquals(20, s.length());
Assert.assertTrue(s.startsWith("1.2.3"));
t.setVersion("2.8.2");
s = t.doExecute();
Assert.assertEquals(20, s.length());
Assert.assertTrue(s.startsWith("2.8.2"));
}
@Test(expected= BuildException.class) public void dateQualifierWithQualifier() {
NormalizeVersion t = new NormalizeVersion();
t.setProperty("normalized");
t.setAddDateQualifier(true);
t.setVersion("1.2.beta");
t.doExecute();
}
}

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.lwjgl.doc</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View File

@ -1,6 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL Documentation
Bundle-SymbolicName: org.lwjgl.doc; singleton:=true
Bundle-Version: 2
Bundle-Vendor: Lightweight Java Game Library Project

View File

@ -1,55 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>About</title>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
</head>
<body lang="EN-US">
<img src="lwjgl_logo.png" align="right"/>
<h2>About This Content</h2>
<p>The <a href="http://lwjgl.org">Lightweight Java Game Library (LWJGL)</a> is a solution aimed
directly at professional and amateur Java programmers alike to enable <a
href="projects.php">commercial quality games</a> to be written in Java.
LWJGL provides developers access to high performance crossplatform
libraries such as OpenGL (<a href="http://www.opengl.org/"
target="_blank">Open Graphics Library</a>) and OpenAL (<a
href="http://www.openal.org" target="_blank">Open Audio Library</a>)
allowing for state of the art 3D games and 3D sound. Additionally LWJGL
provides access to controllers such as Gamepads, Steering wheel and
Joysticks. All in a simple and straight forward API.</p>
<p>LWJGL is not meant to make writing games particularly easy; it is
primarily an enabling technology which allows developers to get at
resources that are simply otherwise unavailable or poorly implemented on
the existing <a href="http://java.sun.com" target="_blank">Java
platform</a>. We anticipate that the LWJGL will, through evolution and
extension, become the foundation for more complete game libraries and
"game engines" as they have popularly become known, and hide some of the
new evils we have had to expose in the APIs.</p>
<p>LWJGL is available under a <a href="http://lwjgl.org/license.php">BSD
license</a>, which means it's open source and freely available at no charge.</p>
<p>Please visit us on the Freenode IRC Network: <a
href="irc://irc.freenode.net/lwjgl" target="_blank">#LWJGL</a>. Do idle
if there is no one to answer any of your questions, we are on different
timezones.</p>
<h2>Plug-Ins</h2>
<p>The following plug-ins are provided:
<dl>
<dt>org.lwjgl</dt>
<dd>Platform independent jars and native libraries for Windows, Linux and Mac OS X</dd>
<dt>org.lwjgl.doc</dt>
<dd>Documentation (JavaDoc)</dd>
<dt>org.lwjgl.source</dt>
<dd>Source files</dd>
<dt>org.lwjgl.tools</dt>
<dd>Developer tools</dd>
<dt>org.lwjgl.info</dt>
<dd>LWJGL test and info view</dd>
</dl>
</p>
</body>
</html>

View File

@ -1,4 +0,0 @@
bin.includes = plugin.xml,\
META-INF/,\
html/,\
*.xml

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,66 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>LWJGL Eclipse Plugins</title>
</head>
<body>
<div style="background-image:url(fig/mesh.png); height:220px; max-width: 878px"><img src="fig/logo.png" align="left" /></div>
<h2>Table of Contents</h2>
<p>
Plugin documentation
<ul>
<li><a href="plugins.html">Overview and Core Plugins</a></li>
<li><a href="tools.html">LWJGL plugin for Java developers</a></li>
<li><a href="views.html">LWJGL Eclipse views</a></li>
</ul>
</p>
<p>
API
<ul>
<li><a href="javadoc/index.html">API Reference</a></li>
</ul>
</p>
<p>
External resources
<ul>
<li><a href="http://lwjgl.org/">LWJGL Website (extern)</a></li>
<li><a href="http://wiki.lwjgl.org/">LWJGL Wiki (extern)</a></li>
<li><a href="http://lwjgl.org/forum/">LWJGL Forum (extern)</a></li>
</ul>
</p>
<h2>About LWJGL</h2>
<p>The <a href="http://lwjgl.org">Lightweight Java Game Library (LWJGL)</a> is a solution aimed
directly at professional and amateur Java programmers alike to enable <a
href="http://lwjgl.org/projects.php">commercial quality games</a> to be written in Java.
LWJGL provides developers access to high performance crossplatform
libraries such as OpenGL (<a href="http://www.opengl.org/"
target="_blank">Open Graphics Library</a>) and OpenAL (<a
href="http://www.openal.org" target="_blank">Open Audio Library</a>)
allowing for state of the art 3D games and 3D sound. Additionally LWJGL
provides access to controllers such as Gamepads, Steering wheel and
Joysticks. All in a simple and straight forward API.</p>
<p>LWJGL is not meant to make writing games particularly easy; it is
primarily an enabling technology which allows developers to get at
resources that are simply otherwise unavailable or poorly implemented on
the existing <a href="http://java.sun.com" target="_blank">Java
platform</a>. We anticipate that the LWJGL will, through evolution and
extension, become the foundation for more complete game libraries and
"game engines" as they have popularly become known, and hide some of the
new evils we have had to expose in the APIs.</p>
<p>LWJGL is available under a <a href="http://lwjgl.org/license.php">BSD
license</a>, which means it's open source and freely available at no charge.</p>
<p>Please visit us on the Freenode IRC Network: <a
href="irc://irc.freenode.net/lwjgl" target="_blank">#LWJGL</a>. Do idle
if there is no one to answer any of your questions, we are on different
timezones.</p>
</body>
</html>

View File

@ -1,60 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>LWJGL Eclipse Plugins</title>
</head>
<body>
<img src="fig/lwjgl_logo.png" align="right" />
<h1>Overview</h1>
<p>The following plug-ins are provided:
<dl>
<dt>org.lwjgl</dt>
<dd>Platform independent jars and native libraries for Windows, Linux, Solaris and Mac OS X</dd>
<dt>org.lwjgl.doc</dt>
<dd>Documentation, containing API documentation (Javadoc) and additional material such as this document your currently reading.</dd>
<dt>org.lwjgl.source</dt>
<dd>Source files of LWJGL Java components</dd>
<dt>org.lwjgl.info</dt>
<dd>Two Eclipse views, one for testing LWJGL and one printing out OpenGL specific information</dd>
<dt>org.lwjgl.tools</dt>
<dd>Plugin for Java developers, providing a LWJGL library for the Java Build Path settings</dd>
</dl>
</p>
All plugins are briefly described in the following.
<h2>LWJGL library: org.lwjgl</h2>
The most important plugin, which actually is the only one needed by non-developers, is org.lwjgl.
It makes the LWJGL library available as an Eclipse plugin. That is if you write an Eclipse plugin using LWJGL,
simply add this plugin to the list of required plugins. It does not only provide the necessary jar files,
but it also configures the library path in order to automatically load the appropriate native library wihtin
the Eclipse workbench.
<h2>LWJGL documentation and sources</h2>
<p>Both, documentation and sources, are only required for developers. Both, Javadoc and sources, are attached to
the LWJGL library in order to allow you easy access to these information. That is, you can simply open an LWJGL class,
and the source code will be opened. JavaDoc is available via tool-tip and with Shift-F2. You do not have to configure
anything in order to access the documentation and the source code.
The tools plugin makes JavaDoc and source code available for non-plugin projects as well.</p>
<p>
Note that only the Java source code is provided, if you want to have a look at the native code, please download
the LWJGL sources from the LWJGL website.
</p>
<h2>LWJGL for Java developers</h2>
<p>The org.lwjgl.tools plugin provides an already configured library to be added
to a projects build path. It does not only provide the JARs and native libraries,
relieving developers from configuring extra VM arguments in the run configuration,
but it also configures Javadoc and source code to be available in Java projects just as in
plugin projects.</p>
Read more about how to set up the library <a href="tools.html">here</a>.
<h2>Information and test view</h2>
<p>In order to test whether your installation is correct and in order to
retrieve additional information on your system, two views are provided. The test view
draws a spinning torso, while the information view simply prints out available
versions and features of your graphics card and OpenGL driver.</p>
Read more about how to open the views <a href="views.html">here</a>.
</body>
</html>

View File

@ -1,72 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>LWJGL Tools</title>
</head>
<body>
<h1>LWJGL Tools</h1>
<p>The org.lwjgl.tools plugin provides an already configured library to be added
to a projects build path. It does not only provide the JARs and native libraries,
relieving developers from configuring extra VM arguments in the run configuration,
but it also configures Javadoc and source code to be available in Java projects just as in
plugin projects.
</p>
<p>You will also need the org.lwjgl plugin. JavaDoc and source code are
retrieved from the org.lwjgl.doc and org.lwjgl.source plugins.</p>
<h2>Configure the LWJGL library</h2>
You can configure the LWJGL library for a plain Java project by opening the
projects properties. Select "Java Build Path" and "Libraries", such as shown in
Figure 1. Note: Click on the images here to show a larger version.
<div style="text-align:center">
<a href="fig/addLib_1.png">
<img src="fig/addLib_1.png" style="height:200px; display:block; margin:0px auto 10px; text-align:center;" border="0" alt="
"id="Project properties" /></a>
<span style="font-weight:bold;font-size:small">Fig. 1: Project properties</span>
</div>
Select "Add Library..." on the right hand side. This will open a new dialog window as shown in Figure 2.
<div style="text-align:center">
<a href="fig/addLib_2.png">
<img src="fig/addLib_2.png" style="height:200px; display:block; margin:0px auto 10px; text-align:center;" border="0" alt="
"id="Add library" /></a>
<span style="font-weight:bold;font-size:small">Fig. 2: Add library</span>
</div>
Select "LWJGL Library". You can simply press "Finish". However if you want to have some information about
the paths of the added library, simply select "Next". In the latter case, the next wizard page will show
you the path settings automatically configured by the tool plugin as shown in Figure 3.
<div style="text-align:center">
<a href="fig/addLib_3.png">
<img src="fig/addLib_3.png" style="height:200px; display:block; margin:0px auto 10px; text-align:center;" border="0" alt="
"id="Library info" /></a>
<span style="font-weight:bold;font-size:small">Fig. 3: Library info</span>
</div>
You have no successfully configured the LWJGL library, as shown in Figure 4. Press "OK" to finish the set up.
<div style="text-align:center">
<a href="fig/addLib_4.png">
<img src="fig/addLib_4.png" style="height:200px; display:block; margin:0px auto 10px; text-align:center;" border="0" alt="
"id="Configured library" /></a>
<span style="font-weight:bold;font-size:small">Fig. 4: Configured library</span>
</div>
<p>
You can now use the LWJGL library in your Java project, and you can simply start
the project by selecting "Run As / Java Application..." in the context menu of a class containing a main method.
That is, you do not have to configure some VM arguments in the run configuration anymore, which will hopefully make development
much easier.
</p>
<p>Note: At this moment, no further tools, e.g., for exporting an LWJGL application, exists.
Feel free to write missing functions and contact us in order to add new functionalty.</p>
</body>
</html>

View File

@ -1,72 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>LWJGL Eclipse Views</title>
</head>
<body>
<h1>LWJGL Eclipse Views</h1>
<p><p>In order to test whether your installation is correct and in order to
retrieve additional information on your system, two views are provided. The test view
draws a spinning torso, while the information view simply prints out available
versions and features of your graphics card and OpenGL driver.</p>
</p>
<h2>Open the views</h2>
You can open the views by selecting them from "Windows / Show View / Other..." as shown in
Figure 1. Note: Click on the images here to show a larger version.
<div style="text-align:center">
<a href="fig/openView_1.png">
<img src="fig/openView_1.png" style="height:200px; display:block; margin:0px auto 10px; text-align:center;" border="0" alt="
"id="Show View Others" /></a>
<span style="font-weight:bold;font-size:small">Fig. 1: Show View / Others...</span>
</div>
Under "Other", you will find two LWJGL views: "LWJGL Information View" and "LWJGL Test View" (see Figure 2).
<div style="text-align:center">
<a href="fig/openView_2.png">
<img src="fig/openView_2.png" style="height:200px; display:block; margin:0px auto 10px; text-align:center;" border="0" alt="
"id="LWJGL views" /></a>
<span style="font-weight:bold;font-size:small">Fig. 2: LWJGL views</span>
</div>
Select "LWJGL Information View" in order to open a simple text view, as shown in Figure 3.
<div style="text-align:center">
<a href="fig/openView_Info.png">
<img src="fig/openView_Info.png" style="height:200px; display:block; margin:0px auto 10px; text-align:center;" border="0" alt="
"id="LWJGL Information View" /></a>
<span style="font-weight:bold;font-size:small">Fig. 3: LWJGL Information View</span>
</div>
<p>
This view shows the version numbers of the LWJGL feature, i.e. the LWJGL plugins, and the LWJGL library. For bug reports, it is usually very
useful to provide additional information about your OpenGL configuration. This view provides you with a lot of necessary information. Note that
not all information can be retrieved on all systems. Features not supported by your graphics card or OpenGL driver are omitted, you see only the
available features and capabilities.
</p>
<p>In order to test whether LWJGL and OpenGL works on your system, open the test view. The view should look similar to Figure 4.
<div style="text-align:center">
<a href="fig/openView_Test.png">
<img src="fig/openView_Test.png" style="height:200px; display:block; margin:0px auto 10px; text-align:center;" border="0" alt="
"id="LWJGL Test View" /></a>
<span style="font-weight:bold;font-size:small">Fig. 4: LWJGL Test View</span>
</div>
The OpenGL code of this torso actually stems from an Eclipse SWT snippet:
<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.java?view=markup&content-type=text%2Fvnd.viewcvs-markup&revision=HEAD">snippet 195</a>.
<p>
You should see a spinning torso and the current frames per second (fps) in the status bar. If you do not even see this torso,
something has gone seriously wrong when installing the plugins. Note that other OpenGL based applications might cause problems, even if
you can see this test view: The test view does not use any extended OpenGL features, such as framebuffer objects. If an application
requires an additional feature which is not supported by your system (see Information View to retrieve the supported features), it
won't run. Sometimes it helps to update the drive of your graphics card!
</p>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.help.toc">
<toc
file="toc.xml"
primary="true">
</toc>
</extension>
<extension point="org.eclipse.pde.core.javadoc">
<javadoc path="doc.zip!/javadoc/" archive="true">
<plugin id="org.lwjgl"/>
</javadoc>
</extension>
</plugin>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.toc"?>
<toc label="LWJGL Documentation">
<topic href="html/overview.html" label="Overview">
</topic>
<topic href="javadoc/index.html" label="API Reference">
</topic>
<topic href="html/plugins.html" label="LWJGL Plugin Documentation">
<topic href="html/tools.html" label="Tools for Java developers">
</topic>
<topic href="html/views.html" label="LWJGL Eclipse Views">
</topic>
</topic>
</toc>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.lwjgl.feature.sdk</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View File

@ -1 +0,0 @@
bin.includes = feature.xml

View File

@ -1,95 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.lwjgl.sdk"
label="Lightweight Java Game Library (LWJGL)"
version="2"
provider-name="Lightweight Java Game Library Project"
image="lwjgl_logo.png">
<description url="http://lwjgl.org">
This feature provides easy access to the
Lightweight Java Game Library (LWJGL)
for Eclipse plugin developers. It includes
- source code
- javadoc
- info plugin
- library tool
</description>
<copyright url="http://lwjgl.org/credits.php">
Copyright (c) 2002-2011 Lightweight Java Game Library Project
All rights reserved.
LWJGL is available under a BSD license, which means it&apos;s open
source and freely available at no charge.
Eclipse feature and plugins, plugin specific code made available under
a BSD license and Eclipse Public License (EPL).
</copyright>
<license url="http://lwjgl.org/license.php">
Copyright (c) 2002-2011 Lightweight Java Game Library Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of &apos;Light Weight Java Game Library&apos; 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
&quot;AS IS&quot; 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.
</license>
<url>
<update label="LWJGL Update Site" url="http://lwjgl.org/update"/>
<discovery label="Home of the Lightweight Java Game Library" url="http://lwjgl.org/index.php"/>
</url>
<requires>
<import feature="org.lwjgl" version="2"/>
</requires>
<plugin
id="org.lwjgl.doc"
download-size="2800"
install-size="2800"
version="2"/>
<plugin
id="org.lwjgl.source"
download-size="1200"
install-size="1200"
version="2"/>
<plugin
id="org.lwjgl.info"
download-size="50"
install-size="50"
version="2"/>
<plugin
id="org.lwjgl.tools"
download-size="16"
install-size="16"
version="2"/>
</feature>

View File

@ -1,95 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.lwjgl.sdk"
label="Lightweight Java Game Library (LWJGL) SDK"
version="@VERSION@"
provider-name="Lightweight Java Game Library Project"
image="lwjgl_logo.png">
<description url="http://lwjgl.org">
This feature provides easy access to the
Lightweight Java Game Library (LWJGL) SDK
for Eclipse plugin developers. It includes
- source code
- javadoc
- info plugin (Test and Info View)
- library tool (Library configuration for plain Java development)
</description>
<copyright url="http://lwjgl.org/credits.php">
Copyright (c) 2002-2011 Lightweight Java Game Library Project
All rights reserved.
LWJGL is available under a BSD license, which means it&apos;s open
source and freely available at no charge.
Eclipse feature and plugins, plugin specific code made available under a
BSD license and Eclipse Public License (EPL).
</copyright>
<license url="http://lwjgl.org/license.php">
Copyright (c) 2002-2011 Lightweight Java Game Library Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of &apos;Light Weight Java Game Library&apos; 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
&quot;AS IS&quot; 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.
</license>
<url>
<update label="LWJGL Update Site" url="http://lwjgl.org/update" />
<discovery label="Home of the Lightweight Java Game Library" url="http://lwjgl.org/index.php"/>
</url>
<requires>
<import feature="org.lwjgl" version="@VERSION@"/>
</requires>
<plugin
id="org.lwjgl.doc"
download-size="2800"
install-size="2800"
version="@VERSION@"/>
<plugin
id="org.lwjgl.source"
download-size="1200"
install-size="1200"
version="@VERSION@"/>
<plugin
id="org.lwjgl.info"
download-size="50"
install-size="50"
version="@VERSION@"/>
<plugin
id="org.lwjgl.tools"
download-size="16"
install-size="16"
version="@VERSION@"/>
</feature>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.lwjgl.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
bin.includes = feature.xml,\
lwjgl_logo.png

View File

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.lwjgl"
label="Lightweight Java Game Library Project (LWJGL)"
version="2"
provider-name="Lightweight Java Game Library Project"
image="lwjgl_logo.png">
<description url="http://lwjgl.org">
This feature provides easy access to the
Lightweight Java Game Library (LWJGL)
for Eclipse plugin developers. It includes
- java and native libraries (Windows, Mac OS X, Linux, Solaris)
- source code
- javadoc
- info plugin
- library tool
</description>
<copyright url="http://lwjgl.org/credits.php">
Copyright (c) 2002-2010 Lightweight Java Game Library Project
All rights reserved.
LWJGL is available under a BSD license, which means it&apos;s open
source and freely available at no charge.
Eclipse feature and plugins created by Jens von Pilgrim (developer@jevopi.de),
plugin specific code made available under a BSD license and
Eclipse Public License (EPL).
</copyright>
<license url="http://lwjgl.org/license.php">
Copyright (c) 2002-2010 Lightweight Java Game Library Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of &apos;Light Weight Java Game Library&apos; 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
&quot;AS IS&quot; 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.
</license>
<url>
<update label="LWJGL Update Site" url="http://lwjgl.org/update"/>
<discovery label="Home of the Lightweight Java Game Library" url="http://lwjgl.org/index.php"/>
</url>
<plugin
id="org.lwjgl"
download-size="3700"
install-size="3700"
version="2"/>
<plugin
id="org.lwjgl.doc"
download-size="2800"
install-size="2800"
version="2"/>
<plugin
id="org.lwjgl.source"
download-size="1200"
install-size="1200"
version="2"/>
<plugin
id="org.lwjgl.info"
download-size="50"
install-size="50"
version="2"/>
</feature>

View File

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.lwjgl"
label="Lightweight Java Game Library (LWJGL)"
version="@VERSION@"
provider-name="Lightweight Java Game Library Project"
image="lwjgl_logo.png">
<description url="http://lwjgl.org">
This feature provides easy access to the
Lightweight Java Game Library (LWJGL)
for Eclipse plugin developers. It includes
- java and native libraries (Windows, Mac OS X, Linux, Solaris)
For source, javadoc and more tools install SDK.
</description>
<copyright url="http://lwjgl.org/credits.php">
Copyright (c) 2002-2010 Lightweight Java Game Library Project
All rights reserved.
LWJGL is available under a BSD license, which means it&apos;s open
source and freely available at no charge.
Eclipse feature and plugins created by Jens von Pilgrim (developer@jevopi.de),
plugin specific code made available under a BSD license and
Eclipse Public License (EPL).
</copyright>
<license url="http://lwjgl.org/license.php">
Copyright (c) 2002-2010 Lightweight Java Game Library Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of &apos;Light Weight Java Game Library&apos; 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
&quot;AS IS&quot; 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.
</license>
<url>
<update label="LWJGL Update Site" url="http://lwjgl.org/update" />
<discovery label="Home of the Lightweight Java Game Library" url="http://lwjgl.org/index.php"/>
</url>
<plugin
id="org.lwjgl"
download-size="3700"
install-size="3700"
version="@VERSION@"/>
</feature>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.lwjgl.info</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,12 +0,0 @@
#Thu Sep 13 13:53:08 CEST 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -1,16 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL TestView
Bundle-Vendor: Lightweight Java Game Library Project
Bundle-SymbolicName: org.lwjgl.info;singleton:=true
Bundle-Version: 2.0.0
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.views,
org.eclipse.core.resources
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.lwjgl,
org.lwjgl.opengl,
org.lwjgl.util,
org.lwjgl.util.glu

View File

@ -1,60 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>About</title>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
</head>
<body lang="EN-US">
<img src="lwjgl_logo.png" align="right"/>
<h2>About This Content</h2>
<p>The <a href="http://lwjgl.org">Lightweight Java Game Library (LWJGL)</a> is a solution aimed
directly at professional and amateur Java programmers alike to enable <a
href="projects.php">commercial quality games</a> to be written in Java.
LWJGL provides developers access to high performance crossplatform
libraries such as OpenGL (<a href="http://www.opengl.org/"
target="_blank">Open Graphics Library</a>) and OpenAL (<a
href="http://www.openal.org" target="_blank">Open Audio Library</a>)
allowing for state of the art 3D games and 3D sound. Additionally LWJGL
provides access to controllers such as Gamepads, Steering wheel and
Joysticks. All in a simple and straight forward API.</p>
<p>LWJGL is not meant to make writing games particularly easy; it is
primarily an enabling technology which allows developers to get at
resources that are simply otherwise unavailable or poorly implemented on
the existing <a href="http://java.sun.com" target="_blank">Java
platform</a>. We anticipate that the LWJGL will, through evolution and
extension, become the foundation for more complete game libraries and
"game engines" as they have popularly become known, and hide some of the
new evils we have had to expose in the APIs.</p>
<p>LWJGL is available under a <a href="http://lwjgl.org/license.php">BSD
license</a>, which means it's open source and freely available at no charge.</p>
<p>Please visit us on the Freenode IRC Network: <a
href="irc://irc.freenode.net/lwjgl" target="_blank">#LWJGL</a>. Do idle
if there is no one to answer any of your questions, we are on different
timezones.</p>
<h3>Plugin assembly</h3>
<p>The plugins were assembled by Jens von Pilgrim (developer@jevopi.de). All files related to this assembly, such as manifest files or plugin descriptors, are copyright under the Eclipse Public License (EPL) and the BSD license</p>
<h3>Third party code</h3>
<h4>IBM</h4>
<p>The LWJGL Textview contains code copyright under the Eclipse Public License (EPL):<br/>
<pre>
Copyright (c) 2000, 2005 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
</pre>
The source of this code can be found at:
<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.java?view=markup&content-type=text%2Fvnd.viewcvs-markup&revision=HEAD">http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.java?view=markup&content-type=text%2Fvnd.viewcvs-markup&revision=HEAD</a>
</p>
<h4>SGI</h4>
<p>
LWJGL contains code copyright by SGI. This code is copyright under the SGI FreeB v1.1, see <a href="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</a>. Note that this license can be updated to version 2.0.
</p>
</body>
</html>

View File

@ -1,9 +0,0 @@
source.. = src/java/
output.. = build/classes/
bin.includes = META-INF/,\
.,\
icons/,\
lwjgl_logo.png,\
plugin.xml,\
about.html
src.includes = src/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="org.eclipse.ui.views" >
<view
category="org.eclipse.ui"
class="org.lwjgl.info.LWJGLTestView"
icon="icons/lwjgl_logo_16.gif"
id="org.lwjgl.info.LWJGLTestView"
name="LWJGL Test View"/>
</extension>
<extension point="org.eclipse.ui.views" >
<view
category="org.eclipse.ui"
class="org.lwjgl.info.LWJGLInfoView"
icon="icons/lwjgl_logo_16.gif"
id="org.lwjgl.info.LWJGLInfoView"
name="LWJGL Information View"/>
</extension>
</plugin>

View File

@ -1,186 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Kristian Duske - FPS Status Line Item
*******************************************************************************/
package org.lwjgl.info;
import java.util.logging.Logger;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.StatusLineLayoutData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
/**
* Displays FPS information in the Eclipse status bar.
*
* @author Kristian Duske
* @version $Revision$
* @since 22.05.2008
* @see $HeadURL$
*/
public class FpsStatusLineItem extends ContributionItem {
private static final int CHAR_WIDTH = 8;
private static final int INDENT = 3;
@SuppressWarnings("unused")
private static final Logger log = Logger.getLogger(FpsStatusLineItem.class
.getName());
private static final int NUM_FRAMES = 500;
private static final long TIMEOUT = 300;
private int m_fixedHeight = -1;
private int m_fixedWidth = -1;
private long[] m_frames = new long[NUM_FRAMES];
private int m_index = 0;
private int m_count = -1;
private double avg;
private long m_lastFrame = -1;
private CLabel m_label;
/**
*
*/
public FpsStatusLineItem() {
for (int i = 0; i < m_frames.length; i++)
m_frames[i] = 0;
avg = 0;
}
/**
* @param i_id
*/
public FpsStatusLineItem(String i_id) {
super(i_id);
}
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Composite)
*/
@Override
public void fill(Composite i_parent) {
Label sep = new Label(i_parent, SWT.SEPARATOR);
m_label = new CLabel(i_parent, SWT.SHADOW_NONE);
StatusLineLayoutData data = new StatusLineLayoutData();
data.widthHint = getWidthHint(i_parent);
m_label.setLayoutData(data);
data = new StatusLineLayoutData();
data.heightHint = getHeightHint(i_parent);
sep.setLayoutData(data);
updateCounter();
}
private int getHeightHint(Composite control) {
if (m_fixedHeight < 0) {
GC gc = new GC(control);
gc.setFont(control.getFont());
m_fixedHeight = gc.getFontMetrics().getHeight();
gc.dispose();
}
return m_fixedHeight;
}
private int getWidthHint(Composite control) {
if (m_fixedWidth < 0) {
GC gc = new GC(control);
gc.setFont(control.getFont());
m_fixedWidth = gc.getFontMetrics().getAverageCharWidth()
* CHAR_WIDTH;
m_fixedWidth += INDENT * 2;
gc.dispose();
}
return m_fixedWidth;
}
/**
* {@inheritDoc}
*
* @see de.feu.draw3d.RenderListener#renderPassFinished()
*/
public void renderPassFinished() {
long time = System.currentTimeMillis();
if (m_lastFrame == -1) {
m_lastFrame = time;
return;
}
long frameTime = time - m_lastFrame;
m_lastFrame = time;
if (frameTime <= TIMEOUT) {
if (m_count < NUM_FRAMES)
m_count++;
avg -= m_frames[m_index];
m_frames[m_index] = frameTime;
avg += m_frames[m_index];
m_index++;
if (m_index >= NUM_FRAMES) {
m_index = 0;
}
}
updateCounter();
}
/**
* {@inheritDoc}
*
* @see de.feu.draw3d.RenderListener#renderPassStarted()
*/
public void renderPassStarted() {
// nothing to do
}
private synchronized void updateCounter() {
long fps = 0;
if (m_count > 0)
fps = (long) (1000.0 / (avg / ((double) m_count)));
// System.out.println("i:"+m_index+", c="+m_count+", avg: " + avg);
if (m_label != null && !m_label.isDisposed()) {
Display display = m_label.getDisplay();
m_label.setForeground(display
.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
m_label.setText(fps + " FPS");
}
}
}

View File

@ -1,609 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl.info;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import org.eclipse.core.runtime.IBundleGroup;
import org.eclipse.core.runtime.IBundleGroupProvider;
import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.SWT;
import org.eclipse.swt.opengl.GLCanvas;
import org.eclipse.swt.opengl.GLData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
import org.lwjgl.opengl.ContextCapabilities;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.util.glu.GLU;
import org.lwjgl.util.glu.Registry;
/**
* LWJGLInfoView
* There should really be more documentation here.
*
* @author Jens von Pilgrim
* @version $Revision$
* @since Nov 23, 2010
*/
public class LWJGLInfoView extends ViewPart {
static final String NL = System.getProperty("line.separator", "\n");
static final int TAB = 16;
/**
* {@inheritDoc}
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite i_parent) {
Text info = new Text(i_parent, SWT.READ_ONLY | SWT.LEFT | SWT.MULTI
| SWT.H_SCROLL | SWT.V_SCROLL);
GLCanvas canvas = new GLCanvas(i_parent, SWT.NONE, new GLData());
canvas.setCurrent();
try {
GLContext.useContext(canvas);
} catch (LWJGLException ex) {
// TODO Implement catch block for LWJGLException
ex.printStackTrace();
}
String infoString = gatherInformation();
info.setText(infoString);
}
static String getFeatureVersion(String myFeatureId) {
IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
if (providers != null) {
for (int i = 0; i < providers.length; ++i) {
IBundleGroup[] bundleGroups = providers[i].getBundleGroups();
for (IBundleGroup bg : bundleGroups) {
if (bg.getIdentifier().equals(myFeatureId)) {
return bg.getVersion();
}
}
}
}
return "Feature not found";
}
/**
* @param i_canvas
* @return
*/
private static String gatherInformation() {
StringBuffer strb = new StringBuffer();
try {
infoNL(strb, "LWJGL feature version",
getFeatureVersion("org.lwjgl"));
} catch (Exception ex) {
warnNL(strb, "Error retrieving feature version: " + ex.getMessage());
}
infoNL(strb, "LWJGL version", Sys.getVersion()
+ (Sys.is64Bit() ? " (64bit)" : ""));
infoNL(strb, "Java", System.getProperty("java.version"),
System.getProperty("java.vendor"));
infoNL(strb, "Platform", LWJGLUtil.getPlatformName());
infoNL(strb, "Graphics card", Display.getAdapter());
infoNL(strb, "Driver version", Display.getVersion());
infoNL(strb, "OpenGL driver version", GL11.glGetString(GL11.GL_VERSION));
infoNL(strb, "GLU version", Registry.gluGetString(GLU.GLU_VERSION));
infoNL(strb, "GLU extensions",
Registry.gluGetString(GLU.GLU_EXTENSIONS));
ContextCapabilities caps = GLContext.getCapabilities();
openGLVersions(strb, caps);
strb.append(NL).append("Capabilities").append(NL);
TreeMap<String, Boolean> capInfos = new TreeMap<String, Boolean>();
gatherCapabilities(caps, capInfos);
infoGroupedCaps(strb, capInfos);
Display.destroy();
return strb.toString();
}
static void openGLVersions(StringBuffer strb, ContextCapabilities caps) {
StringBuffer versions = new StringBuffer();
if (caps.OpenGL11)
versions.append(", 1.1");
if (caps.OpenGL12)
versions.append(", 1.2");
if (caps.OpenGL13)
versions.append(", 1.3");
if (caps.OpenGL14)
versions.append(", 1.4");
if (caps.OpenGL15)
versions.append(", 1.5");
if (caps.OpenGL20)
versions.append(", 2.0");
if (caps.OpenGL21)
versions.append(", 2.1");
if (caps.OpenGL30)
versions.append(", 3.0");
if (caps.OpenGL31)
versions.append(", 3.1");
if (caps.OpenGL32)
versions.append(", 3.2");
if (caps.OpenGL33)
versions.append(", 3.3");
if (caps.OpenGL40)
versions.append(", 4.0");
if (caps.OpenGL41)
versions.append(", 4.1");
if (strb.length() > 2)
versions.delete(0, 2);
infoNL(strb, "Supported OpenGL versions", versions.toString());
}
/**
* @param i_strb
* @param i_capInfos
*/
static void infoGroupedCaps(StringBuffer strb,
TreeMap<String, Boolean> capInfos) {
String currentGroup = "*NOGROUP*";
Set<String> groupInfosSupported = new TreeSet<String>();
Set<String> groupInfosNA = new TreeSet<String>();
for (String key : capInfos.keySet()) {
if (!key.startsWith(currentGroup)) {
printGroup(strb, currentGroup, groupInfosSupported,
groupInfosNA);
currentGroup = key.substring(0, key.indexOf(' '));
}
if (capInfos.get(key).booleanValue()) {
groupInfosSupported.add(key);
} else {
groupInfosNA.add(key);
}
}
printGroup(strb, currentGroup, groupInfosSupported, groupInfosNA);
}
/**
* @param i_currentGroup
* @param i_groupInfosSupported
* @param i_groupInfosNA
*/
private static void printGroup(StringBuffer strb, String currentGroup,
Set<String> groupInfosSupported, Set<String> groupInfosNA) {
String title = currentGroup + " extensions";
if (!(groupInfosSupported.isEmpty() && groupInfosNA.isEmpty())) {
if (groupInfosSupported.isEmpty()) {
infoNL(strb, title, "n.a.");
} else {
strb.append(title).append(": ");
for (int i = 0; i < TAB - title.length(); i++) {
strb.append(' ');
}
int c = 1;
for (String s : groupInfosSupported) {
if (c > 1)
strb.append(',');
if (c % 4 == 0) {
strb.append(NL).append(" ");
} else if (c > 1) {
strb.append(' ');
}
strb.append(s.substring(currentGroup.length() + 1));
c++;
}
strb.append(NL);
}
}
groupInfosNA.clear();
groupInfosSupported.clear();
}
/**
* @param caps
* @param capInfos
*/
private static void gatherCapabilities(ContextCapabilities caps,
Map<String, Boolean> capInfos) {
capInfos.put("AMD conservative depth", caps.GL_AMD_conservative_depth);
capInfos.put("AMD debug output", caps.GL_AMD_debug_output);
capInfos.put("AMD draw buffers blend", caps.GL_AMD_draw_buffers_blend);
capInfos.put("AMD name gen delete", caps.GL_AMD_name_gen_delete);
capInfos.put("AMD performance monitor", caps.GL_AMD_performance_monitor);
capInfos.put("AMD seamless cubemap per texture",
caps.GL_AMD_seamless_cubemap_per_texture);
capInfos.put("AMD shader stencil export",
caps.GL_AMD_shader_stencil_export);
capInfos.put("AMD texture texture4", caps.GL_AMD_texture_texture4);
capInfos.put("AMD transform feedback3 lines triangles",
caps.GL_AMD_transform_feedback3_lines_triangles);
capInfos.put("AMD vertex shader tessellator",
caps.GL_AMD_vertex_shader_tessellator);
capInfos.put("APPLE aux depth stencil", caps.GL_APPLE_aux_depth_stencil);
capInfos.put("APPLE client storage", caps.GL_APPLE_client_storage);
capInfos.put("APPLE element array", caps.GL_APPLE_element_array);
capInfos.put("APPLE fence", caps.GL_APPLE_fence);
capInfos.put("APPLE float pixels", caps.GL_APPLE_float_pixels);
capInfos.put("APPLE flush buffer range",
caps.GL_APPLE_flush_buffer_range);
capInfos.put("APPLE object purgeable", caps.GL_APPLE_object_purgeable);
capInfos.put("APPLE packed pixels", caps.GL_APPLE_packed_pixels);
capInfos.put("APPLE rgb 422", caps.GL_APPLE_rgb_422);
capInfos.put("APPLE row bytes", caps.GL_APPLE_row_bytes);
capInfos.put("APPLE texture range", caps.GL_APPLE_texture_range);
capInfos.put("APPLE vertex array object",
caps.GL_APPLE_vertex_array_object);
capInfos.put("APPLE vertex array range",
caps.GL_APPLE_vertex_array_range);
capInfos.put("APPLE vertex program evaluators",
caps.GL_APPLE_vertex_program_evaluators);
capInfos.put("APPLE ycbcr 422", caps.GL_APPLE_ycbcr_422);
capInfos.put("ARB ES2 compatibility", caps.GL_ARB_ES2_compatibility);
capInfos.put("ARB blend func extended", caps.GL_ARB_blend_func_extended);
capInfos.put("ARB cl event", caps.GL_ARB_cl_event);
capInfos.put("ARB color buffer float", caps.GL_ARB_color_buffer_float);
capInfos.put("ARB compatibility", caps.GL_ARB_compatibility);
capInfos.put("ARB copy buffer", caps.GL_ARB_copy_buffer);
capInfos.put("ARB debug output", caps.GL_ARB_debug_output);
capInfos.put("ARB depth buffer float", caps.GL_ARB_depth_buffer_float);
capInfos.put("ARB depth clamp", caps.GL_ARB_depth_clamp);
capInfos.put("ARB depth texture", caps.GL_ARB_depth_texture);
capInfos.put("ARB draw buffers", caps.GL_ARB_draw_buffers);
capInfos.put("ARB draw buffers blend", caps.GL_ARB_draw_buffers_blend);
capInfos.put("ARB draw elements base vertex",
caps.GL_ARB_draw_elements_base_vertex);
capInfos.put("ARB draw indirect", caps.GL_ARB_draw_indirect);
capInfos.put("ARB draw instanced", caps.GL_ARB_draw_instanced);
capInfos.put("ARB explicit attrib location",
caps.GL_ARB_explicit_attrib_location);
capInfos.put("ARB fragment coord conventions",
caps.GL_ARB_fragment_coord_conventions);
capInfos.put("ARB fragment program", caps.GL_ARB_fragment_program);
capInfos.put("ARB fragment program shadow",
caps.GL_ARB_fragment_program_shadow);
capInfos.put("ARB fragment shader", caps.GL_ARB_fragment_shader);
capInfos.put("ARB framebuffer object", caps.GL_ARB_framebuffer_object);
capInfos.put("ARB framebuffer sRGB", caps.GL_ARB_framebuffer_sRGB);
capInfos.put("ARB geometry shader4", caps.GL_ARB_geometry_shader4);
capInfos.put("ARB get program binary", caps.GL_ARB_get_program_binary);
capInfos.put("ARB gpu shader5", caps.GL_ARB_gpu_shader5);
capInfos.put("ARB gpu shader fp64", caps.GL_ARB_gpu_shader_fp64);
capInfos.put("ARB half float pixel", caps.GL_ARB_half_float_pixel);
capInfos.put("ARB half float vertex", caps.GL_ARB_half_float_vertex);
capInfos.put("ARB imaging", caps.GL_ARB_imaging);
capInfos.put("ARB instanced arrays", caps.GL_ARB_instanced_arrays);
capInfos.put("ARB map buffer range", caps.GL_ARB_map_buffer_range);
capInfos.put("ARB matrix palette", caps.GL_ARB_matrix_palette);
capInfos.put("ARB multisample", caps.GL_ARB_multisample);
capInfos.put("ARB multitexture", caps.GL_ARB_multitexture);
capInfos.put("ARB occlusion query", caps.GL_ARB_occlusion_query);
capInfos.put("ARB occlusion query2", caps.GL_ARB_occlusion_query2);
capInfos.put("ARB pixel buffer object", caps.GL_ARB_pixel_buffer_object);
capInfos.put("ARB point parameters", caps.GL_ARB_point_parameters);
capInfos.put("ARB point sprite", caps.GL_ARB_point_sprite);
capInfos.put("ARB provoking vertex", caps.GL_ARB_provoking_vertex);
capInfos.put("ARB robustness", caps.GL_ARB_robustness);
capInfos.put("ARB sample shading", caps.GL_ARB_sample_shading);
capInfos.put("ARB sampler objects", caps.GL_ARB_sampler_objects);
capInfos.put("ARB seamless cube map", caps.GL_ARB_seamless_cube_map);
capInfos.put("ARB separate shader objects",
caps.GL_ARB_separate_shader_objects);
capInfos.put("ARB shader bit encoding", caps.GL_ARB_shader_bit_encoding);
capInfos.put("ARB shader objects", caps.GL_ARB_shader_objects);
capInfos.put("ARB shader precision", caps.GL_ARB_shader_precision);
capInfos.put("ARB shader stencil export",
caps.GL_ARB_shader_stencil_export);
capInfos.put("ARB shader subroutine", caps.GL_ARB_shader_subroutine);
capInfos.put("ARB shader texture lod", caps.GL_ARB_shader_texture_lod);
capInfos.put("ARB shading language 100",
caps.GL_ARB_shading_language_100);
capInfos.put("ARB shading language include",
caps.GL_ARB_shading_language_include);
capInfos.put("ARB shadow", caps.GL_ARB_shadow);
capInfos.put("ARB shadow ambient", caps.GL_ARB_shadow_ambient);
capInfos.put("ARB sync", caps.GL_ARB_sync);
capInfos.put("ARB tessellation shader", caps.GL_ARB_tessellation_shader);
capInfos.put("ARB texture border clamp",
caps.GL_ARB_texture_border_clamp);
capInfos.put("ARB texture buffer object",
caps.GL_ARB_texture_buffer_object);
capInfos.put("ARB texture buffer object rgb32",
caps.GL_ARB_texture_buffer_object_rgb32);
capInfos.put("ARB texture compression", caps.GL_ARB_texture_compression);
capInfos.put("ARB texture compression bptc",
caps.GL_ARB_texture_compression_bptc);
capInfos.put("ARB texture compression rgtc",
caps.GL_ARB_texture_compression_rgtc);
capInfos.put("ARB texture cube map", caps.GL_ARB_texture_cube_map);
capInfos.put("ARB texture cube map array",
caps.GL_ARB_texture_cube_map_array);
capInfos.put("ARB texture env add", caps.GL_ARB_texture_env_add);
capInfos.put("ARB texture env combine", caps.GL_ARB_texture_env_combine);
capInfos.put("ARB texture env crossbar",
caps.GL_ARB_texture_env_crossbar);
capInfos.put("ARB texture env dot3", caps.GL_ARB_texture_env_dot3);
capInfos.put("ARB texture float", caps.GL_ARB_texture_float);
capInfos.put("ARB texture gather", caps.GL_ARB_texture_gather);
capInfos.put("ARB texture mirrored repeat",
caps.GL_ARB_texture_mirrored_repeat);
capInfos.put("ARB texture multisample", caps.GL_ARB_texture_multisample);
capInfos.put("ARB texture non power of two",
caps.GL_ARB_texture_non_power_of_two);
capInfos.put("ARB texture query lod", caps.GL_ARB_texture_query_lod);
capInfos.put("ARB texture rectangle", caps.GL_ARB_texture_rectangle);
capInfos.put("ARB texture rg", caps.GL_ARB_texture_rg);
capInfos.put("ARB texture rgb10 a2ui", caps.GL_ARB_texture_rgb10_a2ui);
capInfos.put("ARB texture swizzle", caps.GL_ARB_texture_swizzle);
capInfos.put("ARB timer query", caps.GL_ARB_timer_query);
capInfos.put("ARB transform feedback2", caps.GL_ARB_transform_feedback2);
capInfos.put("ARB transform feedback3", caps.GL_ARB_transform_feedback3);
capInfos.put("ARB transpose matrix", caps.GL_ARB_transpose_matrix);
capInfos.put("ARB uniform buffer object",
caps.GL_ARB_uniform_buffer_object);
capInfos.put("ARB vertex array bgra", caps.GL_ARB_vertex_array_bgra);
capInfos.put("ARB vertex array object", caps.GL_ARB_vertex_array_object);
capInfos.put("ARB vertex attrib 64bit", caps.GL_ARB_vertex_attrib_64bit);
capInfos.put("ARB vertex blend", caps.GL_ARB_vertex_blend);
capInfos.put("ARB vertex buffer object",
caps.GL_ARB_vertex_buffer_object);
capInfos.put("ARB vertex program", caps.GL_ARB_vertex_program);
capInfos.put("ARB vertex shader", caps.GL_ARB_vertex_shader);
capInfos.put("ARB vertex type 2 10 10 10 rev",
caps.GL_ARB_vertex_type_2_10_10_10_rev);
capInfos.put("ARB viewport array", caps.GL_ARB_viewport_array);
capInfos.put("ARB window pos", caps.GL_ARB_window_pos);
capInfos.put("ATI draw buffers", caps.GL_ATI_draw_buffers);
capInfos.put("ATI element array", caps.GL_ATI_element_array);
capInfos.put("ATI envmap bumpmap", caps.GL_ATI_envmap_bumpmap);
capInfos.put("ATI fragment shader", caps.GL_ATI_fragment_shader);
capInfos.put("ATI map object buffer", caps.GL_ATI_map_object_buffer);
capInfos.put("ATI meminfo", caps.GL_ATI_meminfo);
capInfos.put("ATI pn triangles", caps.GL_ATI_pn_triangles);
capInfos.put("ATI separate stencil", caps.GL_ATI_separate_stencil);
capInfos.put("ATI shader texture lod", caps.GL_ATI_shader_texture_lod);
capInfos.put("ATI text fragment shader",
caps.GL_ATI_text_fragment_shader);
capInfos.put("ATI texture compression 3dc",
caps.GL_ATI_texture_compression_3dc);
capInfos.put("ATI texture env combine3",
caps.GL_ATI_texture_env_combine3);
capInfos.put("ATI texture float", caps.GL_ATI_texture_float);
capInfos.put("ATI texture mirror once", caps.GL_ATI_texture_mirror_once);
capInfos.put("ATI vertex array object", caps.GL_ATI_vertex_array_object);
capInfos.put("ATI vertex attrib array object",
caps.GL_ATI_vertex_attrib_array_object);
capInfos.put("ATI vertex streams", caps.GL_ATI_vertex_streams);
capInfos.put("EXT abgr", caps.GL_EXT_abgr);
capInfos.put("EXT bgra", caps.GL_EXT_bgra);
capInfos.put("EXT bindable uniform", caps.GL_EXT_bindable_uniform);
capInfos.put("EXT blend color", caps.GL_EXT_blend_color);
capInfos.put("EXT blend equation separate",
caps.GL_EXT_blend_equation_separate);
capInfos.put("EXT blend func separate", caps.GL_EXT_blend_func_separate);
capInfos.put("EXT blend minmax", caps.GL_EXT_blend_minmax);
capInfos.put("EXT blend subtract", caps.GL_EXT_blend_subtract);
capInfos.put("EXT Cg shader", caps.GL_EXT_Cg_shader);
capInfos.put("EXT compiled vertex array",
caps.GL_EXT_compiled_vertex_array);
capInfos.put("EXT depth bounds test", caps.GL_EXT_depth_bounds_test);
capInfos.put("EXT direct state access", caps.GL_EXT_direct_state_access);
capInfos.put("EXT draw buffers2", caps.GL_EXT_draw_buffers2);
capInfos.put("EXT draw instanced", caps.GL_EXT_draw_instanced);
capInfos.put("EXT draw range elements", caps.GL_EXT_draw_range_elements);
capInfos.put("EXT fog coord", caps.GL_EXT_fog_coord);
capInfos.put("EXT framebuffer blit", caps.GL_EXT_framebuffer_blit);
capInfos.put("EXT framebuffer multisample",
caps.GL_EXT_framebuffer_multisample);
capInfos.put("EXT framebuffer object", caps.GL_EXT_framebuffer_object);
capInfos.put("EXT framebuffer sRGB", caps.GL_EXT_framebuffer_sRGB);
capInfos.put("EXT geometry shader4", caps.GL_EXT_geometry_shader4);
capInfos.put("EXT gpu program parameters",
caps.GL_EXT_gpu_program_parameters);
capInfos.put("EXT gpu shader4", caps.GL_EXT_gpu_shader4);
capInfos.put("EXT multi draw arrays", caps.GL_EXT_multi_draw_arrays);
capInfos.put("EXT packed depth stencil",
caps.GL_EXT_packed_depth_stencil);
capInfos.put("EXT packed float", caps.GL_EXT_packed_float);
capInfos.put("EXT packed pixels", caps.GL_EXT_packed_pixels);
capInfos.put("EXT paletted texture", caps.GL_EXT_paletted_texture);
capInfos.put("EXT pixel buffer object", caps.GL_EXT_pixel_buffer_object);
capInfos.put("EXT point parameters", caps.GL_EXT_point_parameters);
capInfos.put("EXT provoking vertex", caps.GL_EXT_provoking_vertex);
capInfos.put("EXT rescale normal", caps.GL_EXT_rescale_normal);
capInfos.put("EXT secondary color", caps.GL_EXT_secondary_color);
capInfos.put("EXT separate shader objects",
caps.GL_EXT_separate_shader_objects);
capInfos.put("EXT separate specular color",
caps.GL_EXT_separate_specular_color);
capInfos.put("EXT shader image load store",
caps.GL_EXT_shader_image_load_store);
capInfos.put("EXT shadow funcs", caps.GL_EXT_shadow_funcs);
capInfos.put("EXT shared texture palette",
caps.GL_EXT_shared_texture_palette);
capInfos.put("EXT stencil clear tag", caps.GL_EXT_stencil_clear_tag);
capInfos.put("EXT stencil two side", caps.GL_EXT_stencil_two_side);
capInfos.put("EXT stencil wrap", caps.GL_EXT_stencil_wrap);
capInfos.put("EXT texture 3d", caps.GL_EXT_texture_3d);
capInfos.put("EXT texture array", caps.GL_EXT_texture_array);
capInfos.put("EXT texture buffer object",
caps.GL_EXT_texture_buffer_object);
capInfos.put("EXT texture compression latc",
caps.GL_EXT_texture_compression_latc);
capInfos.put("EXT texture compression rgtc",
caps.GL_EXT_texture_compression_rgtc);
capInfos.put("EXT texture compression s3tc",
caps.GL_EXT_texture_compression_s3tc);
capInfos.put("EXT texture env combine", caps.GL_EXT_texture_env_combine);
capInfos.put("EXT texture env dot3", caps.GL_EXT_texture_env_dot3);
capInfos.put("EXT texture filter anisotropic",
caps.GL_EXT_texture_filter_anisotropic);
capInfos.put("EXT texture integer", caps.GL_EXT_texture_integer);
capInfos.put("EXT texture lod bias", caps.GL_EXT_texture_lod_bias);
capInfos.put("EXT texture mirror clamp",
caps.GL_EXT_texture_mirror_clamp);
capInfos.put("EXT texture rectangle", caps.GL_EXT_texture_rectangle);
capInfos.put("EXT texture sRGB", caps.GL_EXT_texture_sRGB);
capInfos.put("EXT texture shared exponent",
caps.GL_EXT_texture_shared_exponent);
capInfos.put("EXT texture snorm", caps.GL_EXT_texture_snorm);
capInfos.put("EXT texture swizzle", caps.GL_EXT_texture_swizzle);
capInfos.put("EXT timer query", caps.GL_EXT_timer_query);
capInfos.put("EXT transform feedback", caps.GL_EXT_transform_feedback);
capInfos.put("EXT vertex array bgra", caps.GL_EXT_vertex_array_bgra);
capInfos.put("EXT vertex attrib 64bit", caps.GL_EXT_vertex_attrib_64bit);
capInfos.put("EXT vertex shader", caps.GL_EXT_vertex_shader);
capInfos.put("EXT vertex weighting", caps.GL_EXT_vertex_weighting);
capInfos.put("GREMEDY string marker", caps.GL_GREMEDY_string_marker);
capInfos.put("HP occlusion test", caps.GL_HP_occlusion_test);
capInfos.put("IBM rasterpos clip", caps.GL_IBM_rasterpos_clip);
capInfos.put("NVX gpu memory info", caps.GL_NVX_gpu_memory_info);
capInfos.put("NV blend square", caps.GL_NV_blend_square);
capInfos.put("NV conditional render", caps.GL_NV_conditional_render);
capInfos.put("NV copy depth to color", caps.GL_NV_copy_depth_to_color);
capInfos.put("NV copy image", caps.GL_NV_copy_image);
capInfos.put("NV depth buffer float", caps.GL_NV_depth_buffer_float);
capInfos.put("NV depth clamp", caps.GL_NV_depth_clamp);
capInfos.put("NV evaluators", caps.GL_NV_evaluators);
capInfos.put("NV explicit multisample", caps.GL_NV_explicit_multisample);
capInfos.put("NV fence", caps.GL_NV_fence);
capInfos.put("NV float buffer", caps.GL_NV_float_buffer);
capInfos.put("NV fog distance", caps.GL_NV_fog_distance);
capInfos.put("NV fragment program", caps.GL_NV_fragment_program);
capInfos.put("NV fragment program2", caps.GL_NV_fragment_program2);
capInfos.put("NV fragment program4", caps.GL_NV_fragment_program4);
capInfos.put("NV fragment program option",
caps.GL_NV_fragment_program_option);
capInfos.put("NV framebuffer multisample coverage",
caps.GL_NV_framebuffer_multisample_coverage);
capInfos.put("NV geometry program4", caps.GL_NV_geometry_program4);
capInfos.put("NV geometry shader4", caps.GL_NV_geometry_shader4);
capInfos.put("NV gpu program4", caps.GL_NV_gpu_program4);
capInfos.put("NV gpu program5", caps.GL_NV_gpu_program5);
capInfos.put("NV gpu shader5", caps.GL_NV_gpu_shader5);
capInfos.put("NV half float", caps.GL_NV_half_float);
capInfos.put("NV light max exponent", caps.GL_NV_light_max_exponent);
capInfos.put("NV multisample coverage", caps.GL_NV_multisample_coverage);
capInfos.put("NV multisample filter hint",
caps.GL_NV_multisample_filter_hint);
capInfos.put("NV occlusion query", caps.GL_NV_occlusion_query);
capInfos.put("NV packed depth stencil", caps.GL_NV_packed_depth_stencil);
capInfos.put("NV parameter buffer object",
caps.GL_NV_parameter_buffer_object);
capInfos.put("NV parameter buffer object2",
caps.GL_NV_parameter_buffer_object2);
capInfos.put("NV pixel data range", caps.GL_NV_pixel_data_range);
capInfos.put("NV point sprite", caps.GL_NV_point_sprite);
capInfos.put("NV primitive restart", caps.GL_NV_primitive_restart);
capInfos.put("NV register combiners", caps.GL_NV_register_combiners);
capInfos.put("NV register combiners2", caps.GL_NV_register_combiners2);
capInfos.put("NV shader buffer load", caps.GL_NV_shader_buffer_load);
capInfos.put("NV shader buffer store", caps.GL_NV_shader_buffer_store);
capInfos.put("NV tessellation program5",
caps.GL_NV_tessellation_program5);
capInfos.put("NV texgen reflection", caps.GL_NV_texgen_reflection);
capInfos.put("NV texture barrier", caps.GL_NV_texture_barrier);
capInfos.put("NV texture compression vtc",
caps.GL_NV_texture_compression_vtc);
capInfos.put("NV texture env combine4", caps.GL_NV_texture_env_combine4);
capInfos.put("NV texture expand normal",
caps.GL_NV_texture_expand_normal);
capInfos.put("NV texture rectangle", caps.GL_NV_texture_rectangle);
capInfos.put("NV texture shader", caps.GL_NV_texture_shader);
capInfos.put("NV texture shader2", caps.GL_NV_texture_shader2);
capInfos.put("NV texture shader3", caps.GL_NV_texture_shader3);
capInfos.put("NV transform feedback", caps.GL_NV_transform_feedback);
capInfos.put("NV transform feedback2", caps.GL_NV_transform_feedback2);
capInfos.put("NV vertex array range", caps.GL_NV_vertex_array_range);
capInfos.put("NV vertex array range2", caps.GL_NV_vertex_array_range2);
capInfos.put("NV vertex attrib integer 64bit",
caps.GL_NV_vertex_attrib_integer_64bit);
capInfos.put("NV vertex buffer unified memory",
caps.GL_NV_vertex_buffer_unified_memory);
capInfos.put("NV vertex program", caps.GL_NV_vertex_program);
capInfos.put("NV vertex program1 1", caps.GL_NV_vertex_program1_1);
capInfos.put("NV vertex program2", caps.GL_NV_vertex_program2);
capInfos.put("NV vertex program2 option",
caps.GL_NV_vertex_program2_option);
capInfos.put("NV vertex program3", caps.GL_NV_vertex_program3);
capInfos.put("NV vertex program4", caps.GL_NV_vertex_program4);
capInfos.put("SGIS generate mipmap", caps.GL_SGIS_generate_mipmap);
capInfos.put("SGIS texture lod", caps.GL_SGIS_texture_lod);
capInfos.put("SUN slice accum", caps.GL_SUN_slice_accum);
}
/**
* @param io_strb
* @param title
* @param available
*/
static void availableNL(StringBuffer io_strb, String title, boolean flag) {
infoNL(io_strb, title, flag ? "supported" : "not available");
}
static void warnNL(StringBuffer io_strb, String msg) {
io_strb.append(msg).append(NL);
}
static void infoNL(StringBuffer io_strb, String title, String... msg) {
io_strb.append(title).append(":");
for (int i = 0; i < TAB - title.length(); i++) {
io_strb.append(' ');
}
for (String s : msg) {
io_strb.append(' ');
if (s != null)
io_strb.append(s);
else
io_strb.append("n.a.");
}
io_strb.append(NL);
}
public static void main(String[] args) throws Exception {
Display.setFullscreen(false);
Display.create();
String s = gatherInformation();
System.out.println(s);
}
/**
* {@inheritDoc}
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
@Override
public void setFocus() {
// TODO implement method LWJGLInfoView.setFocus
}
}

View File

@ -1,203 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl.info;
import org.eclipse.core.runtime.IBundleGroup;
import org.eclipse.core.runtime.IBundleGroupProvider;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.opengl.GLCanvas;
import org.eclipse.swt.opengl.GLData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.part.ViewPart;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.util.glu.GLU;
/**
* Simple view for testing whether LWJGL is installed correctly on your
* system.
* The example is based on
* <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.java?view=markup&content-type=text%2Fvnd.viewcvs-markup&revision=HEAD">snippet 195</a>.
*
* @author Jens von Pilgrim
* @version $Revision$
* @since 16.07.2007
* @headurl $HeadURL$
*/
public class LWJGLTestView extends ViewPart {
GLCanvas canvas;
FpsStatusLineItem fpsstatuslineitem;
static String getFeatureVersion(String myFeatureId) {
IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
if (providers != null) {
for (int i = 0; i < providers.length; ++i) {
IBundleGroup[] bundleGroups = providers[i].getBundleGroups();
for (IBundleGroup bg : bundleGroups) {
if (bg.getIdentifier().equals(myFeatureId)) {
return bg.getVersion();
}
}
}
}
return "Feature not found";
}
/**
* {@inheritDoc}
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
String strVersion = getFeatureVersion("org.lwjgl");
this.setPartName("org.lwjgl " + strVersion);
IStatusLineManager statusLine = this.getViewSite().getActionBars()
.getStatusLineManager();
fpsstatuslineitem = new FpsStatusLineItem();
statusLine.add(fpsstatuslineitem);
GLData data = new GLData();
data.doubleBuffer = true;
canvas = new GLCanvas(parent, SWT.NONE, data);
canvas.setCurrent();
try {
GLContext.useContext(canvas);
} catch (LWJGLException e) {
e.printStackTrace();
}
canvas.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
Rectangle bounds = canvas.getBounds();
float fAspect = (float) bounds.width / (float) bounds.height;
canvas.setCurrent();
try {
GLContext.useContext(canvas);
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, bounds.width, bounds.height);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
}
});
GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glColor3f(1.0f, 0.0f, 0.0f);
GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
GL11.glClearDepth(1.0);
GL11.glLineWidth(2);
GL11.glEnable(GL11.GL_DEPTH_TEST);
Display.getCurrent().asyncExec(initRunnable());
}
/**
* {@inheritDoc}
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
@Override
public void setFocus() {
canvas.setFocus();
}
static void drawTorus(float r, float R, int nsides, int rings) {
float ringDelta = 2.0f * (float) Math.PI / rings;
float sideDelta = 2.0f * (float) Math.PI / nsides;
float theta = 0.0f, cosTheta = 1.0f, sinTheta = 0.0f;
for (int i = rings - 1; i >= 0; i--) {
float theta1 = theta + ringDelta;
float cosTheta1 = (float) Math.cos(theta1);
float sinTheta1 = (float) Math.sin(theta1);
GL11.glBegin(GL11.GL_QUAD_STRIP);
float phi = 0.0f;
for (int j = nsides; j >= 0; j--) {
phi += sideDelta;
float cosPhi = (float) Math.cos(phi);
float sinPhi = (float) Math.sin(phi);
float dist = R + r * cosPhi;
GL11
.glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi,
sinPhi);
GL11
.glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r
* sinPhi);
GL11.glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
GL11.glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi);
}
GL11.glEnd();
theta = theta1;
cosTheta = cosTheta1;
sinTheta = sinTheta1;
}
}
Runnable initRunnable() {
return new Runnable() {
int rot = 0;
public void run() {
if (!canvas.isDisposed() && canvas.isVisible()) {
fpsstatuslineitem.renderPassStarted();
canvas.setCurrent();
try {
GLContext.useContext(canvas);
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT
| GL11.GL_DEPTH_BUFFER_BIT);
GL11.glClearColor(.2f, .7f, .2f, 1.0f);
GL11.glLoadIdentity();
GL11.glTranslatef(0.0f, 0.0f, -10.0f);
float frot = rot;
GL11
.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot,
1.0f);
GL11.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f);
rot++;
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
GL11.glColor3f(0.9f, 0.9f, 0.9f);
drawTorus(1, 1.9f + ((float) Math.sin((0.004f * frot))),
15, 15);
canvas.swapBuffers();
fpsstatuslineitem.renderPassFinished();
Display.getCurrent().asyncExec(this);
}
}
};
}
}

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.lwjgl.source</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

View File

@ -1,7 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL Sources
Bundle-Vendor: Lightweight Java Game Library Project
Bundle-Version: 2
Bundle-SymbolicName: org.lwjgl.source;singleton:=true
Bundle-Localization: plugin

View File

@ -1,55 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>About</title>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
</head>
<body lang="EN-US">
<img src="lwjgl_logo.png" align="right"/>
<h2>About This Content</h2>
<p>The <a href="http://lwjgl.org">Lightweight Java Game Library (LWJGL)</a> is a solution aimed
directly at professional and amateur Java programmers alike to enable <a
href="projects.php">commercial quality games</a> to be written in Java.
LWJGL provides developers access to high performance crossplatform
libraries such as OpenGL (<a href="http://www.opengl.org/"
target="_blank">Open Graphics Library</a>) and OpenAL (<a
href="http://www.openal.org" target="_blank">Open Audio Library</a>)
allowing for state of the art 3D games and 3D sound. Additionally LWJGL
provides access to controllers such as Gamepads, Steering wheel and
Joysticks. All in a simple and straight forward API.</p>
<p>LWJGL is not meant to make writing games particularly easy; it is
primarily an enabling technology which allows developers to get at
resources that are simply otherwise unavailable or poorly implemented on
the existing <a href="http://java.sun.com" target="_blank">Java
platform</a>. We anticipate that the LWJGL will, through evolution and
extension, become the foundation for more complete game libraries and
"game engines" as they have popularly become known, and hide some of the
new evils we have had to expose in the APIs.</p>
<p>LWJGL is available under a <a href="http://lwjgl.org/license.php">BSD
license</a>, which means it's open source and freely available at no charge.</p>
<p>Please visit us on the Freenode IRC Network: <a
href="irc://irc.freenode.net/lwjgl" target="_blank">#LWJGL</a>. Do idle
if there is no one to answer any of your questions, we are on different
timezones.</p>
<h2>Plug-Ins</h2>
<p>The following plug-ins are provided:
<dl>
<dt>org.lwjgl</dt>
<dd>Platform independent jars and native libraries for Windows, Linux and Mac OS X</dd>
<dt>org.lwjgl.doc</dt>
<dd>Documentation (JavaDoc)</dd>
<dt>org.lwjgl.source</dt>
<dd>Source files</dd>
<dt>org.lwjgl.tools</dt>
<dd>Developer tools</dd>
<dt>org.lwjgl.info</dt>
<dd>LWJGL test and info view</dd>
</dl>
</p>
</body>
</html>

View File

@ -1,10 +0,0 @@
bin.includes = META-INF/,\
about.html,\
lwjgl_logo.png,\
plugin.xml,\
src/
src.includes = src/,\
lwjgl_logo.png,\
about.html,\
plugin.xml,\
META-INF/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.pde.core.source">
<location path="src" />
</extension>
</plugin>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.lwjgl.tools</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,12 +0,0 @@
#Tue Nov 23 14:40:51 CET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -1,16 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL Tools Plug-in
Bundle-SymbolicName: org.lwjgl.tools;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.lwjgl.tools.Activator
Bundle-Vendor: Lightweight Java Game Library Project
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources;bundle-version="3.4.0",
org.eclipse.jdt.core;bundle-version="3.4.0",
org.eclipse.jdt.ui;bundle-version="3.4.0",
org.eclipse.jdt.launching;bundle-version="3.4.0",
org.lwjgl;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5

View File

@ -1,33 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>
<p>November, 2010</p>
<h3>License</h3>
<p>The LWJGL team makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
indicated below, the Content is provided to you under the terms and conditions of the
Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>If you did not receive this Content directly from lwjgl.org, the Content is
being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
apply to your use of any object code in the Content. Check the Redistributor's license that was
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
<h4>Third party code</h4>
<p>This plug-in contains code from the plugin org.eclipse.jdt.junit, this code
is provided by the Eclipse Foundation under the terms
of the Eclipse Public License Version 1.0.</p>
</body>
</html>

View File

@ -1,6 +0,0 @@
source.. = src/java/
output.. = build/classes/
bin.includes = META-INF/,\
.,\
plugin.xml,\
about.html

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.jdt.core.classpathContainerInitializer">
<classpathContainerInitializer
class="org.lwjgl.tools.LWJGLClasspathContainerInitializer"
id="org.lwjgl.LWJGL_CONTAINER">
</classpathContainerInitializer>
</extension>
<extension
point="org.eclipse.jdt.ui.classpathContainerPage">
<classpathContainerPage
class="org.lwjgl.tools.LWJGLClasspathContainerPage"
id="org.lwjgl.LWJGL_CONTAINER"
name="LWJGL Library">
</classpathContainerPage>
</extension>
</plugin>

View File

@ -1,64 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl.tools;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*
* @author Jens von Pilgrim (developer@jevopi.de)
* @since Mar 30, 2011
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.lwjgl.tools";
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}

View File

@ -1,269 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl.tools;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Logger;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.JavaRuntime;
import org.lwjgl.LibraryPathUtil;
import org.lwjgl.OSNotSupportedException;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
/**
* This class resolves the actual LWJGL library path, that is the location
* of the jars in the org.lwjgl plugin.
*
* Following the "monkey sees, monkey does"-rule, this code was copied and
* modified from the plugin org.eclipse.jdt.junit . This code is published
* under the EPL and (c) by IBM and others.
*
* @see org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathSupport
* @see org.eclipse.jdt.internal.junit.buildpath.BuildPathSupport
*/
public class BuildPathSupport {
/**
* Logger for this class
*/
private static final Logger log = Logger.getLogger(BuildPathSupport.class.getName());
public static class LWJGLPluginDescription {
private final String strBundleId;
private Bundle bundle = null;
public LWJGLPluginDescription(String bundleId) {
strBundleId = bundleId;
}
public Bundle getBundle() {
if (bundle == null)
bundle = Platform.getBundle(strBundleId);
return bundle;
}
public String getBundleId() {
return strBundleId;
}
}
public static final LWJGLPluginDescription LWJGL_PLUGIN = new LWJGLPluginDescription(
"org.lwjgl"); //$NON-NLS-1$
public static final LWJGLPluginDescription LWJGL_SRC_PLUGIN = new LWJGLPluginDescription(
"org.lwjgl.source"); //$NON-NLS-1$
public static final LWJGLPluginDescription LWJGL_DOC_PLUGIN = new LWJGLPluginDescription(
"org.lwjgl.doc"); //$NON-NLS-1$
public static final String[] JAR_FILES = { "lwjgl.jar", "lwjgl_util.jar",
"lwjgl_util_applet.jar", "jinput.jar" };
public static final String[] SRC_FILES = { "lwjglsrc.zip",
"lwjgl_utilsrc.zip", "lwjgl_util_applet.zip", null };
public static final String[] DOC_FILES = { "doc.zip", "doc.zip", "doc.zip",
"doc.zip" };
public static String[] NATIVEPATH = new String[] { "windows", "macosx",
"linux", "solaris" };
public static IPath getBundleLocation(LWJGLPluginDescription pluginDesc) {
Bundle bundle = pluginDesc.getBundle();
if (bundle == null)
return null;
URL local = null;
try {
local = FileLocator.toFileURL(bundle.getEntry("/")); //$NON-NLS-1$
} catch (IOException e) {
return null;
}
String fullPath = new File(local.getPath()).getAbsolutePath();
return Path.fromOSString(fullPath);
}
/**
*
* /Devel/Applications/Eclipse3.4/plugins/org.lwjgl.source_2.0.1/src/org.lwjgl_2.0.1/lwjglsrc.zip
* /Devel/Applications/Eclipse3.4/plugins/org.lwjgl.source_2.0.1/src/org.lwjgl_2.0.1/lwjgl_utilsrc.zip
* /Devel/Applications/Eclipse3.4/plugins/org.lwjgl.source_2.0.1/src/org.lwjgl_2.0.1/lwjgl_util_applet.zip
*
*
* @param pluginDesc
* @return
*/
public static IPath getSourceLocation(String filename) {
if (filename==null)
return null;
Bundle bundleSrc = LWJGL_SRC_PLUGIN.getBundle();
if (bundleSrc == null)
return null;
String version = (String) bundleSrc.getHeaders().get(
Constants.BUNDLE_VERSION);
if (version == null) {
return null;
}
String bundlePath = getURL(bundleSrc);
if (bundlePath == null) {
return null;
}
File bundleLoc = new File(bundlePath);
if (bundleLoc.isDirectory()) {
String fullPath = bundleLoc.getAbsolutePath() + File.separator
+ "src" + File.separator + LWJGL_PLUGIN.getBundleId() + '_'
+ version + File.separator + filename;
return Path.fromOSString(fullPath);
} else if (bundleLoc.isFile()) {
return Path.fromOSString(bundleLoc.getAbsolutePath());
}
return null;
}
/**
* jar:file:/Devel/Applications/Eclipse3.4/plugins/org.lwjgl.doc_2.0.1/doc.zip!/javadoc
*
* @param pluginDesc
* @param filename
* @return
*/
public static String getJavadocLocation(String filename) {
if (filename==null)
return null;
Bundle bundleDoc = LWJGL_DOC_PLUGIN.getBundle();
if (bundleDoc == null)
return null;
String version = (String) bundleDoc.getHeaders().get(
Constants.BUNDLE_VERSION);
if (version == null) {
return null;
}
String bundlePath = getURL(bundleDoc);
if (bundlePath == null) {
return null;
}
File bundleLoc = new File(bundlePath);
if (bundleLoc.isDirectory()) {
String fullPath = "jar:file:" + bundleLoc.getAbsolutePath()
+ File.separator + filename + "!"
+ File.separator + "javadoc" + File.separator;
return fullPath;
} else if (bundleLoc.isFile()) {
return bundleLoc.getAbsolutePath();
}
return null;
}
public static String getNativeLocation() {
String basePath;
try {
basePath = LibraryPathUtil.getRelativeLWJGLLibraryPath();
} catch (OSNotSupportedException ex) {
log.warning(ex.toString()); //$NON-NLS-1$
return null;
}
Bundle bundle = LWJGL_PLUGIN.getBundle();
if (bundle == null)
return null;
String bundlePath = getURL(bundle);
if (bundlePath == null) {
return null;
}
File bundleLoc = new File(bundlePath);
if (bundleLoc.isDirectory()) {
String fullPath = bundleLoc.getAbsolutePath()
+ File.separator + basePath;
return fullPath;
} else if (bundleLoc.isFile()) {
return null;
}
return null;
}
private static String getURL(Bundle bundle) {
try {
URL fileURL = FileLocator.toFileURL(bundle.getEntry("/")); //$NON-NLS-1$
if (fileURL != null) {
return fileURL.getFile();
}
return null;
} catch (IOException e) {
return null;
}
}
public static IClasspathEntry getLWJGLClasspathEntry() {
return JavaCore
.newContainerEntry(LWJGLClasspathContainerInitializer.LWJGL_LIBRARY_PATH);
}
public static IClasspathEntry[] getLWJGLLibraryEntries() {
IPath bundleBase = getBundleLocation(LWJGL_PLUGIN);
if (bundleBase != null) {
IClasspathEntry[] entries = new IClasspathEntry[JAR_FILES.length];
for (int i = 0; i < JAR_FILES.length; i++) {
IPath jarLocation = bundleBase.append(JAR_FILES[i]); //$NON-NLS-1$
IPath srcLocation = getSourceLocation(SRC_FILES[i]);
String nativeLocation = getNativeLocation();
String javadocLocation = getJavadocLocation(DOC_FILES[i]);
IAccessRule[] accessRules = {};
IClasspathAttribute[] attributes = { //
JavaCore
.newClasspathAttribute(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
javadocLocation),
JavaCore.newClasspathAttribute(
JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY,
nativeLocation) };
// return JavaCore.newClasspathAttribute(JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY, dialog.getNativeLibraryPath());
entries[i] = JavaCore.newLibraryEntry(jarLocation, srcLocation,
null, accessRules, attributes, false);
}
return entries;
}
return null;
}
}

View File

@ -1,233 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl.tools;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.ClasspathContainerInitializer;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.launching.JavaRuntime;
/**
* LWJGLClasspathContainerInitializer sets up LWJGL library path.
*
* Parts of this code were copied and modified from
* {@link org.eclipse.jdt.internal.junit.buildpath.JUnitContainerInitializer},
* which is licensed under the EPL as well.
*
* @author Jens von Pilgrim
* @version $Revision$
* @since Dec 5, 2008
*/
public class LWJGLClasspathContainerInitializer extends
ClasspathContainerInitializer {
public static String LWJGL_LIBRARY_ID = "org.lwjgl.LWJGL_CONTAINER";
public static IPath LWJGL_LIBRARY_PATH = new Path(LWJGL_LIBRARY_ID);
private static final IStatus NOT_SUPPORTED = new Status(IStatus.ERROR,
Activator.PLUGIN_ID,
ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED,
new String(), null);
private static class LWJGLClasspathContainer implements IClasspathContainer {
private final IClasspathEntry[] fEntries;
private final IPath fPath;
public LWJGLClasspathContainer(IPath path, IClasspathEntry[] entries) {
fPath = path;
fEntries = entries;
}
public IClasspathEntry[] getClasspathEntries() {
return fEntries;
}
public String getDescription() {
return "LWJGL Libraries";
}
public int getKind() {
return IClasspathContainer.K_APPLICATION;
}
public IPath getPath() {
return fPath;
}
}
public LWJGLClasspathContainerInitializer() {
}
/**
* {@inheritDoc}
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
*/
public void initialize(IPath containerPath, IJavaProject project)
throws CoreException {
if (isValidLWJGLContainerPath(containerPath)) {
LWJGLClasspathContainer container = getNewContainer(containerPath);
JavaCore.setClasspathContainer(containerPath,
new IJavaProject[] { project },
new IClasspathContainer[] { container }, null);
}
}
private static boolean isValidLWJGLContainerPath(IPath path) {
return path != null && path.segmentCount() > 0
&& LWJGL_LIBRARY_ID.equals(path.segment(0));
}
private static LWJGLClasspathContainer getNewContainer(IPath containerPath) {
IClasspathEntry[] entries = null;
// String version = containerPath.segment(1);
entries = BuildPathSupport.getLWJGLLibraryEntries();
if (entries == null)
entries = new IClasspathEntry[] {};
return new LWJGLClasspathContainer(containerPath, entries);
}
/**
* {@inheritDoc}
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#canUpdateClasspathContainer(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
*/
public boolean canUpdateClasspathContainer(IPath containerPath,
IJavaProject project) {
return true;
}
/**
* {@inheritDoc}
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#getAccessRulesStatus(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
*/
public IStatus getAccessRulesStatus(IPath containerPath,
IJavaProject project) {
return NOT_SUPPORTED;
}
/**
* {@inheritDoc}
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#getSourceAttachmentStatus(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
*/
public IStatus getSourceAttachmentStatus(IPath containerPath,
IJavaProject project) {
return Status.OK_STATUS;
}
/**
* {@inheritDoc}
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#getAttributeStatus(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject, java.lang.String)
*/
public IStatus getAttributeStatus(IPath containerPath,
IJavaProject project, String attributeKey) {
if (attributeKey
.equals(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME)) {
return Status.OK_STATUS;
}
if (attributeKey.equals(JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY)) {
return Status.OK_STATUS;
}
return NOT_SUPPORTED;
}
/**
* {@inheritDoc}
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#requestClasspathContainerUpdate(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject, org.eclipse.jdt.core.IClasspathContainer)
*/
public void requestClasspathContainerUpdate(IPath containerPath,
IJavaProject project, IClasspathContainer containerSuggestion)
throws CoreException {
IClasspathEntry[] entries = containerSuggestion.getClasspathEntries();
if (entries.length == 1 && isValidLWJGLContainerPath(containerPath)) {
// String version = containerPath.segment(1);
// only modifiable entry in Javadoc location
IClasspathAttribute[] extraAttributes = entries[0]
.getExtraAttributes();
for (int i = 0; i < extraAttributes.length; i++) {
IClasspathAttribute attrib = extraAttributes[i];
if (attrib.getName().equals(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME)) {
break;
}
}
rebindClasspathEntries(project.getJavaModel(), containerPath);
}
}
private static void rebindClasspathEntries(IJavaModel model,
IPath containerPath) throws JavaModelException {
List<IJavaProject> affectedProjects = new ArrayList<IJavaProject>();
IJavaProject[] projects = model.getJavaProjects();
for (int i = 0; i < projects.length; i++) {
IJavaProject project = projects[i];
IClasspathEntry[] entries = project.getRawClasspath();
for (int k = 0; k < entries.length; k++) {
IClasspathEntry curr = entries[k];
if (curr.getEntryKind() == IClasspathEntry.CPE_CONTAINER
&& containerPath.equals(curr.getPath())) {
affectedProjects.add(project);
}
}
}
if (!affectedProjects.isEmpty()) {
IJavaProject[] affected = (IJavaProject[]) affectedProjects
.toArray(new IJavaProject[affectedProjects.size()]);
IClasspathContainer[] containers = new IClasspathContainer[affected.length];
for (int i = 0; i < containers.length; i++) {
containers[i] = getNewContainer(containerPath);
}
JavaCore.setClasspathContainer(containerPath, affected, containers,
null);
}
}
/**
* {@inheritDoc}
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#getDescription(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
*/
public String getDescription(IPath containerPath, IJavaProject project) {
return "LWJGL library settings, including required java libraries "
+ "(jars) and native libraries.";
}
/**
* {@inheritDoc}
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#getComparisonID(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
*/
public Object getComparisonID(IPath containerPath, IJavaProject project) {
return containerPath;
}
}

View File

@ -1,279 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl.tools;
import java.io.StringWriter;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.ui.JavaElementLabels;
import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
/**
* LWJGLClasspathContainerPage
* There should really be more documentation here.
*
* @author Jens von Pilgrim
* @since Dec 5, 2008
*/
public class LWJGLClasspathContainerPage extends NewElementWizardPage implements
IClasspathContainerPage, IClasspathContainerPageExtension {
private IClasspathEntry containerEntryResult;
private Label labelResolvedPath;
private Label labelResolvedSourcePath;
private Label labelResolvedDocPath;
private Label labelNativePath;
public LWJGLClasspathContainerPage() {
super("LWJGLContainterPage"); //$NON-NLS-1$
setTitle("LWJGL Library");
setDescription("Adds LWJGL Java Libraries to build path");
setImageDescriptor(JavaPluginImages.DESC_WIZBAN_ADD_LIBRARY);
containerEntryResult = JavaCore
.newContainerEntry(LWJGLClasspathContainerInitializer.LWJGL_LIBRARY_PATH);
}
public static IJavaProject getPlaceholderProject() {
String name = "####internal"; //$NON-NLS-1$
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
while (true) {
IProject project = root.getProject(name);
if (!project.exists()) {
return JavaCore.create(project);
}
name += '1';
}
}
public boolean finish() {
try {
IJavaProject[] javaProjects = new IJavaProject[] { getPlaceholderProject() };
IClasspathContainer[] containers = { null };
JavaCore.setClasspathContainer(containerEntryResult.getPath(),
javaProjects, containers, null);
} catch (JavaModelException e) {
perform(e, getShell(), e.getMessage());
return false;
}
return true;
}
public IClasspathEntry getSelection() {
return containerEntryResult;
}
public void setSelection(IClasspathEntry containerEntry) {
containerEntryResult = containerEntry;
}
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setFont(parent.getFont());
composite.setLayout(new GridLayout(2, false));
createLabel(composite, "Path");
labelResolvedPath = createPathLabel(composite);
createLabel(composite, "Source Path");
labelResolvedSourcePath = createPathLabel(composite);
createLabel(composite, "JavaDoc Path");
labelResolvedDocPath = createPathLabel(composite);
createLabel(composite, "Native Path");
labelNativePath = createPathLabel(composite);
update();
setControl(composite);
}
private void createLabel(Composite parent, String strLabel) {
Label label = new Label(parent, SWT.NONE);
label.setFont(parent.getFont());
label.setText(strLabel);
label.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
}
private Label createPathLabel(Composite parent) {
Label label = new Label(parent, SWT.WRAP);
label.setFont(parent.getFont());
label.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true,
true, 1, 1));
return label;
}
protected void update() {
IStatus status = null;
IClasspathEntry[] libEntries = BuildPathSupport
.getLWJGLLibraryEntries();
IPath containerPath = LWJGLClasspathContainerInitializer.LWJGL_LIBRARY_PATH;
containerEntryResult = JavaCore.newContainerEntry(containerPath);
if (libEntries == null) {
status = new Status(ERROR, Activator.PLUGIN_ID,
"No LWJGL library found");
} else
if (labelResolvedPath != null && !labelResolvedPath.isDisposed()) {
// implies all other labels to be created and not yet disposed
if (libEntries != null) {
Set<String> setLines = new TreeSet<String>();
IPath path;
for (IClasspathEntry entry : libEntries) {
path = entry.getPath();
if (path != null) {
setLines.add(getPathLabel(path));
}
}
setLabel(labelResolvedPath, setLines);
setLines.clear();
for (IClasspathEntry entry : libEntries) {
path = entry.getSourceAttachmentPath();
if (path != null) {
setLines.add(getPathLabel(path));
}
}
setLabel(labelResolvedSourcePath, setLines);
setLines.clear();
for (IClasspathEntry entry : libEntries) {
if (entry.getExtraAttributes() != null) {
for (IClasspathAttribute attr : entry
.getExtraAttributes()) {
if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME
.equals(attr.getName())) {
setLines.add(attr.getValue());
break;
}
if (JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY.equals(attr.getName())) {
}
}
}
}
setLabel(labelResolvedDocPath, setLines);
setLines.clear();
for (IClasspathEntry entry : libEntries) {
if (entry.getExtraAttributes() != null) {
for (IClasspathAttribute attr : entry
.getExtraAttributes()) {
if (JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY.equals(attr.getName())) {
setLines.add(attr.getValue());
}
}
}
}
setLabel(labelNativePath, setLines);
} else {
labelResolvedPath.setText("not found");
labelResolvedSourcePath.setText("not found");
labelResolvedDocPath.setText("not found");
}
}
if (status != null)
updateStatus(status);
}
/**
* @param i_labelResolvedDocPath
* @param i_setDocPaths
*/
private void setLabel(Label label, Set<String> lines) {
StringBuffer strb = new StringBuffer();
for (String str : lines) {
if (strb.length() > 0) {
strb.append("\n");
}
strb.append(str);
}
label.setText(strb.toString());
}
private String getPathLabel(IPath path) {
StringBuffer buf = new StringBuffer(BasicElementLabels
.getResourceName(path.lastSegment()));
buf.append(JavaElementLabels.CONCAT_STRING);
buf.append(BasicElementLabels.getPathLabel(path.removeLastSegments(1),
true));
return buf.toString();
}
/* (non-Javadoc)
* @see org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension#initialize(org.eclipse.jdt.core.IJavaProject, org.eclipse.jdt.core.IClasspathEntry[])
*/
public void initialize(IJavaProject project,
IClasspathEntry[] currentEntries) {
}
protected void perform(CoreException e, Shell shell, String message) {
IStatus status = e.getStatus();
if (status != null) {
ErrorDialog.openError(shell, "LWJGL Library", message, status);
} else {
StringWriter msg = new StringWriter();
if (message != null) {
msg.write(message);
msg.write("\n\n"); //$NON-NLS-1$
}
if (message == null || message.length() == 0)
msg.write("Unknown error adding LWJGL library");
else
msg.write(message);
MessageDialog.openError(shell, "LWJGL Library", msg.toString());
}
}
}

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.lwjgl.updatesite</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.UpdateSiteBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.UpdateSiteNature</nature>
</natures>
</projectDescription>

View File

@ -1,60 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>About</title>
<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
</head>
<body lang="EN-US">
<img src="lwjgl_logo.png" align="right"/>
<h2>About This Content</h2>
<p>The <a href="http://lwjgl.org">Lightweight Java Game Library (LWJGL)</a> is a solution aimed
directly at professional and amateur Java programmers alike to enable <a
href="projects.php">commercial quality games</a> to be written in Java.
LWJGL provides developers access to high performance crossplatform
libraries such as OpenGL (<a href="http://www.opengl.org/"
target="_blank">Open Graphics Library</a>) and OpenAL (<a
href="http://www.openal.org" target="_blank">Open Audio Library</a>)
allowing for state of the art 3D games and 3D sound. Additionally LWJGL
provides access to controllers such as Gamepads, Steering wheel and
Joysticks. All in a simple and straight forward API.</p>
<p>LWJGL is not meant to make writing games particularly easy; it is
primarily an enabling technology which allows developers to get at
resources that are simply otherwise unavailable or poorly implemented on
the existing <a href="http://java.sun.com" target="_blank">Java
platform</a>. We anticipate that the LWJGL will, through evolution and
extension, become the foundation for more complete game libraries and
"game engines" as they have popularly become known, and hide some of the
new evils we have had to expose in the APIs.</p>
<p>LWJGL is available under a <a href="http://lwjgl.org/license.php">BSD
license</a>, which means it's open source and freely available at no charge.</p>
<p>Please visit us on the Freenode IRC Network: <a
href="irc://irc.freenode.net/lwjgl" target="_blank">#LWJGL</a>. Do idle
if there is no one to answer any of your questions, we are on different
timezones.</p>
<h3>Plugin assembly</h3>
<p>The plugins were assembled by Jens von Pilgrim (developer@jevopi.de). All files related to this assembly, such as manifest files or plugin descriptors, are copyright under the Eclipse Public License (EPL) and the BSD license</p>
<h3>Third party code</h3>
<h4>IBM</h4>
<p>The LWJGL Textview contains code copyright under the Eclipse Public License (EPL):<br/>
<pre>
Copyright (c) 2000, 2005 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
</pre>
The source of this code can be found at:
<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.java?view=markup&content-type=text%2Fvnd.viewcvs-markup&revision=HEAD">http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet195.java?view=markup&content-type=text%2Fvnd.viewcvs-markup&revision=HEAD</a>
</p>
<h4>SGI</h4>
<p>
LWJGL contains code copyright by SGI. This code is copyright under the SGI FreeB v1.1, see <a href="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</a>. Note that this license can be updated to version 2.0.
</p>
</body>
</html>

View File

@ -1,60 +0,0 @@
<html>
<head>
<title>org.lwjgl.updatesite</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>@import url("web/site.css");</style>
<script type="text/javascript">
var returnval = 0;
var stylesheet, xmlFile, cache, doc;
function init(){
// NSCP 7.1+ / Mozilla 1.4.1+ / Safari
// Use the standard DOM Level 2 technique, if it is supported
if (document.implementation && document.implementation.createDocument) {
xmlFile = document.implementation.createDocument("", "", null);
stylesheet = document.implementation.createDocument("", "", null);
if (xmlFile.load){
xmlFile.load("site.xml");
stylesheet.load("web/site.xsl");
} else {
alert("Document could not be loaded by browser.");
}
xmlFile.addEventListener("load", transform, false);
stylesheet.addEventListener("load", transform, false);
}
//IE 6.0+ solution
else if (window.ActiveXObject) {
xmlFile = new ActiveXObject("msxml2.DOMDocument.3.0");
xmlFile.async = false;
xmlFile.load("site.xml");
stylesheet = new ActiveXObject("msxml2.FreeThreadedDOMDocument.3.0");
stylesheet.async = false;
stylesheet.load("web/site.xsl");
cache = new ActiveXObject("msxml2.XSLTemplate.3.0");
cache.stylesheet = stylesheet;
transformData();
}
}
// separate transformation function for IE 6.0+
function transformData(){
var processor = cache.createProcessor();
processor.input = xmlFile;
processor.transform();
data.innerHTML = processor.output;
}
// separate transformation function for NSCP 7.1+ and Mozilla 1.4.1+
function transform(){
returnval+=1;
if (returnval==2){
var processor = new XSLTProcessor();
processor.importStylesheet(stylesheet);
doc = processor.transformToDocument(xmlFile);
document.getElementById("data").innerHTML = doc.documentElement.innerHTML;
}
}
</script>
</head>
<body onload="init();">
<!--[insert static HTML here]-->
<div id="data"><!-- this is where the transformed data goes --></div>
</body>
</html>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<description url="@UPDATEURL@">
Update site for LWJGL and related features and plugins.
</description>
<feature url="features/org.lwjgl_2.jar" id="org.lwjgl" version="2">
<category name="3dlibs"/>
</feature>
<feature url="features/org.lwjgl.sdk_2.jar" id="org.lwjgl" version="2">
<category name="3dlibs"/>
</feature>
<category-def name="3dlibs" label="3D Libraries">
<description>
Java 3D libraries such as LWJGL.
</description>
</category-def>
</site>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<description url="@UPDATEURL@">
Update site for LWJGL and related features and plugins.
</description>
<feature url="features/org.lwjgl_@VERSION@.jar" id="org.lwjgl" version="@VERSION@">
<category name="3dlibs"/>
</feature>
<feature url="features/org.lwjgl.sdk_@VERSION@.jar" id="org.lwjgl.sdk" version="@VERSION@">
<category name="3dlibs"/>
</feature>
<category-def name="3dlibs" label="3D Libraries">
<description>
Java 3D libraries such as LWJGL.
</description>
</category-def>
</site>

View File

@ -1,12 +0,0 @@
<STYLE type="text/css">
td.spacer {padding-bottom: 10px; padding-top: 10px;}
.title { font-family: sans-serif; color: #99AACC;}
.bodyText { font-family: sans-serif; font-size: 9pt; color:#000000; }
.sub-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white;}
.log-text {font-family: sans-serif; font-style: normal; font-weight: lighter; font-size: 8pt; color:black;}
.big-header { font-family: sans-serif; font-style: normal; font-weight: bold; font-size: 9pt; color: white; border-top:10px solid white;}
.light-row {background:#FFFFFF}
.dark-row {background:#EEEEFF}
.header {background:#99AADD}
#indent {word-wrap : break-word;width :300px;text-indent:10px;}
</STYLE>

View File

@ -1,214 +0,0 @@
<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:output method="html" encoding="UTF-8"/>
<xsl:key name="cat" match="category" use="@name"/>
<xsl:template match="/">
<xsl:for-each select="site">
<html>
<head>
<title>org.lwjgl.updatesite</title>
<style>@import url("web/site.css");</style>
</head>
<body>
<h1 class="title">org.lwjgl.updatesite</h1>
<p class="bodyText"><xsl:value-of select="description"/></p>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<xsl:for-each select="category-def">
<xsl:sort select="@label" order="ascending" case-order="upper-first"/>
<xsl:sort select="@name" order="ascending" case-order="upper-first"/>
<xsl:if test="count(key('cat',@name)) != 0">
<tr class="header">
<td class="sub-header" width="30%">
<xsl:value-of select="@name"/>
</td>
<td class="sub-header" width="70%">
<xsl:value-of select="@label"/>
</td>
</tr>
<xsl:for-each select="key('cat',@name)">
<xsl:sort select="ancestor::feature//@version" order="ascending"/>
<xsl:sort select="ancestor::feature//@id" order="ascending" case-order="upper-first"/>
<tr>
<xsl:choose>
<xsl:when test="(position() mod 2 = 1)">
<xsl:attribute name="class">dark-row</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">light-row</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<td class="log-text" id="indent">
<xsl:choose>
<xsl:when test="ancestor::feature//@label">
<a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@label"/></a>
<br/>
<div id="indent">
(<xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/>)
</div>
</xsl:when>
<xsl:otherwise>
<a href="{ancestor::feature//@url}"><xsl:value-of select="ancestor::feature//@id"/> - <xsl:value-of select="ancestor::feature//@version"/></a>
</xsl:otherwise>
</xsl:choose>
<br />
</td>
<td>
<table>
<xsl:if test="ancestor::feature//@os">
<tr><td class="log-text" id="indent">Operating Systems:</td>
<td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@os"/></td>
</tr>
</xsl:if>
<xsl:if test="ancestor::feature//@ws">
<tr><td class="log-text" id="indent">Windows Systems:</td>
<td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@ws"/></td>
</tr>
</xsl:if>
<xsl:if test="ancestor::feature//@nl">
<tr><td class="log-text" id="indent">Languages:</td>
<td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@nl"/></td>
</tr>
</xsl:if>
<xsl:if test="ancestor::feature//@arch">
<tr><td class="log-text" id="indent">Architecture:</td>
<td class="log-text" id="indent"><xsl:value-of select="ancestor::feature//@arch"/></td>
</tr>
</xsl:if>
</table>
</td>
</tr>
</xsl:for-each>
<tr><td class="spacer"><br/></td><td class="spacer"><br/></td></tr>
</xsl:if>
</xsl:for-each>
<xsl:if test="count(feature) &gt; count(feature/category)">
<tr class="header">
<td class="sub-header" colspan="2">
Uncategorized
</td>
</tr>
</xsl:if>
<xsl:choose>
<xsl:when test="function-available('msxsl:node-set')">
<xsl:variable name="rtf-nodes">
<xsl:for-each select="feature[not(category)]">
<xsl:sort select="@id" order="ascending" case-order="upper-first"/>
<xsl:sort select="@version" order="ascending" />
<xsl:value-of select="."/>
<xsl:copy-of select="." />
</xsl:for-each>
</xsl:variable>
<xsl:variable name="myNodeSet" select="msxsl:node-set($rtf-nodes)/*"/>
<xsl:for-each select="$myNodeSet">
<tr>
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<xsl:attribute name="class">dark-row</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">light-row</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<td class="log-text" id="indent">
<xsl:choose>
<xsl:when test="@label">
<a href="{@url}"><xsl:value-of select="@label"/></a>
<br />
<div id="indent">
(<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>)
</div>
</xsl:when>
<xsl:otherwise>
<a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a>
</xsl:otherwise>
</xsl:choose>
<br /><br />
</td>
<td>
<table>
<xsl:if test="@os">
<tr><td class="log-text" id="indent">Operating Systems:</td>
<td class="log-text" id="indent"><xsl:value-of select="@os"/></td>
</tr>
</xsl:if>
<xsl:if test="@ws">
<tr><td class="log-text" id="indent">Windows Systems:</td>
<td class="log-text" id="indent"><xsl:value-of select="@ws"/></td>
</tr>
</xsl:if>
<xsl:if test="@nl">
<tr><td class="log-text" id="indent">Languages:</td>
<td class="log-text" id="indent"><xsl:value-of select="@nl"/></td>
</tr>
</xsl:if>
<xsl:if test="@arch">
<tr><td class="log-text" id="indent">Architecture:</td>
<td class="log-text" id="indent"><xsl:value-of select="@arch"/></td>
</tr>
</xsl:if>
</table>
</td>
</tr>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="feature[not(category)]">
<xsl:sort select="@id" order="ascending" case-order="upper-first"/>
<xsl:sort select="@version" order="ascending" />
<tr>
<xsl:choose>
<xsl:when test="count(preceding-sibling::feature[not(category)]) mod 2 = 1">
<xsl:attribute name="class">dark-row</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">light-row</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<td class="log-text" id="indent">
<xsl:choose>
<xsl:when test="@label">
<a href="{@url}"><xsl:value-of select="@label"/></a>
<br />
<div id="indent">
(<xsl:value-of select="@id"/> - <xsl:value-of select="@version"/>)
</div>
</xsl:when>
<xsl:otherwise>
<a href="{@url}"><xsl:value-of select="@id"/> - <xsl:value-of select="@version"/></a>
</xsl:otherwise>
</xsl:choose>
<br /><br />
</td>
<td>
<table>
<xsl:if test="@os">
<tr><td class="log-text" id="indent">Operating Systems:</td>
<td class="log-text" id="indent"><xsl:value-of select="@os"/></td>
</tr>
</xsl:if>
<xsl:if test="@ws">
<tr><td class="log-text" id="indent">Windows Systems:</td>
<td class="log-text" id="indent"><xsl:value-of select="@ws"/></td>
</tr>
</xsl:if>
<xsl:if test="@nl">
<tr><td class="log-text" id="indent">Languages:</td>
<td class="log-text" id="indent"><xsl:value-of select="@nl"/></td>
</tr>
</xsl:if>
<xsl:if test="@arch">
<tr><td class="log-text" id="indent">Architecture:</td>
<td class="log-text" id="indent"><xsl:value-of select="@arch"/></td>
</tr>
</xsl:if>
</table>
</td>
</tr>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</table>
</body>
</html>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/java"/>
<classpathentry exported="true" kind="lib" path="AppleJavaExtensions.jar"/>
<classpathentry exported="true" kind="lib" path="jinput.jar"/>
<classpathentry exported="true" kind="lib" path="lwjgl.jar"/>
<classpathentry exported="true" kind="lib" path="lwjgl_test.jar"/>
<classpathentry exported="true" kind="lib" path="lwjgl_util.jar"/>
<classpathentry exported="true" kind="lib" path="lwjgl_util_applet.jar"/>
<classpathentry exported="true" kind="lib" path="lzma.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.lwjgl</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,12 +0,0 @@
#Tue Nov 23 14:49:20 CET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -1,38 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: LWJGL Lightweight Java Game Library
Bundle-SymbolicName: org.lwjgl
Bundle-Version: 2.0.0
Bundle-Vendor: Lightweight Java Game Library Project
Bundle-Activator: org.lwjgl.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Export-Package: LZMA,
com.apple.eawt,
com.apple.eio,
net.java.games.input,
net.java.games.util,
net.java.games.util.plugins,
org.lwjgl,
org.lwjgl.input,
org.lwjgl.openal,
org.lwjgl.opencl,
org.lwjgl.opencl.api,
org.lwjgl.opengl,
org.lwjgl.util,
org.lwjgl.util.applet,
org.lwjgl.util.glu,
org.lwjgl.util.glu.tessellation,
org.lwjgl.util.input,
org.lwjgl.util.jinput,
org.lwjgl.util.vector
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .,
lwjgl.jar,
lwjgl_util.jar,
lwjgl_util_applet.jar,
lwjgl_test.jar,
AppleJavaExtensions.jar,
jinput.jar,
lzma.jar

View File

@ -1,11 +0,0 @@
source.. = src/java/
output.. = build/classes/
bin.includes = META-INF/,\
.,\
lzma.jar,\
jinput.jar,\
lwjgl.jar,\
lwjgl_test.jar,\
lwjgl_util.jar,\
lwjgl_util_applet.jar,\
native/

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,83 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
/**
* The activator class controls the plug-in life cycle.
*
* @author Jens von Pilgrim (developer@jevopi.de)
* @since Mar 30, 2011
*/
public class Activator extends Plugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.lwjgl";
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
try {
String path = LibraryPathUtil.getLWJGLLibraryPath(context);
Status status = new Status(Status.INFO, PLUGIN_ID, Status.INFO,
"Set org.lwjgl.librarypath to " + path, null);
getLog().log(status);
} catch (Throwable ex) {
Status status = new Status(Status.ERROR, PLUGIN_ID, Status.ERROR,
"Error setting native LWJGL libraries path: " + ex.toString(), ex);
getLog().log(status);
throw new BundleException(status.getMessage(), ex);
}
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}

View File

@ -1,92 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
* Helper class for retrieving plugin relative path of native LWJGL
* libraries and setting the path in the system properties.
*
* @author Jens von Pilgrim
* @since Jan 30, 2011
*/
public class LibraryPathUtil {
public static final String LWJGL_SYSTEM_PROPERTY = "org.lwjgl.librarypath";
public static String[] NATIVEPATH = new String[] { "windows", "macosx",
"linux", "solaris" };
/**
* Returns plugin relative path to native libraries according to
* current operating system.
*
* @return
* @throws OSNotSupportedException
*/
public static String getRelativeLWJGLLibraryPath()
throws OSNotSupportedException {
int iOS = -1;
String osname = System.getProperty("os.name").toLowerCase();
String osarch = System.getProperty("os.arch").toLowerCase();
// applied patch by Carlo Salinari: ignore osarch on windows
// see http://lwjgl.org/forum/index.php/topic,3726.0.html
if (osname.startsWith("windows")) {
iOS = 0;
} else if (osname.startsWith("mac")) {
iOS = 1;
} else if (osname.startsWith("linux")) {
iOS = 2;
} else if (osname.startsWith("solaris")) {
iOS = 3;
}
if (iOS >= 0 && iOS < NATIVEPATH.length) {
String base = "native" + File.separator + NATIVEPATH[iOS];
return base;
} else {
throw new OSNotSupportedException(osname, osarch);
}
}
/**
* Returns absolute path of native LWJGL libraries according to
* current operating system, this path is also set as
* system property.
*
* @param context
* @return
* @throws OSNotSupportedException
* @throws IOException
*/
public static String getLWJGLLibraryPath(BundleContext context)
throws OSNotSupportedException, IOException {
String base = getRelativeLWJGLLibraryPath();
Bundle fragment = context.getBundle();
URL url = FileLocator.resolve(fragment.getEntry(base));
File fileDir = new File(url.getPath());
String path = fileDir.getPath();
System.setProperty(LWJGL_SYSTEM_PROPERTY, path);
return path;
}
}

View File

@ -1,53 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 LWJGL Project and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
* BSD license, see http://lwjgl.org/license.php for details.
*
* Contributors:
* Jens von Pilgrim - initial implementation
******************************************************************************/
package org.lwjgl;
/**
* Exception thrown by library loader if operating system is not supported.
*
* @author Jens von Pilgrim (developer@jevopi.de)
* @since Jan 30, 2011
*/
public class OSNotSupportedException extends Exception {
String strOSName;
String strOSArch;
/**
* @param i_strOSName
* @param i_strOSArch
*/
public OSNotSupportedException(String i_strOSName, String i_strOSArch) {
super();
strOSName = i_strOSName;
strOSArch = i_strOSArch;
}
/**
* {@inheritDoc}
* @see java.lang.Throwable#getMessage()
*/
@Override
public String getMessage() {
return strOSName + " (" + strOSArch + ") not supported by LWJGL.";
}
/**
* {@inheritDoc}
* @see java.lang.Throwable#toString()
*/
@Override
public String toString() {
return getMessage();
}
}

View File

@ -80,22 +80,8 @@
<arg value="-Dfiles=lwjgl_util-sources.jar,lwjgl_util-javadoc.jar" />
<arg value="-Plwjglgpg" />
</artifact:mvn>
<!-- lwjgl_util_applet.jar -->
<artifact:mvn>
<arg value="${mvncommand}" />
<arg value="-Durl=${mavenrepo}" />
<arg value="-DrepositoryId=${mavenrepoId}" />
<arg value="-DpomFile=lwjgl_util_applet.pom" />
<arg value="-Dfile=lwjgl_util_applet.jar" />
<arg value="-Dtypes=jar,jar" />
<arg value="-Dclassifiers=sources,javadoc" />
<arg value="-Dfiles=lwjgl_util_applet-sources.jar,lwjgl_util_applet-javadoc.jar" />
<arg value="-Plwjglgpg" />
</artifact:mvn>
</target>
</target>
<target name="execute-install">
@ -199,37 +185,8 @@
<arg value="-Dfile=lwjgl_util-javadoc.jar" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Dpackaging=jar" />
</artifact:mvn>
<!-- lwjgl_util_applet.jar -->
<artifact:mvn>
<arg value="${mvncommand}" />
<arg value="-Durl=${mavenrepo}" />
<arg value="-DrepositoryId=${mavenrepoId}" />
<arg value="-DpomFile=lwjgl_util_applet.pom" />
<arg value="-Dfile=lwjgl_util_applet.jar" />
</artifact:mvn>
<artifact:mvn>
<arg value="${mvncommand}" />
<arg value="-Durl=${mavenrepo}" />
<arg value="-DrepositoryId=${mavenrepoId}" />
<arg value="-DpomFile=lwjgl_util_applet.pom" />
<arg value="-Dfile=lwjgl_util_applet-sources.jar" />
<arg value="-Dclassifier=sources" />
</artifact:mvn>
<artifact:mvn>
<arg value="${mvncommand}" />
<arg value="-Durl=${mavenrepo}" />
<arg value="-DrepositoryId=${mavenrepoId}" />
<arg value="-DpomFile=lwjgl_util_applet.pom" />
<arg value="-Dfile=lwjgl_util_applet-javadoc.jar" />
<arg value="-Dclassifier=javadoc" />
</artifact:mvn>
</artifact:mvn>
</target>
</project>

View File

@ -1,19 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>parent</artifactId>
<version>@VERSION@</version>
</parent>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>lwjgl_util_applet</artifactId>
<packaging>jar</packaging>
<name>Lighweight Java Game Library</name>
<version>@VERSION@</version>
<description>Lighweight Java Game Library</description>
<url>http://lwjgl.org/</url>
<scm>
<url>http://java-game-lib.svn.sourceforge.net/viewvc/java-game-lib/trunk/</url>
<connection>https://java-game-lib.svn.sourceforge.net/svnroot/java-game-lib </connection>
</scm>
</project>

View File

@ -77,7 +77,7 @@
<target name="compile32" unless="build.64bit.only">
<mkdir dir="x32"/>
<apply dir="x32" executable="cc" skipemptyfilesets="true" failonerror="true">
<apply dir="x32" executable="cc" failonerror="true">
<arg line="${cflags32} ${cflags_pthread}"/>
<arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/freebsd"/>
@ -91,12 +91,13 @@
<arg value="-I${native}/common/opengl"/>
<arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengl"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengl" includes="*.c"/>
<fileset dir="${native}/linux" includes="*.c"/>
<fileset dir="${native}/linux/opengl" includes="*.c"/>
</apply>
@ -112,7 +113,7 @@
<target name="compile64" unless="build.32bit.only">
<mkdir dir="x64"/>
<apply dir="x64" executable="cc" skipemptyfilesets="true" failonerror="true">
<apply dir="x64" executable="cc" failonerror="true">
<arg line="${cflags64} ${cflags_pthread}"/>
<arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/freebsd"/>
@ -126,12 +127,13 @@
<arg value="-I${native}/common/opengl"/>
<arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengl"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengl" includes="*.c"/>
<fileset dir="${native}/linux" includes="*.c"/>
<fileset dir="${native}/linux/opengl" includes="*.c"/>
</apply>

View File

@ -1,147 +0,0 @@
<project name="applet">
<!-- Create our packer task -->
<taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task" classpath="platform_build/Pack200Task.jar"/>
<target name="applet">
<antcall target="-applet">
<param name="keystore" value="applet/lwjglkeystore"/>
<param name="alias" value="lwjgl"/>
<param name="password" value="123456"/>
</antcall>
</target>
<target name="applet-release">
<input message="Please enter the keystore" addproperty="keystore.location" defaultvalue="applet/lwjglkeystore"/>
<input message="Please enter the keystore alias" addproperty="keystore.alias" defaultvalue="lwjgl"/>
<input message="Please type the password for the keystore" addproperty="sign.pwd" defaultvalue="123456"/>
<antcall target="-applet">
<!--
<param name="keystore" value="signing/matzon_java_code_signing.keystore"/>
<param name="alias" value="oddlabs_java_code_signing"/>
<param name="password" value="${sign.pwd}"/>
-->
<param name="keystore" value="${keystore.location}"/>
<param name="alias" value="${keystore.alias}"/>
<param name="password" value="${sign.pwd}"/>
</antcall>
</target>
<target name="-applet">
<!-- Create lwjgl_applet.jar -->
<jar destfile="applet/basic/lwjgl_applet.jar" taskname="lwjgl_applet.jar">
<fileset refid="lwjgl_applet.fileset" />
</jar>
<!-- create each of the native jars -->
<jar destfile="applet/basic/windows_natives.jar" taskname="windows_natives.jar">
<fileset dir="${lwjgl.lib}/windows">
<patternset refid="lwjgl-windows.fileset"/>
</fileset>
</jar>
<signjar jar="applet/basic/windows_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<jar destfile="applet/basic/linux_natives.jar" taskname="linux_natives.jar">
<fileset dir="${lwjgl.lib}/linux">
<patternset refid="lwjgl-linux.fileset"/>
</fileset>
</jar>
<signjar jar="applet/basic/linux_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<jar destfile="applet/basic/macosx_natives.jar" taskname="macosx_natives.jar">
<fileset dir="${lwjgl.lib}/macosx">
<patternset refid="lwjgl-macosx.fileset"/>
</fileset>
</jar>
<signjar jar="applet/basic/macosx_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<jar destfile="applet/basic/solaris_natives.jar" taskname="solaris_natives.jar">
<fileset dir="${lwjgl.lib}/solaris">
<patternset refid="lwjgl-solaris.fileset"/>
</fileset>
</jar>
<signjar jar="applet/basic/solaris_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<copy file="${lwjgl.lib}/lwjgl.jar" todir="applet/basic" overwrite="true"/>
<copy file="${lwjgl.lib}/lwjgl-debug.jar" todir="applet/basic" overwrite="true"/>
<copy file="${lwjgl.lib}/lwjgl_util_applet.jar" todir="applet/basic" overwrite="true"/>
<copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet/basic" overwrite="true"/>
<copy file="${lwjgl.lib}/jinput.jar" todir="applet/basic" overwrite="true"/>
<copy file="${lwjgl.lib}/lzma.jar" todir="applet/advance" overwrite="true"/>
<signjar jar="applet/basic/lwjgl_util_applet.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="applet/advance/lzma.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<copy file="applet/basic/lwjgl_util_applet.jar" todir="applet/advance" overwrite="true"/>
<!-- LZMA only, for 1.4 only clients -->
<!--antcall target="compress-resource">
<param name="input" value="applet/basic/lwjgl.jar"/>
<param name="output" value="applet/advance/lwjgl.jar.lzma"/>
</antcall>
<antcall target="compress-resource">
<param name="input" value="applet/basic/lwjgl-debug.jar"/>
<param name="output" value="applet/advance/lwjgl-debug.jar.lzma"/>
</antcall>
<antcall target="compress-resource">
<param name="input" value="applet/basic/lwjgl_util.jar"/>
<param name="output" value="applet/advance/lwjgl_util.jar.lzma"/>
</antcall>
<antcall target="compress-resource">
<param name="input" value="applet/basic/jinput.jar"/>
<param name="output" value="applet/advance/jinput.jar.lzma"/>
</antcall>
<antcall target="compress-resource">
<param name="input" value="applet/basic/lwjgl_applet.jar"/>
<param name="output" value="applet/advance/lwjgl_applet.jar.lzma"/>
</antcall>
<antcall target="compress-resource">
<param name="input" value="applet/basic/windows_natives.jar"/>
<param name="output" value="applet/advance/windows_natives.jar.lzma"/>
</antcall -->
<antcall target="compress-sign-class">
<param name="dir" value="applet/basic/"/>
<param name="outputdir" value="applet/advance/"/>
<param name="jarfile" value="lwjgl"/>
</antcall>
<antcall target="compress-sign-class">
<param name="dir" value="applet/basic/"/>
<param name="outputdir" value="applet/advance/"/>
<param name="jarfile" value="lwjgl-debug"/>
</antcall>
<antcall target="compress-sign-class">
<param name="dir" value="applet/basic/"/>
<param name="outputdir" value="applet/advance/"/>
<param name="jarfile" value="lwjgl_util"/>
</antcall>
<antcall target="compress-sign-class">
<param name="dir" value="applet/basic/"/>
<param name="outputdir" value="applet/advance/"/>
<param name="jarfile" value="jinput"/>
</antcall>
<antcall target="compress-sign-class">
<param name="dir" value="applet/basic/"/>
<param name="outputdir" value="applet/advance/"/>
<param name="jarfile" value="lwjgl_applet"/>
</antcall>
<antcall target="compress-resource">
<param name="input" value="applet/basic/windows_natives.jar"/>
<param name="output" value="applet/advance/windows_natives.jar.lzma"/>
</antcall>
<antcall target="compress-resource">
<param name="input" value="applet/basic/macosx_natives.jar"/>
<param name="output" value="applet/advance/macosx_natives.jar.lzma"/>
</antcall>
<antcall target="compress-resource">
<param name="input" value="applet/basic/linux_natives.jar"/>
<param name="output" value="applet/advance/linux_natives.jar.lzma"/>
</antcall>
<antcall target="compress-resource">
<param name="input" value="applet/basic/solaris_natives.jar"/>
<param name="output" value="applet/advance/solaris_natives.jar.lzma"/>
</antcall>
</target>
</project>

View File

@ -1,203 +1,198 @@
<project name="definitions">
<!-- ================================================================== -->
<!-- Global properties for build -->
<!-- ================================================================== -->
<property name="lwjgl.src" location="src" />
<property name="lwjgl.src.native" location="${lwjgl.src}/native" />
<property name="lwjgl.src.headers" location="${lwjgl.src.native}/common" />
<property name="lwjgl.src.templates" location="${lwjgl.src}/templates" />
<property name="lwjgl.bin" location="bin" />
<property name="lwjgl.lib" location="libs" />
<property name="lwjgl.dist" location="dist" />
<property name="lwjgl.docs" location="doc" />
<property name="lwjgl.temp" location="temp" />
<property name="lwjgl.res" location="res" />
<property name="lwjgl.version" value="2.9.2" />
<property name="lwjgl.web" location="www" />
<property name="lwjgl.src.templates.al" location="${lwjgl.src.templates}/org/lwjgl/openal"/>
<property name="lwjgl.src.templates.gl" location="${lwjgl.src.templates}/org/lwjgl/opengl"/>
<property name="lwjgl.src.templates.gles" location="${lwjgl.src.templates}/org/lwjgl/opengles"/>
<property name="lwjgl.src.templates.cl" location="${lwjgl.src.templates}/org/lwjgl/opencl"/>
<property name="openal-template-pattern" value="AL*.java,EFX*.java"/>
<property name="opengl-template-pattern" value="GL*.java,ARB*.java,EXT*.java,KHR*.java,AMD*.java,APPLE*.java,ATI*.java,NV*.java,NVX*.java,HP*.java,IBM*.java,SUN*.java,SGIS*.java,GREMEDY*.java,INTEL*.java"/>
<property name="opengles-template-pattern" value="GLES*.java,ARB*.java,EXT*.java,KHR*.java,AMD*.java,ANGLE*.java,APPLE*.java,ARM*.java,DMP*.java,IMG*.java,NV*.java,OES*.java,QCOM*.java,VIV*.java"/>
<property name="opencl-template-pattern-extensions" value="KHR*.java,EXT*.java,APPLE*.java,AMD*.java,INTEL*.java,NV*.java"/>
<property name="opencl-template-pattern" value="CL*.java,${opencl-template-pattern-extensions}"/>
<!-- ================================================================== -->
<!-- Filesets used for targets -->
<!-- ================================================================== -->
<!-- Files to include in the lwjgl.jar file -->
<fileset id="lwjgl.fileset" dir="${lwjgl.bin}">
<patternset id="lwjgl.package.pattern">
<include name="org/**/*" />
<exclude name="org/lwjgl/opengles/**"/>
<exclude name="org/lwjgl/d3d/**" />
<exclude name="org/lwjgl/test/**" />
<exclude name="org/lwjgl/util/**" />
<exclude name="org/lwjgl/examples/**" />
</patternset>
</fileset>
<fileset id="lwjgl.fileset.dependencies" dir="${lwjgl.bin}">
<patternset id="lwjgl.package.dependencies.pattern">
<include name="org/lwjgl/opengles/ContextAttribs*.*"/>
</patternset>
</fileset>
<!-- Files to include in the lwjgl_util_applet.jar file -->
<fileset id="lwjgl_util_applet.fileset" dir="${lwjgl.bin}">
<patternset id="lwjgl_util_applet.package.pattern">
<exclude name="**.*"/>
<include name="org/lwjgl/util/applet/**"/>
</patternset>
</fileset>
<!-- Files to include in the lwjgl_test.jar file -->
<fileset id="lwjgl_test.fileset" dir="${lwjgl.bin}">
<exclude name="**.*" />
<include name="org/lwjgl/test/**" />
<exclude name="org/lwjgl/test/opengles/**"/>
<include name="org/lwjgl/examples/**" />
</fileset>
<!-- More files to include in the lwjgl_test.jar file -->
<fileset id="lwjgl_test_extra.fileset" dir="${lwjgl.src}/java">
<exclude name="**.*" />
<include name="org/lwjgl/test/opengl/shaders/*.fp" />
<include name="org/lwjgl/test/opengl/shaders/*.vp" />
<include name="org/lwjgl/test/opengl/shaders/*.vsh" />
<include name="org/lwjgl/test/opengl/shaders/*.fsh" />
<include name="org/lwjgl/test/opencl/gl/*.cl" />
</fileset>
<!-- Files to include in the lwjgl_test.jar file for the ES build -->
<fileset id="lwjgl_test_es.fileset" dir="${lwjgl.bin}">
<exclude name="**.*"/>
<include name="org/lwjgl/test/**"/>
<exclude name="org/lwjgl/test/opengl/**"/>
<exclude name="org/lwjgl/test/*.*"/>
</fileset>
<!-- Files to include in the lwjgl_util.jar file -->
<fileset id="lwjgl_util.fileset" dir="${lwjgl.bin}">
<patternset id="lwjgl_util.package.pattern">
<exclude name="**.*" />
<exclude name="org/lwjgl/util/generator/**" />
<exclude name="org/lwjgl/util/applet/**" />
<include name="org/lwjgl/util/**" />
</patternset>
</fileset>
<!-- Files to include in the lwjgl_applet.jar file -->
<fileset id="lwjgl_applet.fileset" dir="${lwjgl.bin}">
<exclude name="**.*"/>
<include name="org/lwjgl/test/applet/**"/>
<include name="org/lwjgl/test/opengl/awt/AWTGearsCanvas.class"/>
</fileset>
<!-- Files to make Javadoc from -->
<fileset id="lwjgl.javadoc.fileset" dir="${lwjgl.src}">
<include name="**/*.java" />
<exclude name="native/**" />
<exclude name="templates/**" />
<exclude name="java/org/lwjgl/test/**" />
<exclude name="java/org/lwjgl/examples/**" />
<exclude name="java/org/lwjgl/util/generator/**" />
</fileset>
<!-- Files to include in doc package -->
<patternset id="lwjgl-docs.fileset">
<include name="CREDITS" />
<include name="LICENSE" />
<include name="README" />
<include name="lwjgl_hidden_switches.text" />
<include name="3rdparty/*" />
</patternset>
<!-- Files to include in windows package -->
<patternset id="lwjgl-windows.fileset">
<patternset id="lwjgl-windows-lwjgl.fileset">
<include name="lwjgl.dll" />
<include name="lwjgl64.dll" />
<include name="OpenAL32.dll" />
<include name="OpenAL64.dll" />
</patternset>
<patternset id="lwjgl-windows-jinput.fileset">
<include name="jinput-dx8*.dll" />
<include name="jinput-raw*.dll" />
</patternset>
</patternset>
<!-- Files to include in linux, glibc2.3 package -->
<patternset id="lwjgl-linux.fileset">
<patternset id="lwjgl-linux-lwjgl.fileset">
<include name="liblwjgl*.so" />
<include name="libopenal*.so" />
</patternset>
<patternset id="lwjgl-linux-jinput.fileset">
<include name="libjinput-linux.so" />
<include name="libjinput-linux64.so" />
</patternset>
</patternset>
<!-- Files to include in mac os x package -->
<patternset id="lwjgl-macosx.fileset">
<patternset id="lwjgl-macosx-lwjgl.fileset">
<include name="liblwjgl.dylib" />
<include name="openal.dylib" />
</patternset>
<patternset id="lwjgl-macosx-jinput.fileset">
<include name="libjinput-osx.dylib" />
<include name="libjinput-osx-legacy.dylib" />
</patternset>
</patternset>
<!-- Files to include in solaris package -->
<patternset id="lwjgl-solaris.fileset">
<include name="liblwjgl*.so" />
<include name="libopenal*.so" />
</patternset>
<!-- Files to include in source distribution -->
<fileset id="lwjgl.source.fileset" dir=".">
<include name="build.xml" />
<include name="src/**" />
<include name="platform_build/**/*" />
</fileset>
<!-- files in the base package -->
<patternset id="lwjgl_base">
<include name="**" />
<exclude name="res/ILtest.*" />
<exclude name="res/Missing_you.mod" />
<exclude name="res/phero*.*" />
</patternset>
<!-- files in the optional package -->
<patternset id="lwjgl_optional">
<include name="res/**" />
<exclude name="res/logo/**" />
<exclude name="res/spaceinvaders/**" />
<exclude name="res/*.wav" />
<exclude name="res/*.xpm" />
<include name="doc/CREDITS" />
<include name="doc/LICENSE" />
<include name="doc/README" />
</patternset>
<!-- files in the lwjgl_applet package -->
<patternset id="lwjgl_applet">
<include name="applet/**" />
<exclude name="applet/appletviewer.policy" />
<exclude name="applet/lwjglkeystore" />
</patternset>
<uptodate property="lwjgl.main.built" targetfile="${lwjgl.lib}/windows/lwjgl.dll" >
<srcfiles dir= "${lwjgl.src.native}/common" includes="*.c*"/>
<srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/>
</uptodate>
</project>
<project name="definitions" basedir="/dev/null">
<!-- ================================================================== -->
<!-- Global properties for build -->
<!-- ================================================================== -->
<property name="lwjgl.version" value="2.9.4" />
<property name="lwjgl.web" location="www" />
<property name="lwjgl.lib" location="libs" />
<property name="lwjgl.target" location="target" />
<!-- Intermediates -->
<property name="lwjgl.target.gen" location="${lwjgl.target}/gen" />
<property name="lwjgl.target.gen.classes" location="${lwjgl.target.gen}/classes" />
<property name="lwjgl.target.gen.java" location="${lwjgl.target.gen}/java" />
<property name="lwjgl.target.gen.headers" location="${lwjgl.target.gen}/headers" />
<property name="lwjgl.target.gen.native" location="${lwjgl.target.gen}/native" />
<property name="lwjgl.target.gen.obj" location="${lwjgl.target.gen}/obj" />
<property name="lwjgl.target.staging" location="${lwjgl.target}/staging" />
<!-- Artifacts -->
<property name="lwjgl.target.jars" location="${lwjgl.target}/jars" />
<property name="lwjgl.target.natives" location="${lwjgl.target}/natives" />
<property name="lwjgl.target.doc" location="${lwjgl.target}/doc" />
<property name="lwjgl.target.bundle" location="${lwjgl.target}/bundle" />
<!-- Sources -->
<property name="lwjgl.src" location="src" />
<property name="lwjgl.src.java" location="${lwjgl.src}/java" />
<property name="lwjgl.src.native" location="${lwjgl.src}/native" />
<property name="lwjgl.src.templates" location="${lwjgl.src}/templates" />
<property name="lwjgl.src.stubs" location="${lwjgl.src}/stubs" />
<property name="lwjgl.src.templates.al" location="${lwjgl.src.templates}/org/lwjgl/openal"/>
<property name="lwjgl.src.templates.gl" location="${lwjgl.src.templates}/org/lwjgl/opengl"/>
<property name="lwjgl.src.templates.gles" location="${lwjgl.src.templates}/org/lwjgl/opengles"/>
<property name="lwjgl.src.templates.cl" location="${lwjgl.src.templates}/org/lwjgl/opencl"/>
<property name="openal-template-pattern" value="AL*.java,EFX*.java"/>
<property name="opengl-template-pattern" value="GL*.java,ARB*.java,EXT*.java,KHR*.java,AMD*.java,APPLE*.java,ATI*.java,NV*.java,NVX*.java,HP*.java,IBM*.java,SUN*.java,SGIS*.java,GREMEDY*.java,INTEL*.java"/>
<property name="opengles-template-pattern" value="GLES*.java,ARB*.java,EXT*.java,KHR*.java,AMD*.java,ANGLE*.java,APPLE*.java,ARM*.java,DMP*.java,IMG*.java,NV*.java,OES*.java,QCOM*.java,VIV*.java"/>
<property name="opencl-template-pattern-extensions" value="KHR*.java,EXT*.java,APPLE*.java,AMD*.java,INTEL*.java,NV*.java"/>
<property name="opencl-template-pattern" value="CL*.java,${opencl-template-pattern-extensions}"/>
<!-- Compilers -->
<!-- Appears to be 25% faster than Clang -->
<property name="lwjgl.compiler.native.linux" value="gcc"/>
<!--<property name="lwjgl.compiler.native.linux" value="clang"/>-->
<!-- ================================================================== -->
<!-- Filesets used for targets -->
<!-- ================================================================== -->
<!-- Files to include in the lwjgl.jar file -->
<fileset id="lwjgl.fileset" dir="${lwjgl.target.gen.classes}">
<patternset id="lwjgl.package.pattern">
<include name="org/**/*" />
<exclude name="org/lwjgl/opengles/**"/>
<exclude name="org/lwjgl/d3d/**" />
<exclude name="org/lwjgl/test/**" />
<exclude name="org/lwjgl/util/**" />
<exclude name="org/lwjgl/examples/**" />
</patternset>
</fileset>
<fileset id="lwjgl.fileset.dependencies" dir="${lwjgl.target.gen.classes}">
<patternset id="lwjgl.package.dependencies.pattern">
<include name="org/lwjgl/opengles/ContextAttribs*.*"/>
</patternset>
</fileset>
<!-- Files to include in the lwjgl_test.jar file -->
<fileset id="lwjgl_test.fileset" dir="${lwjgl.target.gen.classes}">
<exclude name="**.*" />
<include name="org/lwjgl/test/**" />
<exclude name="org/lwjgl/test/opengles/**"/>
<include name="org/lwjgl/examples/**" />
</fileset>
<!-- More files to include in the lwjgl_test.jar file -->
<fileset id="lwjgl_test_extra.fileset" dir="${lwjgl.src}/java">
<exclude name="**.*" />
<include name="org/lwjgl/test/opengl/shaders/*.fp" />
<include name="org/lwjgl/test/opengl/shaders/*.vp" />
<include name="org/lwjgl/test/opengl/shaders/*.vsh" />
<include name="org/lwjgl/test/opengl/shaders/*.fsh" />
<include name="org/lwjgl/test/opencl/gl/*.cl" />
</fileset>
<!-- Files to include in the lwjgl_test.jar file for the ES build -->
<fileset id="lwjgl_test_es.fileset" dir="${lwjgl.target.gen.classes}">
<exclude name="**.*"/>
<include name="org/lwjgl/test/**"/>
<exclude name="org/lwjgl/test/opengl/**"/>
<exclude name="org/lwjgl/test/*.*"/>
</fileset>
<!-- Files to include in the lwjgl_util.jar file -->
<fileset id="lwjgl_util.fileset" dir="${lwjgl.target.gen.classes}">
<patternset id="lwjgl_util.package.pattern">
<exclude name="**.*" />
<exclude name="org/lwjgl/util/generator/**" />
<include name="org/lwjgl/util/**" />
</patternset>
</fileset>
<!-- Files to make Javadoc from -->
<fileset id="lwjgl.javadoc.fileset" dir="${lwjgl.src}">
<include name="**/*.java" />
<exclude name="native/**" />
<exclude name="templates/**" />
<exclude name="java/org/lwjgl/test/**" />
<exclude name="java/org/lwjgl/examples/**" />
<exclude name="java/org/lwjgl/util/generator/**" />
</fileset>
<!-- Files to include in doc package -->
<patternset id="lwjgl-docs.fileset">
<include name="CREDITS" />
<include name="LICENSE" />
<include name="README" />
<include name="lwjgl_hidden_switches.text" />
<include name="3rdparty/*" />
</patternset>
<!-- Files to include in windows package -->
<patternset id="lwjgl-windows.fileset">
<patternset id="lwjgl-windows-lwjgl.fileset">
<include name="lwjgl.dll" />
<include name="lwjgl64.dll" />
<include name="OpenAL32.dll" />
<include name="OpenAL64.dll" />
</patternset>
<patternset id="lwjgl-windows-jinput.fileset">
<include name="jinput-dx8*.dll" />
<include name="jinput-raw*.dll" />
</patternset>
</patternset>
<!-- Files to include in linux, glibc2.3 package -->
<patternset id="lwjgl-linux.fileset">
<patternset id="lwjgl-linux-lwjgl.fileset">
<include name="liblwjgl*.so" />
<include name="libopenal*.so" />
</patternset>
<patternset id="lwjgl-linux-jinput.fileset">
<include name="libjinput-linux.so" />
<include name="libjinput-linux64.so" />
</patternset>
</patternset>
<!-- Files to include in mac os x package -->
<patternset id="lwjgl-macosx.fileset">
<patternset id="lwjgl-macosx-lwjgl.fileset">
<include name="liblwjgl.dylib" />
<include name="openal.dylib" />
</patternset>
<patternset id="lwjgl-macosx-jinput.fileset">
<include name="libjinput-osx.dylib" />
<include name="libjinput-osx-legacy.dylib" />
</patternset>
</patternset>
<!-- Files to include in solaris package -->
<patternset id="lwjgl-solaris.fileset">
<include name="liblwjgl*.so" />
<include name="libopenal*.so" />
</patternset>
<!-- Files to include in source distribution -->
<fileset id="lwjgl.source.fileset" dir=".">
<include name="build.xml" />
<include name="src/**" />
<include name="platform_build/**/*" />
</fileset>
<!-- files in the base package -->
<patternset id="lwjgl_base">
<include name="**" />
<exclude name="res/ILtest.*" />
<exclude name="res/Missing_you.mod" />
<exclude name="res/phero*.*" />
</patternset>
<!-- files in the optional package -->
<patternset id="lwjgl_optional">
<include name="res/**" />
<exclude name="res/logo/**" />
<exclude name="res/spaceinvaders/**" />
<exclude name="res/*.wav" />
<exclude name="res/*.xpm" />
<include name="doc/CREDITS" />
<include name="doc/LICENSE" />
<include name="doc/README" />
</patternset>
<uptodate property="lwjgl.main.built" targetfile="${lwjgl.target.natives}/lwjgl.dll" >
<srcfiles dir= "${lwjgl.src.native}/common" includes="*.c*"/>
<srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/>
</uptodate>
</project>

View File

@ -1,64 +1,40 @@
<project name="generator">
<project name="generator" basedir="/dev/null">
<import file="build-definitions.xml"/>
<!-- clean the generated files -->
<target name="clean-generated" description="Deletes the generated java source">
<delete quiet="true" failonerror="false">
<fileset dir="${lwjgl.src}/generated" includes="**"/>
</delete>
</target>
<target name="clean-generated-native" description="Deletes the generated native source" depends="clean-generated">
<delete quiet="false" failonerror="false">
<fileset dir="${lwjgl.src.native}/generated" includes="**"/>
</delete>
</target>
<!-- Compiles the Java generator source code -->
<target name="generators" description="Compiles the native method generators">
<mkdir dir="${lwjgl.src}/generated/"/>
<mkdir dir="${lwjgl.src.native}/generated/openal"/>
<mkdir dir="${lwjgl.src.native}/generated/opengl"/>
<mkdir dir="${lwjgl.src.native}/generated/opengles"/>
<mkdir dir="${lwjgl.src.native}/generated/opencl"/>
<target name="-generate-common" description="Performs up for the generators and compiles common classes for the templates.">
<condition property="javac.args.debug" value="-Ageneratechecks" else="-Anogeneratechecks">
<istrue value="${enable_debug}"/>
</condition>
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.6" target="1.6" includes="org/lwjgl/util/generator/**.java" taskname="generator">
<include name="org/lwjgl/util/generator/openal/**.java"/>
<include name="org/lwjgl/util/generator/opengl/**.java"/>
<include name="org/lwjgl/util/generator/opengles/**.java"/>
<include name="org/lwjgl/util/generator/opencl/**.java"/>
<compilerarg value="-Xlint:none"/>
</javac>
<mkdir dir="${lwjgl.target.gen.java}/"/>
<mkdir dir="${lwjgl.target.gen.classes}"/>
<!-- Compile helper classes used by the templates -->
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.5" target="1.5" taskname="generator">
<javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator">
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.java}:${lwjgl.src.stubs}"/>
<include name="org/lwjgl/PointerWrapper.java"/>
<include name="org/lwjgl/PointerBuffer.java"/>
<!-- OpenGL -->
<include name="org/lwjgl/opengl/GLSync.java"/>
<include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/>
<include name="org/lwjgl/opengl/ARBDebugOutputCallback.java"/>
<include name="org/lwjgl/opengl/KHRDebugCallback.java"/>
<!-- OpenGL ES -->
<include name="org/lwjgl/opengles/EGLImageOES.java"/>
<include name="org/lwjgl/opengles/KHRDebugCallback.java"/>
<!-- OpenCL -->
<include name="org/lwjgl/opencl/CLPlatform.java"/>
<include name="org/lwjgl/opencl/CLDevice.java"/>
<include name="org/lwjgl/opencl/CLContext.java"/>
<include name="org/lwjgl/opencl/CLCommandQueue.java"/>
<include name="org/lwjgl/opencl/CLMem.java"/>
<include name="org/lwjgl/opencl/CL*Callback.java"/>
<include name="org/lwjgl/opencl/CLNativeKernel.java"/>
<include name="org/lwjgl/opencl/CLFunctionAddress.java"/>
</javac>
</target>
<!-- Proxy target to generate it all -->
<target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references, generate-opengles, generate-opengles-capabilities, generate-opencl, generate-opencl-capabilities" description="Generates java and native source"/>
<target name="generate-all" depends="-generate-common" description="Generates java and native source">
<parallel>
<antcall target="generate-openal"/>
<antcall target="generate-opengles"/>
<target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references, generate-opengles-debug, generate-opengles-capabilities-debug, generate-opencl-debug, generate-opencl-capabilities-debug" description="Generates java and native source with debug functionality"/>
<sequential>
<antcall target="-compile-opencl-helpers"/>
<parallel>
<antcall target="generate-opengl"/>
<antcall target="generate-opencl"/>
</parallel>
</sequential>
</parallel>
</target>
<!-- ********************************************************************************
*********************************************************************************
@ -67,19 +43,31 @@
**************************************************************************** -->
<!-- Generate OpenAL -->
<target name="generate-openal" depends="generators" description="Generates java and native source for AL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.al}" fork="true" taskname="processor">
<target name="generate-openal" description="Generates java and native source for AL">
<mkdir dir="${lwjgl.target.gen.native}/openal"/>
<javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator">
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.java}:${lwjgl.src.stubs}"/>
<include name="org/lwjgl/util/generator/openal/**.java"/>
<compilerarg value="-Xlint:none"/>
</javac>
<javac destdir="${lwjgl.target.gen.native}/openal" source="1.8" target="1.8" srcdir="${lwjgl.src.templates.al}" fork="true" taskname="GeneratorProcessor+OpenAL">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.GeneratorProcessor"/>
<compilerarg value="-processorpath"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-d"/>
<compilerarg path="${lwjgl.src.native}/generated/openal"/>
<compilerarg value="-Abinpath=${lwjgl.bin}"/>
<compilerarg path="${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenJavaPath=${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenNativePath=${lwjgl.target.gen.native}/openal"/>
<compilerarg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
<compilerarg value="${javac.args.debug}"/>
<compilerarg value="-J-XX:CompileThreshold=1"/>
<src>
<fileset dir="${lwjgl.src.templates.al}">
<include name="${openal-template-pattern}"/>
@ -88,29 +76,6 @@
</javac>
</target>
<!-- Generate OpenAL [DEBUG] -->
<target name="generate-openal-debug" depends="generators" description="Generates java and native source for AL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.al}" fork="true" taskname="processor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.GeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-d"/>
<compilerarg path="${lwjgl.src.native}/generated/openal"/>
<compilerarg value="-Abinpath=${lwjgl.bin}"/>
<compilerarg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
<compilerarg value="-Ageneratechecks"/>
<src>
<fileset dir="${lwjgl.src.templates.al}">
<include name="${openal-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<!-- ********************************************************************************
*********************************************************************************
OPENGL
@ -118,107 +83,92 @@
**************************************************************************** -->
<!-- Generate OpenGL -->
<target name="generate-opengl" depends="generators" description="Generates java and native source for GL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.gl}" fork="true" taskname="processorGL">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.GeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-d"/>
<compilerarg path="${lwjgl.src.native}/generated/opengl"/>
<compilerarg value="-Abinpath=${lwjgl.bin}"/>
<compilerarg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
<compilerarg value="-Acontextspecific"/>
<src>
<fileset dir="${lwjgl.src.templates.gl}">
<include name="${opengl-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<target name="generate-opengl" description="Generates java and native source for GL">
<mkdir dir="${lwjgl.target.gen.native}/opengl"/>
<!-- Generate OpenGL [DEBUG] -->
<target name="generate-opengl-debug" depends="generators" description="Generates debug java and native source for GL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.gl}" fork="true" taskname="processor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.GeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-d"/>
<compilerarg path="${lwjgl.src.native}/generated/opengl"/>
<compilerarg value="-Abinpath=${lwjgl.bin}"/>
<compilerarg value="-Ageneratechecks"/>
<compilerarg value="-Acontextspecific"/>
<compilerarg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
<src>
<fileset dir="${lwjgl.src.templates.gl}">
<include name="${opengl-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator">
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.java}:${lwjgl.src.stubs}"/>
<include name="org/lwjgl/util/generator/opengl/**.java"/>
<compilerarg value="-Xlint:none"/>
</javac>
<!-- Generate OpenGL references -->
<target name="generate-opengl-references" depends="generators" description="Generates java and native source for GL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.gl}" fork="true" taskname="processor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.opengl.GLReferencesGeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<src>
<fileset dir="${lwjgl.src.templates.gl}">
<include name="${opengl-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<!-- Compile helper classes used by the templates -->
<javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator">
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.java}:${lwjgl.src.stubs}"/>
<include name="org/lwjgl/opengl/GLSync.java"/>
<include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/>
<include name="org/lwjgl/opengl/ARBDebugOutputCallback.java"/>
<include name="org/lwjgl/opengl/KHRDebugCallback.java"/>
</javac>
<!-- Generate OpenGL context capabilities -->
<target name="generate-opengl-capabilities" depends="generators" description="Generates java and native source for GL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.gl}" fork="true" taskname="processor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-Acontextspecific"/>
<src>
<fileset dir="${lwjgl.src.templates.gl}">
<include name="${opengl-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<parallel>
<javac destdir="${lwjgl.target.gen.native}/opengl" source="1.8" target="1.8" srcdir="${lwjgl.src.templates.gl}" fork="true" taskname="GeneratorProcessor+OpenGL">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.GeneratorProcessor"/>
<compilerarg value="-processorpath"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenJavaPath=${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenNativePath=${lwjgl.target.gen.native}/opengl"/>
<compilerarg value="${javac.args.debug}"/>
<compilerarg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
<compilerarg value="-Acontextspecific"/>
<compilerarg value="-J-XX:CompileThreshold=1"/>
<src>
<fileset dir="${lwjgl.src.templates.gl}">
<include name="${opengl-template-pattern}"/>
</fileset>
</src>
</javac>
<!-- Generate OpenGL context capabilities [DEBUG] -->
<target name="generate-opengl-capabilities-debug" depends="generators" description="Generates debug java and native source for GL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.gl}" fork="true" taskname="processor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-Ageneratechecks"/>
<compilerarg value="-Acontextspecific"/>
<src>
<fileset dir="${lwjgl.src.templates.gl}">
<include name="${opengl-template-pattern}"/>
</fileset>
</src>
</javac>
<!-- Generate OpenGL references -->
<javac destdir="${lwjgl.target.gen.native}/opengl" source="1.8" target="1.8" srcdir="${lwjgl.src.templates.gl}" fork="true" taskname="GLReferencesGeneratorProcessor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.opengl.GLReferencesGeneratorProcessor"/>
<compilerarg value="-processorpath"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenJavaPath=${lwjgl.target.gen.java}"/>
<compilerarg value="-J-XX:CompileThreshold=1"/>
<src>
<fileset dir="${lwjgl.src.templates.gl}">
<include name="${opengl-template-pattern}"/>
</fileset>
</src>
</javac>
<!-- Generate OpenGL context capabilities -->
<javac destdir="${lwjgl.target.gen.native}/opengl" source="1.8" target="1.8" srcdir="${lwjgl.src.templates.gl}" fork="true" taskname="GLGeneratorProcessor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessor"/>
<compilerarg value="-processorpath"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenJavaPath=${lwjgl.target.gen.java}"/>
<compilerarg value="${javac.args.debug}"/>
<compilerarg value="-Acontextspecific"/>
<compilerarg value="-J-XX:CompileThreshold=1"/>
<src>
<fileset dir="${lwjgl.src.templates.gl}">
<include name="${opengl-template-pattern}"/>
</fileset>
</src>
</javac>
</parallel>
</target>
<!-- ********************************************************************************
@ -228,89 +178,70 @@
**************************************************************************** -->
<!-- Generate OpenGL ES -->
<target name="generate-opengles" depends="generators" description="Generates java and native source for GL ES">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.gles}" fork="true" taskname="processor">
<target name="generate-opengles" description="Generates java and native source for GL ES">
<mkdir dir="${lwjgl.target.gen.native}/opengles"/>
<javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator">
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.java}:${lwjgl.src.stubs}"/>
<include name="org/lwjgl/util/generator/opengles/**.java"/>
<compilerarg value="-Xlint:none"/>
</javac>
<!-- Compile helper classes used by the templates -->
<javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator">
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.java}:${lwjgl.src.stubs}"/>
<include name="org/lwjgl/opengles/EGLImageOES.java"/>
<include name="org/lwjgl/opengles/KHRDebugCallback.java"/>
</javac>
<parallel>
<javac destdir="${lwjgl.target.gen.native}/opengles" source="1.8" target="1.8" srcdir="${lwjgl.src.templates.gles}" fork="true" taskname="GeneratorProcessor+OpenGLES">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.GeneratorProcessor"/>
<compilerarg value="-processorpath"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-d"/>
<compilerarg path="${lwjgl.src.native}/generated/opengles"/>
<compilerarg value="-Abinpath=${lwjgl.bin}"/>
<compilerarg path="${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenJavaPath=${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenNativePath=${lwjgl.target.gen.native}/opengles"/>
<compilerarg value="${javac.args.debug}"/>
<!--<compilerarg value="-Acontextspecific"/>-->
<compilerarg value="-Atypemap=org.lwjgl.util.generator.opengl.GLESTypeMap"/>
<compilerarg value="-J-XX:CompileThreshold=1"/>
<src>
<fileset dir="${lwjgl.src.templates.gles}">
<include name="${opengles-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<!-- Generate OpenGL ES [DEBUG] -->
<target name="generate-opengles-debug" depends="generators" description="Generates debug java and native source for GL ES">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.gles}" fork="true" taskname="processor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.GeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-d"/>
<compilerarg path="${lwjgl.src.native}/generated/opengles"/>
<compilerarg value="-Abinpath=${lwjgl.bin}"/>
<compilerarg value="-Ageneratechecks"/>
<!--<compilerarg value="-Acontextspecific"/>-->
<compilerarg value="-Atypemap=org.lwjgl.util.generator.opengl.GLESTypeMap"/>
<src>
<fileset dir="${lwjgl.src.templates.gles}">
<include name="${opengles-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<!-- Generate OpenGL ES context capabilities -->
<target name="generate-opengles-capabilities" depends="generators" description="Generates java and native source for GL ES">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.gles}" fork="true" taskname="processor">
<!-- Generate OpenGL ES context capabilities -->
<javac destdir="${lwjgl.target.gen.native}/opengles" source="1.8" target="1.8" srcdir="${lwjgl.src.templates.gles}" fork="true" taskname="GLESGeneratorProcessor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.opengl.GLESGeneratorProcessor"/>
<compilerarg value="-processorpath"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<!--<compilerarg value="-Acontextspecific"/>-->
<src>
<fileset dir="${lwjgl.src.templates.gles}">
<include name="${opengles-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<!-- Generate OpenGL ES context capabilities [DEBUG] -->
<target name="generate-opengles-capabilities-debug" depends="generators" description="Generates debug java and native source for GL ES">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.gles}" fork="true" taskname="processor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.opengl.GLESGeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-Ageneratechecks"/>
<compilerarg path="${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenJavaPath=${lwjgl.target.gen.java}"/>
<compilerarg value="${javac.args.debug}"/>
<!--<compilerarg value="-Acontextspecific"/>-->
<compilerarg value="-J-XX:CompileThreshold=1"/>
<src>
<fileset dir="${lwjgl.src.templates.gles}">
<include name="${opengles-template-pattern}"/>
</fileset>
</src>
</javac>
</parallel>
</target>
<!-- ********************************************************************************
@ -319,89 +250,77 @@
*********************************************************************************
**************************************************************************** -->
<!-- Generate OpenCL -->
<target name="generate-opencl" depends="generators" description="Generates java and native source for CL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.cl}" fork="true" taskname="processor">
<target name="-compile-opencl-helpers" description="Compiles java helpers for CL">
<!-- Compile helper classes used by the templates -->
<javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" taskname="generator">
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.java}:${lwjgl.src.stubs}"/>
<include name="org/lwjgl/opencl/CLPlatform.java"/>
<include name="org/lwjgl/opencl/CLDevice.java"/>
<include name="org/lwjgl/opencl/CLContext.java"/>
<include name="org/lwjgl/opencl/CLCommandQueue.java"/>
<include name="org/lwjgl/opencl/CLMem.java"/>
<include name="org/lwjgl/opencl/CL*Callback.java"/>
<include name="org/lwjgl/opencl/CLNativeKernel.java"/>
<include name="org/lwjgl/opencl/CLFunctionAddress.java"/>
</javac>
</target>
<target name="generate-opencl" description="Generates java and native source for CL">
<mkdir dir="${lwjgl.target.gen.native}/opencl"/>
<javac debug="yes" srcdir="${lwjgl.src.java}" destdir="${lwjgl.target.gen.classes}" source="1.8" target="1.8" includes="org/lwjgl/util/generator/**.java" taskname="generator">
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.java}:${lwjgl.src.stubs}"/>
<include name="org/lwjgl/util/generator/opencl/**.java"/>
<compilerarg value="-Xlint:none"/>
</javac>
<parallel>
<javac destdir="${lwjgl.target.gen.native}/opencl" source="1.8" target="1.8" srcdir="${lwjgl.src.templates.cl}" fork="true" taskname="GeneratorProcessor+OpenCL">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.GeneratorProcessor"/>
<compilerarg value="-processorpath"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-d"/>
<compilerarg path="${lwjgl.src.native}/generated/opencl"/>
<compilerarg value="-Abinpath=${lwjgl.bin}"/>
<compilerarg path="${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenJavaPath=${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenNativePath=${lwjgl.target.gen.native}/opencl"/>
<compilerarg value="${javac.args.debug}"/>
<compilerarg value="-Acontextspecific"/>
<compilerarg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
<compilerarg value="-J-XX:CompileThreshold=1"/>
<src>
<fileset dir="${lwjgl.src.templates.cl}">
<include name="${opencl-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<!-- Generate OpenCL [DEBUG] -->
<target name="generate-opencl-debug" depends="generators" description="Generates debug java and native source for CL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.cl}" fork="true" taskname="processor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.GeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-d"/>
<compilerarg path="${lwjgl.src.native}/generated/opencl"/>
<compilerarg value="-Abinpath=${lwjgl.bin}"/>
<compilerarg value="-Ageneratechecks"/>
<compilerarg value="-Acontextspecific"/>
<compilerarg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
<src>
<fileset dir="${lwjgl.src.templates.cl}">
<include name="${opencl-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<!-- Generate OpenCL capabilities -->
<target name="generate-opencl-capabilities" depends="generators" description="Generates capabilities for CL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.cl}" fork="true" taskname="processor">
<!-- Generate OpenCL capabilities -->
<javac destdir="${lwjgl.target.gen.native}/opencl" source="1.8" target="1.8" srcdir="${lwjgl.src.templates.cl}" fork="true" taskname="CLGeneratorProcessor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessor"/>
<compilerarg value="-processorpath"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-Acontextspecific"/>
<src>
<fileset dir="${lwjgl.src.templates.cl}">
<include name="${opencl-template-pattern}"/>
</fileset>
</src>
</javac>
</target>
<!-- Generate OpenCL capabilities [DEBUG] -->
<target name="generate-opencl-capabilities-debug" depends="generators" description="Generates debug capabilities for CL">
<javac destdir="${lwjgl.bin}" source="1.6" target="1.6" srcdir="${lwjgl.src.templates.cl}" fork="true" taskname="processor">
<compilerarg value="-proc:only"/>
<compilerarg value="-processor"/>
<compilerarg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessor"/>
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src}/generated"/>
<compilerarg value="-Ageneratechecks"/>
<compilerarg path="${lwjgl.target.gen.java}"/>
<compilerarg value="-AgenJavaPath=${lwjgl.target.gen.java}"/>
<compilerarg value="${javac.args.debug}"/>
<compilerarg value="-Acontextspecific"/>
<compilerarg value="-J-XX:CompileThreshold=1"/>
<src>
<fileset dir="${lwjgl.src.templates.cl}">
<include name="${opencl-template-pattern}"/>
</fileset>
</src>
</javac>
</parallel>
</target>
</project>

View File

@ -1,22 +1,17 @@
<project name="maven">
<property name="lwjgl.src.java" location="${lwjgl.src}/java" />
<property name="lwjgl.src.generated" location="${lwjgl.src}/generated" />
<project name="maven" basedir="/dev/null">
<property name="lwjgl.maven" location="maven" />
<property name="lwjgl.dstMaven" location="${lwjgl.temp}/maven" />
<property name="lwjgl.dstMaven" location="${lwjgl.target.staging}/maven" />
<property name="lwjgl.src.java" location="${lwjgl.src}/java" />
<property name="jinput.version" value="2.0.5" />
<fileset id="lwjgl-sources.manual.fileset" dir="${lwjgl.src.java}">
<patternset refid="lwjgl.package.pattern" />
<patternset refid="lwjgl.package.dependencies.pattern"/>
</fileset>
<fileset id="lwjgl-sources.generated.fileset" dir="${lwjgl.src.generated}">
<fileset id="lwjgl-sources.generated.fileset" dir="${lwjgl.target.gen.java}">
<include name="**/*" />
</fileset>
<fileset id="lwjgl_util_applet-sources.fileset" dir="${lwjgl.src.java}">
<patternset refid="lwjgl_util_applet.package.pattern" />
</fileset>
<fileset id="lwjgl_util-sources.fileset" dir="${lwjgl.src.java}">
<patternset refid="lwjgl_util.package.pattern" />
@ -104,11 +99,10 @@
<target name="-copylwjgljars">
<copy todir="${lwjgl.dstMaven}">
<fileset dir="${lwjgl.temp}/jar/">
<fileset dir="${lwjgl.target.staging}/jar/">
<patternset>
<include name="lwjgl.jar" />
<include name="lwjgl_util.jar" />
<include name="lwjgl_util_applet.jar" />
</patternset>
</fileset>
</copy>
@ -121,11 +115,7 @@
<fileset refid="lwjgl-sources.manual.fileset" />
<fileset refid="lwjgl-sources.generated.fileset" />
</jar>
<jar destfile="${lwjgl.dstMaven}/lwjgl_util_applet-sources.jar" taskname="lwjgl_util_applet-sources.jar">
<fileset refid="lwjgl_util_applet-sources.fileset" />
</jar>
<jar destfile="${lwjgl.dstMaven}/lwjgl_util-sources.jar" taskname="lwjgl_util-sources.jar">
<fileset refid="lwjgl_util-sources.fileset" />
</jar>
@ -134,7 +124,7 @@
<target name="-createmavenjavadocs">
<!-- Creates the Javadoc -->
<javadoc destdir="${lwjgl.dstMaven}/lwjgl-javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL API" useexternalfile="true">
<javadoc destdir="${lwjgl.dstMaven}/lwjgl-javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.8" windowtitle="LWJGL API" useexternalfile="true">
<fileset refid="lwjgl-sources.manual.fileset"/>
<fileset refid="lwjgl-sources.generated.fileset"/>
<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
@ -144,7 +134,7 @@
<fileset dir="${lwjgl.dstMaven}/lwjgl-javadoc" />
</jar>
<javadoc destdir="${lwjgl.dstMaven}/lwjgl_util-javadoc" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/lwjgl.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL UTIL API" useexternalfile="true">
<javadoc destdir="${lwjgl.dstMaven}/lwjgl_util-javadoc" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/lwjgl.jar" author="true" version="true" use="true" source="1.8" windowtitle="LWJGL UTIL API" useexternalfile="true">
<fileset refid="lwjgl_util-sources.fileset"/>
<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2002-2010 lwjgl.org. All Rights Reserved.</i>]]></bottom>
@ -153,18 +143,8 @@
<fileset dir="${lwjgl.dstMaven}/lwjgl_util-javadoc" />
</jar>
<javadoc destdir="${lwjgl.dstMaven}/lwjgl_util_applet-javadoc" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/lwjgl.jar" author="true" version="true" use="true" source="1.5" windowtitle="LWJGL UTIL API" useexternalfile="true">
<fileset refid="lwjgl_util_applet-sources.fileset"/>
<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2002-2010 lwjgl.org. All Rights Reserved.</i>]]></bottom>
</javadoc>
<jar destfile="${lwjgl.dstMaven}/lwjgl_util_applet-javadoc.jar" taskname="lwjgl_util_applet-javadoc.jar">
<fileset dir="${lwjgl.dstMaven}/lwjgl_util_applet-javadoc" />
</jar>
<delete dir="${lwjgl.dstMaven}/lwjgl-javadoc" quiet="true" failonerror="false" taskname="cleaning maven javadoc temps lwjgl" />
<delete dir="${lwjgl.dstMaven}/lwjgl_util-javadoc" quiet="true" failonerror="false" taskname="cleaning maven javadoc temps lwjgl_util" />
<delete dir="${lwjgl.dstMaven}/lwjgl_util_applet-javadoc" quiet="true" failonerror="false" taskname="cleaning maven javadoc temps lwjgl_util_applet" />
</target>
<target name="-createmavennativejars">
@ -206,6 +186,6 @@
</target>
<target name="-copymaventdist">
<zip destfile="${lwjgl.dist}/lwjgl-maven-${lwjgl.version}.zip" basedir="${lwjgl.temp}" includes="maven/**" />
<zip destfile="${lwjgl.target.bundle}/lwjgl-maven-${lwjgl.version}.zip" basedir="${lwjgl.target.staging}" includes="maven/**" />
</target>
</project>
</project>

View File

@ -1,181 +0,0 @@
<project name="webstart">
<target name="webstart_demo" depends="jars">
<antcall target="-webstart_demo">
<param name="keystore" value="applet/lwjglkeystore"/>
<param name="alias" value="lwjgl"/>
<param name="password" value="123456"/>
</antcall>
</target>
<target name="webstart_demo-release">
<input message="Please type the password for the keystore" addproperty="sign.pwd"/>
<antcall target="-webstart_demo">
<param name="keystore" value="signing/lwjgl.jks"/>
<param name="alias" value="lwjgl"/>
<param name="password" value="${sign.pwd}"/>
</antcall>
</target>
<!-- Create webstart demo and extension from release files -->
<target name="-webstart_demo" description="Using released files, creates the necessary files used for jnlp demos">
<!-- delete existing temp -->
<delete dir="${lwjgl.temp}"/>
<!-- unzip release to temp dir -->
<unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/webstart/temp" overwrite="true"/>
<!-- DEMO SECTION -->
<move file="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/jar/lwjgl_test.jar" tofile="${lwjgl.temp}/webstart/lwjgl_test.jar"/>
<jar destfile="${lwjgl.temp}/webstart/lwjgl_test.jar" update="true">
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<jar destfile="${lwjgl.temp}/webstart/media.jar" basedir="${lwjgl.res}">
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<!-- EXTENSION SECTION -->
<move todir="${lwjgl.temp}/webstart/${lwjgl.version}/" flatten="true">
<fileset dir="${lwjgl.temp}/webstart/temp">
<include name="**/jinput.jar"/>
<include name="**/lwjgl*.jar"/>
<exclude name="**/lwjgl_util_applet.jar"/>
<exclude name="**/lwjgl-debug.jar"/>
</fileset>
</move>
<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl.jar" update="true">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
<attribute name="Specification-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Implementation-Version" value="${lwjgl.version}"/>
<attribute name="Implementation-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
<attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/jinput.jar" update="true">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
<attribute name="Specification-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Implementation-Version" value="${lwjgl.version}"/>
<attribute name="Implementation-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
<attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl_util.jar" update="true">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
<attribute name="Specification-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Implementation-Version" value="${lwjgl.version}"/>
<attribute name="Implementation-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
<attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<!-- create native jars -->
<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_windows.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/windows">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
<attribute name="Specification-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Implementation-Version" value="${lwjgl.version}"/>
<attribute name="Implementation-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
<attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_linux.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/linux">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
<attribute name="Specification-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Implementation-Version" value="${lwjgl.version}"/>
<attribute name="Implementation-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
<attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_macosx.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/macosx">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
<attribute name="Specification-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Implementation-Version" value="${lwjgl.version}"/>
<attribute name="Implementation-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
<attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<jar destfile="${lwjgl.temp}/webstart/${lwjgl.version}/native_solaris.jar" basedir="${lwjgl.temp}/webstart/temp/lwjgl-${lwjgl.version}/native/solaris">
<manifest>
<attribute name="Specification-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Specification-Version" value="${lwjgl.version}"/>
<attribute name="Specification-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Title" value="LWJGL ${lwjgl.version}"/>
<attribute name="Implementation-Version" value="${lwjgl.version}"/>
<attribute name="Implementation-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Vendor-Id" value="org.lwjgl"/>
<attribute name="Extension-Name" value="org.lwjgl"/>
<attribute name="Sealed" value="true"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<!-- sign 'em -->
<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/webstart/${lwjgl.version}/native_windows.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<!-- copy over extension jnlp file -->
<copy todir="${lwjgl.temp}/webstart/${lwjgl.version}">
<fileset dir="${lwjgl.web}/webstart">
<include name="extension.jnlp"/>
</fileset>
<filterset>
<filter token="LWJGL_VERSION" value="${lwjgl.version}"/>
</filterset>
</copy>
<!-- nuke extracted dir -->
<delete dir="${lwjgl.temp}/webstart/temp"/>
</target>
</project>

View File

@ -1,126 +1,118 @@
<?xml version="1.0"?>
<project name="lwjgl native code, linux" basedir="../../bin/lwjgl" default="compile">
<property name="native" location="../../src/native"/>
<project name="lwjgl native code, linux" basedir="/dev/null" default="compile">
<property name="libname32" value="liblwjgl.so"/>
<property name="libname64" value="liblwjgl64.so"/>
<property name="libs32" value="-L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib/i386 -ljawt" />
<property name="libs64" value="-L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib/amd64 -ljawt" />
<property name="cflags32" value="-O2 -Wall -c -fPIC -std=c99 -Wunused"/>
<property name="libs32" value="-L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib -L${java.home}/lib/i386 -ljawt" />
<property name="libs64" value="-L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib -L${java.home}/lib/amd64 -ljawt" />
<property name="cflags32" value="-O3 -Wall -c -fPIC -std=c99 -Wunused"/>
<target name="clean">
<delete>
<fileset dir="x32"/>
<fileset dir="x64"/>
<fileset dir="." includes="*.o"/>
<fileset dir="." includes="*.so"/>
</delete>
</target>
<target name="compile">
<target name="compile">
<exec executable="uname" outputproperty="hwplatform">
<arg value="-m"/>
</exec>
<condition property="cflags_pthread" value="-pthreads" else="-pthread">
<os name="SunOS" />
</condition>
<condition property="version_script_flags32" value="" else="-Wl,--version-script='${native}/linux/lwjgl.map'">
<condition property="version_script_flags32" value="" else="-Wl,--version-script='${lwjgl.src.native}/linux/lwjgl.map'">
<os name="SunOS" />
</condition>
<condition property="version_script_flags64" value="-m64" else="-Wl,--version-script='${native}/linux/lwjgl.map'">
<condition property="version_script_flags64" value="-m64" else="-Wl,--version-script='${lwjgl.src.native}/linux/lwjgl.map'">
<and>
<os name="SunOS" />
</and>
</condition>
<condition property="cflags64" value="-O2 -m64 -Wall -c -fPIC -std=c99 -Wunused" else="-O2 -Wall -c -fPIC -std=c99 -Wunused">
<os name="SunOS" />
</condition>
<condition property="cflags64" value="-O3 -m64 -Wall -c -fPIC -std=c99 -Wunused" else="-O3 -Wall -c -fPIC -std=c99 -Wunused">
<os name="SunOS" />
</condition>
<property name="linker_flags32" value="${version_script_flags32} -shared -O2 -Wall -o ${libname32} ${libs32}"/>
<property name="linker_flags64" value="${version_script_flags64} -shared -O2 -Wall -o ${libname64} ${libs64}"/>
<property name="linker_flags32" value="${version_script_flags32} -shared -O3 -Wall -o ${libname32} ${libs32}"/>
<property name="linker_flags64" value="${version_script_flags64} -shared -O3 -Wall -o ${libname64} ${libs64}"/>
<condition property="build.32bit.only">
<not>
<or>
<condition property="build.32bit.only">
<not>
<or>
<equals arg1="${hwplatform}" arg2="x86_64"/>
<equals arg1="${hwplatform}" arg2="i86pc"/>
</or>
</not>
</condition>
</not>
</condition>
<!-- On linux, the 64 bit jre doesn't have the 32 bit libs -->
<condition property="build.64bit.only">
<and>
<os name="Linux"/>
<equals arg1="${hwplatform}" arg2="x86_64"/>
</and>
</condition>
<!-- On linux, the 64 bit jre doesn't have the 32 bit libs -->
<condition property="build.64bit.only">
<and>
<os name="Linux"/>
<equals arg1="${hwplatform}" arg2="x86_64"/>
</and>
</condition>
<antcall target="compile32"/>
<antcall target="compile64"/>
</target>
<antcall target="compile32"/>
<antcall target="compile64"/>
</target>
<target name="compile32" unless="build.64bit.only">
<mkdir dir="x32"/>
<apply dir="x32" executable="gcc" skipemptyfilesets="true" failonerror="true">
<target name="compile32" unless="build.64bit.only">
<mkdir dir="${lwjgl.target.gen.obj}/i386"/>
<apply dir="${lwjgl.target.gen.obj}/i386" executable="${lwjgl.compiler.native.linux}" failonerror="true" parallel="true">
<arg line="${cflags32} ${cflags_pthread}"/>
<arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/linux"/>
<arg value="-I${java.home}/../include"/>
<arg value="-I${java.home}/../include/linux"/>
<arg value="-I${java.home}/../include/solaris"/>
<arg value="-I${native}/common"/>
<arg value="-I${native}/common/opengl"/>
<arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengl"/>
<arg value="-I${lwjgl.src.native}/common"/>
<arg value="-I${lwjgl.src.native}/common/opengl"/>
<arg value="-I${lwjgl.src.native}/linux"/>
<arg value="-I${lwjgl.src.native}/linux/opengl"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<fileset dir="${native}/linux" includes="*.c"/>
<fileset dir="${native}/linux/opengl" includes="*.c"/>
</apply>
<apply dir="." parallel="true" executable="gcc" failonerror="true">
<fileset dir="${lwjgl.src.native}/common" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/common/opengl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengl" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/linux" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/linux/opengl" includes="*.c"/>
</apply>
<apply dir="${lwjgl.target.natives}" parallel="true" executable="${lwjgl.compiler.native.linux}" failonerror="true">
<srcfile/>
<arg line="${linker_flags32}"/>
<fileset dir="x32" includes="*.o"/>
<fileset dir="${lwjgl.target.gen.obj}/i386" includes="*.o"/>
</apply>
<apply dir="." parallel="true" executable="strip" failonerror="true">
<apply dir="${lwjgl.target.natives}" parallel="true" executable="strip" failonerror="true">
<fileset file="${libname32}"/>
</apply>
</target>
</target>
<target name="compile64" unless="build.32bit.only">
<mkdir dir="x64"/>
<apply dir="x64" executable="gcc" skipemptyfilesets="true" failonerror="true">
<target name="compile64" unless="build.32bit.only">
<mkdir dir="${lwjgl.target.gen.obj}/x86_64"/>
<apply dir="${lwjgl.target.gen.obj}/x86_64" executable="${lwjgl.compiler.native.linux}" failonerror="true" parallel="true">
<arg line="${cflags64} ${cflags_pthread}"/>
<arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/linux"/>
<arg value="-I${java.home}/../include"/>
<arg value="-I${java.home}/../include/linux"/>
<arg value="-I${java.home}/../include/solaris"/>
<arg value="-I${native}/common"/>
<arg value="-I${native}/common/opengl"/>
<arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengl"/>
<arg value="-I${lwjgl.src.native}/common"/>
<arg value="-I${lwjgl.src.native}/common/opengl"/>
<arg value="-I${lwjgl.src.native}/linux"/>
<arg value="-I${lwjgl.src.native}/linux/opengl"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<fileset dir="${native}/linux" includes="*.c"/>
<fileset dir="${native}/linux/opengl" includes="*.c"/>
</apply>
<apply dir="." parallel="true" executable="gcc" failonerror="true">
<fileset dir="${lwjgl.src.native}/common" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/common/opengl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengl" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/linux" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/linux/opengl" includes="*.c"/>
</apply>
<apply dir="${lwjgl.target.natives}" parallel="true" executable="${lwjgl.compiler.native.linux}" failonerror="true">
<srcfile/>
<arg line="${linker_flags64}"/>
<fileset dir="x64" includes="*.o"/>
<fileset dir="${lwjgl.target.gen.obj}/x86_64" includes="*.o"/>
</apply>
<apply dir="." parallel="true" executable="strip" failonerror="true">
<fileset file="${libname64}"/>
<apply dir="${lwjgl.target.natives}" parallel="true" executable="strip" failonerror="true">
<fileset file="${lwjgl.target.natives}/${libname64}"/>
</apply>
</target>
</target>
</project>

View File

@ -5,18 +5,9 @@
<property name="libname32" value="liblwjgl.so"/>
<property name="libname64" value="liblwjgl64.so"/>
<property name="lib_folder" value="${lwjgl.lib}/linux"/>
<property name="libs32" value="-L${lib_folder} -lEGL -L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib/i386 -ljawt" />
<property name="libs64" value="-L${lib_folder}/x64 -lEGL -L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib/amd64 -ljawt" />
<property name="cflags32" value="-O2 -Wall -c -fPIC -std=c99 -Wunused"/>
<target name="clean">
<delete>
<fileset dir="x32"/>
<fileset dir="x64"/>
<fileset dir="." includes="*.o"/>
<fileset dir="." includes="*.so"/>
</delete>
</target>
<property name="libs32" value="-L${lib_folder} -lEGL -L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib -L${java.home}/lib/i386 -ljawt" />
<property name="libs64" value="-L${lib_folder}/x64 -lEGL -L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm -lpthread -L${java.home}/lib -L${java.home}/lib/amd64 -ljawt" />
<property name="cflags32" value="-O3 -Wall -c -fPIC -std=c99 -Wunused"/>
<target name="compile">
<exec executable="uname" outputproperty="hwplatform">
@ -33,12 +24,12 @@
<os name="SunOS" />
</and>
</condition>
<condition property="cflags64" value="-O2 -m64 -Wall -c -fPIC -std=c99 -Wunused" else="-O2 -Wall -c -fPIC -std=c99 -Wunused">
<condition property="cflags64" value="-O3 -m64 -Wall -c -fPIC -std=c99 -Wunused" else="-O3 -Wall -c -fPIC -std=c99 -Wunused">
<os name="SunOS" />
</condition>
<property name="linker_flags32" value="${version_script_flags32} -shared -O2 -Wall -o ${libname32} ${libs32}"/>
<property name="linker_flags64" value="${version_script_flags64} -shared -O2 -Wall -o ${libname64} ${libs64}"/>
<property name="linker_flags32" value="${version_script_flags32} -shared -O3 -Wall -o ${libname32} ${libs32}"/>
<property name="linker_flags64" value="${version_script_flags64} -shared -O3 -Wall -o ${libname64} ${libs64}"/>
<condition property="build.32bit.only">
<not>
@ -63,7 +54,7 @@
<target name="compile32" unless="build.64bit.only">
<mkdir dir="x32"/>
<apply dir="x32" executable="gcc" skipemptyfilesets="true" failonerror="true">
<apply dir="x32" executable="gcc" failonerror="true">
<arg line="${cflags32} ${cflags_pthread}"/>
<arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/linux"/>
@ -74,12 +65,13 @@
<arg value="-I${native}/common/opengles"/>
<arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengles"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengles" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengles" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengles" includes="*.c"/>
<fileset dir="${native}/linux" includes="*.c"/>
<fileset dir="${native}/linux/opengles" includes="*.c"/>
</apply>
@ -106,12 +98,13 @@
<arg value="-I${native}/common/opengles"/>
<arg value="-I${native}/linux"/>
<arg value="-I${native}/linux/opengles"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengles" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengles" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengles" includes="*.c"/>
<fileset dir="${native}/linux" includes="*.c"/>
<fileset dir="${native}/linux/opengles" includes="*.c"/>
</apply>
@ -124,4 +117,4 @@
<fileset file="${libname64}"/>
</apply>
</target>
</project>
</project>

View File

@ -1,126 +1,79 @@
<project name="OS X Native code" basedir="../../bin/lwjgl" default="nativelibrary">
<property name="native" location="../../src/native"/>
<project name="OS X Native code" default="nativelibrary" basedir="/dev/null">
<target name="init">
<mkdir dir="x86_64"/>
<property environment="env" />
<!-- Ask Xcode for correct path to XCode tools -->
<!-- Will fail if XCode Command Line Tools are not installed on 10.7+ (Lion) -->
<exec executable="xcode-select" outputproperty="developer_path" errorproperty="xcode-select.error" failonerror="false" failifexecutionfails="false">
<arg value="-print-path" />
<exec executable="xcrun" outputproperty="sdk_path" errorproperty="xcode-select.error" failonerror="false" failifexecutionfails="false">
<arg value="--sdk" />
<arg value="macosx" />
<arg value="--show-sdk-path" />
</exec>
<!-- Default to /Developer if xcode-select fails -->
<condition property="developer_path" value="/Developer">
<condition property="sdk_path" value="/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk">
<isset property="xcode-select.error" />
</condition>
<property name="sdk_path" value="Platforms/MacOSX.platform/Developer/SDKs"/>
<property name="jvm_headers_path" value="System/Library/Frameworks/JavaVM.framework/Versions/A/Headers"/>
<property name="jvm_headers_path" value="include"/>
<property name="jvm_headers_path_md" value="${jvm_headers_path}/darwin"/>
<!-- Choose a JavaVM.framework -->
<condition property="javavmroot" value="${developer_path}/${sdk_path}/MacOSX10.9.sdk">
<and>
<not><isset property="javavmroot"/></not>
<available file="${developer_path}/${sdk_path}/MacOSX10.9.sdk/${jvm_headers_path}" type="dir"/>
</and>
</condition>
<condition property="javavmroot" value="${developer_path}/${sdk_path}/MacOSX10.8.sdk">
<and>
<not><isset property="javavmroot"/></not>
<available file="${developer_path}/${sdk_path}/MacOSX10.8.sdk/${jvm_headers_path}" type="dir"/>
</and>
</condition>
<condition property="javavmroot" value="${developer_path}/${sdk_path}/MacOSX10.7.sdk">
<and>
<not><isset property="javavmroot"/></not>
<available file="${developer_path}/${sdk_path}/MacOSX10.7.sdk/${jvm_headers_path}" type="dir"/>
</and>
</condition>
<condition property="javavmroot" value="${developer_path}/${sdk_path}/MacOSX10.6.sdk">
<and>
<not><isset property="javavmroot"/></not>
<available file="${developer_path}/${sdk_path}/MacOSX10.6.sdk/${jvm_headers_path}" type="dir"/>
</and>
</condition>
<condition property="javavmroot" value=""> <!-- Old location -->
<and>
<not><isset property="javavmroot"/></not>
<available file="/${jvm_headers_path}" type="dir"/>
</and>
</condition>
<!-- TODO: detect link version -->
<!--<property name="macos_link_ver" value="10.5"/>-->
<property name="macos_link_ver" value="10.9"/>
<!-- Choose a MacOSX SDK -->
<property name="compiler" value="clang"/> <!-- Default to clang for 10.8 and up -->
<condition property="sdkroot" value="${developer_path}/${sdk_path}/MacOSX10.9.sdk">
<condition property="javavmroot" value="${java.home}">
<and>
<not><isset property="sdkroot"/></not>
<available file="${developer_path}/${sdk_path}/MacOSX10.9.sdk" type="dir"/>
<not><isset property="javavmroot"/></not>
<available file="${java.home}/${jvm_headers_path}" type="dir"/>
</and>
</condition>
<condition property="sdkroot" value="${developer_path}/${sdk_path}/MacOSX10.8.sdk">
</condition>
<condition property="javavmroot" value="${env.JAVA_HOME}">
<and>
<not><isset property="sdkroot"/></not>
<available file="${developer_path}/${sdk_path}/MacOSX10.8.sdk" type="dir"/>
<not><isset property="javavmroot"/></not>
<available file="${env.JAVA_HOME}/${jvm_headers_path}" type="dir"/>
</and>
</condition>
</condition>
<!-- If we're on 10.7 or lower, use gcc instead of clang -->
<condition property="compiler" value="gcc-4.2">
<condition property="compiler" value="clang">
<and>
<not><isset property="sdkroot"/></not>
<available file="gcc-4.2" filepath="${env.PATH}"/>
<not><isset property="compiler"/></not>
<available file="clang" filepath="${env.PATH}"/>
</and>
</condition>
<condition property="compiler" value="gcc">
<and>
<not><isset property="sdkroot"/></not>
<not><available file="gcc-4.2" filepath="${env.PATH}"/></not>
<not><isset property="compiler"/></not>
<available file="gcc" filepath="${env.PATH}"/>
</and>
</condition>
<condition property="sdkroot" value="${developer_path}/${sdk_path}/MacOSX10.7.sdk">
<condition property="compiler" value="gcc-11">
<and>
<not><isset property="sdkroot"/></not>
<available file="${developer_path}/${sdk_path}/MacOSX10.7.sdk" type="dir"/>
<not><isset property="compiler"/></not>
<available file="gcc-11" filepath="${env.PATH}"/>
</and>
</condition>
<condition property="sdkroot" value="${developer_path}/${sdk_path}/MacOSX10.6.sdk">
<condition property="compiler" value="gcc-4.2">
<and>
<not><isset property="sdkroot"/></not>
<available file="${developer_path}/${sdk_path}/MacOSX10.6.sdk" type="dir"/>
</and>
</condition>
<condition property="sdkroot" value="${developer_path}/SDKs/MacOSx10.6.sdk"> <!-- Old XCode location -->
<and>
<not><isset property="sdkroot"/></not>
<available file="${developer_path}/SDKs/MacOSx10.6.sdk" type="dir"/>
<not><isset property="compiler"/></not>
<available file="gcc-4.2" filepath="${env.PATH}"/>
</and>
</condition>
</target>
<target name="clean">
<delete failonerror="false">
<fileset dir="i386"/>
<fileset dir="x86_64"/>
<fileset dir="." includes="liblwjgl.dylib"/>
<fileset dir="." includes="lwjgl.symbols"/>
</delete>
</target>
<target name="compile" depends="init">
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}">
<arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I${javavmroot}/${jvm_headers_path} -I${native}/common -I${native}/common/opengl -I${native}/macosx"/>
<target name="compile" depends="init">
<mkdir dir="${dstdir}" taskname="initializing ${dstdir} folder"/>
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" failonerror="true" dest="${dstdir}">
<arg line="${cflags} -ObjC -O3 -Wall -Wunused -c -fPIC -I${javavmroot}/${jvm_headers_path_md} -I${javavmroot}/${jvm_headers_path} -I${lwjgl.src.native}/common -I${lwjgl.src.native}/common/opengl -I${lwjgl.src.native}/macosx"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<!-- Map from *.m and *.c to .o -->
<mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/>
<fileset dir="${native}/macosx" includes="*.m"/>
<fileset dir="${native}/macosx" includes="*.c"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/macosx" includes="*.m"/>
<fileset dir="${lwjgl.src.native}/macosx" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/common" includes="*.c"/>
<fileset dir="${lwjgl.src.native}/common/opengl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengl" includes="*.c"/>
</apply>
</target>
@ -131,92 +84,49 @@
<condition property="jdk_lib" value="${java.home}/../Libraries">
<not><isset property="jdk_lib"/></not>
</condition>
<apply dir="${objdir}" parallel="true" executable="${compiler}" os="Mac OS X" failonerror="true" skipemptyfilesets="true">
<arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -weak_framework AppKit -framework Carbon -framework OpenGL -framework QuartzCore -L${jdk_lib} -ljawt"/>
<apply dir="${objdir}" parallel="true" executable="${compiler}" os="Mac OS X" failonerror="true">
<arg line="${linkerflags} -exported_symbols_list lwjgl.symbols -dynamiclib -o ${lwjgl.target.natives}/${libname} -framework Foundation -weak_framework AppKit -framework Carbon -framework OpenGL -framework QuartzCore -L${jdk_lib} -ljawt -L${sdk_path}/usr/lib"/>
<fileset dir="${objdir}" includes="*.o"/>
</apply>
<apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true">
</apply>
<echo message="Linked library"/>
<apply dir="${lwjgl.target.natives}" executable="strip" os="Mac OS X" failonerror="true">
<arg line="-S -X"/>
<fileset dir="." file="${libname}"/>
<fileset file="${libname}"/>
</apply>
<echo message="Stripped library"/>
</target>
<target name="nativelibrary" depends="init">
<echo message=" Java Home: ${java.home}"/>
<echo message=" Compiler: ${compiler}"/>
<echo message=" Mac OS SDK: ${sdkroot}"/>
<echo message=" Mac OS SDK: ${sdk_path}"/>
<echo message="JavaVM.framework: ${javavmroot}"/>
<condition property="build_x86_64" value="1">
<equals arg1="${compiler}" arg2="clang"/>
</condition>
<antcall target="-build"/>
</target>
<target name="-build" depends="-build_universal,-build_x86_x64"/>
<target name="-build_universal" unless="build_x86_64">
<mkdir dir="i386"/>
<property name="universal_sdkroot" location="${sdkroot}"/>
<property name="x86_64_sdkroot" location="${sdkroot}"/>
<property name="universal_flags" value="-isysroot ${universal_sdkroot}"/>
<target name="-build">
<antcall target="compile">
<param name="dstdir" location="i386"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
<param name="cflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.5"/>
<param name="dstdir" location="${lwjgl.target.gen.obj}/x86_64"/>
<param name="sdkroot" location="${sdk_path}"/>
<param name="cflags" value="-isysroot ${sdk_path} -arch x86_64 -mmacosx-version-min=${macos_link_ver}"/>
</antcall>
<antcall target="compile">
<param name="dstdir" location="x86_64"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
<param name="cflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/>
</antcall>
<exec vmlauncher="true" executable="sh" output="lwjgl.symbols" failonerror="true">
<arg path="../../platform_build/macosx_ant/build-symbol-list"/>
<arg path="i386"/>
<exec vmlauncher="true" executable="sh" output="${lwjgl.target.gen.obj}/x86_64/lwjgl.symbols" failonerror="true" logError="true">
<arg path="platform_build/macosx_ant/build-symbol-list"/>
<arg path="${lwjgl.target.gen.obj}/x86_64"/>
</exec>
<antcall target="link">
<param name="objdir" location="i386"/>
<param name="libname" value="liblwjgl-i386.dylib"/>
<param name="linkerflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.5"/>
<param name="objdir" location="${lwjgl.target.gen.obj}/x86_64"/>
<param name="libname" value="liblwjgl-x86_64.dylib"/>
<param name="linkerflags" value="-isysroot ${sdk_path} -arch x86_64 -mmacosx-version-min=${macos_link_ver}"/>
</antcall>
<antcall target="link">
<param name="objdir" location="x86_64"/>
<param name="libname" value="liblwjgl-i86_64.dylib"/>
<param name="linkerflags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/>
</antcall>
<apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true">
<apply parallel="true" executable="lipo" os="Mac OS X" failonerror="true">
<arg value="-create"/>
<srcfile/>
<arg value="-output"/>
<arg path="liblwjgl.dylib"/>
<fileset file="i386/liblwjgl-i386.dylib"/>
<fileset file="x86_64/liblwjgl-i86_64.dylib"/>
<arg path="${lwjgl.target.natives}/liblwjgl.dylib"/>
<fileset file="${lwjgl.target.natives}/liblwjgl-x86_64.dylib"/>
</apply>
</target>
<target name="-build_x86_x64" if="build_x86_64">
<antcall target="compile">
<param name="dstdir" location="x86_64"/>
<param name="sdkroot" location="${sdkroot}"/>
<param name="cflags" value="-isysroot ${sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/>
</antcall>
<exec vmlauncher="true" executable="sh" output="lwjgl.symbols" failonerror="true">
<arg path="../../platform_build/macosx_ant/build-symbol-list"/>
<arg path="x86_64"/>
</exec>
<antcall target="link">
<param name="objdir" location="x86_64"/>
<param name="libname" value="liblwjgl-i86_64.dylib"/>
<param name="linkerflags" value="-isysroot ${sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/>
</antcall>
<apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true">
<arg value="-create"/>
<srcfile/>
<arg value="-output"/>
<arg path="liblwjgl.dylib"/>
<fileset file="x86_64/liblwjgl-i86_64.dylib"/>
</apply>
</target>
</project>
</project>

View File

@ -11,7 +11,7 @@
<property name="dllname" value="lwjgl64.dll"/>
<target name="compile_dir">
<apply dir="." failonerror="true" executable="${gcc}" dest="." skipemptyfilesets="true">
<apply dir="." failonerror="true" executable="${gcc}" dest=".">
<arg line="-c -Wall -O2 -std=gnu99 -D_JNI_IMPLEMENTATION_"/>
<arg value="-I${dxhome}/include"/>
<arg value="-I${alhome}/include"/>
@ -19,12 +19,13 @@
<arg value="-I${jdkhome}/include/win32"/>
<arg value="-I${native}/common"/>
<arg value="-I${native}/windows"/>
<arg value="-I${lwjgl.target.gen.headers}"/>
<srcfile/>
<fileset dir="${native}/windows" includes="*.c"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengl" includes="*.c"/>
<mapper type="glob" from="*.c" to="*.o"/>
</apply>
</target>
@ -49,13 +50,6 @@
</apply>
</target>
<target name="clean">
<delete>
<fileset dir="." includes="*.o"/>
<fileset dir="." includes="*.dll"/>
</delete>
</target>
<target name="compile">
<property name="libs" value="-lkernel32 -lole32 -lopengl32 -lversion -luser32 -lgdi32 -ladvapi32 -lwinmm"/>
<antcall target="compile_dir"/>

View File

@ -6,7 +6,7 @@
<property name="sdkhome" location="${env.MSSDK}"/>
<target name="compile_dir">
<apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true" parallel="true">
<apply dir="." failonerror="true" executable="cl" dest="." parallel="true">
<arg line="/c /W2 /EHsc /Ox /Gy /MT /MP /nologo"/>
<arg value="/I${sdkhome}\include"/>
<arg value="/I${java.home}\..\include"/>
@ -15,12 +15,13 @@
<arg value="/I${native}\common\opengl"/>
<arg value="/I${native}\windows"/>
<arg value="/I${native}\windows\opengl"/>
<arg value="/I${lwjgl.target.gen.headers}"/>
<srcfile/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengl" includes="*.c"/>
<fileset dir="${native}/windows" includes="*.c"/>
<fileset dir="${native}/windows/opengl" includes="*.c"/>
<mapper type="glob" from="*.c" to="*.obj"/>
@ -41,15 +42,6 @@
</apply>
</target>
<target name="clean">
<delete>
<fileset dir="." includes="*.obj"/>
<fileset dir="." includes="*.dll"/>
<fileset dir="." includes="*.exp"/>
<fileset dir="." includes="*.lib"/>
</delete>
</target>
<target name="compile">
<condition property="sdkhomelib" value="${sdkhome}\lib" else="${sdkhome}\lib\x64">
<equals arg1="${os.arch}" arg2="x86"/>

View File

@ -6,7 +6,7 @@
<property name="sdkhome" location="${env.MSSDK}"/>
<target name="compile_dir">
<apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true" parallel="true">
<apply dir="." failonerror="true" executable="cl" dest="." parallel="true">
<arg line="/c /W2 /EHsc /Ox /Gy /MT /MP /nologo"/>
<arg value="/I${sdkhome}\include"/>
<arg value="/I${java.home}\..\include"/>
@ -15,12 +15,13 @@
<arg value="/I${native}\common\opengles"/>
<arg value="/I${native}\windows"/>
<arg value="/I${native}\windows\opengles"/>
<arg value="/I${lwjgl.target.gen.headers}"/>
<srcfile/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengles" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengles" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/openal" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opencl" includes="*.c"/>
<fileset dir="${lwjgl.target.gen.native}/opengles" includes="*.c"/>
<fileset dir="${native}/windows" includes="*.c"/>
<fileset dir="${native}/windows/opengles" includes="*.c"/>
<mapper type="glob" from="*.c" to="*.obj"/>
@ -42,15 +43,6 @@
</apply>
</target>
<target name="clean">
<delete>
<fileset dir="." includes="*.obj"/>
<fileset dir="." includes="*.dll"/>
<fileset dir="." includes="*.exp"/>
<fileset dir="." includes="*.lib"/>
</delete>
</target>
<target name="compile">
<condition property="sdkhomelib" value="${sdkhome}\lib" else="${sdkhome}\lib\x64">
<equals arg1="${os.arch}" arg2="x86"/>

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1,198 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="543.281" height="196.23" viewBox="0 0 543.281 196.23"
overflow="visible" enable-background="new 0 0 543.281 196.23" xml:space="preserve">
<g id="Layer_6">
</g>
<g id="Layer_2">
<path display="none" opacity="0.61" fill="#DE923A" d="M536.093,118.816c-17.196,51.267-59.783,83.217-95.122,71.367
c-35.338-11.853-50.048-63.028-32.853-114.288c17.195-51.269,59.782-83.217,95.118-71.362
C538.579,16.382,553.287,67.556,536.093,118.816z"/>
<path fill="#FFFFFF" d="M161.34,109.049c-16.054,47.862-55.868,77.672-88.928,66.585S25.565,116.751,41.617,68.897
C57.671,21.033,97.485-8.775,130.542,2.316C163.605,13.4,177.392,61.194,161.34,109.049z"/>
<path fill="#0A90CB" d="M157.985,107.256c-15.051,44.873-52.326,72.838-83.257,62.466C43.797,159.349,30.923,114.556,45.973,69.69
C61.024,24.816,98.298-3.148,129.227,7.229C160.161,17.599,173.034,62.391,157.985,107.256z"/>
<path fill="#FFFFFF" d="M180.458,94.522l-48-11.5c-2.02-0.532-5.155,0.337-6.955,1.197l10.151-37.832
c0.936-3.473,0.061-7.84-1.75-10.831c-1.811-2.991-7.549-10.722-9.737-13.622s-3.939-3.61-6.528-3.738l-36.7-2.094
c-4.949-0.335-10.023,3.617-11.332,8.826L59.458,65.647L27.873,58.02c-3.792-1.016-7.688,1.436-8.702,5.473L8.962,104.105
c-1.016,4.038,1.007,8.071,4.622,9.792l142.5,76.584c4.75,2.5,9.169,1.462,10.667-4.501l19.305-77.485
C187.554,102.535,185.318,95.803,180.458,94.522z"/>
<g>
<path d="M103.521,133.708c-1.006,4.003-4.428,6.12-7.644,4.728l-32.025-13.862c-3.216-1.393-5.109-5.359-4.229-8.861l8.855-35.227
c0.88-3.501,4.303-5.621,7.646-4.732l33.288,8.838c3.342,0.888,5.236,4.853,4.229,8.854L103.521,133.708z"/>
<g>
<path d="M163.445,159.116c-1.16,4.615-5.048,7.144-8.683,5.648l-35.622-16.062c-3.635-1.495-5.744-6.04-4.71-10.156
l10.566-42.111c1.034-4.113,4.922-6.645,8.685-5.653l37.468,9.87c3.762,0.99,5.873,5.535,4.713,10.149L163.445,159.116z"/>
<path d="M50.911,111.844c-0.853,3.394-3.563,5.166-6.052,3.96L19.9,104.265c-2.49-1.208-3.918-4.532-3.19-7.427l7.481-29.591
c0.728-2.894,3.438-4.67,6.054-3.967l26.056,7.002c2.616,0.702,4.045,4.024,3.192,7.418L50.911,111.844z"/>
<path d="M108.224,68.855c-0.968,3.849-4.276,6.375-7.39,5.639L69.829,67.17c-3.113-0.736-4.955-4.045-4.113-7.393L74.181,26.1
c0.842-3.348,4.151-5.875,7.391-5.644l32.269,2.3c3.24,0.23,5.082,3.538,4.116,7.386L108.224,68.855z"/>
</g>
</g>
<line display="none" fill="#0092D2" x1="0" y1="108.564" x2="194.333" y2="196.23"/>
<line display="none" fill="none" x1="214" y1="119.23" x2="21.667" y2="68.563"/>
</g>
<g id="Layer_4">
<polygon points="227.728,31.353 243.953,31.353 216.963,112.878 244.745,112.878 241.184,122.614 197.334,122.614 "/>
<polygon points="255.668,31.432 250.207,122.614 265.404,122.614 280.838,98.157 282.342,122.614 299.281,122.614 340.123,31.432
322.79,31.59 294.373,95.188 293.186,76.706 278.226,76.904 267.185,94.357 270.984,31.432 "/>
<path fill="#0B0B0B" d="M323.62,88.421h16.978c0,0-4.097,12.703-5.462,17.096c-1.365,4.394,1.028,7.599,3.72,7.599
c2.692,0,6.253-1.107,8.786-7.599c2.533-6.49,24.458-74.165,24.458-74.165l18.006,0.08c0,0-21.938,66.379-24.773,74.243
c-5.225,14.484-13.852,17.889-30.117,17.889c-12.822,0-20.026-10.058-16.621-20.223C321.166,95.664,323.62,88.421,323.62,88.421z"
/>
<path fill="#0B0B0B" d="M444.126,64.358c0,0,2.643-7.251,4.274-13.455c2.612-9.934-0.95-20.263-19.313-20.263
c-20.658,0-32.452,11.833-42.9,45.116c-11.267,35.894-2.968,47.57,11.16,47.57c8.074,0,11.636-2.612,11.636-2.612l-0.554,2.059
h16.463l13.772-41.951h-24.299l-3.603,9.418l7.639-0.157c0,0-1.543,6.016-2.73,9.419s-4.314,13.297-12.704,13.297
c-7.123,0-4.749-17.255,1.267-36.845c8.331-27.134,14.996-35.262,21.964-35.262c6.49,0,5.818,4.907,4.631,9.023
c-1.617,5.603-4.749,14.563-4.749,14.563L444.126,64.358z"/>
<polygon fill="#0B0B0B" points="483.069,31.432 465.498,31.59 435.459,122.733 487.343,122.614 490.667,112.878 457.662,112.878
"/>
</g>
<g id="Layer_3">
<g>
<path d="M192.785,136.61h3.132l-3.727,11.92h5.634l-0.859,2.74h-8.767L192.785,136.61z"/>
<path d="M198.663,151.27l3.33-10.637h3.111l-3.308,10.637H198.663z M204.099,139.242c-0.914,0-1.508-0.652-1.388-1.632
c0.139-1.131,1.125-1.892,2.147-1.892c0.979,0,1.597,0.631,1.475,1.631c-0.147,1.196-1.146,1.893-2.212,1.893H204.099z"/>
<path d="M204.942,152.75c0.544,0.348,1.798,0.587,2.712,0.587c1.566,0,2.805-0.696,3.523-2.828l0.286-0.913h-0.043
c-0.96,1.088-1.979,1.588-3.24,1.588c-2.11,0-3.183-1.719-2.948-3.807c0.408-3.502,3.359-6.982,7.992-6.982
c1.501,0,2.771,0.283,3.847,0.74l-2.687,8.766c-0.61,1.957-1.433,3.697-2.82,4.72c-1.265,0.914-2.845,1.196-4.259,1.196
c-1.436,0-2.708-0.261-3.397-0.674L204.942,152.75z M213.45,142.983c-0.226-0.108-0.672-0.196-1.107-0.196
c-1.893,0-3.5,2.11-3.746,4.111c-0.134,1.088,0.249,1.871,1.206,1.871c1.022,0,2.187-1.153,2.754-2.937L213.45,142.983z"/>
<path d="M216.565,151.27l4.833-15.443h3.132l-1.955,6.178h0.043c1.012-0.979,2.199-1.61,3.591-1.61
c1.653,0,2.547,1.045,2.323,2.872c-0.062,0.5-0.25,1.326-0.431,1.914l-1.901,6.09h-3.132l1.825-5.829
c0.138-0.413,0.237-0.87,0.291-1.306c0.088-0.718-0.133-1.218-0.917-1.218c-1.109,0-2.384,1.349-3.038,3.48l-1.534,4.872H216.565z
"/>
<path d="M236.475,137.762l-0.896,2.871h2.284l-0.772,2.393h-2.262l-1.159,3.59c-0.141,0.435-0.294,0.979-0.34,1.348
c-0.064,0.522,0.108,0.893,0.804,0.893c0.261,0,0.587,0,0.854-0.044l-0.65,2.458c-0.432,0.152-1.226,0.239-1.878,0.239
c-1.893,0-2.667-0.957-2.501-2.306c0.069-0.565,0.207-1.152,0.479-1.958l1.323-4.22h-1.349l0.729-2.393h1.37l0.638-2.001
L236.475,137.762z"/>
<path d="M241.952,140.633l-0.534,4.524c-0.125,1.196-0.292,2.197-0.501,3.372h0.044c0.508-1.132,1.118-2.197,1.684-3.263
l2.679-4.634h2.545l-0.289,4.481c-0.09,1.262-0.172,2.283-0.376,3.415h0.065c0.493-1.175,0.99-2.219,1.578-3.459l2.373-4.438
h3.154l-6.484,10.637h-2.937l0.149-3.697c0.049-1.109,0.175-2.132,0.33-3.394h-0.065c-0.75,1.501-1.085,2.284-1.66,3.241
l-2.278,3.85h-2.937l0.306-10.637H241.952z"/>
<path d="M261.516,150.661c-1.317,0.631-2.889,0.849-4.063,0.849c-3.045,0-4.4-1.719-4.059-4.503
c0.398-3.24,3.162-6.612,7.012-6.612c2.154,0,3.549,1.219,3.306,3.198c-0.332,2.696-3.084,3.676-7.334,3.566
c-0.038,0.305,0.013,0.783,0.193,1.088c0.346,0.544,1.029,0.826,1.943,0.826c1.153,0,2.164-0.261,3.063-0.674L261.516,150.661z
M260.777,143.57c0.064-0.521-0.326-0.892-1.043-0.892c-1.458,0-2.434,1.218-2.771,2.197c2.434,0.021,3.692-0.305,3.812-1.283
L260.777,143.57z"/>
<path d="M263.442,151.27l3.329-10.637h3.111l-3.308,10.637H263.442z M268.879,139.242c-0.914,0-1.508-0.652-1.388-1.632
c0.139-1.131,1.124-1.892,2.146-1.892c0.979,0,1.598,0.631,1.475,1.631c-0.147,1.196-1.146,1.893-2.212,1.893H268.879z"/>
<path d="M269.721,152.75c0.545,0.348,1.799,0.587,2.712,0.587c1.566,0,2.805-0.696,3.523-2.828l0.286-0.913H276.2
c-0.96,1.088-1.979,1.588-3.241,1.588c-2.11,0-3.182-1.719-2.948-3.807c0.409-3.502,3.359-6.982,7.993-6.982
c1.501,0,2.771,0.283,3.846,0.74l-2.686,8.766c-0.61,1.957-1.434,3.697-2.82,4.72c-1.266,0.914-2.845,1.196-4.259,1.196
c-1.436,0-2.709-0.261-3.397-0.674L269.721,152.75z M278.23,142.983c-0.226-0.108-0.672-0.196-1.107-0.196
c-1.892,0-3.5,2.11-3.746,4.111c-0.133,1.088,0.249,1.871,1.206,1.871c1.022,0,2.187-1.153,2.754-2.937L278.23,142.983z"/>
<path d="M281.345,151.27l4.833-15.443h3.133l-1.955,6.178h0.043c1.013-0.979,2.199-1.61,3.592-1.61
c1.653,0,2.547,1.045,2.323,2.872c-0.062,0.5-0.25,1.326-0.432,1.914l-1.9,6.09h-3.133l1.825-5.829
c0.138-0.413,0.237-0.87,0.291-1.306c0.088-0.718-0.133-1.218-0.916-1.218c-1.109,0-2.385,1.349-3.038,3.48l-1.533,4.872H281.345z
"/>
<path d="M301.254,137.762l-0.896,2.871h2.284l-0.772,2.393h-2.262l-1.159,3.59c-0.141,0.435-0.294,0.979-0.34,1.348
c-0.063,0.522,0.108,0.893,0.805,0.893c0.261,0,0.587,0,0.854-0.044l-0.65,2.458c-0.432,0.152-1.226,0.239-1.878,0.239
c-1.893,0-2.667-0.957-2.501-2.306c0.069-0.565,0.206-1.152,0.479-1.958l1.323-4.22h-1.349l0.729-2.393h1.37l0.638-2.001
L301.254,137.762z"/>
<path d="M312.664,136.61h3.133l-3.038,9.679c-1.175,3.72-2.946,5.221-6.275,5.221c-0.913,0-1.917-0.152-2.371-0.348l0.938-2.676
c0.438,0.152,1.012,0.261,1.708,0.261c1.37,0,2.323-0.674,3.004-2.849L312.664,136.61z"/>
<path d="M320.891,151.27c0.097-0.609,0.253-1.349,0.39-2.11h-0.044c-1.217,1.763-2.659,2.35-3.899,2.35
c-1.914,0-3.037-1.479-2.765-3.697c0.44-3.589,3.304-7.418,8.524-7.418c1.283,0,2.603,0.239,3.438,0.522l-1.75,5.568
c-0.43,1.37-0.903,3.458-1.023,4.785H320.891z M322.773,142.852c-0.233-0.043-0.489-0.087-0.815-0.087
c-2.023,0-3.807,2.479-4.05,4.459c-0.129,1.044,0.196,1.762,1.066,1.762c0.936,0,2.263-1.065,3.063-3.676L322.773,142.852z"/>
<path d="M331.268,140.633l-0.071,4.655c-0.052,1.305-0.042,2.109-0.072,2.893h0.064c0.377-0.761,0.802-1.565,1.55-2.871
l2.706-4.677h3.502l-7.224,10.637h-3.197l-0.478-10.637H331.268z"/>
<path d="M343.84,151.27c0.097-0.609,0.253-1.349,0.39-2.11h-0.044c-1.217,1.763-2.659,2.35-3.899,2.35
c-1.914,0-3.038-1.479-2.766-3.697c0.441-3.589,3.305-7.418,8.525-7.418c1.283,0,2.603,0.239,3.438,0.522l-1.749,5.568
c-0.43,1.37-0.904,3.458-1.023,4.785H343.84z M345.722,142.852c-0.233-0.043-0.489-0.087-0.815-0.087
c-2.023,0-3.807,2.479-4.05,4.459c-0.129,1.044,0.196,1.762,1.066,1.762c0.936,0,2.263-1.065,3.063-3.676L345.722,142.852z"/>
<path d="M365.175,150.596c-1.155,0.369-2.995,0.826-4.844,0.826c-2.001,0-3.612-0.522-4.675-1.609
c-1.05-1.022-1.523-2.654-1.294-4.524c0.337-2.741,1.737-5.111,3.804-6.699c1.821-1.37,4.199-2.132,6.744-2.132
c1.893,0,3.261,0.37,3.792,0.652l-1.262,2.654c-0.615-0.305-1.73-0.609-3.036-0.609c-1.457,0-2.791,0.413-3.863,1.175
c-1.407,1-2.469,2.74-2.715,4.741c-0.302,2.458,1.004,3.698,3.31,3.698c0.739,0,1.253-0.109,1.642-0.262l0.967-3.088h-2.284
l0.808-2.502h5.329L365.175,150.596z"/>
<path d="M374.62,151.27c0.097-0.609,0.253-1.349,0.39-2.11h-0.043c-1.217,1.763-2.66,2.35-3.899,2.35
c-1.915,0-3.038-1.479-2.766-3.697c0.44-3.589,3.304-7.418,8.524-7.418c1.283,0,2.603,0.239,3.438,0.522l-1.75,5.568
c-0.43,1.37-0.903,3.458-1.022,4.785H374.62z M376.502,142.852c-0.234-0.043-0.49-0.087-0.816-0.087
c-2.022,0-3.807,2.479-4.05,4.459c-0.128,1.044,0.197,1.762,1.067,1.762c0.936,0,2.263-1.065,3.062-3.676L376.502,142.852z"/>
<path d="M379.645,151.27l2.208-7.178c0.427-1.349,0.721-2.502,0.969-3.459h2.697l-0.409,1.74h0.043
c1.147-1.37,2.506-1.979,3.876-1.979c1.697,0,2.303,1.088,2.275,2.023c1.125-1.37,2.532-2.023,3.925-2.023
c1.631,0,2.457,1.066,2.235,2.872c-0.053,0.435-0.244,1.283-0.398,1.826l-1.911,6.178h-3.046l1.779-5.808
c0.138-0.413,0.26-0.87,0.311-1.283c0.091-0.739-0.172-1.262-0.89-1.262c-1.044,0-2.26,1.393-2.938,3.546l-1.481,4.807h-3.024
l1.828-5.851c0.116-0.414,0.232-0.827,0.277-1.196c0.091-0.74-0.079-1.306-0.84-1.306c-1.066,0-2.357,1.479-2.983,3.567
l-1.479,4.785H379.645z"/>
<path d="M406.693,150.661c-1.317,0.631-2.889,0.849-4.063,0.849c-3.045,0-4.4-1.719-4.059-4.503
c0.398-3.24,3.162-6.612,7.012-6.612c2.154,0,3.549,1.219,3.306,3.198c-0.331,2.696-3.083,3.676-7.334,3.566
c-0.037,0.305,0.013,0.783,0.193,1.088c0.346,0.544,1.029,0.826,1.943,0.826c1.152,0,2.163-0.261,3.063-0.674L406.693,150.661z
M405.955,143.57c0.063-0.521-0.326-0.892-1.044-0.892c-1.457,0-2.434,1.218-2.771,2.197c2.434,0.021,3.692-0.305,3.813-1.283
L405.955,143.57z"/>
<path d="M417.337,136.61h3.133l-3.727,11.92h5.634l-0.858,2.74h-8.767L417.337,136.61z"/>
<path d="M423.215,151.27l3.329-10.637h3.111l-3.308,10.637H423.215z M428.652,139.242c-0.914,0-1.508-0.652-1.388-1.632
c0.139-1.131,1.124-1.892,2.146-1.892c0.979,0,1.598,0.631,1.475,1.631c-0.146,1.196-1.146,1.893-2.212,1.893H428.652z"/>
<path d="M436.924,135.827l-2.01,6.091h0.043c0.898-0.936,2.167-1.523,3.473-1.523c2.219,0,2.995,1.827,2.763,3.72
c-0.423,3.437-3.171,7.396-7.957,7.396c-2.523,0-3.651-1.088-3.419-2.979c0.08-0.653,0.27-1.306,0.478-1.937l3.476-10.767H436.924
z M433.38,146.79c-0.107,0.348-0.221,0.739-0.253,1.174c-0.071,0.762,0.313,1.175,1.053,1.175c1.827,0,3.42-2.522,3.647-4.372
c0.128-1.044-0.211-1.827-1.168-1.827c-1.131,0-2.38,1.132-2.977,2.98L433.38,146.79z"/>
<path d="M441.183,151.27l1.996-6.329c0.48-1.61,0.852-3.394,1.072-4.308h2.698c-0.132,0.718-0.285,1.436-0.466,2.197h0.087
c0.916-1.436,2.213-2.437,3.671-2.437c0.218,0,0.41,0.022,0.585,0.022l-0.986,3.066c-0.128-0.021-0.302-0.021-0.476-0.021
c-1.979,0-3.153,1.762-3.801,3.85l-1.227,3.959H441.183z"/>
<path d="M456.084,151.27c0.097-0.609,0.253-1.349,0.39-2.11h-0.043c-1.218,1.763-2.66,2.35-3.9,2.35
c-1.914,0-3.037-1.479-2.765-3.697c0.44-3.589,3.304-7.418,8.524-7.418c1.283,0,2.603,0.239,3.438,0.522l-1.75,5.568
c-0.43,1.37-0.903,3.458-1.023,4.785H456.084z M457.966,142.852c-0.233-0.043-0.489-0.087-0.815-0.087
c-2.023,0-3.807,2.479-4.05,4.459c-0.128,1.044,0.196,1.762,1.066,1.762c0.936,0,2.264-1.065,3.063-3.676L457.966,142.852z"/>
<path d="M461.087,151.27l1.995-6.329c0.48-1.61,0.853-3.394,1.073-4.308h2.697c-0.132,0.718-0.285,1.436-0.466,2.197h0.087
c0.916-1.436,2.214-2.437,3.672-2.437c0.217,0,0.41,0.022,0.584,0.022l-0.985,3.066c-0.128-0.021-0.302-0.021-0.476-0.021
c-1.98,0-3.153,1.762-3.802,3.85l-1.226,3.959H461.087z"/>
<path d="M474.815,140.633l0.083,4.634c0.017,1.109,0.031,1.87,0.035,2.545h0.044c0.319-0.653,0.645-1.349,1.242-2.502l2.511-4.677
h3.307l-4.744,7.635c-1.762,2.828-3.261,4.764-4.838,6.091c-1.385,1.175-2.928,1.696-3.637,1.805l-0.368-2.675
c0.52-0.152,1.247-0.413,1.91-0.849c0.779-0.5,1.466-1.131,1.967-1.849c0.106-0.152,0.122-0.283,0.105-0.5l-0.902-9.658H474.815z"
/>
</g>
<g display="none">
<path display="inline" d="M261.5,171.218l11.574-34.969h14.483c2.508,0,4.354,0.29,5.537,0.871
c1.183,0.581,2.099,1.575,2.746,2.982s0.863,2.986,0.648,4.735c-0.178,1.447-0.65,2.92-1.418,4.414
c-0.768,1.496-1.656,2.729-2.667,3.699c-1.011,0.97-2.004,1.701-2.979,2.194s-2,0.859-3.069,1.098
c-2.29,0.524-4.57,0.787-6.843,0.787h-8.687l-4.696,14.188H261.5z M272.139,153.062h7.648c2.968,0,5.186-0.321,6.653-0.966
c1.468-0.644,2.702-1.626,3.701-2.947c0.999-1.32,1.59-2.721,1.771-4.201c0.141-1.145,0.035-2.08-0.317-2.805
c-0.354-0.724-0.911-1.257-1.673-1.6c-0.763-0.342-2.287-0.513-4.574-0.513h-8.896L272.139,153.062z"/>
<path display="inline" d="M295.298,161.598c0.607-4.943,2.554-9.037,5.84-12.28c2.711-2.671,5.999-4.006,9.865-4.006
c3.03,0,5.354,0.954,6.975,2.862c1.62,1.907,2.23,4.482,1.833,7.725c-0.357,2.91-1.273,5.616-2.749,8.12s-3.372,4.424-5.689,5.759
c-2.318,1.336-4.669,2.003-7.052,2.003c-1.957,0-3.685-0.421-5.183-1.264s-2.575-2.035-3.229-3.577
C295.253,165.398,295.05,163.618,295.298,161.598z M299.632,161.168c-0.293,2.383,0.053,4.19,1.037,5.422s2.352,1.847,4.103,1.847
c0.915,0,1.845-0.187,2.789-0.56s1.85-0.941,2.717-1.705c0.866-0.762,1.632-1.632,2.295-2.609
c0.664-0.977,1.231-2.029,1.701-3.158c0.682-1.572,1.112-3.082,1.29-4.527c0.28-2.288-0.073-4.063-1.062-5.326
c-0.988-1.264-2.35-1.896-4.084-1.896c-1.341,0-2.603,0.321-3.785,0.966c-1.184,0.643-2.297,1.584-3.339,2.824
c-1.044,1.238-1.875,2.681-2.495,4.325S299.791,159.881,299.632,161.168z"/>
<path display="inline" d="M325.079,171.218l0.487-25.344h4.125l-0.293,11.395l-0.315,6.391c-0.04,0.478-0.108,1.435-0.207,2.871
c0.68-1.612,1.239-2.853,1.68-3.718s1.123-2.101,2.048-3.706l7.588-13.232h4.656l-0.74,12.681c-0.115,1.925-0.349,4.489-0.7,7.694
c1.066-2.124,2.718-5.082,4.953-8.872l6.815-11.503h4.313l-15.44,25.344h-4.438l0.9-14.858c0.043-0.922,0.209-2.719,0.498-5.392
c-0.865,1.694-1.855,3.528-2.971,5.505l-8.459,14.745H325.079z"/>
<path display="inline" d="M374.843,162.625l4.112,0.438c-0.855,2.075-2.475,4.047-4.858,5.915
c-2.385,1.869-5.069,2.804-8.053,2.804c-1.863,0-3.52-0.434-4.968-1.3c-1.449-0.865-2.479-2.126-3.088-3.779
c-0.61-1.653-0.785-3.537-0.526-5.651c0.34-2.767,1.305-5.448,2.895-8.048c1.591-2.6,3.474-4.531,5.65-5.795
c2.176-1.264,4.44-1.896,6.793-1.896c3,0,5.28,0.938,6.842,2.815c1.563,1.876,2.145,4.436,1.746,7.68
c-0.152,1.241-0.42,2.514-0.801,3.817h-18.512c-0.123,0.493-0.209,0.938-0.258,1.335c-0.291,2.366,0.027,4.173,0.955,5.42
s2.173,1.87,3.735,1.87c1.467,0,2.97-0.482,4.509-1.448C372.555,165.836,373.832,164.444,374.843,162.625z M363.165,156.343
h14.103c0.07-0.446,0.118-0.767,0.142-0.958c0.267-2.171-0.065-3.836-0.996-4.993s-2.24-1.736-3.928-1.736
c-1.83,0-3.576,0.639-5.239,1.916C365.582,151.849,364.221,153.773,363.165,156.343z"/>
<path display="inline" d="M382.333,171.218l8.362-25.344h3.814l-1.712,5.185c1.541-1.955,2.987-3.402,4.342-4.34
c1.354-0.938,2.677-1.407,3.971-1.407c0.853,0,1.863,0.313,3.033,0.938l-2.242,4c-0.676-0.542-1.455-0.813-2.338-0.813
c-1.499,0-3.144,0.845-4.934,2.532c-1.789,1.688-3.407,4.721-4.853,9.098l-3.374,10.151H382.333z"/>
<path display="inline" d="M417.95,162.625l4.111,0.438c-0.854,2.075-2.475,4.047-4.858,5.915
c-2.385,1.869-5.069,2.804-8.053,2.804c-1.863,0-3.52-0.434-4.968-1.3c-1.448-0.865-2.478-2.126-3.088-3.779
s-0.785-3.537-0.525-5.651c0.34-2.767,1.304-5.448,2.895-8.048c1.59-2.6,3.474-4.531,5.649-5.795s4.44-1.896,6.794-1.896
c2.999,0,5.28,0.938,6.842,2.815c1.562,1.876,2.144,4.436,1.745,7.68c-0.152,1.241-0.419,2.514-0.801,3.817h-18.512
c-0.123,0.493-0.209,0.938-0.258,1.335c-0.29,2.366,0.027,4.173,0.956,5.42c0.928,1.247,2.173,1.87,3.734,1.87
c1.468,0,2.971-0.482,4.509-1.448C415.661,165.836,416.937,164.444,417.95,162.625z M406.27,156.343h14.104
c0.07-0.446,0.117-0.767,0.141-0.958c0.267-2.171-0.065-3.836-0.996-4.993s-2.24-1.736-3.928-1.736
c-1.83,0-3.576,0.639-5.239,1.916C408.687,151.849,407.327,153.773,406.27,156.343z"/>
<path display="inline" d="M442.803,167.545c-2.794,2.824-5.524,4.235-8.192,4.235c-2.384,0-4.261-0.886-5.629-2.659
c-1.369-1.771-1.847-4.344-1.433-7.714c0.379-3.084,1.352-5.901,2.92-8.453s3.374-4.463,5.417-5.735
c2.042-1.271,4.011-1.907,5.905-1.907c3.126,0,5.299,1.521,6.521,4.563l4.514-13.625h4.25l-11.544,34.969h-3.938L442.803,167.545z
M431.899,160.594c-0.217,1.763-0.213,3.152,0.01,4.168c0.224,1.018,0.713,1.863,1.468,2.537c0.755,0.676,1.718,1.013,2.889,1.013
c1.944,0,3.832-1.016,5.663-3.047c2.45-2.697,3.919-6.029,4.406-9.997c0.246-2.004-0.083-3.57-0.988-4.699
s-2.148-1.694-3.729-1.694c-1.028,0-1.993,0.23-2.896,0.69c-0.902,0.461-1.837,1.243-2.803,2.347
c-0.966,1.104-1.838,2.505-2.615,4.204C432.525,157.815,432.057,159.308,431.899,160.594z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,141 +0,0 @@
/* XPM */
static char * lwjgl_logo_2a_xpm[] = {
"16 16 122 2",
" c #000000",
". c #010101",
"+ c #020202",
"@ c #030303",
"# c #0A0A0A",
"$ c #0C0C0C",
"% c #0E0E0E",
"& c #171717",
"* c #1B1B1B",
"= c #1D1D1D",
"- c #1F1F1F",
"; c #222222",
"> c #232323",
", c #2B2B2B",
"' c #2D2D2D",
") c #333333",
"! c #3D3D3D",
"~ c #404040",
"{ c #434343",
"] c #4A4A4A",
"^ c #4F4F4F",
"/ c #525252",
"( c #565656",
"_ c #585858",
": c #595959",
"< c #5C5C5C",
"[ c #5E5E5E",
"} c #5F5F5F",
"| c #666666",
"1 c #686868",
"2 c #6C6C6C",
"3 c #6D6D6D",
"4 c #397CB5",
"5 c #3A7DB5",
"6 c #3D7FB6",
"7 c #3E80B6",
"8 c #747474",
"9 c #787878",
"0 c #4886BA",
"a c #4C89BC",
"b c #4D89BC",
"c c #508BBD",
"d c #508CBD",
"e c #76828D",
"f c #548EBF",
"g c #5690C0",
"h c #848484",
"i c #5B92C1",
"j c #7D8D9B",
"k c #6096C3",
"l c #8C8C8C",
"m c #8D8F91",
"n c #669AC5",
"o c #919191",
"p c #6D9EC8",
"q c #8499AA",
"r c #959595",
"s c #71A1CA",
"t c #74A4CB",
"u c #9B9B9B",
"v c #77A5CC",
"w c #9C9EA0",
"x c #7CA8CE",
"y c #7EA9CE",
"z c #A1A1A1",
"A c #81ABCE",
"B c #82ACD0",
"C c #84ADD0",
"D c #A5A5A5",
"E c #A6A6A7",
"F c #86AFD2",
"G c #87B0D2",
"H c #A8A8A8",
"I c #8CB3D4",
"J c #8DB4D4",
"K c #91B6D5",
"L c #94B7D5",
"M c #97BAD8",
"N c #9EBFDA",
"O c #A2C1DC",
"P c #BCBCBC",
"Q c #BDBDBD",
"R c #BFBFBF",
"S c #C0C0C0",
"T c #B0C5D6",
"U c #C6C6C6",
"V c #CCCCCC",
"W c #CFCFCF",
"X c #D0D0D0",
"Y c #C2D7E8",
"Z c #D3D3D3",
"` c #C4D8E9",
" . c #D4D4D4",
".. c #C6D9E9",
"+. c #D6D6D6",
"@. c #D0E0ED",
"#. c #DADEE1",
"$. c #D2E1EE",
"%. c #DFDFDF",
"&. c #E4E4E4",
"*. c #DAE7F1",
"=. c #E5E5E5",
"-. c #E6E6E6",
";. c #E0EAF3",
">. c #E2ECF4",
",. c #E4EDF5",
"'. c #E7EFF6",
"). c #EEEEEE",
"!. c #E8F0F6",
"~. c #EFEFEF",
"{. c #EBF2F8",
"]. c #EDF3F8",
"^. c #F2F2F2",
"/. c #F5F5F5",
"(. c #F6F6F6",
"_. c #F4F8FB",
":. c #FBFBFB",
"<. c #FAFCFD",
"[. c #FCFDFE",
"}. c #FEFEFE",
"|. c #FEFFFF",
"1. c #FFFFFF",
"1.1.1.1.1.1.|.Y t c f F '.1.1.1.",
"1.1.1.1.1./.m e j q L 5 0 *.1.1.",
"1.1.1.1._.w &.C 5 i [.1.",
"1.1.1.1.K } ; 1.!.4 5 ` 1.",
"1.1.1...A = | 1.@.5 5 J 1.",
"^.D %.O T # H 1.M 5 5 s 1.",
"z . > V X D h < ~.1.k 5 5 p 1.",
"[ W - @ , 2 U <.N v a x 1.",
"* & +.. / =.! 1 E #.1.",
"8 % : r o u + { ",
"1.).l R ( Z _ ) ",
"1.1.[.1.S ~ + * :.& 9 ",
"1.1.$.y ;.1. .3 h Z Q ",
"1.1.}.n 6 B ,.1.1.=.' $ (.",
"1.1.1.>.b 5 7 G '.1.}.P ^ @ ] 1.",
"1.1.1.1.{.I g d v ].1.1.1.%.-.1."};

View File

@ -1,275 +0,0 @@
/* XPM */
static char * lwjgl_32x32_xpm[] = {
"32 32 240 2",
" c #FFFFFF",
". c #FAFCFD",
"+ c #CBDDEC",
"@ c #93B7D6",
"# c #6FA0C9",
"$ c #5C93C2",
"% c #6096C3",
"& c #7AA7CD",
"* c #ACC8E0",
"= c #EDF3F8",
"- c #FCFDFE",
"; c #B5CEE3",
"> c #5A92C1",
", c #3A7DB5",
"' c #4585B9",
") c #A1C1DC",
"! c #FCFCFC",
"~ c #E2EAF1",
"{ c #B8CFE3",
"] c #AEC9E0",
"^ c #A3C2DC",
"/ c #98BAD8",
"( c #8CB3D3",
"_ c #81ACCF",
": c #6E9FC8",
"< c #3D7FB6",
"[ c #72A2CA",
"} c #F5F8FB",
"| c #D8D8D8",
"1 c #313131",
"2 c #242424",
"3 c #404040",
"4 c #525252",
"5 c #656565",
"6 c #747474",
"7 c #8F8F8F",
"8 c #F7F8F8",
"9 c #ACC8DF",
"0 c #3B7DB5",
"a c #79A7CD",
"b c #FEFEFE",
"c c #686868",
"d c #000000",
"e c #B6B6B6",
"f c #86AED1",
"g c #AECAE1",
"h c #D3E2EE",
"i c #E1EAF2",
"j c #282828",
"k c #020202",
"l c #DEDEDE",
"m c #5B92C1",
"n c #4886BA",
"o c #F4F8FB",
"p c #ECF3F8",
"q c #6499C5",
"r c #D7D9DB",
"s c #050505",
"t c #C0D5E7",
"u c #397CB5",
"v c #ABC8E0",
"w c #FEFFFF",
"x c #78A6CC",
"y c #7BA7CD",
"z c #9E9E9E",
"A c #E2ECF4",
"B c #377BB4",
"C c #669AC5",
"D c #C3D7E8",
"E c #397DB5",
"F c #B2CCE1",
"G c #585858",
"H c #A9A9A9",
"I c #BCD2E5",
"J c #4081B7",
"K c #EEF4F9",
"L c #DDE5ED",
"M c #1C1C1C",
"N c #070707",
"O c #E7E7E7",
"P c #85AED1",
"Q c #CCDEEC",
"R c #BAD2E5",
"S c #5790BF",
"T c #D0D1D1",
"U c #030303",
"V c #333333",
"W c #FDFDFD",
"X c #FBFCFD",
"Y c #508BBD",
"Z c #B1CCE2",
"` c #CACACA",
" . c #373737",
".. c #616161",
"+. c #A2A2A2",
"@. c #DDDDDD",
"#. c #E4ECF3",
"$. c #B1CBE1",
"%. c #B4CDE2",
"&. c #E6E6E6",
"*. c #232323",
"=. c #727272",
"-. c #D8E5F0",
";. c #A0C0DB",
">. c #666666",
",. c #060606",
"'. c #272727",
"). c #D4D4D4",
"!. c #F6F6F6",
"~. c #D0D0D0",
"{. c #979797",
"]. c #5E5E5E",
"^. c #040404",
"/. c #C0C0C0",
"(. c #A2C1DB",
"_. c #9EBFDA",
":. c #FBFBFB",
"<. c #252525",
"[. c #5C5C5C",
"}. c #EAEAEA",
"|. c #B5B5B5",
"1. c #E9E9E9",
"2. c #B2B2B2",
"3. c #BDBDBD",
"4. c #6B9DC7",
"5. c #DBDBDB",
"6. c #838383",
"7. c #5F5F5F",
"8. c #0B0B0B",
"9. c #767676",
"0. c #B7B7B7",
"a. c #F0F0F0",
"b. c #F0F5F9",
"c. c #4B88BB",
"d. c #B2CCE2",
"e. c #9A9A9A",
"f. c #C5C5C5",
"g. c #F7F7F7",
"h. c #1D1D1D",
"i. c #3C3C3C",
"j. c #DFDFDF",
"k. c #F3F7FA",
"l. c #CCDDEB",
"m. c #9EBEDA",
"n. c #72A1C9",
"o. c #4C89BB",
"p. c #C9DCEB",
"q. c #565656",
"r. c #0F0F0F",
"s. c #F9F9F9",
"t. c #D1D1D1",
"u. c #8E8E8E",
"v. c #848484",
"w. c #707070",
"x. c #B0B0B0",
"y. c #F9FBFC",
"z. c #DCE8F2",
"A. c #F6F9FC",
"B. c #151515",
"C. c #4E4E4E",
"D. c #919191",
"E. c #BBBBBB",
"F. c #2F2F2F",
"G. c #393939",
"H. c #909090",
"I. c #4D4D4D",
"J. c #101010",
"K. c #5A5A5A",
"L. c #090909",
"M. c #323232",
"N. c #B1B1B1",
"O. c #A1A1A1",
"P. c #353535",
"Q. c #F5F5F5",
"R. c #131313",
"S. c #454545",
"T. c #F8F8F8",
"U. c #2B2B2B",
"V. c #BEBEBE",
"W. c #505050",
"X. c #C2C2C2",
"Y. c #868686",
"Z. c #D2D2D2",
"`. c #010101",
" + c #434343",
".+ c #DCDCDC",
"++ c #E0E0E0",
"@+ c #959595",
"#+ c #C8C8C8",
"$+ c #888888",
"%+ c #292929",
"&+ c #181818",
"*+ c #4A4A4A",
"=+ c #CFCFCF",
"-+ c #F1F6FA",
";+ c #4B4B4B",
">+ c #86AFD1",
",+ c #90B5D5",
"'+ c #EAF1F7",
")+ c #787878",
"!+ c #1B1B1B",
"~+ c #969696",
"{+ c #C6C6C6",
"]+ c #C3D8E9",
"^+ c #4383B8",
"/+ c #94B8D6",
"(+ c #F4F4F4",
"_+ c #A7A7A7",
":+ c #858585",
"<+ c #9D9D9D",
"[+ c #FAFBFD",
"}+ c #5D94C2",
"|+ c #4685B9",
"1+ c #98BBD8",
"2+ c #EFF4F9",
"3+ c #9B9B9B",
"4+ c #C5D9E9",
"5+ c #3B7EB6",
"6+ c #F2F6FA",
"7+ c #2C2C2C",
"8+ c #8FB5D5",
"9+ c #4A87BB",
"0+ c #FAFAFA",
"a+ c #6E6E6E",
"b+ c #85AFD1",
"c+ c #4D89BC",
"d+ c #A8C5DE",
"e+ c #0E0E0E",
"f+ c #B8B8B8",
"g+ c #FEFEFF",
"h+ c #B1CBE2",
"i+ c #4C89BC",
"j+ c #BFD4E7",
"k+ c #ECECEC",
"l+ c #939393",
"m+ c #81ACD0",
"n+ c #6599C5",
"o+ c #6197C4",
"p+ c #6C9EC8",
"q+ c #F7FAFC",
" . + @ # $ % & * = ",
" - ; > , , , , , , , ' ) - ",
" ! ~ { ] ^ / ( _ : < , , , [ } ",
" | 1 2 1 3 4 5 6 7 8 9 0 , , , a - ",
" b c d d d d d d d d e b f , , , , g ",
" h i j d d d d d d d k l } m , , , n o ",
" p q r s d d d d d d d 2 b t u , , , v ",
" w x y z d d d d d d d d 5 A B , , , C ",
" D E F G d d d d d d d d H I , , , , J K ",
" . > < L M d d d d d d d N O P , , , , E Q ",
" b R , S T U d d d d d d d V W X Y , , , , E Z ",
" ` ...+.@.#.$.%.&.*.d d d d d d d =. -., , , , , , ;. ",
" >.d d d ,.'.>.). !.~.{.].'.^.d U /. (., , , , , , _. ",
":.<.d d d d d d [. }.7 |.1.W O 2.3.b 4., , , , , , ) ",
"5.U d d d d d d 6. 7.d d 8. .9.0.a. b.c.< u , , , , d. ",
"e.d d d d d d d f.g.h.d d d d d d N i.j. X - k.l.m.n.o., p. ",
"q.d d d d d d r.s.t.U d d d d d d d d u. s.v.w.x.}. y.z.A. ",
"B.d d d d d d C. D.d d d d d d d d d E. z d d d ^.F.w.x.&.b ",
"G.d d d d d d H. I.d d d d d d d d J.a. K.d d d d d d d L.M.N.",
"!.O.P.k d d k t.Q.R.d d d d d d d d S.b T.h.d d d d d d d d d U.",
" ! V.W.s <.s.X.d d d d d d d d d Y. Z.`.d d d d d d d d d +",
" b .+++ @+d d d d d d d d `.#+ u.d d d d d d d d d d $+",
" j.%+d d d d d d d &+Q. *+d d d d d d d d d d =+",
" -+ s.|.;+,.d d d d 4 T.J.d d d d d d d d d M T.",
" >+,+'+ 5.)+!+d d ~+ {+d d d d d d d d d d K. ",
" ]+, ^+/+= (+_+:+(+ Y.d d d d d d d d d d <+ ",
" [+}+, , |+1+2+ 3+d d d d d d d d d s @. ",
" 4+5+, , , n m.6+ :.u.<.`.d d d d d d 7+! ",
" 8+, , , , , 9+^ k. 0+x.S.^.d d d d a+ ",
" - b+, , , , , , c+d+A. b Z.c e+d `.f+ ",
" g+h+i+E , , , , , c+j+ k+l+3+W ",
" k.; m+n+o+p+8+4+q+ "};

Binary file not shown.

Binary file not shown.

View File

@ -1,11 +0,0 @@
The following files are included in the resource archive:
Footsteps.wav - from openal.org cvs
ding.wav - from openal.org cvs
left.wav - sampled by matzon
right.wav - sampled by matzon
center.wav - sampled by matzon
optional:
Missing_you.mod - Missing You, by Doh (Nicolas Desessart, http://doh.av7.net)
phero.mp3 - snipped from unreleased Phero track
phero2.ogg - snipped from unreleased Phero track

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

5
run-test.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -e
java -cp res:target/jars/lwjgl.jar:target/jars/lwjgl_util.jar:target/jars/lwjgl_test.jar:lib/jinput.jar -Dorg.lwjgl.util.Debug=true -Djava.library.path=target/natives "$@"

View File

@ -50,6 +50,8 @@ import java.nio.ShortBuffer;
*/
public final class BufferUtils {
@java.lang.annotation.Native
private static final int __FORCE_NATIVE_HEADER = 0;
/**
* Construct a direct native-ordered bytebuffer with the specified size.

View File

@ -0,0 +1,201 @@
package org.lwjgl;
final class LWJGLIconData {
static final String ICON_16x16 =
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\376\377\377\377\302\327\350\377" +
"\164\244\313\377\120\213\275\377\124\216\277\377\206\257\322\377" +
"\347\357\366\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\365\365\365\377\215\217\221\377\166\202\215\377" +
"\175\215\233\377\204\231\252\377\224\267\325\377\072\175\265\377" +
"\110\206\272\377\332\347\361\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\364\370\373\377\234\236\240\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\344\344\344\377\204\255\320\377" +
"\072\175\265\377\133\222\301\377\374\375\376\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\221\266\325\377\137\137\137\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\042\042\042\377\377\377\377\377\350\360\366\377" +
"\071\174\265\377\072\175\265\377\304\330\351\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\306\331\351\377" +
"\201\253\316\377\035\035\035\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\146\146\146\377\377\377\377\377\320\340\355\377" +
"\072\175\265\377\072\175\265\377\215\264\324\377\377\377\377\377" +
"\362\362\362\377\245\245\245\377\337\337\337\377\242\301\334\377" +
"\260\305\326\377\012\012\012\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\250\250\250\377\377\377\377\377\227\272\330\377" +
"\072\175\265\377\072\175\265\377\161\241\312\377\377\377\377\377" +
"\241\241\241\377\000\000\000\377\001\001\001\377\043\043\043\377" +
"\314\314\314\377\320\320\320\377\245\245\245\377\204\204\204\377" +
"\134\134\134\377\357\357\357\377\377\377\377\377\140\226\303\377" +
"\072\175\265\377\072\175\265\377\155\236\310\377\377\377\377\377" +
"\136\136\136\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\317\317\317\377\037\037\037\377\003\003\003\377\053\053\053\377" +
"\154\154\154\377\306\306\306\377\372\374\375\377\236\277\332\377" +
"\167\245\314\377\114\211\274\377\174\250\316\377\377\377\377\377" +
"\033\033\033\377\000\000\000\377\000\000\000\377\027\027\027\377" +
"\326\326\326\377\001\001\001\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\122\122\122\377\345\345\345\377\075\075\075\377" +
"\150\150\150\377\246\246\247\377\332\336\341\377\377\377\377\377" +
"\164\164\164\377\016\016\016\377\000\000\000\377\131\131\131\377" +
"\225\225\225\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\221\221\221\377\233\233\233\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\002\002\002\377\103\103\103\377" +
"\377\377\377\377\356\356\356\377\214\214\214\377\277\277\277\377" +
"\126\126\126\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\323\323\323\377\130\130\130\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\063\063\063\377" +
"\377\377\377\377\377\377\377\377\374\375\376\377\377\377\377\377" +
"\300\300\300\377\100\100\100\377\002\002\002\377\000\000\000\377" +
"\033\033\033\377\373\373\373\377\027\027\027\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\170\170\170\377" +
"\377\377\377\377\377\377\377\377\322\341\356\377\176\251\316\377" +
"\340\352\363\377\377\377\377\377\324\324\324\377\155\155\155\377" +
"\204\204\204\377\323\323\323\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\275\275\275\377" +
"\377\377\377\377\377\377\377\377\376\376\376\377\146\232\305\377" +
"\075\177\266\377\202\254\320\377\344\355\365\377\377\377\377\377" +
"\377\377\377\377\345\345\345\377\055\055\055\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\014\014\014\377\366\366\366\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\342\354\364\377" +
"\115\211\274\377\072\175\265\377\076\200\266\377\207\260\322\377" +
"\347\357\366\377\377\377\377\377\376\376\376\377\274\274\274\377" +
"\117\117\117\377\003\003\003\377\112\112\112\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\353\362\370\377\214\263\324\377\126\220\300\377\120\214\275\377" +
"\167\245\314\377\355\363\370\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\337\337\337\377\346\346\346\377\377\377\377\377";
static final String ICON_32x32 =
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\374\375\377" +
"\313\335\354\377\223\267\326\377\157\240\311\377\134\223\302\377\140\226\303\377\172\247\315\377\254\310\340\377\355\363\370\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\375\376\377\265\316\343\377\132\222\301\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\105\205\271\377" +
"\241\301\334\377\374\375\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\374\374\377\342\352\361\377\270\317\343\377\256\311\340\377" +
"\243\302\334\377\230\272\330\377\214\263\323\377\201\254\317\377\156\237\310\377\075\177\266\377\072\175\265\377\072\175\265\377" +
"\072\175\265\377\162\242\312\377\365\370\373\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\330\330\330\377\061\061\061\377\044\044\044\377\061\061\061\377\100\100\100\377" +
"\122\122\122\377\145\145\145\377\164\164\164\377\217\217\217\377\367\370\370\377\254\310\337\377\073\175\265\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\171\247\315\377\374\375\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\376\376\376\377\150\150\150\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\266\266\266\377\376\376\376\377\206\256\321\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\256\312\341\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\323\342\356\377\341\352\362\377\050\050\050\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\002\002\002\377\336\336\336\377\377\377\377\377\365\370\373\377\133\222\301\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\110\206\272\377\364\370\373\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\354\363\370\377\144\231\305\377\327\331\333\377\005\005\005\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\044\044\044\377\376\376\376\377\377\377\377\377\377\377\377\377\300\325\347\377" +
"\071\174\265\377\072\175\265\377\072\175\265\377\072\175\265\377\253\310\340\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376\377\377\377" +
"\170\246\314\377\173\247\315\377\236\236\236\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\145\145\145\377\377\377\377\377\377\377\377\377\377\377\377\377\342\354\364\377" +
"\067\173\264\377\072\175\265\377\072\175\265\377\072\175\265\377\146\232\305\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\303\327\350\377" +
"\071\175\265\377\262\314\341\377\130\130\130\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\251\251\251\377\377\377\377\377\377\377\377\377\377\377\377\377\274\322\345\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\100\201\267\377\356\364\371\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\374\375\377\132\222\301\377" +
"\075\177\266\377\335\345\355\377\034\034\034\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\007\007\007\377\347\347\347\377\377\377\377\377\377\377\377\377\377\377\377\377\205\256\321\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\071\175\265\377\314\336\354\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\376\376\376\377\377\377\377\377\377\377\377\377\377\377\377\377\272\322\345\377\072\175\265\377" +
"\127\220\277\377\320\321\321\377\003\003\003\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\063\063\063\377\375\375\375\377\377\377\377\377\377\377\377\377\373\374\375\377\120\213\275\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\071\175\265\377\261\314\342\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\312\312\312\377\067\067\067\377\141\141\141\377\242\242\242\377\335\335\335\377\344\354\363\377\261\313\341\377" +
"\264\315\342\377\346\346\346\377\043\043\043\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\162\162\162\377\377\377\377\377\377\377\377\377\377\377\377\377\330\345\360\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\240\300\333\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\146\146\146\377\000\000\000\377\000\000\000\377\000\000\000\377\006\006\006\377\047\047\047\377\146\146\146\377" +
"\324\324\324\377\377\377\377\377\366\366\366\377\320\320\320\377\227\227\227\377\136\136\136\377\047\047\047\377\004\004\004\377" +
"\000\000\000\377\003\003\003\377\300\300\300\377\377\377\377\377\377\377\377\377\377\377\377\377\242\301\333\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\236\277\332\377\377\377\377\377\377\377\377\377" +
"\373\373\373\377\045\045\045\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\134\134\134\377\377\377\377\377\352\352\352\377\217\217\217\377\265\265\265\377\351\351\351\377\375\375\375\377\347\347\347\377" +
"\262\262\262\377\275\275\275\377\376\376\376\377\377\377\377\377\377\377\377\377\377\377\377\377\153\235\307\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\241\301\334\377\377\377\377\377\377\377\377\377" +
"\333\333\333\377\003\003\003\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\203\203\203\377\377\377\377\377\137\137\137\377\000\000\000\377\000\000\000\377\013\013\013\377\067\067\067\377\166\166\166\377" +
"\267\267\267\377\360\360\360\377\377\377\377\377\377\377\377\377\377\377\377\377\360\365\371\377\113\210\273\377\075\177\266\377" +
"\071\174\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\262\314\342\377\377\377\377\377\377\377\377\377" +
"\232\232\232\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\305\305\305\377\367\367\367\377\035\035\035\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\007\007\007\377\074\074\074\377\337\337\337\377\377\377\377\377\373\374\375\377\374\375\376\377\363\367\372\377" +
"\314\335\353\377\236\276\332\377\162\241\311\377\114\211\273\377\072\175\265\377\311\334\353\377\377\377\377\377\377\377\377\377" +
"\126\126\126\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\017\017\017\377" +
"\371\371\371\377\321\321\321\377\003\003\003\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\216\216\216\377\377\377\377\377\371\371\371\377\204\204\204\377\160\160\160\377" +
"\260\260\260\377\352\352\352\377\377\377\377\377\371\373\374\377\334\350\362\377\366\371\374\377\377\377\377\377\377\377\377\377" +
"\025\025\025\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\116\116\116\377" +
"\377\377\377\377\221\221\221\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\273\273\273\377\377\377\377\377\236\236\236\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\004\004\004\377\057\057\057\377\160\160\160\377\260\260\260\377\346\346\346\377\376\376\376\377\377\377\377\377" +
"\071\071\071\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\220\220\220\377" +
"\377\377\377\377\115\115\115\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\020\020\020\377\360\360\360\377\377\377\377\377\132\132\132\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\011\011\011\377\062\062\062\377\261\261\261\377" +
"\366\366\366\377\241\241\241\377\065\065\065\377\002\002\002\377\000\000\000\377\000\000\000\377\002\002\002\377\321\321\321\377" +
"\365\365\365\377\023\023\023\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\105\105\105\377\376\376\376\377\370\370\370\377\035\035\035\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\053\053\053\377" +
"\377\377\377\377\377\377\377\377\374\374\374\377\276\276\276\377\120\120\120\377\005\005\005\377\045\045\045\377\371\371\371\377" +
"\302\302\302\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\206\206\206\377\377\377\377\377\322\322\322\377\001\001\001\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\103\103\103\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376\376\376\377\334\334\334\377\340\340\340\377\377\377\377\377" +
"\225\225\225\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\001\001\001\377\310\310\310\377\377\377\377\377\216\216\216\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\210\210\210\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\337\337\337\377\051\051\051\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\030\030\030\377\365\365\365\377\377\377\377\377\112\112\112\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\317\317\317\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\361\366\372\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\371\371\371\377\265\265\265\377\113\113\113\377\006\006\006\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\122\122\122\377\377\377\377\377\370\370\370\377\020\020\020\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\034\034\034\377\370\370\370\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\206\257\321\377\220\265\325\377\352\361\367\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\333\333\333\377\170\170\170\377\033\033\033\377\000\000\000\377" +
"\000\000\000\377\226\226\226\377\377\377\377\377\306\306\306\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\132\132\132\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\303\330\351\377\072\175\265\377\103\203\270\377" +
"\224\270\326\377\355\363\370\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\364\364\364\377\247\247\247\377" +
"\205\205\205\377\364\364\364\377\377\377\377\377\206\206\206\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\235\235\235\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\373\375\377\135\224\302\377\072\175\265\377" +
"\072\175\265\377\106\205\271\377\230\273\330\377\357\364\371\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\233\233\233\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\005\005\005\377\335\335\335\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\305\331\351\377\073\176\266\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\110\206\272\377\236\276\332\377\362\366\372\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\373\373\373\377\216\216\216\377\045\045\045\377\001\001\001\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\054\054\054\377\374\374\374\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\217\265\325\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\112\207\273\377\243\302\334\377\363\367\372\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\372\372\377\260\260\260\377\105\105\105\377" +
"\004\004\004\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\156\156\156\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\375\376\377" +
"\205\257\321\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\115\211\274\377" +
"\250\305\336\377\366\371\374\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376\376\376\377" +
"\322\322\322\377\150\150\150\377\016\016\016\377\000\000\000\377\001\001\001\377\270\270\270\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\376\376\377\377\261\313\342\377\114\211\274\377\071\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377" +
"\072\175\265\377\115\211\274\377\277\324\347\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\354\354\354\377\223\223\223\377\233\233\233\377\375\375\375\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\363\367\372\377\265\316\343\377\201\254\320\377\145\231\305\377\141\227\304\377\154\236\310\377" +
"\217\265\325\377\305\331\351\377\367\372\374\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377";
private LWJGLIconData() {}
}

View File

@ -32,16 +32,18 @@
package org.lwjgl;
import java.io.File;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.*;
import dev.pfaff.unfettered.Unfettered;
import static java.lang.invoke.MethodType.methodType;
/**
* <p>
* Internal library methods
@ -59,207 +61,22 @@ public class LWJGLUtil {
public static final String PLATFORM_MACOSX_NAME = "macosx";
public static final String PLATFORM_WINDOWS_NAME = "windows";
private static final String LWJGL_ICON_DATA_16x16 =
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\376\377\377\377\302\327\350\377" +
"\164\244\313\377\120\213\275\377\124\216\277\377\206\257\322\377" +
"\347\357\366\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\365\365\365\377\215\217\221\377\166\202\215\377" +
"\175\215\233\377\204\231\252\377\224\267\325\377\072\175\265\377" +
"\110\206\272\377\332\347\361\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\364\370\373\377\234\236\240\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\344\344\344\377\204\255\320\377" +
"\072\175\265\377\133\222\301\377\374\375\376\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\221\266\325\377\137\137\137\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\042\042\042\377\377\377\377\377\350\360\366\377" +
"\071\174\265\377\072\175\265\377\304\330\351\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\306\331\351\377" +
"\201\253\316\377\035\035\035\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\146\146\146\377\377\377\377\377\320\340\355\377" +
"\072\175\265\377\072\175\265\377\215\264\324\377\377\377\377\377" +
"\362\362\362\377\245\245\245\377\337\337\337\377\242\301\334\377" +
"\260\305\326\377\012\012\012\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\250\250\250\377\377\377\377\377\227\272\330\377" +
"\072\175\265\377\072\175\265\377\161\241\312\377\377\377\377\377" +
"\241\241\241\377\000\000\000\377\001\001\001\377\043\043\043\377" +
"\314\314\314\377\320\320\320\377\245\245\245\377\204\204\204\377" +
"\134\134\134\377\357\357\357\377\377\377\377\377\140\226\303\377" +
"\072\175\265\377\072\175\265\377\155\236\310\377\377\377\377\377" +
"\136\136\136\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\317\317\317\377\037\037\037\377\003\003\003\377\053\053\053\377" +
"\154\154\154\377\306\306\306\377\372\374\375\377\236\277\332\377" +
"\167\245\314\377\114\211\274\377\174\250\316\377\377\377\377\377" +
"\033\033\033\377\000\000\000\377\000\000\000\377\027\027\027\377" +
"\326\326\326\377\001\001\001\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\122\122\122\377\345\345\345\377\075\075\075\377" +
"\150\150\150\377\246\246\247\377\332\336\341\377\377\377\377\377" +
"\164\164\164\377\016\016\016\377\000\000\000\377\131\131\131\377" +
"\225\225\225\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\221\221\221\377\233\233\233\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\002\002\002\377\103\103\103\377" +
"\377\377\377\377\356\356\356\377\214\214\214\377\277\277\277\377" +
"\126\126\126\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\323\323\323\377\130\130\130\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\063\063\063\377" +
"\377\377\377\377\377\377\377\377\374\375\376\377\377\377\377\377" +
"\300\300\300\377\100\100\100\377\002\002\002\377\000\000\000\377" +
"\033\033\033\377\373\373\373\377\027\027\027\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\170\170\170\377" +
"\377\377\377\377\377\377\377\377\322\341\356\377\176\251\316\377" +
"\340\352\363\377\377\377\377\377\324\324\324\377\155\155\155\377" +
"\204\204\204\377\323\323\323\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\275\275\275\377" +
"\377\377\377\377\377\377\377\377\376\376\376\377\146\232\305\377" +
"\075\177\266\377\202\254\320\377\344\355\365\377\377\377\377\377" +
"\377\377\377\377\345\345\345\377\055\055\055\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\014\014\014\377\366\366\366\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\342\354\364\377" +
"\115\211\274\377\072\175\265\377\076\200\266\377\207\260\322\377" +
"\347\357\366\377\377\377\377\377\376\376\376\377\274\274\274\377" +
"\117\117\117\377\003\003\003\377\112\112\112\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\353\362\370\377\214\263\324\377\126\220\300\377\120\214\275\377" +
"\167\245\314\377\355\363\370\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\337\337\337\377\346\346\346\377\377\377\377\377";
private static final MethodHandle MH_findLibrary;
private static final String LWJGL_ICON_DATA_32x32 =
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\374\375\377" +
"\313\335\354\377\223\267\326\377\157\240\311\377\134\223\302\377\140\226\303\377\172\247\315\377\254\310\340\377\355\363\370\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\375\376\377\265\316\343\377\132\222\301\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\105\205\271\377" +
"\241\301\334\377\374\375\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\374\374\377\342\352\361\377\270\317\343\377\256\311\340\377" +
"\243\302\334\377\230\272\330\377\214\263\323\377\201\254\317\377\156\237\310\377\075\177\266\377\072\175\265\377\072\175\265\377" +
"\072\175\265\377\162\242\312\377\365\370\373\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\330\330\330\377\061\061\061\377\044\044\044\377\061\061\061\377\100\100\100\377" +
"\122\122\122\377\145\145\145\377\164\164\164\377\217\217\217\377\367\370\370\377\254\310\337\377\073\175\265\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\171\247\315\377\374\375\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\376\376\376\377\150\150\150\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\266\266\266\377\376\376\376\377\206\256\321\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\256\312\341\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\323\342\356\377\341\352\362\377\050\050\050\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\002\002\002\377\336\336\336\377\377\377\377\377\365\370\373\377\133\222\301\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\110\206\272\377\364\370\373\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\354\363\370\377\144\231\305\377\327\331\333\377\005\005\005\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\044\044\044\377\376\376\376\377\377\377\377\377\377\377\377\377\300\325\347\377" +
"\071\174\265\377\072\175\265\377\072\175\265\377\072\175\265\377\253\310\340\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376\377\377\377" +
"\170\246\314\377\173\247\315\377\236\236\236\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\145\145\145\377\377\377\377\377\377\377\377\377\377\377\377\377\342\354\364\377" +
"\067\173\264\377\072\175\265\377\072\175\265\377\072\175\265\377\146\232\305\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\303\327\350\377" +
"\071\175\265\377\262\314\341\377\130\130\130\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\251\251\251\377\377\377\377\377\377\377\377\377\377\377\377\377\274\322\345\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\100\201\267\377\356\364\371\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\374\375\377\132\222\301\377" +
"\075\177\266\377\335\345\355\377\034\034\034\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\007\007\007\377\347\347\347\377\377\377\377\377\377\377\377\377\377\377\377\377\205\256\321\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\071\175\265\377\314\336\354\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\376\376\376\377\377\377\377\377\377\377\377\377\377\377\377\377\272\322\345\377\072\175\265\377" +
"\127\220\277\377\320\321\321\377\003\003\003\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\063\063\063\377\375\375\375\377\377\377\377\377\377\377\377\377\373\374\375\377\120\213\275\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\071\175\265\377\261\314\342\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\312\312\312\377\067\067\067\377\141\141\141\377\242\242\242\377\335\335\335\377\344\354\363\377\261\313\341\377" +
"\264\315\342\377\346\346\346\377\043\043\043\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\162\162\162\377\377\377\377\377\377\377\377\377\377\377\377\377\330\345\360\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\240\300\333\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\146\146\146\377\000\000\000\377\000\000\000\377\000\000\000\377\006\006\006\377\047\047\047\377\146\146\146\377" +
"\324\324\324\377\377\377\377\377\366\366\366\377\320\320\320\377\227\227\227\377\136\136\136\377\047\047\047\377\004\004\004\377" +
"\000\000\000\377\003\003\003\377\300\300\300\377\377\377\377\377\377\377\377\377\377\377\377\377\242\301\333\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\236\277\332\377\377\377\377\377\377\377\377\377" +
"\373\373\373\377\045\045\045\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\134\134\134\377\377\377\377\377\352\352\352\377\217\217\217\377\265\265\265\377\351\351\351\377\375\375\375\377\347\347\347\377" +
"\262\262\262\377\275\275\275\377\376\376\376\377\377\377\377\377\377\377\377\377\377\377\377\377\153\235\307\377\072\175\265\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\241\301\334\377\377\377\377\377\377\377\377\377" +
"\333\333\333\377\003\003\003\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\203\203\203\377\377\377\377\377\137\137\137\377\000\000\000\377\000\000\000\377\013\013\013\377\067\067\067\377\166\166\166\377" +
"\267\267\267\377\360\360\360\377\377\377\377\377\377\377\377\377\377\377\377\377\360\365\371\377\113\210\273\377\075\177\266\377" +
"\071\174\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\262\314\342\377\377\377\377\377\377\377\377\377" +
"\232\232\232\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\305\305\305\377\367\367\367\377\035\035\035\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\007\007\007\377\074\074\074\377\337\337\337\377\377\377\377\377\373\374\375\377\374\375\376\377\363\367\372\377" +
"\314\335\353\377\236\276\332\377\162\241\311\377\114\211\273\377\072\175\265\377\311\334\353\377\377\377\377\377\377\377\377\377" +
"\126\126\126\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\017\017\017\377" +
"\371\371\371\377\321\321\321\377\003\003\003\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\216\216\216\377\377\377\377\377\371\371\371\377\204\204\204\377\160\160\160\377" +
"\260\260\260\377\352\352\352\377\377\377\377\377\371\373\374\377\334\350\362\377\366\371\374\377\377\377\377\377\377\377\377\377" +
"\025\025\025\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\116\116\116\377" +
"\377\377\377\377\221\221\221\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\273\273\273\377\377\377\377\377\236\236\236\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\004\004\004\377\057\057\057\377\160\160\160\377\260\260\260\377\346\346\346\377\376\376\376\377\377\377\377\377" +
"\071\071\071\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\220\220\220\377" +
"\377\377\377\377\115\115\115\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\020\020\020\377\360\360\360\377\377\377\377\377\132\132\132\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\011\011\011\377\062\062\062\377\261\261\261\377" +
"\366\366\366\377\241\241\241\377\065\065\065\377\002\002\002\377\000\000\000\377\000\000\000\377\002\002\002\377\321\321\321\377" +
"\365\365\365\377\023\023\023\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\105\105\105\377\376\376\376\377\370\370\370\377\035\035\035\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\053\053\053\377" +
"\377\377\377\377\377\377\377\377\374\374\374\377\276\276\276\377\120\120\120\377\005\005\005\377\045\045\045\377\371\371\371\377" +
"\302\302\302\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\206\206\206\377\377\377\377\377\322\322\322\377\001\001\001\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\103\103\103\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376\376\376\377\334\334\334\377\340\340\340\377\377\377\377\377" +
"\225\225\225\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\001\001\001\377\310\310\310\377\377\377\377\377\216\216\216\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\210\210\210\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\337\337\337\377\051\051\051\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\030\030\030\377\365\365\365\377\377\377\377\377\112\112\112\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\317\317\317\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\361\366\372\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\371\371\371\377\265\265\265\377\113\113\113\377\006\006\006\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\122\122\122\377\377\377\377\377\370\370\370\377\020\020\020\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\034\034\034\377\370\370\370\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\206\257\321\377\220\265\325\377\352\361\367\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\333\333\333\377\170\170\170\377\033\033\033\377\000\000\000\377" +
"\000\000\000\377\226\226\226\377\377\377\377\377\306\306\306\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\132\132\132\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\303\330\351\377\072\175\265\377\103\203\270\377" +
"\224\270\326\377\355\363\370\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\364\364\364\377\247\247\247\377" +
"\205\205\205\377\364\364\364\377\377\377\377\377\206\206\206\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\235\235\235\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\373\375\377\135\224\302\377\072\175\265\377" +
"\072\175\265\377\106\205\271\377\230\273\330\377\357\364\371\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\233\233\233\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\005\005\005\377\335\335\335\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\305\331\351\377\073\176\266\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\110\206\272\377\236\276\332\377\362\366\372\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\373\373\373\377\216\216\216\377\045\045\045\377\001\001\001\377\000\000\000\377" +
"\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\054\054\054\377\374\374\374\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\217\265\325\377" +
"\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\112\207\273\377\243\302\334\377\363\367\372\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\372\372\377\260\260\260\377\105\105\105\377" +
"\004\004\004\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\156\156\156\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\375\376\377" +
"\205\257\321\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\115\211\274\377" +
"\250\305\336\377\366\371\374\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376\376\376\377" +
"\322\322\322\377\150\150\150\377\016\016\016\377\000\000\000\377\001\001\001\377\270\270\270\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\376\376\377\377\261\313\342\377\114\211\274\377\071\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377" +
"\072\175\265\377\115\211\274\377\277\324\347\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\354\354\354\377\223\223\223\377\233\233\233\377\375\375\375\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\363\367\372\377\265\316\343\377\201\254\320\377\145\231\305\377\141\227\304\377\154\236\310\377" +
"\217\265\325\377\305\331\351\377\367\372\374\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" +
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377";
static {
MethodHandles.Lookup l = Unfettered.getTrustedLookup();
try {
MH_findLibrary = l.findVirtual(ClassLoader.class, "findLibrary", methodType(String.class, String.class));
} catch (ReflectiveOperationException e) {
throw new RuntimeException("Failed to get a MethodHandle for the findLibrary method", e);
}
}
/** LWJGL Logo - 16 by 16 pixels */
public static final ByteBuffer LWJGLIcon16x16 = loadIcon(LWJGL_ICON_DATA_16x16);
public static final ByteBuffer LWJGLIcon16x16 = loadIcon(LWJGLIconData.ICON_16x16);
/** LWJGL Logo - 32 by 32 pixels */
public static final ByteBuffer LWJGLIcon32x32 = loadIcon(LWJGL_ICON_DATA_32x32);
public static final ByteBuffer LWJGLIcon32x32 = loadIcon(LWJGLIconData.ICON_32x32);
/** Debug flag. */
public static final boolean DEBUG = getPrivilegedBoolean("org.lwjgl.util.Debug");
@ -268,6 +85,32 @@ public class LWJGLUtil {
private static final int PLATFORM;
private static StupidSimpleLogger logger = msg -> {
//if (DEBUG) {
System.err.println("[LWJGL] " + msg.get());
//}
};
public static StupidSimpleLogger logger() {
return logger;
}
public static void logger(StupidSimpleLogger newLogger) {
logger = newLogger;
}
/**
* Logs the given message.
*
* @param msg Message to print
*
* @deprecated Use {@link #logger} instead.
*/
@Deprecated
public static void log(CharSequence msg) {
logger().log(() -> msg.toString());
}
static {
final String osName = getPrivilegedProperty("os.name");
if ( osName.startsWith("Windows") )
@ -342,8 +185,8 @@ public class LWJGLUtil {
* @param classloader The classloader to ask for library paths
* @return Paths to located libraries, if any
*/
public static String[] getLibraryPaths(String libname, String platform_lib_name, ClassLoader classloader) {
return getLibraryPaths(libname, new String[]{platform_lib_name}, classloader);
public static List<String> getLibraryPaths(String libname, String platform_lib_name, ClassLoader classloader) {
return getLibraryPaths(libname, List.of(platform_lib_name), classloader);
}
/**
@ -354,30 +197,41 @@ public class LWJGLUtil {
* @param classloader The classloader to ask for library paths
* @return Paths to located libraries, if any
*/
public static String[] getLibraryPaths(String libname, String[] platform_lib_names, ClassLoader classloader) {
public static List<String> getLibraryPaths(String libname, List<String> platform_lib_names, ClassLoader classloader) {
String overridePath = getPrivilegedProperty("org.lwjgl.librarypath.override." + libname);
if (overridePath != null) {
// override specifies an exact path
return List.of(overridePath);
}
// need to pass path of possible locations of library to native side
List<String> possible_paths = new ArrayList<String>();
// generic custom path
String customPath = getPrivilegedProperty("org.lwjgl.librarypath");
for (String platform_lib_name : platform_lib_names) {
possible_paths.add(customPath + File.separator + platform_lib_name);
}
String classloader_path = getPathFromClassLoader(libname, classloader);
if (classloader_path != null) {
log("getPathFromClassLoader: Path found: " + classloader_path);
if (DEBUG) {
logger().log(() -> "getPathFromClassLoader: Path found: " + classloader_path);
}
possible_paths.add(classloader_path);
}
for ( String platform_lib_name : platform_lib_names ) {
String lwjgl_classloader_path = getPathFromClassLoader("lwjgl", classloader);
if ( lwjgl_classloader_path != null ) {
log("getPathFromClassLoader: Path found: " + lwjgl_classloader_path);
if ( DEBUG ) {
logger().log(() -> "getPathFromClassLoader: Path found: " + lwjgl_classloader_path);
}
possible_paths.add(lwjgl_classloader_path.substring(0, lwjgl_classloader_path.lastIndexOf(File.separator))
+ File.separator + platform_lib_name);
}
// add Installer path
String alternative_path = getPrivilegedProperty("org.lwjgl.librarypath");
if ( alternative_path != null ) {
possible_paths.add(alternative_path + File.separator + platform_lib_name);
}
// Add all possible paths from java.library.path
String java_library_path = getPrivilegedProperty("java.library.path");
@ -387,90 +241,40 @@ public class LWJGLUtil {
possible_paths.add(path + File.separator + platform_lib_name);
}
//add current path
String current_dir = getPrivilegedProperty("user.dir");
possible_paths.add(current_dir + File.separator + platform_lib_name);
//add pure library (no path, let OS search)
possible_paths.add(platform_lib_name);
}
//create needed string array
return possible_paths.toArray(new String[possible_paths.size()]);
return possible_paths;
}
static void execPrivileged(final String[] cmd_array) throws Exception {
try {
Process process = AccessController.doPrivileged(new PrivilegedExceptionAction<Process>() {
public Process run() throws Exception {
return Runtime.getRuntime().exec(cmd_array);
}
});
// Close unused streams to make sure the child process won't hang
process.getInputStream().close();
process.getOutputStream().close();
process.getErrorStream().close();
} catch (PrivilegedActionException e) {
throw (Exception)e.getCause();
static void execPrivileged(String... cmd_array) throws Exception {
Process process = Runtime.getRuntime().exec(cmd_array);
// Close unused streams to make sure the child process won't hang
process.getInputStream().close();
process.getOutputStream().close();
process.getErrorStream().close();
}
private static String getPrivilegedProperty(String property_name) {
return System.getProperty(property_name);
}
/** Gets a boolean property as a privileged action. */
public static boolean getPrivilegedBoolean(String property_name) {
String s = getPrivilegedProperty(property_name);
if (s == null || s.equals("false")) return false;
if (DEBUG) {
if (!s.equals("true")) {
logger().log(() -> "Value of boolean property " + property_name + " is not one of [true, false]: " + s);
}
}
return true;
}
private static String getPrivilegedProperty(final String property_name) {
return AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty(property_name);
}
});
}
/**
* Tries to locate named library from the current ClassLoader
* This method exists because native libraries are loaded from native code, and as such
* is exempt from ClassLoader library loading rutines. It therefore always fails.
* We therefore invoke the protected method of the ClassLoader to see if it can
* locate it.
*
* @param libname Name of library to search for
* @param classloader Classloader to use
* @return Absolute path to library if found, otherwise null
*/
private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) {
Class<?> c = null;
try {
log("getPathFromClassLoader: searching for: " + libname);
c = classloader.getClass();
while (c != null) {
final Class<?> clazz = c;
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
public String run() throws Exception {
Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class);
findLibrary.setAccessible(true);
String path = (String)findLibrary.invoke(classloader, libname);
return path;
}
});
} catch (PrivilegedActionException e) {
log("Failed to locate findLibrary method: " + e.getCause());
c = c.getSuperclass();
}
}
} catch (Exception e) {
log("Failure locating " + e + " using classloader:" + c);
}
return null;
}
/**
* Gets a boolean property as a privileged action.
*/
public static boolean getPrivilegedBoolean(final String property_name) {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.getBoolean(property_name);
}
});
/** Gets a string property as a privileged action. */
public static String getPrivilegedString(String property_name) {
return getPrivilegedProperty(property_name);
}
/**
@ -481,11 +285,9 @@ public class LWJGLUtil {
* @return the property value
*/
public static Integer getPrivilegedInteger(final String property_name) {
return AccessController.doPrivileged(new PrivilegedAction<Integer>() {
public Integer run() {
return Integer.getInteger(property_name);
}
});
String s = getPrivilegedProperty(property_name);
if (s == null) return null;
return Integer.decode(s);
}
/**
@ -496,22 +298,32 @@ public class LWJGLUtil {
*
* @return the property value
*/
public static Integer getPrivilegedInteger(final String property_name, final int default_val) {
return AccessController.doPrivileged(new PrivilegedAction<Integer>() {
public Integer run() {
return Integer.getInteger(property_name, default_val);
}
});
public static int getPrivilegedInteger(final String property_name, final int default_val) {
String s = getPrivilegedProperty(property_name);
if (s == null) return default_val;
return Integer.decode(s);
}
/**
* Prints the given message to System.err if DEBUG is true.
* Tries to locate named library from the current ClassLoader
* This method exists because native libraries are loaded from native code, and as such
* is exempt from ClassLoader library loading routines. It therefore always fails.
* We therefore invoke the protected method of the ClassLoader to see if it can
* locate it.
*
* @param msg Message to print
* @param libname Name of library to search for
* @param classLoader Classloader to use
* @return Absolute path to library if found, otherwise null
*/
public static void log(CharSequence msg) {
private static String getPathFromClassLoader(final String libname, final ClassLoader classLoader) {
if (DEBUG) {
System.err.println("[LWJGL] " + msg);
logger().log(() -> "getPathFromClassLoader: Searching for '" + libname + '\'');
}
try {
return (String) MH_findLibrary.invokeExact(classLoader, libname);
} catch (Throwable e) {
logger().log(() -> "getPathFromClassLoader: Failure locating using classloader '" + classLoader + '\'', e);
return null;
}
}
@ -522,16 +334,28 @@ public class LWJGLUtil {
*/
public static boolean isMacOSXEqualsOrBetterThan(int major_required, int minor_required) {
String os_version = getPrivilegedProperty("os.version");
StringTokenizer version_tokenizer = new StringTokenizer(os_version, ".");
int dotI = os_version.indexOf('.');
if (dotI == -1) {
if (DEBUG) {
logger().log("No '.' delimiter was found in value of 'os.version'");
}
return false;
}
int major;
int minor;
int patch;
try {
String major_str = version_tokenizer.nextToken();
String minor_str = version_tokenizer.nextToken();
major = Integer.parseInt(major_str);
minor = Integer.parseInt(minor_str);
major = Integer.parseInt(os_version, 0, dotI, 10);
int dotI1 = os_version.indexOf('.', dotI + 1);
if (dotI1 == -1) {
minor = Integer.parseInt(os_version, dotI + 1, os_version.length(), 10);
patch = 0;
} else {
minor = Integer.parseInt(os_version, dotI + 1, dotI1, 10);
patch = Integer.parseInt(os_version, dotI1 + 1, os_version.length(), 10);
}
} catch (Exception e) {
LWJGLUtil.log("Exception occurred while trying to determine OS version: " + e);
logger().log("Exception occurred while trying to determine OS version: " + os_version, e);
// Best guess, no
return false;
}
@ -612,8 +436,8 @@ public class LWJGLUtil {
}
/** Simple interface for Field filtering. */
@FunctionalInterface
public interface TokenFilter {
/**
* Should return true if the specified Field passes the filter.
*
@ -623,7 +447,5 @@ public class LWJGLUtil {
* @return true if the Field is accepted
*/
boolean accept(Field field, int value);
}
}

View File

@ -31,10 +31,8 @@
*/
package org.lwjgl;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.lang.UnsatisfiedLinkError;
import java.lang.annotation.Native;
/**
*
@ -43,6 +41,7 @@ import java.lang.UnsatisfiedLinkError;
* $Id$
*/
final class LinuxSysImplementation extends J2SESysImplementation {
@Native
private static final int JNI_VERSION = 19;
static {
@ -50,17 +49,12 @@ final class LinuxSysImplementation extends J2SESysImplementation {
java.awt.Toolkit.getDefaultToolkit();
// manually load libjawt.so into vm, needed since Java 7
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
try {
System.loadLibrary("jawt");
} catch (UnsatisfiedLinkError e) {
// catch and ignore an already loaded in another classloader
// exception, as vm already has it loaded
}
return null;
}
});
try {
System.loadLibrary("jawt");
} catch (UnsatisfiedLinkError e) {
// catch and ignore an already loaded in another classloader
// exception, as vm already has it loaded
}
}
public int getRequiredJNIVersion() {
@ -71,7 +65,7 @@ final class LinuxSysImplementation extends J2SESysImplementation {
// Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it
// right anyway.
String[] browsers = {"sensible-browser", "xdg-open", "google-chrome", "chromium", "firefox", "iceweasel", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"};
String[] browsers = {"xdg-open", "sensible-browser"};
for ( final String browser : browsers ) {
try {

View File

@ -31,11 +31,7 @@
*/
package org.lwjgl;
import com.apple.eio.FileManager;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.lang.UnsatisfiedLinkError;
import java.lang.annotation.Native;
/**
*
@ -44,6 +40,7 @@ import java.lang.UnsatisfiedLinkError;
* $Id$
*/
final class MacOSXSysImplementation extends J2SESysImplementation {
@Native
private static final int JNI_VERSION = 25;
static {
@ -57,7 +54,7 @@ final class MacOSXSysImplementation extends J2SESysImplementation {
public boolean openURL(String url) {
try {
FileManager.openURL(url);
LWJGLUtil.execPrivileged("open", url);
return true;
} catch (Exception e) {
LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e);

View File

@ -31,13 +31,14 @@
*/
package org.lwjgl;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.Buffer;
import sun.misc.Unsafe;
import sun.reflect.FieldAccessor;
import dev.pfaff.unfettered.UnsafeWrapper;
/**
* MemoryUtil.Accessor implementations that depend on sun.misc.
@ -54,82 +55,50 @@ final class MemoryUtilSun {
/** Implementation using sun.misc.Unsafe. */
private static class AccessorUnsafe implements MemoryUtil.Accessor {
private final Unsafe unsafe;
private final long address;
AccessorUnsafe() {
try {
unsafe = getUnsafeInstance();
address = unsafe.objectFieldOffset(MemoryUtil.getAddressField());
address = UnsafeWrapper.objectFieldOffset(MemoryUtil.getAddressField());
} catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
public long getAddress(final Buffer buffer) {
return unsafe.getLong(buffer, address);
return UnsafeWrapper.getLong(buffer, address);
}
private static Unsafe getUnsafeInstance() {
final Field[] fields = Unsafe.class.getDeclaredFields();
/*
Different runtimes use different names for the Unsafe singleton,
so we cannot use .getDeclaredField and we scan instead. For example:
Oracle: theUnsafe
PERC : m_unsafe_instance
Android: THE_ONE
*/
for ( Field field : fields ) {
if ( !field.getType().equals(Unsafe.class) )
continue;
final int modifiers = field.getModifiers();
if ( !(Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) )
continue;
field.setAccessible(true);
try {
return (Unsafe)field.get(null);
} catch (IllegalAccessException e) {
// ignore
}
break;
}
throw new UnsupportedOperationException();
}
}
/** Implementation using reflection on ByteBuffer, FieldAccessor is used directly. */
/** Implementation using {@link java.lang.MethodHandle}s on ByteBuffer. Reflection is used to acquire the handle. */
private static class AccessorReflectFast implements MemoryUtil.Accessor {
private final FieldAccessor addressAccessor;
private final MethodHandle addressAccessor;
AccessorReflectFast() {
Field address;
Field addressField;
try {
address = MemoryUtil.getAddressField();
addressField = MemoryUtil.getAddressField();
} catch (NoSuchFieldException e) {
throw new UnsupportedOperationException(e);
}
address.setAccessible(true);
addressField.setAccessible(true);
try {
Method m = Field.class.getDeclaredMethod("acquireFieldAccessor", boolean.class);
m.setAccessible(true);
addressAccessor = (FieldAccessor)m.invoke(address, true);
} catch (Exception e) {
addressAccessor = MethodHandles.lookup().unreflectGetter(addressField);
} catch (ReflectiveOperationException e) {
throw new UnsupportedOperationException(e);
}
}
public long getAddress(final Buffer buffer) {
return addressAccessor.getLong(buffer);
try {
return (long) addressAccessor.invokeExact(buffer);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
}
}
}

View File

@ -0,0 +1,58 @@
package org.lwjgl;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.function.Supplier;
/**
* A (mostly) stupidly simple logger.
*/
@FunctionalInterface
public interface StupidSimpleLogger {
/**
* Logs a message provided lazily.
*/
void log(Supplier<String> message);
/**
* Logs a message.
*/
default void log(String message) {
log(() -> message);
}
/**
* Logs a message provided lazily and an error.
*/
default void log(Supplier<String> message, Throwable throwable) {
log(() -> {
StringWriter buf = new StringWriter().append(message.get()).append('\n');
throwable.printStackTrace(new PrintWriter(buf));
return buf.toString();
});
}
/**
* Logs a message and an error.
*/
default void log(String message, Throwable throwable) {
log(() -> message, throwable);
}
/**
* A No-Op implementation of the logger. All default forwarding methods are overidden with No-Op implementations.
*/
public static final StupidSimpleLogger NOOP = new StupidSimpleLogger() {
@Override
public void log(Supplier<String> message) {}
@Override
public void log(String message) {}
@Override
public void log(Supplier<String> message, Throwable throwable) {}
@Override
public void log(String message, Throwable throwable) {}
};
}

View File

@ -35,9 +35,6 @@ import java.io.File;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import org.lwjgl.input.Mouse;
@ -54,7 +51,7 @@ public final class Sys {
private static final String JNI_LIBRARY_NAME = "lwjgl";
/** Current version of library */
private static final String VERSION = "2.9.2";
private static final String VERSION = "2.9.4";
private static final String POSTFIX64BIT = "64";
@ -63,17 +60,12 @@ public final class Sys {
private static final boolean is64Bit;
private static void doLoadLibrary(final String lib_name) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
String library_path = System.getProperty("org.lwjgl.librarypath");
if (library_path != null) {
System.load(library_path + File.separator + LWJGLUtil.mapLibraryName(lib_name));
} else {
System.loadLibrary(lib_name);
}
return null;
}
});
String library_path = System.getProperty("org.lwjgl.librarypath");
if (library_path != null) {
System.load(library_path + File.separator + LWJGLUtil.mapLibraryName(lib_name));
} else {
System.loadLibrary(lib_name);
}
}
private static void loadLibrary(final String lib_name) {
@ -234,18 +226,10 @@ public final class Sys {
try {
// Lookup the javax.jnlp.BasicService object
final Class<?> serviceManagerClass = Class.forName("javax.jnlp.ServiceManager");
Method lookupMethod = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
public Method run() throws Exception {
return serviceManagerClass.getMethod("lookup", String.class);
}
});
Method lookupMethod = serviceManagerClass.getMethod("lookup", String.class);
Object basicService = lookupMethod.invoke(serviceManagerClass, new Object[] {"javax.jnlp.BasicService"});
final Class<?> basicServiceClass = Class.forName("javax.jnlp.BasicService");
Method showDocumentMethod = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
public Method run() throws Exception {
return basicServiceClass.getMethod("showDocument", URL.class);
}
});
Method showDocumentMethod = basicServiceClass.getMethod("showDocument", URL.class);
try {
Boolean ret = (Boolean)showDocumentMethod.invoke(basicService, new URL(url));
return ret;

View File

@ -32,9 +32,6 @@
package org.lwjgl;
import java.nio.ByteBuffer;
import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
import java.security.AccessController;
import java.lang.reflect.Method;
import org.lwjgl.opengl.Display;
@ -76,18 +73,14 @@ final class WindowsSysImplementation extends DefaultSysImplementation {
* public
*/
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Long>() {
public Long run() throws Exception {
Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation");
getImplementation_method.setAccessible(true);
Object display_impl = getImplementation_method.invoke(null);
Class<?> WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay");
Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd");
getHwnd_method.setAccessible(true);
return (Long)getHwnd_method.invoke(display_impl);
}
});
} catch (PrivilegedActionException e) {
Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation");
getImplementation_method.setAccessible(true);
Object display_impl = getImplementation_method.invoke(null);
Class<?> WindowsDisplay_class = Class.forName("org.lwjgl.opengl.WindowsDisplay");
Method getHwnd_method = WindowsDisplay_class.getDeclaredMethod("getHwnd");
getHwnd_method.setAccessible(true);
return (Long)getHwnd_method.invoke(display_impl);
} catch (Exception e) {
throw new Error(e);
}
}

View File

@ -1,104 +0,0 @@
package org.lwjgl.examples.spaceinvaders;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Canvas;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
public class GameApplet extends Applet {
/** The Canvas where the LWJGL Display is added */
Canvas display_parent;
/** Thread which runs the main game loop */
Thread gameThread;
/** The Game instance */
Game game;
/**
* Once the Canvas is created its add notify method will call this method to
* start the LWJGL Display and game loop in another thread.
*/
public void startLWJGL() {
gameThread = new Thread() {
public void run() {
try {
Display.setParent(display_parent);
} catch (LWJGLException e) {
e.printStackTrace();
}
// start game
game = new Game(false);
game.execute();
}
};
gameThread.start();
}
/**
* Tell game loop to stop running, after which the LWJGL Display will be destoryed.
* The main thread will wait for the Display.destroy() to complete
*/
private void stopLWJGL() {
Game.gameRunning = false;
try {
gameThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void start() {
}
public void stop() {
}
/**
* Applet Destroy method will remove the canvas, before canvas is destroyed it will notify
* stopLWJGL() to stop main game loop and to destroy the Display
*/
public void destroy() {
remove(display_parent);
super.destroy();
System.out.println("Clear up");
}
/**
* initialise applet by adding a canvas to it, this canvas will start the LWJGL Display and game loop
* in another thread. It will also stop the game loop and destroy the display on canvas removal when
* applet is destroyed.
*/
public void init() {
setLayout(new BorderLayout());
try {
display_parent = new Canvas() {
public void addNotify() {
super.addNotify();
startLWJGL();
}
public void removeNotify() {
stopLWJGL();
super.removeNotify();
}
};
display_parent.setSize(getWidth(),getHeight());
add(display_parent);
display_parent.setFocusable(true);
display_parent.requestFocus();
display_parent.setIgnoreRepaint(true);
setVisible(true);
} catch (Exception e) {
System.err.println(e);
throw new RuntimeException("Unable to create display");
}
}
}

View File

@ -51,12 +51,15 @@ import org.lwjgl.Sys;
public class Cursor {
/** 1 bit transparency for native cursor */
@java.lang.annotation.Native
public static final int CURSOR_ONE_BIT_TRANSPARENCY = 1;
/** 8 bit alhpa native cursor */
@java.lang.annotation.Native
public static final int CURSOR_8_BIT_ALPHA = 2;
/** animation native cursor */
@java.lang.annotation.Native
public static final int CURSOR_ANIMATION = 4;
/** First element to display */
@ -116,11 +119,9 @@ public class Cursor {
* @return the maximum size of a native cursor
*/
public static int getMinCursorSize() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!Mouse.isCreated())
throw new IllegalStateException("Mouse must be created.");
return Mouse.getImplementation().getMinCursorSize();
}
if (!Mouse.isCreated())
throw new IllegalStateException("Mouse must be created.");
return Mouse.getImplementation().getMinCursorSize();
}
/**
@ -131,11 +132,9 @@ public class Cursor {
* @return the maximum size of a native cursor
*/
public static int getMaxCursorSize() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!Mouse.isCreated())
throw new IllegalStateException("Mouse must be created.");
return Mouse.getImplementation().getMaxCursorSize();
}
if (!Mouse.isCreated())
throw new IllegalStateException("Mouse must be created.");
return Mouse.getImplementation().getMaxCursorSize();
}
/**
@ -147,11 +146,10 @@ public class Cursor {
* @return A bit mask with native cursor capabilities.
*/
public static int getCapabilities() {
synchronized (OpenGLPackageAccess.global_lock) {
if (Mouse.getImplementation() != null)
return Mouse.getImplementation().getNativeCursorCapabilities();
else
return OpenGLPackageAccess.createImplementation().getNativeCursorCapabilities();
if (Mouse.getImplementation() != null) {
return Mouse.getImplementation().getNativeCursorCapabilities();
} else {
return OpenGLPackageAccess.createImplementation().getNativeCursorCapabilities();
}
}

View File

@ -323,11 +323,9 @@ public class Keyboard {
* @throws LWJGLException if the keyboard could not be created for any reason
*/
public static void create() throws LWJGLException {
synchronized (OpenGLPackageAccess.global_lock) {
if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
create(OpenGLPackageAccess.createImplementation());
}
create(OpenGLPackageAccess.createImplementation());
}
private static void reset() {
@ -341,22 +339,19 @@ public class Keyboard {
* @return true if the keyboard has been created
*/
public static boolean isCreated() {
synchronized (OpenGLPackageAccess.global_lock) {
return created;
}
return created;
}
/**
* "Destroy" the keyboard
*/
public static void destroy() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
return;
created = false;
implementation.destroyKeyboard();
reset();
if (!created) {
return;
}
created = false;
implementation.destroyKeyboard();
reset();
}
/**
@ -381,12 +376,11 @@ public class Keyboard {
* @see org.lwjgl.input.Keyboard#getEventCharacter()
*/
public static void poll() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can poll the device");
implementation.pollKeyboard(keyDownBuffer);
read();
if (!created) {
throw new IllegalStateException("Keyboard must be created before you can poll the device");
}
implementation.pollKeyboard(keyDownBuffer);
read();
}
private static void read() {
@ -401,11 +395,10 @@ public class Keyboard {
* @return true if the key is down according to the last poll()
*/
public static boolean isKeyDown(int key) {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can query key state");
return keyDownBuffer.get(key) != 0;
if (!created) {
throw new IllegalStateException("Keyboard must be created before you can query key state");
}
return keyDownBuffer.get(key) != 0;
}
/**
@ -425,7 +418,7 @@ public class Keyboard {
* @param key The key
* @return a String with the key's human readable name in it or null if the key is unnamed
*/
public static synchronized String getKeyName(int key) {
public static String getKeyName(int key) {
return keyName[key];
}
@ -433,12 +426,13 @@ public class Keyboard {
* Get's a key's index. If the key is unrecognised then KEY_NONE is returned.
* @param keyName The key name
*/
public static synchronized int getKeyIndex(String keyName) {
public static int getKeyIndex(String keyName) {
Integer ret = keyMap.get(keyName);
if (ret == null)
if (ret == null) {
return KEY_NONE;
else
} else {
return ret;
}
}
/**
@ -446,16 +440,14 @@ public class Keyboard {
* @return the number of keyboard events
*/
public static int getNumKeyboardEvents() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can read events");
int old_position = readBuffer.position();
int num_events = 0;
while (readNext(tmp_event) && (!tmp_event.repeat || repeat_enabled))
num_events++;
readBuffer.position(old_position);
return num_events;
}
if (!created)
throw new IllegalStateException("Keyboard must be created before you can read events");
int old_position = readBuffer.position();
int num_events = 0;
while (readNext(tmp_event) && (!tmp_event.repeat || repeat_enabled))
num_events++;
readBuffer.position(old_position);
return num_events;
}
/**
@ -470,15 +462,12 @@ public class Keyboard {
* @return true if a keyboard event was read, false otherwise
*/
public static boolean next() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can read events");
if (!created)
throw new IllegalStateException("Keyboard must be created before you can read events");
boolean result;
while ((result = readNext(current_event)) && current_event.repeat && !repeat_enabled)
;
return result;
}
boolean result;
while ((result = readNext(current_event)) && current_event.repeat && !repeat_enabled) {}
return result;
}
/**
@ -490,9 +479,7 @@ public class Keyboard {
* @see org.lwjgl.input.Keyboard#getEventKey()
*/
public static void enableRepeatEvents(boolean enable) {
synchronized (OpenGLPackageAccess.global_lock) {
repeat_enabled = enable;
}
repeat_enabled = enable;
}
/**
@ -502,9 +489,7 @@ public class Keyboard {
* @see org.lwjgl.input.Keyboard#getEventKey()
*/
public static boolean areRepeatEventsEnabled() {
synchronized (OpenGLPackageAccess.global_lock) {
return repeat_enabled;
}
return repeat_enabled;
}
private static boolean readNext(KeyEvent event) {
@ -530,9 +515,7 @@ public class Keyboard {
* @return The character from the current event
*/
public static char getEventCharacter() {
synchronized (OpenGLPackageAccess.global_lock) {
return (char)current_event.character;
}
return (char)current_event.character;
}
/**
@ -543,9 +526,7 @@ public class Keyboard {
* @return The key from the current event
*/
public static int getEventKey() {
synchronized (OpenGLPackageAccess.global_lock) {
return current_event.key;
}
return current_event.key;
}
/**
@ -555,9 +536,7 @@ public class Keyboard {
* @return True if key was down, or false if released
*/
public static boolean getEventKeyState() {
synchronized (OpenGLPackageAccess.global_lock) {
return current_event.state;
}
return current_event.state;
}
/**
@ -568,9 +547,7 @@ public class Keyboard {
* @return The time in nanoseconds of the current event
*/
public static long getEventNanoseconds() {
synchronized (OpenGLPackageAccess.global_lock) {
return current_event.nanos;
}
return current_event.nanos;
}
/**
@ -579,9 +556,7 @@ public class Keyboard {
* the current event is not a repeat even or if repeat events are disabled.
*/
public static boolean isRepeatEvent() {
synchronized (OpenGLPackageAccess.global_lock) {
return current_event.repeat;
}
return current_event.repeat;
}
private static final class KeyEvent {

View File

@ -33,8 +33,6 @@ package org.lwjgl.input;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.Map;
@ -45,6 +43,8 @@ import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.InputImplementation;
import static org.lwjgl.LWJGLUtil.getPrivilegedBoolean;
/**
* <br>
@ -163,9 +163,7 @@ public class Mouse {
* @return the currently bound native cursor, if any.
*/
public static Cursor getNativeCursor() {
synchronized (OpenGLPackageAccess.global_lock) {
return currentCursor;
}
return currentCursor;
}
/**
@ -181,21 +179,20 @@ public class Mouse {
* @throws LWJGLException if the cursor could not be set for any reason
*/
public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
synchronized (OpenGLPackageAccess.global_lock) {
if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) == 0)
throw new IllegalStateException("Mouse doesn't support native cursors");
Cursor oldCursor = currentCursor;
currentCursor = cursor;
if (isCreated()) {
if (currentCursor != null) {
implementation.setNativeCursor(currentCursor.getHandle());
currentCursor.setTimeout();
} else {
implementation.setNativeCursor(null);
}
}
return oldCursor;
if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) == 0) {
throw new IllegalStateException("Mouse doesn't support native cursors");
}
Cursor oldCursor = currentCursor;
currentCursor = cursor;
if (isCreated()) {
if (currentCursor != null) {
implementation.setNativeCursor(currentCursor.getHandle());
currentCursor.setTimeout();
} else {
implementation.setNativeCursor(null);
}
}
return oldCursor;
}
public static boolean isClipMouseCoordinatesToWindow() {
@ -216,18 +213,16 @@ public class Mouse {
* to the window origin.
*/
public static void setCursorPosition(int new_x, int new_y) {
synchronized (OpenGLPackageAccess.global_lock) {
if (!isCreated())
throw new IllegalStateException("Mouse is not created");
x = event_x = new_x;
y = event_y = new_y;
if (!isGrabbed() && (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) {
implementation.setCursorPosition(x, y);
}
else {
grab_x = new_x;
grab_y = new_y;
}
if (!isCreated()) {
throw new IllegalStateException("Mouse is not created");
}
x = event_x = new_x;
y = event_y = new_y;
if (!isGrabbed() && (Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0) {
implementation.setCursorPosition(x, y);
} else {
grab_x = new_x;
grab_y = new_y;
}
}
@ -291,34 +286,29 @@ public class Mouse {
* @throws LWJGLException if the mouse could not be created for any reason
*/
public static void create() throws LWJGLException {
synchronized (OpenGLPackageAccess.global_lock) {
if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
create(OpenGLPackageAccess.createImplementation());
}
create(OpenGLPackageAccess.createImplementation());
}
/**
* @return true if the mouse has been created
*/
public static boolean isCreated() {
synchronized (OpenGLPackageAccess.global_lock) {
return created;
}
return created;
}
/**
* "Destroy" the mouse.
*/
public static void destroy() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created) return;
created = false;
buttons = null;
coord_buffer = null;
if (!created) return;
implementation.destroyMouse();
}
created = false;
buttons = null;
coord_buffer = null;
implementation.destroyMouse();
}
/**
@ -346,38 +336,37 @@ public class Mouse {
* @see org.lwjgl.input.Mouse#getDWheel()
*/
public static void poll() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created) throw new IllegalStateException("Mouse must be created before you can poll it");
implementation.pollMouse(coord_buffer, buttons);
if (!created) throw new IllegalStateException("Mouse must be created before you can poll it");
/* If we're grabbed, poll returns mouse deltas, if not it returns absolute coordinates */
int poll_coord1 = coord_buffer.get(0);
int poll_coord2 = coord_buffer.get(1);
/* The wheel is always relative */
int poll_dwheel = coord_buffer.get(2);
implementation.pollMouse(coord_buffer, buttons);
if (isGrabbed()) {
dx += poll_coord1;
dy += poll_coord2;
x += poll_coord1;
y += poll_coord2;
absolute_x += poll_coord1;
absolute_y += poll_coord2;
} else {
dx = poll_coord1 - absolute_x;
dy = poll_coord2 - absolute_y;
absolute_x = x = poll_coord1;
absolute_y = y = poll_coord2;
}
if(clipMouseCoordinatesToWindow) {
x = Math.min(Display.getWidth() - 1, Math.max(0, x));
y = Math.min(Display.getHeight() - 1, Math.max(0, y));
}
dwheel += poll_dwheel;
read();
/* If we're grabbed, poll returns mouse deltas, if not it returns absolute coordinates */
int poll_coord1 = coord_buffer.get(0);
int poll_coord2 = coord_buffer.get(1);
/* The wheel is always relative */
int poll_dwheel = coord_buffer.get(2);
if (isGrabbed()) {
dx += poll_coord1;
dy += poll_coord2;
x += poll_coord1;
y += poll_coord2;
absolute_x += poll_coord1;
absolute_y += poll_coord2;
} else {
dx = poll_coord1 - absolute_x;
dy = poll_coord2 - absolute_y;
absolute_x = x = poll_coord1;
absolute_y = y = poll_coord2;
}
if (clipMouseCoordinatesToWindow) {
x = Math.min(Display.getWidth() - 1, Math.max(0, x));
y = Math.min(Display.getHeight() - 1, Math.max(0, y));
}
dwheel += poll_dwheel;
read();
}
private static void read() {
@ -393,12 +382,11 @@ public class Mouse {
* @return true if the specified button is down
*/
public static boolean isButtonDown(int button) {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created) throw new IllegalStateException("Mouse must be created before you can poll the button state");
if (button >= buttonCount || button < 0)
return false;
else
return buttons.get(button) == 1;
if (!created) throw new IllegalStateException("Mouse must be created before you can poll the button state");
if (button >= buttonCount || button < 0) {
return false;
} else {
return buttons.get(button) == 1;
}
}
@ -408,11 +396,10 @@ public class Mouse {
* @return a String with the button's human readable name in it or null if the button is unnamed
*/
public static String getButtonName(int button) {
synchronized (OpenGLPackageAccess.global_lock) {
if (button >= buttonName.length || button < 0)
return null;
else
return buttonName[button];
if (button >= buttonName.length || button < 0) {
return null;
} else {
return buttonName[button];
}
}
@ -421,12 +408,11 @@ public class Mouse {
* @param buttonName The button name
*/
public static int getButtonIndex(String buttonName) {
synchronized (OpenGLPackageAccess.global_lock) {
Integer ret = buttonMap.get(buttonName);
if (ret == null)
return -1;
else
return ret;
Integer ret = buttonMap.get(buttonName);
if (ret == null) {
return -1;
} else {
return ret;
}
}
@ -440,7 +426,6 @@ public class Mouse {
* @return true if a mouse event was read, false otherwise
*/
public static boolean next() {
synchronized (OpenGLPackageAccess.global_lock) {
if (!created) throw new IllegalStateException("Mouse must be created before you can read events");
if (readBuffer.hasRemaining()) {
eventButton = readBuffer.get();
@ -462,25 +447,23 @@ public class Mouse {
last_event_raw_x = new_event_x;
last_event_raw_y = new_event_y;
}
if(clipMouseCoordinatesToWindow) {
if (clipMouseCoordinatesToWindow) {
event_x = Math.min(Display.getWidth() - 1, Math.max(0, event_x));
event_y = Math.min(Display.getHeight() - 1, Math.max(0, event_y));
}
event_dwheel = readBuffer.getInt();
event_nanos = readBuffer.getLong();
return true;
} else
} else {
return false;
}
}
}
/**
* @return Current events button. Returns -1 if no button state was changed
*/
public static int getEventButton() {
synchronized (OpenGLPackageAccess.global_lock) {
return eventButton;
}
return eventButton;
}
/**
@ -488,54 +471,42 @@ public class Mouse {
* @return Current events button state.
*/
public static boolean getEventButtonState() {
synchronized (OpenGLPackageAccess.global_lock) {
return eventState;
}
return eventState;
}
/**
* @return Current events delta x.
*/
public static int getEventDX() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_dx;
}
return event_dx;
}
/**
* @return Current events delta y.
*/
public static int getEventDY() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_dy;
}
return event_dy;
}
/**
* @return Current events absolute x.
*/
public static int getEventX() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_x;
}
return event_x;
}
/**
* @return Current events absolute y.
*/
public static int getEventY() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_y;
}
return event_y;
}
/**
* @return Current events delta z
*/
public static int getEventDWheel() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_dwheel;
}
return event_dwheel;
}
/**
@ -547,9 +518,7 @@ public class Mouse {
* @return The time in nanoseconds of the current event
*/
public static long getEventNanoseconds() {
synchronized (OpenGLPackageAccess.global_lock) {
return event_nanos;
}
return event_nanos;
}
/**
@ -559,9 +528,7 @@ public class Mouse {
* @return Absolute x axis position of mouse
*/
public static int getX() {
synchronized (OpenGLPackageAccess.global_lock) {
return x;
}
return x;
}
/**
@ -571,69 +538,55 @@ public class Mouse {
* @return Absolute y axis position of mouse
*/
public static int getY() {
synchronized (OpenGLPackageAccess.global_lock) {
return y;
}
return y;
}
/**
* @return Movement on the x axis since last time getDX() was called.
*/
public static int getDX() {
synchronized (OpenGLPackageAccess.global_lock) {
int result = dx;
dx = 0;
return result;
}
int result = dx;
dx = 0;
return result;
}
/**
* @return Movement on the y axis since last time getDY() was called.
*/
public static int getDY() {
synchronized (OpenGLPackageAccess.global_lock) {
int result = dy;
dy = 0;
return result;
}
int result = dy;
dy = 0;
return result;
}
/**
* @return Movement of the wheel since last time getDWheel() was called
*/
public static int getDWheel() {
synchronized (OpenGLPackageAccess.global_lock) {
int result = dwheel;
dwheel = 0;
return result;
}
int result = dwheel;
dwheel = 0;
return result;
}
/**
* @return Number of buttons on this mouse
*/
public static int getButtonCount() {
synchronized (OpenGLPackageAccess.global_lock) {
return buttonCount;
}
return buttonCount;
}
/**
* @return Whether or not this mouse has wheel support
*/
public static boolean hasWheel() {
synchronized (OpenGLPackageAccess.global_lock) {
return hasWheel;
}
return hasWheel;
}
/**
* @return whether or not the mouse has grabbed the cursor
*/
public static boolean isGrabbed() {
synchronized (OpenGLPackageAccess.global_lock) {
return isGrabbed;
}
return isGrabbed;
}
/**
@ -645,31 +598,31 @@ public class Mouse {
* @param grab whether the mouse should be grabbed
*/
public static void setGrabbed(boolean grab) {
synchronized (OpenGLPackageAccess.global_lock) {
boolean grabbed = isGrabbed;
isGrabbed = grab;
if (isCreated()) {
if (grab && !grabbed) {
// store location mouse was grabbed
grab_x = x;
grab_y = y;
}
else if (!grab && grabbed) {
// move mouse back to location it was grabbed before ungrabbing
if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0)
implementation.setCursorPosition(grab_x, grab_y);
}
boolean grabbed = isGrabbed;
if (grabbed == grab) return;
implementation.grabMouse(grab);
// Get latest values from native side
poll();
event_x = x;
event_y = y;
last_event_raw_x = x;
last_event_raw_y = y;
resetMouse();
}
isGrabbed = grab;
if (!isCreated()) return;
if (grab && !grabbed) {
// store location mouse was grabbed
grab_x = x;
grab_y = y;
} else if (!grab && grabbed) {
// move mouse back to location it was grabbed before ungrabbing
if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) != 0)
implementation.setCursorPosition(grab_x, grab_y);
}
implementation.grabMouse(grab);
// Get latest values from native side
poll();
event_x = x;
event_y = y;
last_event_raw_x = x;
last_event_raw_y = y;
resetMouse();
}
/**
@ -678,35 +631,23 @@ public class Mouse {
* shouldn't be called otherwise
*/
public static void updateCursor() {
synchronized (OpenGLPackageAccess.global_lock) {
if (emulateCursorAnimation && currentCursor != null && currentCursor.hasTimedOut() && Mouse.isInsideWindow()) {
currentCursor.nextCursor();
try {
setNativeCursor(currentCursor);
} catch (LWJGLException e) {
if (LWJGLUtil.DEBUG) e.printStackTrace();
}
if (emulateCursorAnimation && currentCursor != null && currentCursor.hasTimedOut() && Mouse.isInsideWindow()) {
currentCursor.nextCursor();
try {
setNativeCursor(currentCursor);
} catch (LWJGLException e) {
if (LWJGLUtil.DEBUG) e.printStackTrace();
}
}
}
/** Gets a boolean property as a privileged action. */
static boolean getPrivilegedBoolean(final String property_name) {
Boolean value = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.getBoolean(property_name);
}
});
return value;
}
/**
* Retrieves whether or not the mouse cursor is within the bounds of the window.
* If the mouse cursor was moved outside the display during a drag, then the result of calling
* this method will be true until the button is released.
* @return true if mouse is inside display, false otherwise.
*/
public static boolean isInsideWindow() {
return implementation.isInsideWindow();
}
/**
* Retrieves whether or not the mouse cursor is within the bounds of the window.
* If the mouse cursor was moved outside the display during a drag, then the result of calling
* this method will be true until the button is released.
* @return true if mouse is inside display, false otherwise.
*/
public static boolean isInsideWindow() {
return implementation.isInsideWindow();
}
}

View File

@ -36,9 +36,6 @@ import org.lwjgl.opengl.Display;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;
/**
* This class contains utilities for accessing the org.lwjgl.opengl
@ -49,14 +46,10 @@ final class OpenGLPackageAccess {
static {
try {
global_lock = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
Field lock_field = Class.forName("org.lwjgl.opengl.GlobalLock").getDeclaredField("lock");
lock_field.setAccessible(true);
return lock_field.get(null);
}
});
} catch (PrivilegedActionException e) {
Field lock_field = Class.forName("org.lwjgl.opengl.GlobalLock").getDeclaredField("lock");
lock_field.setAccessible(true);
global_lock = lock_field.get(null);
} catch (Exception e) {
throw new Error(e);
}
}
@ -66,14 +59,10 @@ final class OpenGLPackageAccess {
* public
*/
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<InputImplementation>() {
public InputImplementation run() throws Exception {
Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation");
getImplementation_method.setAccessible(true);
return (InputImplementation)getImplementation_method.invoke(null);
}
});
} catch (PrivilegedActionException e) {
Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation");
getImplementation_method.setAccessible(true);
return (InputImplementation)getImplementation_method.invoke(null);
} catch (Exception e) {
throw new Error(e);
}
}

View File

@ -35,6 +35,8 @@ import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
import java.util.List;
/**
* <p>
* The AL class implements the actual creation code for linking to the native library
@ -112,30 +114,30 @@ public final class AL {
if (created)
throw new IllegalStateException("Only one OpenAL context may be instantiated at any one time.");
String libname;
String[] library_names;
List<String> library_names;
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_WINDOWS:
if ( Sys.is64Bit() ) {
libname = "OpenAL64";
library_names = new String[]{"OpenAL64.dll"};
library_names = List.of("OpenAL64.dll");
} else {
libname = "OpenAL32";
library_names = new String[]{"OpenAL32.dll"};
library_names = List.of("OpenAL32.dll");
}
break;
case LWJGLUtil.PLATFORM_LINUX:
libname = "openal";
library_names = new String[]{"libopenal64.so", "libopenal.so", "libopenal.so.0"};
library_names = List.of("libopenal64.so", "libopenal.so", "libopenal.so.0");
break;
case LWJGLUtil.PLATFORM_MACOSX:
libname = "openal";
library_names = new String[]{"openal.dylib"};
library_names = List.of("libopenal.dylib");
break;
default:
throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform());
}
String[] oalPaths = LWJGLUtil.getLibraryPaths(libname, library_names, AL.class.getClassLoader());
LWJGLUtil.log("Found " + oalPaths.length + " OpenAL paths");
List<String> oalPaths = LWJGLUtil.getLibraryPaths(libname, library_names, AL.class.getClassLoader());
LWJGLUtil.logger().log(() -> "Found " + oalPaths.size() + " OpenAL paths: " + oalPaths);
for ( String oalPath : oalPaths ) {
try {
nCreate(oalPath);

View File

@ -224,7 +224,7 @@ public final class ALC10 {
boolean result = nalcCloseDevice(getDevice(device));
synchronized (devices) {
device.setInvalid();
devices.remove(new Long(device.device));
devices.remove(Long.valueOf(device.device));
}
return result;

View File

@ -118,7 +118,7 @@ public final class ALC11 {
boolean result = nalcCaptureCloseDevice(ALC10.getDevice(device));
synchronized (ALC10.devices) {
device.setInvalid();
ALC10.devices.remove(new Long(device.device));
ALC10.devices.remove(Long.valueOf(device.device));
}
return result;
}

View File

@ -37,6 +37,7 @@ import org.lwjgl.MemoryUtil;
import org.lwjgl.Sys;
import java.nio.ByteBuffer;
import java.util.List;
/**
* LWJGL users must use this class to initialize OpenCL
@ -82,26 +83,26 @@ public final class CL {
//throw new IllegalStateException("OpenCL has already been created.");
final String libname;
final String[] library_names;
final List<String> library_names;
switch ( LWJGLUtil.getPlatform() ) {
case LWJGLUtil.PLATFORM_WINDOWS:
libname = "OpenCL";
library_names = new String[] { "OpenCL.dll" };
library_names = List.of("OpenCL.dll");
break;
case LWJGLUtil.PLATFORM_LINUX:
libname = "OpenCL";
library_names = new String[] { "libOpenCL64.so", "libOpenCL.so" }; // TODO: Fix this
library_names = List.of("libOpenCL64.so", "libOpenCL.so"); // TODO: Fix this
break;
case LWJGLUtil.PLATFORM_MACOSX:
libname = "OpenCL";
library_names = new String[] { "OpenCL.dylib" }; // TODO: Fix this
library_names = List.of("OpenCL.dylib"); // TODO: Fix this
break;
default:
throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform());
}
final String[] oclPaths = LWJGLUtil.getLibraryPaths(libname, library_names, CL.class.getClassLoader());
LWJGLUtil.log("Found " + oclPaths.length + " OpenCL paths");
final List<String> oclPaths = LWJGLUtil.getLibraryPaths(libname, library_names, CL.class.getClassLoader());
LWJGLUtil.log("Found " + oclPaths.size() + " OpenCL paths");
for ( String oclPath : oclPaths ) {
try {
nCreate(oclPath);
@ -147,7 +148,9 @@ public final class CL {
/** Helper method to get a pointer to a named function in the OpenCL library. */
static long getFunctionAddress(String name) {
ByteBuffer buffer = MemoryUtil.encodeASCII(name);
return ngetFunctionAddress(MemoryUtil.getAddress(buffer));
long address = ngetFunctionAddress(MemoryUtil.getAddress(buffer));
if (address == 0L) LWJGLUtil.logger().log(() -> "Could not locate symbol " + name);
return address;
}
private static native long ngetFunctionAddress(long name);
@ -155,4 +158,4 @@ public final class CL {
private static native void resetNativeStubs(Class clazz);
}
}

View File

@ -31,9 +31,11 @@
*/
package org.lwjgl.opencl;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.PointerBuffer;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import static org.lwjgl.opencl.CL10.*;
@ -137,7 +139,7 @@ final class CLChecks {
*
* @return the 2D image size in bytes
*/
static int calculateImage2DSize(final ByteBuffer format, final long w, final long h, long row_pitch) {
static int calculateImage2DSize(final Buffer host_ptr, final ByteBuffer format, final long w, final long h, long row_pitch) {
if ( !LWJGLUtil.CHECKS )
return 0;
@ -151,7 +153,7 @@ final class CLChecks {
else if ( LWJGLUtil.DEBUG && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch);
return (int)(row_pitch * h);
return (int)(row_pitch * h) >> BufferUtils.getElementSizeExponent(host_ptr);
}
/**
@ -166,7 +168,7 @@ final class CLChecks {
*
* @return the 3D image size in bytes
*/
static int calculateImage3DSize(final ByteBuffer format, final long w, final long h, final long d, long row_pitch, long slice_pitch) {
static int calculateImage3DSize(final Buffer host_ptr, final ByteBuffer format, final long w, final long h, final long d, long row_pitch, long slice_pitch) {
if ( !LWJGLUtil.CHECKS )
return 0;
@ -185,7 +187,7 @@ final class CLChecks {
else if ( LWJGLUtil.DEBUG && ((row_pitch < row_pitch * h) || (slice_pitch % row_pitch != 0)) )
throw new IllegalArgumentException("Invalid image_slice_pitch specified: " + row_pitch);
return (int)(slice_pitch * d);
return (int)(slice_pitch * d) >> BufferUtils.getElementSizeExponent(host_ptr);
}
/**

View File

@ -40,6 +40,8 @@ import java.util.Map;
* @author Spasi
*/
final class CallbackUtil {
@java.lang.annotation.Native
private static final int __NATIVE_HEADER = 0;
private static final Map<CLContext, Long> contextUserData = new HashMap<CLContext, Long>();
@ -169,4 +171,4 @@ final class CallbackUtil {
*/
static native long getLogMessageToStderrAPPLE();
}
}

View File

@ -305,7 +305,7 @@ final class InfoUtilFactory {
errcode_ret = APIUtil.getBufferInt();
CLMem __result = new CLMem(nclCreateImage2D(context.getPointer(), flags, MemoryUtil.getAddress(formatBuffer, 0), image_width, image_height, image_row_pitch, MemoryUtil.getAddress0Safe(host_ptr) +
(host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0),
(host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(host_ptr, formatBuffer, image_width, image_height, image_row_pitch)) : 0),
MemoryUtil.getAddressSafe(errcode_ret), function_pointer), context);
if ( LWJGLUtil.DEBUG )
Util.checkCLError(errcode_ret.get(0));
@ -325,7 +325,7 @@ final class InfoUtilFactory {
errcode_ret = APIUtil.getBufferInt();
CLMem __result = new CLMem(nclCreateImage3D(context.getPointer(), flags, MemoryUtil.getAddress(formatBuffer, 0), image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, MemoryUtil.getAddress0Safe(host_ptr) +
(host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0),
(host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(host_ptr, formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0),
MemoryUtil.getAddressSafe(errcode_ret), function_pointer), context);
if ( LWJGLUtil.DEBUG )
Util.checkCLError(errcode_ret.get(0));
@ -603,4 +603,4 @@ final class InfoUtilFactory {
}
};
}
}

View File

@ -44,11 +44,8 @@ import java.util.Map;
public final class Util {
/** Maps OpenCL error token values to their String representations. */
private static final Map<Integer, String> CL_ERROR_TOKENS = LWJGLUtil.getClassTokens(new LWJGLUtil.TokenFilter() {
public boolean accept(final Field field, final int value) {
return value < 0; // Currently, all OpenCL errors have negative values.
}
}, null, CL10.class, CL11.class, KHRGLSharing.class, KHRICD.class, APPLEGLSharing.class, EXTDeviceFission.class);
// Currently, all OpenCL errors have negative values.
private static final Map<Integer, String> CL_ERROR_TOKENS = LWJGLUtil.getClassTokens((_field, value) -> value < 0, null, CL10.class, CL11.class, KHRGLSharing.class, KHRICD.class, APPLEGLSharing.class, EXTDeviceFission.class);
private Util() {
}
@ -65,4 +62,4 @@ public final class Util {
throw new OpenCLException("Error Code: " + errname + " (" + LWJGLUtil.toHexString(errcode) + ")");
}
}
}

View File

@ -216,7 +216,7 @@ public class AWTGLCanvas extends Canvas implements DrawableLWJGL, ComponentListe
}
/** Set swap interval. */
public void setSwapInterval(int swap_interval) {
public void setSwapInterval(int swap_interval) throws LWJGLException {
synchronized ( SYNC_LOCK ) {
if ( context == null )
throw new IllegalStateException("Canvas not yet displayable");
@ -225,7 +225,7 @@ public class AWTGLCanvas extends Canvas implements DrawableLWJGL, ComponentListe
}
/** Enable vsync */
public void setVSyncEnabled(boolean enabled) {
public void setVSyncEnabled(boolean enabled) throws LWJGLException {
setSwapInterval(enabled ? 1 : 0);
}
@ -411,4 +411,4 @@ public class AWTGLCanvas extends Canvas implements DrawableLWJGL, ComponentListe
setUpdate();
}
}
}

View File

@ -33,11 +33,7 @@ package org.lwjgl.opengl;
import java.awt.Canvas;
import java.awt.Component;
import java.applet.Applet;
import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
@ -54,8 +50,6 @@ final class AWTSurfaceLock {
private final ByteBuffer lock_buffer;
private boolean firstLockSucceeded;
AWTSurfaceLock() {
lock_buffer = createHandle();
}
@ -63,7 +57,7 @@ final class AWTSurfaceLock {
private static native ByteBuffer createHandle();
public ByteBuffer lockAndGetHandle(Canvas component) throws LWJGLException {
while (!privilegedLockAndInitHandle(component)) {
while (!lockAndInitHandle(lock_buffer, component)) {
LWJGLUtil.log("Could not get drawing surface info, retrying...");
try {
Thread.sleep(WAIT_DELAY_MILLIS);
@ -75,28 +69,6 @@ final class AWTSurfaceLock {
return lock_buffer;
}
private boolean privilegedLockAndInitHandle(final Canvas component) throws LWJGLException {
// Workaround for Sun JDK bug 4796548 which still exists in java for OS X
// We need to elevate privileges because of an AWT bug. Please see
// http://192.18.37.44/forums/index.php?topic=10572 for a discussion.
// It is only needed on first call, so we avoid it on all subsequent calls
// due to performance..
if (firstLockSucceeded)
return lockAndInitHandle(lock_buffer, component);
else
try {
firstLockSucceeded = AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() {
public Boolean run() throws LWJGLException {
return lockAndInitHandle(lock_buffer, component);
}
});
return firstLockSucceeded;
} catch (PrivilegedActionException e) {
throw (LWJGLException) e.getException();
}
}
private static native boolean lockAndInitHandle(ByteBuffer lock_buffer, Canvas component) throws LWJGLException;
void unlock() throws LWJGLException {

View File

@ -48,9 +48,6 @@ import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.nio.IntBuffer;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
@ -87,12 +84,8 @@ final class AWTUtil {
public static Robot createRobot(final Component component) {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Robot>() {
public Robot run() throws Exception {
return new Robot(component.getGraphicsConfiguration().getDevice());
}
});
} catch (PrivilegedActionException e) {
return new Robot(component.getGraphicsConfiguration().getDevice());
} catch (Exception e) {
LWJGLUtil.log("Got exception while creating robot: " + e.getCause());
return null;
}
@ -111,11 +104,7 @@ final class AWTUtil {
try {
final GraphicsConfiguration config = component.getGraphicsConfiguration();
if (config != null) {
PointerInfo pointer_info = AccessController.doPrivileged(new PrivilegedExceptionAction<PointerInfo>() {
public PointerInfo run() throws Exception {
return MouseInfo.getPointerInfo();
}
});
PointerInfo pointer_info = MouseInfo.getPointerInfo();
GraphicsDevice device = pointer_info.getDevice();
if (device == config.getDevice()) {
return pointer_info.getLocation();
@ -123,7 +112,7 @@ final class AWTUtil {
return null;
}
} catch (Exception e) {
LWJGLUtil.log("Failed to query pointer location: " + e.getCause());
LWJGLUtil.logger().log("Failed to query pointer location", e);
}
return null;
}

View File

@ -228,7 +228,7 @@ final class ContextGL implements Context {
* <p/>
* A video frame period is the time required to display a full frame of video data.
*/
public static void setSwapInterval(int value) {
public static void setSwapInterval(int value) throws LWJGLException {
implementation.setSwapInterval(value);
}
@ -296,4 +296,4 @@ final class ContextGL implements Context {
}
}
}
}

View File

@ -81,7 +81,7 @@ interface ContextImplementation {
*/
boolean isCurrent(ByteBuffer handle) throws LWJGLException;
void setSwapInterval(int value);
void setSwapInterval(int value) throws LWJGLException;
/**
* Destroys the Context.

View File

@ -57,11 +57,12 @@ import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Objects;
import java.util.HashSet;
import static org.lwjgl.LWJGLUtil.getPrivilegedBoolean;
public final class Display {
private static final Thread shutdown_hook = new Thread() {
@ -125,9 +126,7 @@ public final class Display {
private static final ComponentListener component_listener = new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
synchronized ( GlobalLock.lock ) {
parent_resized = true;
}
parent_resized = true;
}
};
@ -184,24 +183,28 @@ public final class Display {
* @return an array of all display modes the system reckons it can handle.
*/
public static DisplayMode[] getAvailableDisplayModes() throws LWJGLException {
synchronized ( GlobalLock.lock ) {
DisplayMode[] unfilteredModes = display_impl.getAvailableDisplayModes();
DisplayMode[] unfilteredModes = display_impl.getAvailableDisplayModes();
if ( unfilteredModes == null ) {
return new DisplayMode[0];
}
// We'll use a HashSet to filter out the duplicated modes
HashSet<DisplayMode> modes = new HashSet<DisplayMode>(unfilteredModes.length);
modes.addAll(Arrays.asList(unfilteredModes));
DisplayMode[] filteredModes = new DisplayMode[modes.size()];
modes.toArray(filteredModes);
LWJGLUtil.log("Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes");
return filteredModes;
if (unfilteredModes == null) {
return new DisplayMode[0];
}
if (unfilteredModes.length <= 1) {
return unfilteredModes;
}
// We'll use a HashSet to filter out the duplicated modes
HashSet<DisplayMode> modes = new HashSet<>(unfilteredModes.length);
for (DisplayMode mode : unfilteredModes) {
modes.add(mode);
}
DisplayMode[] filteredModes = new DisplayMode[modes.size()];
modes.toArray(filteredModes);
int n = unfilteredModes.length - filteredModes.length;
LWJGLUtil.logger().log(() -> "Removed " + n + " duplicate displaymodes");
return filteredModes;
}
/**
@ -234,27 +237,29 @@ public final class Display {
* @throws LWJGLException if the display mode could not be set
*/
public static void setDisplayMode(DisplayMode mode) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
if ( mode == null )
throw new NullPointerException("mode must be non-null");
boolean was_fullscreen = isFullscreen();
current_mode = mode;
if ( isCreated() ) {
destroyWindow();
// If mode is not fullscreen capable, make sure we are in windowed mode
try {
if ( was_fullscreen && !isFullscreen() )
display_impl.resetDisplayMode();
else if ( isFullscreen() )
switchDisplayMode();
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
drawable.destroy();
display_impl.resetDisplayMode();
throw e;
}
}
Objects.requireNonNull(mode, "mode must be non-null");
if (mode == current_mode) return;
boolean was_fullscreen = isFullscreen();
current_mode = mode;
if (!isCreated() || parent != null) return;
destroyWindow();
// If mode is not fullscreen capable, make sure we are in windowed mode
try {
if ( was_fullscreen && !isFullscreen() )
display_impl.resetDisplayMode();
else if ( isFullscreen() )
switchDisplayMode();
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
drawable.destroy();
display_impl.resetDisplayMode();
throw e;
}
}
@ -293,13 +298,15 @@ public final class Display {
* A native context must exist, and it will be attached to the window.
*/
private static void createWindow() throws LWJGLException {
if ( window_created ) {
if (window_created) {
return;
}
Canvas tmp_parent = isFullscreen() ? null : parent;
if ( tmp_parent != null && !tmp_parent.isDisplayable() ) // Only a best effort check, since the parent can turn undisplayable hereafter
if (tmp_parent != null && !tmp_parent.isDisplayable()) {
// Only a best effort check, since the parent can turn undisplayable hereafter
throw new LWJGLException("Parent.isDisplayable() must be true");
if ( tmp_parent != null ) {
}
if (tmp_parent != null) {
tmp_parent.addComponentListener(component_listener);
}
DisplayMode mode = getEffectiveMode();
@ -328,7 +335,7 @@ public final class Display {
context.releaseDrawable();
}
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred while trying to release context: " + e);
LWJGLUtil.logger().log("Exception occurred while trying to release context", e);
}
}
@ -353,7 +360,7 @@ public final class Display {
}
private static void switchDisplayMode() throws LWJGLException {
if ( !current_mode.isFullscreenCapable() ) {
if (!current_mode.isFullscreenCapable()) {
throw new IllegalStateException("Only modes acquired from getAvailableDisplayModes() can be used for fullscreen display");
}
display_impl.switchDisplayMode(current_mode);
@ -368,37 +375,35 @@ public final class Display {
* @param contrast The contrast, larger than 0.0.
*/
public static void setDisplayConfiguration(float gamma, float brightness, float contrast) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() ) {
throw new LWJGLException("Display not yet created.");
}
if ( brightness < -1.0f || brightness > 1.0f )
throw new IllegalArgumentException("Invalid brightness value");
if ( contrast < 0.0f )
throw new IllegalArgumentException("Invalid contrast value");
int rampSize = display_impl.getGammaRampLength();
if ( rampSize == 0 ) {
throw new LWJGLException("Display configuration not supported");
}
FloatBuffer gammaRamp = BufferUtils.createFloatBuffer(rampSize);
for ( int i = 0; i < rampSize; i++ ) {
float intensity = (float)i / (rampSize - 1);
// apply gamma
float rampEntry = (float)java.lang.Math.pow(intensity, gamma);
// apply brightness
rampEntry += brightness;
// apply contrast
rampEntry = (rampEntry - 0.5f) * contrast + 0.5f;
// Clamp entry to [0, 1]
if ( rampEntry > 1.0f )
rampEntry = 1.0f;
else if ( rampEntry < 0.0f )
rampEntry = 0.0f;
gammaRamp.put(i, rampEntry);
}
display_impl.setGammaRamp(gammaRamp);
LWJGLUtil.log("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast);
if ( !isCreated() ) {
throw new LWJGLException("Display not yet created.");
}
if ( brightness < -1.0f || brightness > 1.0f )
throw new IllegalArgumentException("Invalid brightness value");
if ( contrast < 0.0f )
throw new IllegalArgumentException("Invalid contrast value");
int rampSize = display_impl.getGammaRampLength();
if ( rampSize == 0 ) {
throw new LWJGLException("Display configuration not supported");
}
FloatBuffer gammaRamp = BufferUtils.createFloatBuffer(rampSize);
for ( int i = 0; i < rampSize; i++ ) {
float intensity = (float)i / (rampSize - 1);
// apply gamma
float rampEntry = (float)java.lang.Math.pow(intensity, gamma);
// apply brightness
rampEntry += brightness;
// apply contrast
rampEntry = (rampEntry - 0.5f) * contrast + 0.5f;
// Clamp entry to [0, 1]
if ( rampEntry > 1.0f )
rampEntry = 1.0f;
else if ( rampEntry < 0.0f )
rampEntry = 0.0f;
gammaRamp.put(i, rampEntry);
}
display_impl.setGammaRamp(gammaRamp);
LWJGLUtil.log("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast);
}
/**
@ -413,16 +418,12 @@ public final class Display {
/** @return the title of the window */
public static String getTitle() {
synchronized ( GlobalLock.lock ) {
return title;
}
return title;
}
/** Return the last parent set with setParent(). */
public static Canvas getParent() {
synchronized ( GlobalLock.lock ) {
return parent;
}
return parent;
}
/**
@ -436,25 +437,23 @@ public final class Display {
* the Dispaly will inherit the size of the parent, disregarding the currently set display mode.<p>
*/
public static void setParent(Canvas parent) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
if ( Display.parent != parent ) {
Display.parent = parent;
if ( !isCreated() )
return;
destroyWindow();
try {
if ( isFullscreen() ) {
switchDisplayMode();
} else {
display_impl.resetDisplayMode();
}
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
drawable.destroy();
if ( Display.parent != parent ) {
Display.parent = parent;
if ( !isCreated() )
return;
destroyWindow();
try {
if ( isFullscreen() ) {
switchDisplayMode();
} else {
display_impl.resetDisplayMode();
throw e;
}
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
drawable.destroy();
display_impl.resetDisplayMode();
throw e;
}
}
}
@ -491,39 +490,34 @@ public final class Display {
}
private static void setDisplayModeAndFullscreenInternal(boolean fullscreen, DisplayMode mode) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
if ( mode == null )
throw new NullPointerException("mode must be non-null");
DisplayMode old_mode = current_mode;
current_mode = mode;
boolean was_fullscreen = isFullscreen();
Display.fullscreen = fullscreen;
if ( was_fullscreen != isFullscreen() || !mode.equals(old_mode) ) {
if ( !isCreated() )
return;
destroyWindow();
try {
if ( isFullscreen() ) {
switchDisplayMode();
} else {
display_impl.resetDisplayMode();
}
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
drawable.destroy();
if ( mode == null )
throw new NullPointerException("mode must be non-null");
DisplayMode old_mode = current_mode;
current_mode = mode;
boolean was_fullscreen = isFullscreen();
Display.fullscreen = fullscreen;
if (was_fullscreen != isFullscreen() || !mode.equals(old_mode)) {
if (!isCreated()) return;
destroyWindow();
try {
if ( isFullscreen() ) {
switchDisplayMode();
} else {
display_impl.resetDisplayMode();
throw e;
}
createWindow();
makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
drawable.destroy();
display_impl.resetDisplayMode();
throw e;
}
}
}
/** @return whether the Display is in fullscreen mode */
public static boolean isFullscreen() {
synchronized ( GlobalLock.lock ) {
return fullscreen && current_mode.isFullscreenCapable();
}
return fullscreen && current_mode.isFullscreenCapable();
}
/**
@ -532,41 +526,37 @@ public final class Display {
* @param newTitle The new window title
*/
public static void setTitle(String newTitle) {
synchronized ( GlobalLock.lock ) {
if ( newTitle == null ) {
newTitle = "";
}
title = newTitle;
if ( isCreated() )
display_impl.setTitle(title);
if ( newTitle == null ) {
newTitle = "";
}
title = newTitle;
if (isCreated()) {
display_impl.setTitle(title);
}
}
/** @return true if the user or operating system has asked the window to close */
public static boolean isCloseRequested() {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
throw new IllegalStateException("Cannot determine close requested state of uncreated window");
return display_impl.isCloseRequested();
if (!isCreated()) {
throw new IllegalStateException("Cannot determine close requested state of uncreated window");
}
return display_impl.isCloseRequested();
}
/** @return true if the window is visible, false if not */
public static boolean isVisible() {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
throw new IllegalStateException("Cannot determine minimized state of uncreated window");
return display_impl.isVisible();
if (!isCreated()) {
throw new IllegalStateException("Cannot determine minimized state of uncreated window");
}
return display_impl.isVisible();
}
/** @return true if window is active, that is, the foreground display of the operating system. */
public static boolean isActive() {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
throw new IllegalStateException("Cannot determine focused state of uncreated window");
return display_impl.isActive();
if (!isCreated()) {
throw new IllegalStateException("Cannot determine focused state of uncreated window");
}
return display_impl.isActive();
}
/**
@ -580,11 +570,10 @@ public final class Display {
* and needs to repaint itself
*/
public static boolean isDirty() {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
throw new IllegalStateException("Cannot determine dirty state of uncreated window");
return display_impl.isDirty();
if (!isCreated()) {
throw new IllegalStateException("Cannot determine dirty state of uncreated window");
}
return display_impl.isDirty();
}
/**
@ -593,12 +582,11 @@ public final class Display {
* this method if update() is called periodically.
*/
public static void processMessages() {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
throw new IllegalStateException("Display not created");
display_impl.update();
if (!isCreated()) {
throw new IllegalStateException("Display not created");
}
display_impl.update();
pollDevices();
}
@ -609,14 +597,15 @@ public final class Display {
* @throws OpenGLException if an OpenGL error has occured since the last call to glGetError()
*/
public static void swapBuffers() throws LWJGLException {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
throw new IllegalStateException("Display not created");
if ( LWJGLUtil.DEBUG )
drawable.checkGLError();
drawable.swapBuffers();
if (!isCreated()) {
throw new IllegalStateException("Display not created");
}
if (LWJGLUtil.DEBUG) {
drawable.checkGLError();
}
drawable.swapBuffers();
}
/**
@ -636,49 +625,49 @@ public final class Display {
* @param processMessages Poll input devices if true
*/
public static void update(boolean processMessages) {
synchronized ( GlobalLock.lock ) {
if ( !isCreated() )
throw new IllegalStateException("Display not created");
if (!isCreated()) {
throw new IllegalStateException("Display not created");
}
// We paint only when the window is visible or dirty
if ( display_impl.isVisible() || display_impl.isDirty() ) {
try {
swapBuffers();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
// We paint only when the window is visible or dirty
if (display_impl.isVisible() || display_impl.isDirty()) {
try {
swapBuffers();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
}
window_resized = !isFullscreen() && parent == null && display_impl.wasResized();
window_resized = !isFullscreen() && parent == null && display_impl.wasResized();
if ( window_resized ) {
width = display_impl.getWidth();
height = display_impl.getHeight();
}
if (window_resized) {
width = display_impl.getWidth();
height = display_impl.getHeight();
}
if ( parent_resized ) {
reshape();
parent_resized = false;
window_resized = true;
}
if (parent_resized) {
reshape();
parent_resized = false;
window_resized = true;
}
if ( processMessages )
processMessages();
if (processMessages) {
processMessages();
}
}
static void pollDevices() {
public static void pollDevices() {
// Poll the input devices while we're here
if ( Mouse.isCreated() ) {
if (Mouse.isCreated()) {
Mouse.poll();
Mouse.updateCursor();
}
if ( Keyboard.isCreated() ) {
if (Keyboard.isCreated()) {
Keyboard.poll();
}
if ( Controllers.isCreated() ) {
if (Controllers.isCreated()) {
Controllers.poll();
}
}
@ -707,21 +696,11 @@ public final class Display {
}
private static void removeShutdownHook() {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
Runtime.getRuntime().removeShutdownHook(shutdown_hook);
return null;
}
});
Runtime.getRuntime().removeShutdownHook(shutdown_hook);
}
private static void registerShutdownHook() {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
Runtime.getRuntime().addShutdownHook(shutdown_hook);
return null;
}
});
Runtime.getRuntime().addShutdownHook(shutdown_hook);
}
/**
@ -753,9 +732,7 @@ public final class Display {
* @throws LWJGLException
*/
public static void create(PixelFormat pixel_format) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
create(pixel_format, null, (ContextAttribs)null);
}
create(pixel_format, null, (ContextAttribs)null);
}
/**
@ -773,9 +750,7 @@ public final class Display {
* @throws LWJGLException
*/
public static void create(PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
create(pixel_format, shared_drawable, (ContextAttribs)null);
}
create(pixel_format, shared_drawable, (ContextAttribs)null);
}
/**
@ -793,9 +768,7 @@ public final class Display {
* @throws LWJGLException
*/
public static void create(PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
create(pixel_format, null, attribs);
}
create(pixel_format, null, attribs);
}
/**
@ -815,13 +788,13 @@ public final class Display {
*/
public static void create(PixelFormat pixel_format, Drawable shared_drawable, ContextAttribs attribs) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
if ( isCreated() )
if (isCreated())
throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time.");
if ( pixel_format == null )
if (pixel_format == null)
throw new NullPointerException("pixel_format cannot be null");
removeShutdownHook();
registerShutdownHook();
if ( isFullscreen() )
if (isFullscreen())
switchDisplayMode();
final DrawableGL drawable = new DrawableGL() {
@ -885,9 +858,7 @@ public final class Display {
*/
public static void create(PixelFormatLWJGL pixel_format) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
create(pixel_format, null, null);
}
create(pixel_format, null, null);
}
/**
@ -905,9 +876,7 @@ public final class Display {
* @throws LWJGLException
*/
public static void create(PixelFormatLWJGL pixel_format, Drawable shared_drawable) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
create(pixel_format, shared_drawable, null);
}
create(pixel_format, shared_drawable, null);
}
/**
@ -925,9 +894,7 @@ public final class Display {
* @throws LWJGLException
*/
public static void create(PixelFormatLWJGL pixel_format, org.lwjgl.opengles.ContextAttribs attribs) throws LWJGLException {
synchronized ( GlobalLock.lock ) {
create(pixel_format, null, attribs);
}
create(pixel_format, null, attribs);
}
/**
@ -1026,9 +993,9 @@ public final class Display {
try {
drawable.checkGLError();
} catch (OpenGLException e) {
LWJGLUtil.log("OpenGL error during context creation: " + e.getMessage());
LWJGLUtil.logger().log("OpenGL error during context creation", e);
}
setSwapInterval(swap_interval);
drawable.setSwapInterval(Display.swap_interval);
}
private static void initContext() {
@ -1040,47 +1007,21 @@ public final class Display {
return display_impl;
}
/** Gets a boolean property as a privileged action. */
static boolean getPrivilegedBoolean(final String property_name) {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.getBoolean(property_name);
}
});
}
/** Gets a string property as a privileged action. */
static String getPrivilegedString(final String property_name) {
return AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty(property_name);
}
});
}
private static void initControls() {
// Automatically create mouse, keyboard and controller
if ( !getPrivilegedBoolean("org.lwjgl.opengl.Display.noinput") ) {
if ( !Mouse.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nomouse") ) {
if (!getPrivilegedBoolean("org.lwjgl.opengl.Display.noinput")) {
if (!Mouse.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nomouse")) {
try {
Mouse.create();
} catch (LWJGLException e) {
if ( LWJGLUtil.DEBUG ) {
e.printStackTrace(System.err);
} else {
LWJGLUtil.log("Failed to create Mouse: " + e);
}
LWJGLUtil.logger().log("Failed to create Mouse", e);
}
}
if ( !Keyboard.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nokeyboard") ) {
if (!Keyboard.isCreated() && !getPrivilegedBoolean("org.lwjgl.opengl.Display.nokeyboard")) {
try {
Keyboard.create();
} catch (LWJGLException e) {
if ( LWJGLUtil.DEBUG ) {
e.printStackTrace(System.err);
} else {
LWJGLUtil.log("Failed to create Keyboard: " + e);
}
LWJGLUtil.logger().log("Failed to create Keyboard", e);
}
}
}
@ -1091,7 +1032,7 @@ public final class Display {
* regardless of whether the Display was the current rendering context.
*/
public static void destroy() {
if(isCreated()) {
if (isCreated()) {
drawable.destroy();
}
}
@ -1108,9 +1049,7 @@ public final class Display {
/** @return true if the window's native peer has been created */
public static boolean isCreated() {
synchronized ( GlobalLock.lock ) {
return window_created;
}
return window_created;
}
/**
@ -1122,12 +1061,11 @@ public final class Display {
*
* @param value The swap interval in frames, 0 to disable
*/
public static void setSwapInterval(int value) {
synchronized ( GlobalLock.lock ) {
swap_interval = value;
if ( isCreated() )
drawable.setSwapInterval(swap_interval);
public static void setSwapInterval(int value) throws LWJGLException {
if (value == swap_interval) return;
swap_interval = value;
if (isCreated()) {
drawable.setSwapInterval(value);
}
}
@ -1137,10 +1075,8 @@ public final class Display {
*
* @param sync true to synchronize; false to ignore synchronization
*/
public static void setVSyncEnabled(boolean sync) {
synchronized ( GlobalLock.lock ) {
setSwapInterval(sync ? 1 : 0);
}
public static void setVSyncEnabled(boolean sync) throws LWJGLException {
setSwapInterval(sync ? 1 : 0);
}
/**
@ -1154,15 +1090,13 @@ public final class Display {
* @param new_y The new window location on the y axis
*/
public static void setLocation(int new_x, int new_y) {
synchronized ( GlobalLock.lock ) {
// cache position
x = new_x;
y = new_y;
// cache position
x = new_x;
y = new_y;
// offset if already created
if ( isCreated() && !isFullscreen() ) {
reshape();
}
// offset if already created
if ( isCreated() && !isFullscreen() ) {
reshape();
}
}
@ -1178,9 +1112,7 @@ public final class Display {
* @return a String
*/
public static String getAdapter() {
synchronized ( GlobalLock.lock ) {
return display_impl.getAdapter();
}
return display_impl.getAdapter();
}
/**
@ -1190,9 +1122,7 @@ public final class Display {
* @return a String
*/
public static String getVersion() {
synchronized ( GlobalLock.lock ) {
return display_impl.getVersion();
}
return display_impl.getVersion();
}
/**
@ -1213,25 +1143,23 @@ public final class Display {
* @return number of icons used, or 0 if display hasn't been created
*/
public static int setIcon(ByteBuffer[] icons) {
synchronized ( GlobalLock.lock ) {
// make deep copy so we dont rely on the supplied buffers later on
// don't recache!
if ( cached_icons != icons ) {
cached_icons = new ByteBuffer[icons.length];
for ( int i = 0; i < icons.length; i++ ) {
cached_icons[i] = BufferUtils.createByteBuffer(icons[i].capacity());
int old_position = icons[i].position();
cached_icons[i].put(icons[i]);
icons[i].position(old_position);
cached_icons[i].flip();
}
// make deep copy so we dont rely on the supplied buffers later on
// don't recache!
if (cached_icons != icons) {
cached_icons = new ByteBuffer[icons.length];
for ( int i = 0; i < icons.length; i++ ) {
cached_icons[i] = BufferUtils.createByteBuffer(icons[i].capacity());
int old_position = icons[i].position();
cached_icons[i].put(icons[i]);
icons[i].position(old_position);
cached_icons[i].flip();
}
}
if ( Display.isCreated() && parent == null ) {
return display_impl.setIcon(cached_icons);
} else {
return 0;
}
if (Display.isCreated() && parent == null) {
return display_impl.setIcon(cached_icons);
} else {
return 0;
}
}
@ -1242,9 +1170,11 @@ public final class Display {
* false to disable resizing on the Display window.
*/
public static void setResizable(boolean resizable) {
window_resizable = resizable;
if ( isCreated() ) {
display_impl.setResizable(resizable);
if (window_resizable != resizable) {
window_resizable = resizable;
if (isCreated()) {
display_impl.setResizable(resizable);
}
}
}
@ -1273,7 +1203,6 @@ public final class Display {
* the parent will be returned.
*/
public static int getX() {
if (Display.isFullscreen()) {
return 0;
}
@ -1293,7 +1222,6 @@ public final class Display {
* the parent will be returned.
*/
public static int getY() {
if (Display.isFullscreen()) {
return 0;
}
@ -1315,7 +1243,6 @@ public final class Display {
* This value will be updated after a call to Display.update().
*/
public static int getWidth() {
if (Display.isFullscreen()) {
return Display.getDisplayMode().getWidth();
}
@ -1337,7 +1264,6 @@ public final class Display {
* This value will be updated after a call to Display.update().
*/
public static int getHeight() {
if (Display.isFullscreen()) {
return Display.getDisplayMode().getHeight();
}

View File

@ -82,7 +82,7 @@ abstract class DrawableGL implements DrawableLWJGL {
Util.checkGLError();
}
public void setSwapInterval(final int swap_interval) {
public void setSwapInterval(final int swap_interval) throws LWJGLException {
ContextGL.setSwapInterval(swap_interval);
}

View File

@ -62,10 +62,10 @@ interface DrawableLWJGL extends Drawable {
void checkGLError();
void setSwapInterval(int swap_interval);
void setSwapInterval(int swap_interval) throws LWJGLException;
void swapBuffers() throws LWJGLException;
void initContext(final float r, final float g, final float b);
}
}

View File

@ -43,6 +43,7 @@ import static org.lwjgl.opengl.EXTAbgr.*;
import static org.lwjgl.opengl.EXTBgra.*;
import static org.lwjgl.opengl.EXTDirectStateAccess.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL13.*;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.NVPathRendering.*;
@ -294,37 +295,36 @@ class GLChecks {
}
}
static int calculatePathColorGenCoeffsCount(int genMode, int colorFormat) {
final int coeffsPerComponent = calculatePathGenCoeffsPerComponent(genMode);
switch ( colorFormat ) {
case GL_RGB:
return 3 * coeffsPerComponent;
case GL_RGBA:
return 4 * coeffsPerComponent;
default:
return coeffsPerComponent;
}
}
static int calculatePathTextGenCoeffsPerComponent(FloatBuffer coeffs, int genMode) {
if ( genMode == GL_NONE )
return 0;
return coeffs.remaining() / calculatePathGenCoeffsPerComponent(genMode);
}
private static int calculatePathGenCoeffsPerComponent(int genMode) {
static int calculatePathColorGenModeElements(int genMode) {
switch ( genMode ) {
case GL_NONE:
return 0;
case GL_CONSTANT:
return 1;
case GL_OBJECT_LINEAR:
case GL_PATH_OBJECT_BOUNDING_BOX_NV:
return 3;
case GL_EYE_LINEAR:
return 4;
default:
throw new IllegalArgumentException("Unsupported gen mode: " + genMode);
throw new IllegalArgumentException(String.format("Unsupported genMode specified: 0x%X", genMode));
}
}
static int calculatePathColorGenFormatComponents(int colorFormat) {
switch ( colorFormat ) {
case GL_LUMINANCE:
case GL_INTENSITY:
case GL_ALPHA:
return 1;
case GL_LUMINANCE_ALPHA:
return 2;
case GL_RGB:
return 3;
case GL_RGBA:
return 4;
default:
throw new IllegalArgumentException(String.format("Unsupported colorFormat specified: 0x%X", colorFormat));
}
}

View File

@ -38,9 +38,6 @@ import org.lwjgl.Sys;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.util.*;
import static org.lwjgl.opengl.GL11.*;
@ -177,12 +174,8 @@ public final class GLContext {
* Helper method to get a pointer to a named function in the OpenGL library
* with a name dependent on the current platform
*/
static long getPlatformSpecificFunctionAddress(String function_prefix, String[] os_prefixes, String[] os_function_prefixes, String function) {
String os_name = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty("os.name");
}
});
public static long getPlatformSpecificFunctionAddress(String function_prefix, String[] os_prefixes, String[] os_function_prefixes, String function) {
String os_name = System.getProperty("os.name");
for ( int i = 0; i < os_prefixes.length; i++ )
if ( os_name.startsWith(os_prefixes[i]) ) {
String platform_function_name = function.replaceFirst(function_prefix, os_function_prefixes[i]);
@ -199,7 +192,7 @@ public final class GLContext {
*
* @return the function pointer address
*/
static long getFunctionAddress(String[] aliases) {
public static long getFunctionAddress(String[] aliases) {
for ( String alias : aliases ) {
long address = getFunctionAddress(alias);
if ( address != 0 )
@ -209,9 +202,11 @@ public final class GLContext {
}
/** Helper method to get a pointer to a named function in the OpenGL library. */
static long getFunctionAddress(String name) {
public static long getFunctionAddress(String name) {
ByteBuffer buffer = MemoryUtil.encodeASCII(name);
return ngetFunctionAddress(MemoryUtil.getAddress(buffer));
long address = ngetFunctionAddress(MemoryUtil.getAddress(buffer));
if (address == 0L) LWJGLUtil.logger().log(() -> "Could not locate symbol " + name);
return address;
}
private static native long ngetFunctionAddress(long name);
@ -299,17 +294,12 @@ public final class GLContext {
*/
static void initNativeStubs(final Class<?> extension_class, Set supported_extensions, String ext_name) {
resetNativeStubs(extension_class);
if ( supported_extensions.contains(ext_name) ) {
if (supported_extensions.contains(ext_name)) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs");
init_stubs_method.invoke(null);
return null;
}
});
Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs");
init_stubs_method.invoke(null);
} catch (Exception e) {
LWJGLUtil.log("Failed to initialize extension " + extension_class + " - exception: " + e);
LWJGLUtil.logger().log(() -> "Failed to initialize extension " + extension_class + " - exception", e);
supported_extensions.remove(ext_name);
}
}
@ -412,4 +402,4 @@ public final class GLContext {
Thread owner;
ContextCapabilities capabilities;
}
}
}

View File

@ -69,7 +69,7 @@ public interface InputImplementation {
void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons);
/**
* Method to read the keyboard buffer
* Method to read the mouse buffer
*/
void readMouse(ByteBuffer buffer);

View File

@ -35,8 +35,6 @@ import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.Canvas;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
@ -50,11 +48,7 @@ import org.lwjgl.LWJGLUtil;
final class LinuxCanvasImplementation implements AWTCanvasImplementation {
static int getScreenFromDevice(final GraphicsDevice device) throws LWJGLException {
try {
Method getScreen_method = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
public Method run() throws Exception {
return device.getClass().getMethod("getScreen");
}
});
Method getScreen_method = device.getClass().getMethod("getScreen");
Integer screen = (Integer)getScreen_method.invoke(device);
return screen;
} catch (Exception e) {
@ -64,11 +58,7 @@ final class LinuxCanvasImplementation implements AWTCanvasImplementation {
private static int getVisualIDFromConfiguration(final GraphicsConfiguration configuration) throws LWJGLException {
try {
Method getVisual_method = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
public Method run() throws Exception {
return configuration.getClass().getMethod("getVisual");
}
});
Method getVisual_method = configuration.getClass().getMethod("getVisual");
Integer visual = (Integer)getVisual_method.invoke(configuration);
return visual;
} catch (Exception e) {
@ -102,8 +92,7 @@ final class LinuxCanvasImplementation implements AWTCanvasImplementation {
}
private static int findVisualIDFromFormat(int screen, PixelFormat pixel_format) throws LWJGLException {
try {
LinuxDisplay.lockAWT();
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
try {
GLContext.loadOpenGLLibrary();
try {
@ -115,8 +104,6 @@ final class LinuxCanvasImplementation implements AWTCanvasImplementation {
} finally {
GLContext.unloadOpenGLLibrary();
}
} finally {
LinuxDisplay.unlockAWT();
}
}
private static native int nFindVisualIDFromFormat(long display, int screen, PixelFormat pixel_format) throws LWJGLException;

View File

@ -44,16 +44,13 @@ import java.nio.IntBuffer;
final class LinuxContextImplementation implements ContextImplementation {
public ByteBuffer create(PeerInfo peer_info, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException {
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
ByteBuffer peer_handle = peer_info.lockAndGetHandle();
try {
return nCreate(peer_handle, attribs, shared_context_handle);
} finally {
peer_info.unlock();
}
} finally {
LinuxDisplay.unlockAWT();
}
}
@ -72,16 +69,13 @@ final class LinuxContextImplementation implements ContextImplementation {
throw new IllegalStateException("No context is current");
synchronized ( current_context ) {
PeerInfo current_peer_info = current_context.getPeerInfo();
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
ByteBuffer peer_handle = current_peer_info.lockAndGetHandle();
try {
nSwapBuffers(peer_handle);
} finally {
current_peer_info.unlock();
}
} finally {
LinuxDisplay.unlockAWT();
}
}
}
@ -94,16 +88,13 @@ final class LinuxContextImplementation implements ContextImplementation {
throw new IllegalStateException("No context is current");
synchronized ( current_context ) {
PeerInfo current_peer_info = current_context.getPeerInfo();
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
ByteBuffer peer_handle = current_peer_info.lockAndGetHandle();
try {
nReleaseCurrentContext(peer_handle);
} finally {
current_peer_info.unlock();
}
} finally {
LinuxDisplay.unlockAWT();
}
}
}
@ -114,53 +105,44 @@ final class LinuxContextImplementation implements ContextImplementation {
}
public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException {
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
ByteBuffer peer_handle = peer_info.lockAndGetHandle();
try {
nMakeCurrent(peer_handle, handle);
} finally {
peer_info.unlock();
}
} finally {
LinuxDisplay.unlockAWT();
}
}
private static native void nMakeCurrent(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException;
public boolean isCurrent(ByteBuffer handle) throws LWJGLException {
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
boolean result = nIsCurrent(handle);
return result;
} finally {
LinuxDisplay.unlockAWT();
}
}
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
public void setSwapInterval(int value) {
@Override
public void setSwapInterval(int value) throws LWJGLException {
ContextGL current_context = ContextGL.getCurrentContext();
PeerInfo peer_info = current_context.getPeerInfo();
if ( current_context == null )
throw new IllegalStateException("No context is current");
PeerInfo peer_info = current_context.getPeerInfo();
synchronized ( current_context ) {
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
ByteBuffer peer_handle = peer_info.lockAndGetHandle();
try {
nSetSwapInterval(peer_handle, current_context.getHandle(), value);
} finally {
peer_info.unlock();
}
} catch (LWJGLException e) {
// API CHANGE - this methods should throw LWJGLException
e.printStackTrace();
} finally {
LinuxDisplay.unlockAWT();
}
}
}
@ -168,16 +150,13 @@ final class LinuxContextImplementation implements ContextImplementation {
private static native void nSetSwapInterval(ByteBuffer peer_handle, ByteBuffer context_handle, int value);
public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException {
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
ByteBuffer peer_handle = peer_info.lockAndGetHandle();
try {
nDestroy(peer_handle, handle);
} finally {
peer_info.unlock();
}
} finally {
LinuxDisplay.unlockAWT();
}
}

View File

@ -45,12 +45,18 @@ import java.awt.event.FocusEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.ByteOrder;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
@ -58,11 +64,6 @@ import org.lwjgl.MemoryUtil;
import org.lwjgl.opengl.XRandR.Screen;
import org.lwjgl.opengles.EGL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.List;
final class LinuxDisplay implements DisplayImplementation {
/* X11 constants */
public static final int CurrentTime = 0;
@ -178,8 +179,7 @@ final class LinuxDisplay implements DisplayImplementation {
};
private static ByteBuffer getCurrentGammaRamp() throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
if (isXF86VidModeSupported())
@ -189,8 +189,6 @@ final class LinuxDisplay implements DisplayImplementation {
} finally {
decDisplay();
}
} finally {
unlockAWT();
}
}
private static native ByteBuffer nGetCurrentGammaRamp(long display, int screen) throws LWJGLException;
@ -211,10 +209,9 @@ final class LinuxDisplay implements DisplayImplementation {
}
private static boolean isXrandrSupported() {
if (Display.getPrivilegedBoolean("LWJGL_DISABLE_XRANDR"))
if (LWJGLUtil.getPrivilegedBoolean("LWJGL_DISABLE_XRANDR"))
return false;
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
return nIsXrandrSupported(getDisplay());
@ -224,15 +221,12 @@ final class LinuxDisplay implements DisplayImplementation {
} catch (LWJGLException e) {
LWJGLUtil.log("Got exception while querying Xrandr support: " + e);
return false;
} finally {
unlockAWT();
}
}
private static native boolean nIsXrandrSupported(long display) throws LWJGLException;
private static boolean isXF86VidModeSupported() {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
return nIsXF86VidModeSupported(getDisplay());
@ -242,17 +236,14 @@ final class LinuxDisplay implements DisplayImplementation {
} catch (LWJGLException e) {
LWJGLUtil.log("Got exception while querying XF86VM support: " + e);
return false;
} finally {
unlockAWT();
}
}
private static native boolean nIsXF86VidModeSupported(long display) throws LWJGLException;
private static boolean isNetWMFullscreenSupported() throws LWJGLException {
if (Display.getPrivilegedBoolean("LWJGL_DISABLE_NETWM"))
if (LWJGLUtil.getPrivilegedBoolean("LWJGL_DISABLE_NETWM"))
return false;
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
return nIsNetWMFullscreenSupported(getDisplay(), getDefaultScreen());
@ -262,32 +253,38 @@ final class LinuxDisplay implements DisplayImplementation {
} catch (LWJGLException e) {
LWJGLUtil.log("Got exception while querying NetWM support: " + e);
return false;
} finally {
unlockAWT();
}
}
private static native boolean nIsNetWMFullscreenSupported(long display, int screen) throws LWJGLException;
public static final class AWTLock implements AutoCloseable {
private static final AWTLock INSTANCE = new AWTLock();
@Override
public void close() {
try {
nUnlockAWT();
} catch (LWJGLException e) {
LWJGLUtil.log("Caught exception while unlocking AWT: " + e);
}
}
}
/* Since Xlib is not guaranteed to be thread safe, we need a way to synchronize LWJGL
* Xlib calls with AWT Xlib calls. Fortunately, JAWT implements Lock()/Unlock() to
* do just that.
*/
static void lockAWT() {
static AWTLock awtLock() {
try {
nLockAWT();
} catch (LWJGLException e) {
LWJGLUtil.log("Caught exception while locking AWT: " + e);
}
return AWTLock.INSTANCE;
}
private static native void nLockAWT() throws LWJGLException;
static void unlockAWT() {
try {
nUnlockAWT();
} catch (LWJGLException e) {
LWJGLUtil.log("Caught exception while unlocking AWT: " + e);
}
}
private static native void nUnlockAWT() throws LWJGLException;
/**
@ -452,8 +449,7 @@ final class LinuxDisplay implements DisplayImplementation {
}
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
if ( drawable instanceof DrawableGLES )
@ -472,7 +468,7 @@ final class LinuxDisplay implements DisplayImplementation {
// managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
// unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
// See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));
boolean undecorated = LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));
this.parent = parent;
parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
@ -495,7 +491,7 @@ final class LinuxDisplay implements DisplayImplementation {
current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);
// Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell
wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS");
wm_class = LWJGLUtil.getPrivilegedString("LWJGL_WM_CLASS");
if (wm_class == null) wm_class = Display.getTitle();
setClassHint(Display.getTitle(), wm_class);
@ -527,8 +523,6 @@ final class LinuxDisplay implements DisplayImplementation {
decDisplay();
throw e;
}
} finally {
unlockAWT();
}
}
private static native long nCreateWindow(long display, int screen, ByteBuffer peer_info_handle, DisplayMode mode, int window_mode, int x, int y, boolean undecorated, long parent_handle, boolean resizable) throws LWJGLException;
@ -576,8 +570,7 @@ final class LinuxDisplay implements DisplayImplementation {
}
public void destroyWindow() {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
if (parent != null) {
parent.removeFocusListener(focus_listener);
}
@ -594,19 +587,14 @@ final class LinuxDisplay implements DisplayImplementation {
if ( current_window_mode != WINDOWED )
Compiz.setLegacyFullscreenSupport(false);
} finally {
unlockAWT();
}
}
static native void nDestroyWindow(long display, long window);
public void switchDisplayMode(DisplayMode mode) throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
switchDisplayModeOnTmpDisplay(mode);
current_mode = mode;
} finally {
unlockAWT();
}
}
@ -636,37 +624,26 @@ final class LinuxDisplay implements DisplayImplementation {
static native long nInternAtom(long display, String atom_name, boolean only_if_exists);
public void resetDisplayMode() {
lockAWT();
try {
if( current_displaymode_extension == XRANDR )
{
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
XRandR.restoreConfiguration();
return null;
}
});
}
else
{
try (LinuxDisplay.AWTLock _lock = awtLock()) {
if (current_displaymode_extension == XRANDR) {
XRandR.restoreConfiguration();
} else {
switchDisplayMode(saved_mode);
}
if (isXF86VidModeSupported())
if (isXF86VidModeSupported()) {
doSetGamma(saved_gamma);
}
Compiz.setLegacyFullscreenSupport(false);
} catch (LWJGLException e) {
LWJGLUtil.log("Caught exception while resetting mode: " + e);
} finally {
unlockAWT();
}
}
public int getGammaRampLength() {
if (!isXF86VidModeSupported())
return 0;
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
try {
incDisplay();
try {
@ -681,8 +658,6 @@ final class LinuxDisplay implements DisplayImplementation {
LWJGLUtil.log("Failed to get gamma ramp length: " + e);
return 0;
}
} finally {
unlockAWT();
}
}
private static native int nGetGammaRampLength(long display, int screen) throws LWJGLException;
@ -694,12 +669,9 @@ final class LinuxDisplay implements DisplayImplementation {
}
private void doSetGamma(ByteBuffer native_gamma) throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
setGammaRampOnTmpDisplay(native_gamma);
current_gamma = native_gamma;
} finally {
unlockAWT();
}
}
@ -727,8 +699,7 @@ final class LinuxDisplay implements DisplayImplementation {
}
public DisplayMode init() throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
Compiz.init();
delete_atom = internAtom("WM_DELETE_WINDOW", false);
@ -740,12 +711,7 @@ final class LinuxDisplay implements DisplayImplementation {
throw new LWJGLException("No modes available");
switch (current_displaymode_extension) {
case XRANDR:
saved_mode = AccessController.doPrivileged(new PrivilegedAction<DisplayMode>() {
public DisplayMode run() {
XRandR.saveConfiguration();
return XRandR.ScreentoDisplayMode(XRandR.getConfiguration());
}
});
saved_mode = XRandR.ScreentoDisplayMode(XRandR.getConfiguration());
break;
case XF86VIDMODE:
saved_mode = modes[0];
@ -757,22 +723,17 @@ final class LinuxDisplay implements DisplayImplementation {
saved_gamma = getCurrentGammaRamp();
current_gamma = saved_gamma;
return saved_mode;
} finally {
unlockAWT();
}
}
private static DisplayMode getCurrentXRandrMode() throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
return nGetCurrentXRandrMode(getDisplay(), getDefaultScreen());
} finally {
decDisplay();
}
} finally {
unlockAWT();
}
}
@ -780,29 +741,20 @@ final class LinuxDisplay implements DisplayImplementation {
private static native DisplayMode nGetCurrentXRandrMode(long display, int screen) throws LWJGLException;
public void setTitle(String title) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
final ByteBuffer titleText = MemoryUtil.encodeUTF8(title);
nSetTitle(getDisplay(), getWindow(), MemoryUtil.getAddress(titleText), titleText.remaining() - 1);
} finally {
unlockAWT();
}
// also update the class hint value as some WM's use it for the window title
if (Display.isCreated()) setClassHint(title, wm_class);
}
private static native void nSetTitle(long display, long window, long title, int len);
/** the WM_CLASS hint is needed by some WM's e.g. gnome shell */
private void setClassHint(String wm_name, String wm_class) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
final ByteBuffer nameText = MemoryUtil.encodeUTF8(wm_name);
final ByteBuffer classText = MemoryUtil.encodeUTF8(wm_class);
nSetClassHint(getDisplay(), getWindow(), MemoryUtil.getAddress(nameText), MemoryUtil.getAddress(classText));
} finally {
unlockAWT();
}
}
private static native void nSetClassHint(long display, long window, long wm_name, long wm_class);
@ -920,28 +872,21 @@ final class LinuxDisplay implements DisplayImplementation {
}
public void update() {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
processEvents();
checkInput();
} finally {
unlockAWT();
}
}
public void reshape(int x, int y, int width, int height) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
nReshape(getDisplay(), getWindow(), x, y, width, height);
} finally {
unlockAWT();
}
}
private static native void nReshape(long display, long window, int x, int y, int width, int height);
public DisplayMode[] getAvailableDisplayModes() throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
if (current_displaymode_extension == XRANDR) {
// nGetAvailableDisplayModes cannot be trusted. Use it only for bitsPerPixel
@ -965,8 +910,6 @@ final class LinuxDisplay implements DisplayImplementation {
decDisplay();
}
}
} finally {
unlockAWT();
}
}
private static native DisplayMode[] nGetAvailableDisplayModes(long display, int screen, int extension) throws LWJGLException;
@ -981,11 +924,8 @@ final class LinuxDisplay implements DisplayImplementation {
}
public void createMouse() throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
mouse = new LinuxMouse(getDisplay(), getWindow(), getWindow());
} finally {
unlockAWT();
}
}
@ -995,29 +935,20 @@ final class LinuxDisplay implements DisplayImplementation {
}
public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
mouse.poll(grab, coord_buffer, buttons);
} finally {
unlockAWT();
}
}
public void readMouse(ByteBuffer buffer) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
mouse.read(buffer);
} finally {
unlockAWT();
}
}
public void setCursorPosition(int x, int y) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
mouse.setCursorPosition(x, y);
} finally {
unlockAWT();
}
}
@ -1132,17 +1063,9 @@ final class LinuxDisplay implements DisplayImplementation {
if (current_window_mode == FULLSCREEN_NETWM) {
nIconifyWindow(getDisplay(), getWindow(), getDefaultScreen());
try {
if( current_displaymode_extension == XRANDR )
{
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
if (current_displaymode_extension == XRANDR) {
XRandR.restoreConfiguration();
return null;
}
});
}
else
{
} else {
switchDisplayModeOnTmpDisplay(saved_mode);
}
setGammaRampOnTmpDisplay(saved_gamma);
@ -1169,15 +1092,12 @@ final class LinuxDisplay implements DisplayImplementation {
}
public void grabMouse(boolean new_grab) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
if (new_grab != grab) {
grab = new_grab;
updateInputGrab();
mouse.changeGrabbed(grab, shouldWarpPointer());
}
} finally {
unlockAWT();
}
}
@ -1186,8 +1106,7 @@ final class LinuxDisplay implements DisplayImplementation {
}
public int getNativeCursorCapabilities() {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
return nGetNativeCursorCapabilities(getDisplay());
@ -1196,25 +1115,19 @@ final class LinuxDisplay implements DisplayImplementation {
}
} catch (LWJGLException e) {
throw new RuntimeException(e);
} finally {
unlockAWT();
}
}
private static native int nGetNativeCursorCapabilities(long display) throws LWJGLException;
public void setNativeCursor(Object handle) throws LWJGLException {
current_cursor = getCursorHandle(handle);
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
updateCursor();
} finally {
unlockAWT();
}
}
public int getMinCursorSize() {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
return nGetMinCursorSize(getDisplay(), getWindow());
@ -1224,15 +1137,12 @@ final class LinuxDisplay implements DisplayImplementation {
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred in getMinCursorSize: " + e);
return 0;
} finally {
unlockAWT();
}
}
private static native int nGetMinCursorSize(long display, long window);
public int getMaxCursorSize() {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
return nGetMaxCursorSize(getDisplay(), getWindow());
@ -1242,47 +1152,33 @@ final class LinuxDisplay implements DisplayImplementation {
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred in getMaxCursorSize: " + e);
return 0;
} finally {
unlockAWT();
}
}
private static native int nGetMaxCursorSize(long display, long window);
/* Keyboard */
public void createKeyboard() throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
keyboard = new LinuxKeyboard(getDisplay(), getWindow());
} finally {
unlockAWT();
}
}
public void destroyKeyboard() {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
keyboard.destroy(getDisplay());
keyboard = null;
} finally {
unlockAWT();
}
}
public void pollKeyboard(ByteBuffer keyDownBuffer) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
keyboard.poll(keyDownBuffer);
} finally {
unlockAWT();
}
}
public void readKeyboard(ByteBuffer buffer) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
keyboard.read(buffer);
} finally {
unlockAWT();
}
}
@ -1294,8 +1190,7 @@ final class LinuxDisplay implements DisplayImplementation {
static native long nCreateBlankCursor(long display, long window);
public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
long cursor = nCreateCursor(getDisplay(), width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1);
@ -1304,8 +1199,6 @@ final class LinuxDisplay implements DisplayImplementation {
decDisplay();
throw e;
}
} finally {
unlockAWT();
}
}
@ -1314,19 +1207,15 @@ final class LinuxDisplay implements DisplayImplementation {
}
public void destroyCursor(Object cursorHandle) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
nDestroyCursor(getDisplay(), getCursorHandle(cursorHandle));
decDisplay();
} finally {
unlockAWT();
}
}
static native void nDestroyCursor(long display, long cursorHandle);
public int getPbufferCapabilities() {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
return nGetPbufferCapabilities(getDisplay(), getDefaultScreen());
@ -1336,8 +1225,6 @@ final class LinuxDisplay implements DisplayImplementation {
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred in getPbufferCapabilities: " + e);
return 0;
} finally {
unlockAWT();
}
}
private static native int nGetPbufferCapabilities(long display, int screen);
@ -1430,8 +1317,7 @@ final class LinuxDisplay implements DisplayImplementation {
* @return number of icons used.
*/
public int setIcon(ByteBuffer[] icons) {
lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = awtLock()) {
incDisplay();
try {
// get icons as cardinal ARGB format
@ -1445,8 +1331,6 @@ final class LinuxDisplay implements DisplayImplementation {
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to set display icon: " + e);
return 0;
} finally {
unlockAWT();
}
}
@ -1512,164 +1396,172 @@ final class LinuxDisplay implements DisplayImplementation {
}
static void init() {
if ( Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.nocompiz_lfs") )
return;
if (LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.nocompiz_lfs")) return;
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
try {
// Check if Compiz is active
if ( !isProcessActive("compiz") )
return null;
try {
// Check if Compiz is active
if (!isProcessActive("compiz")) return;
provider = null;
provider = null;
String providerName = null;
String providerName = null;
// Check if Dbus is available
if ( isProcessActive("dbus-daemon") ) {
providerName = "Dbus";
provider = new Provider() {
// Check if Dbus is available
if (isProcessActive("dbus-daemon")) {
providerName = "Dbus";
provider = new Provider() {
private static final String KEY = "/org/freedesktop/compiz/workarounds/allscreens/legacy_fullscreen";
private static final String KEY = "/org/freedesktop/compiz/workarounds/allscreens/legacy_fullscreen";
public boolean hasLegacyFullscreenSupport() throws LWJGLException {
final List<String> output = Compiz.runLines(
"dbus-send", "--print-reply", "--type=method_call", "--dest=org.freedesktop.compiz", KEY, "org.freedesktop.compiz.get"
);
public boolean hasLegacyFullscreenSupport() throws LWJGLException {
final List output = Compiz.run(
"dbus-send", "--print-reply", "--type=method_call", "--dest=org.freedesktop.compiz", KEY, "org.freedesktop.compiz.get"
);
if (output == null || output.size() < 2) {
throw new LWJGLException("Invalid Dbus reply.");
}
if ( output == null || output.size() < 2 )
throw new LWJGLException("Invalid Dbus reply.");
String line = (String)output.get(0);
String line = (String)output.get(0);
if (!line.startsWith("method return")) {
throw new LWJGLException("Invalid Dbus reply.");
}
if ( !line.startsWith("method return") )
throw new LWJGLException("Invalid Dbus reply.");
line = ((String)output.get(1)).trim(); // value
if (!line.startsWith("boolean") || line.length() < 12) {
throw new LWJGLException("Invalid Dbus reply.");
}
line = ((String)output.get(1)).trim(); // value
if ( !line.startsWith("boolean") || line.length() < 12)
throw new LWJGLException("Invalid Dbus reply.");
return "true".equalsIgnoreCase(line.substring("boolean".length() + 1));
}
return "true".equalsIgnoreCase(line.substring("boolean".length() + 1));
}
public void setLegacyFullscreenSupport(final boolean state) throws LWJGLException {
if ( Compiz.run(
"dbus-send", "--type=method_call", "--dest=org.freedesktop.compiz", KEY, "org.freedesktop.compiz.set", "boolean:" + Boolean.toString(state)
) == null )
throw new LWJGLException("Failed to apply Compiz LFS workaround.");
}
};
} else {
try {
// Check if Gconf is available
Runtime.getRuntime().exec("gconftool");
providerName = "gconftool";
provider = new Provider() {
private static final String KEY = "/apps/compiz/plugins/workarounds/allscreens/options/legacy_fullscreen";
public boolean hasLegacyFullscreenSupport() throws LWJGLException {
final List output = Compiz.run(new String[] {
"gconftool", "-g", KEY
});
if ( output == null || output.size() == 0 )
throw new LWJGLException("Invalid gconftool reply.");
return Boolean.parseBoolean(((String)output.get(0)).trim());
}
public void setLegacyFullscreenSupport(final boolean state) throws LWJGLException {
if ( Compiz.run(new String[] {
"gconftool", "-s", KEY, "-s", Boolean.toString(state), "-t", "bool"
}) == null )
throw new LWJGLException("Failed to apply Compiz LFS workaround.");
if ( state ) {
try {
// gconftool will not apply the workaround immediately, sleep a bit
// to make sure it will be ok when we create the window.
Thread.sleep(200); // 100 is too low, 150 works, set to 200 to be safe.
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
} catch (IOException e) {
// Ignore
public void setLegacyFullscreenSupport(final boolean state) throws LWJGLException {
if (Compiz.run("dbus-send", "--type=method_call", "--dest=org.freedesktop.compiz", KEY, "org.freedesktop.compiz.set", "boolean:" + state) != 0) {
throw new LWJGLException("Failed to apply Compiz LFS workaround.");
}
}
};
} else {
try {
// Check if Gconf is available
Runtime.getRuntime().exec("gconftool");
if ( provider != null && !provider.hasLegacyFullscreenSupport() ) { // No need to do anything if LFS is already enabled.
applyFix = true;
LWJGLUtil.log("Using " + providerName + " to apply Compiz LFS workaround.");
}
} catch (LWJGLException e) {
providerName = "gconftool";
provider = new Provider() {
private static final String KEY = "/apps/compiz/plugins/workarounds/allscreens/options/legacy_fullscreen";
public boolean hasLegacyFullscreenSupport() throws LWJGLException {
final List<String> output = Compiz.runLines("gconftool", "-g", KEY);
if (output == null || output.size() == 0) {
throw new LWJGLException("Invalid gconftool reply.");
}
return Boolean.parseBoolean(((String)output.get(0)).trim());
}
public void setLegacyFullscreenSupport(final boolean state) throws LWJGLException {
if (Compiz.run("gconftool", "-s", KEY, "-s", Boolean.toString(state), "-t", "bool") != 0) {
throw new LWJGLException("Failed to apply Compiz LFS workaround.");
}
if (state) {
try {
// gconftool will not apply the workaround immediately, sleep a bit
// to make sure it will be ok when we create the window.
Thread.sleep(200); // 100 is too low, 150 works, set to 200 to be safe.
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
} catch (IOException e) {
// Ignore
} finally {
return null;
}
}
});
if (provider != null && !provider.hasLegacyFullscreenSupport()) {
// No need to do anything if LFS is already enabled.
applyFix = true;
String providerName1 = providerName;
LWJGLUtil.logger().log(() -> "Using " + providerName1 + " to apply Compiz LFS workaround.");
}
} catch (LWJGLException e) {
// Ignore
}
}
static void setLegacyFullscreenSupport(final boolean enabled) {
if ( !applyFix )
if (!applyFix)
return;
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
try {
provider.setLegacyFullscreenSupport(enabled);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to change Compiz Legacy Fullscreen Support. Reason: " + e.getMessage());
}
return null;
}
});
try {
provider.setLegacyFullscreenSupport(enabled);
} catch (LWJGLException e) {
LWJGLUtil.logger().log(() -> "Failed to change Compiz Legacy Fullscreen Support. Reason: " + e.getMessage());
}
}
private static List<String> run(final String... command) throws LWJGLException {
final List<String> output = new ArrayList<String>();
private static List<String> runLines(final String... command) throws LWJGLException {
List<String> output = new ArrayList<>();
try {
final Process p = Runtime.getRuntime().exec(command);
try {
final int exitValue = p.waitFor();
if ( exitValue != 0 )
return null;
} catch (InterruptedException e) {
throw new LWJGLException("Process interrupted.", e);
}
final BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ( (line = br.readLine()) != null )
output.add(line);
br.close();
} catch (final IOException e) {
throw new LWJGLException("Process failed.", e);
}
if (run(output::add, command) != 0) return null;
return output;
}
private static boolean isProcessActive(final String processName) throws LWJGLException {
final List<String> output = run(new String[] { "ps", "-C", processName });
if ( output == null )
return false;
private static int run(final String... command) throws LWJGLException {
try {
final Process p = Runtime.getRuntime().exec(command);
for ( final String line : output ) {
if ( line.contains(processName) )
return true;
try {
return p.waitFor();
} catch (InterruptedException e) {
throw new LWJGLException("Process interrupted.", e);
}
} catch (final IOException e) {
throw new LWJGLException("Process failed.", e);
}
}
private static int run(Consumer<String> lineConsumer, final String... command) throws LWJGLException {
try {
final Process p = Runtime.getRuntime().exec(command);
final BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
lineConsumer.accept(line);
}
br.close();
try {
return p.waitFor();
} catch (InterruptedException e) {
throw new LWJGLException("Process interrupted.", e);
}
} catch (final IOException e) {
throw new LWJGLException("Process failed.", e);
}
}
private static boolean isProcessActive(final String processName) throws LWJGLException {
class LineFindingConsumer implements Consumer<String> {
boolean found = false;
@Override
public void accept(String line) {
if (found) return;
found = line.contains(processName);
}
}
return false;
LineFindingConsumer consumer = new LineFindingConsumer();
run(consumer, "ps", "-C", processName);
return consumer.found;
}
private interface Provider {

View File

@ -52,8 +52,7 @@ final class LinuxDisplayPeerInfo extends LinuxPeerInfo {
LinuxDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException {
egl = false;
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
GLContext.loadOpenGLLibrary();
try {
LinuxDisplay.incDisplay();
@ -67,18 +66,13 @@ final class LinuxDisplayPeerInfo extends LinuxPeerInfo {
GLContext.unloadOpenGLLibrary();
throw e;
}
} finally {
LinuxDisplay.unlockAWT();
}
}
private static native void initDefaultPeerInfo(long display, int screen, ByteBuffer peer_info_handle, PixelFormat pixel_format) throws LWJGLException;
protected void doLockAndInitHandle() throws LWJGLException {
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
initDrawable(LinuxDisplay.getWindow(), getHandle());
} finally {
LinuxDisplay.unlockAWT();
}
}
private static native void initDrawable(long window, ByteBuffer peer_info_handle);
@ -90,13 +84,13 @@ final class LinuxDisplayPeerInfo extends LinuxPeerInfo {
public void destroy() {
super.destroy();
if ( egl )
if (egl) {
org.lwjgl.opengles.GLContext.unloadOpenGLLibrary();
else {
LinuxDisplay.lockAWT();
LinuxDisplay.decDisplay();
GLContext.unloadOpenGLLibrary();
LinuxDisplay.unlockAWT();
} else {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
LinuxDisplay.decDisplay();
GLContext.unloadOpenGLLibrary();
}
}
}
}

View File

@ -257,43 +257,19 @@ final class LinuxKeyboard {
private static native long lookupKeysym(long event_ptr, int index);
private static native long toUpper(long keysym);
private long mapEventToKeySym(long event_ptr, int event_state) {
int group;
long keysym;
if ((event_state & modeswitch_mask) != 0)
group = 1;
else
group = 0;
if ((event_state & numlock_mask) != 0 && isKeypadKeysym(keysym = getKeySym(event_ptr, group, 1))) {
if ((event_state & (ShiftMask | shift_lock_mask)) != 0) {
return getKeySym(event_ptr, group, 0);
} else {
return keysym;
}
} else if ((event_state & (ShiftMask | LockMask)) == 0) {
return getKeySym(event_ptr, group, 0);
} else if ((event_state & ShiftMask) == 0) {
keysym = getKeySym(event_ptr, group, 0);
if ((event_state & caps_lock_mask) != 0)
keysym = toUpper(keysym);
return keysym;
} else {
keysym = getKeySym(event_ptr, group, 1);
if ((event_state & caps_lock_mask) != 0)
keysym = toUpper(keysym);
return keysym;
}
}
private int getKeycode(long event_ptr, int event_state) {
long keysym = mapEventToKeySym(event_ptr, event_state);
int keycode = LinuxKeycodes.mapKeySymToLWJGLKeyCode(keysym);
if (keycode == Keyboard.KEY_NONE) {
// Try unshifted keysym mapping
keysym = lookupKeysym(event_ptr, 0);
keycode = LinuxKeycodes.mapKeySymToLWJGLKeyCode(keysym);
boolean shift = (event_state & (ShiftMask | shift_lock_mask)) != 0;
int group = (event_state & modeswitch_mask) != 0 ? 1 : 0;
long keysym;
if ((event_state & numlock_mask) != 0 && isKeypadKeysym(keysym = getKeySym(event_ptr, group, 1))) {
if ( shift )
keysym = getKeySym(event_ptr, group, 0);
} else {
keysym = getKeySym(event_ptr, group, 0);
if ( shift ^ ((event_state & caps_lock_mask) != 0) )
keysym = toUpper(keysym);
}
return keycode;
return LinuxKeycodes.mapKeySymToLWJGLKeyCode(keysym);
}
private static byte getKeyState(int event_type) {

View File

@ -43,8 +43,7 @@ import org.lwjgl.LWJGLException;
*/
final class LinuxPbufferPeerInfo extends LinuxPeerInfo {
LinuxPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException {
LinuxDisplay.lockAWT();
try {
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
GLContext.loadOpenGLLibrary();
try {
LinuxDisplay.incDisplay();
@ -58,18 +57,16 @@ final class LinuxPbufferPeerInfo extends LinuxPeerInfo {
GLContext.unloadOpenGLLibrary();
throw e;
}
} finally {
LinuxDisplay.unlockAWT();
}
}
private static native void nInitHandle(long display, int screen, ByteBuffer handle, int width, int height, PixelFormat pixel_format) throws LWJGLException;
public void destroy() {
LinuxDisplay.lockAWT();
nDestroy(getHandle());
LinuxDisplay.decDisplay();
GLContext.unloadOpenGLLibrary();
LinuxDisplay.unlockAWT();
try (LinuxDisplay.AWTLock _lock = LinuxDisplay.awtLock()) {
nDestroy(getHandle());
LinuxDisplay.decDisplay();
GLContext.unloadOpenGLLibrary();
}
}
private static native void nDestroy(ByteBuffer handle);

View File

@ -46,9 +46,6 @@ import java.awt.Robot;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.List;
@ -127,7 +124,7 @@ final class MacOSXDisplay implements DisplayImplementation {
private native boolean nIsNativeMode(ByteBuffer peer_info_handle);
private static boolean isUndecorated() {
return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
return LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
}
public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
@ -137,11 +134,11 @@ final class MacOSXDisplay implements DisplayImplementation {
// OS X fullscreen mode API is only available on OS X 10.7+
boolean enableFullscreenModeAPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null &&
!Display.getPrivilegedBoolean("org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI");
!LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI");
// OS X high DPI mode is only available on OS X 10.7+
enableHighDPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null &&
(Display.getPrivilegedBoolean("org.lwjgl.opengl.Display.enableHighDPI") || fullscreen);
(LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Display.enableHighDPI") || fullscreen);
if (parented) this.canvas = parent;
else this.canvas = null;
@ -182,22 +179,16 @@ final class MacOSXDisplay implements DisplayImplementation {
}
public void doHandleQuit() {
synchronized (this) {
close_requested = true;
}
close_requested = true;
}
public void mouseInsideWindow(boolean inside) {
synchronized (this) {
mouseInsideWindow = inside;
}
mouseInsideWindow = inside;
updateNativeCursor = true;
}
public void setScaleFactor(float scale) {
synchronized (this) {
scaleFactor = scale;
}
scaleFactor = scale;
}
public native void nDestroyCALayer(ByteBuffer peer_info_handle);
@ -287,11 +278,8 @@ final class MacOSXDisplay implements DisplayImplementation {
}
public boolean isCloseRequested() {
boolean result;
synchronized (this) {
result = close_requested;
close_requested = false;
}
boolean result = close_requested;
close_requested = false;
return result;
}

View File

@ -52,86 +52,103 @@ public final class Pbuffer extends DrawableGL {
/**
* Indicates that Pbuffers can be created.
*/
@java.lang.annotation.Native
public static final int PBUFFER_SUPPORTED = 1 << 0;
/**
* Indicates that Pbuffers can be used as render-textures.
*/
@java.lang.annotation.Native
public static final int RENDER_TEXTURE_SUPPORTED = 1 << 1;
/**
* Indicates that Pbuffers can be used as non-power-of-two render-textures.
*/
@java.lang.annotation.Native
public static final int RENDER_TEXTURE_RECTANGLE_SUPPORTED = 1 << 2;
/**
* Indicates that Pbuffers can be used as depth render-textures.
*/
@java.lang.annotation.Native
public static final int RENDER_DEPTH_TEXTURE_SUPPORTED = 1 << 3;
/**
* The render-to-texture mipmap level attribute.
*/
@java.lang.annotation.Native
public static final int MIPMAP_LEVEL = RenderTexture.WGL_MIPMAP_LEVEL_ARB;
/**
* The render-to-texture cube map face attribute.
*/
@java.lang.annotation.Native
public static final int CUBE_MAP_FACE = RenderTexture.WGL_CUBE_MAP_FACE_ARB;
/**
* The render-to-texture cube map positive X face value.
*/
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_POSITIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB;
/**
* The render-to-texture cube map negative X face value.
*/
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_NEGATIVE_X = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB;
/**
* The render-to-texture cube map positive Y face value.
*/
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_POSITIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB;
/**
* The render-to-texture cube map negative Y face value.
*/
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_NEGATIVE_Y = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB;
/**
* The render-to-texture cube map positive Z face value.
*/
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_POSITIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB;
/**
* The render-to-texture cube map negative Z face value.
*/
@java.lang.annotation.Native
public static final int TEXTURE_CUBE_MAP_NEGATIVE_Z = RenderTexture.WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB;
/**
* The Pbuffer front left buffer.
*/
@java.lang.annotation.Native
public static final int FRONT_LEFT_BUFFER = RenderTexture.WGL_FRONT_LEFT_ARB;
/**
* The Pbuffer front right buffer.
*/
@java.lang.annotation.Native
public static final int FRONT_RIGHT_BUFFER = RenderTexture.WGL_FRONT_RIGHT_ARB;
/**
* The Pbuffer back left buffer.
*/
@java.lang.annotation.Native
public static final int BACK_LEFT_BUFFER = RenderTexture.WGL_BACK_LEFT_ARB;
/**
* The Pbuffer back right buffer.
*/
@java.lang.annotation.Native
public static final int BACK_RIGHT_BUFFER = RenderTexture.WGL_BACK_RIGHT_ARB;
/**
* The Pbuffer depth buffer.
*/
@java.lang.annotation.Native
public static final int DEPTH_BUFFER = RenderTexture.WGL_DEPTH_COMPONENT_NV;
/**

View File

@ -36,7 +36,6 @@ import java.awt.GraphicsDevice;
import java.awt.Toolkit;
import java.awt.Canvas;
import java.security.PrivilegedAction;
import java.security.AccessController;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
@ -51,19 +50,13 @@ final class WindowsCanvasImplementation implements AWTCanvasImplementation {
static {
// Make sure the awt stuff is properly initialised (the jawt library in particular)
Toolkit.getDefaultToolkit();
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
try {
System.loadLibrary("jawt");
} catch (UnsatisfiedLinkError e) {
/* It is probably already loaded, potentially by a different ClassLoader
* so just log the exception and continue
*/
LWJGLUtil.log("Failed to load jawt: " + e.getMessage());
}
return null;
}
});
try {
System.loadLibrary("jawt");
} catch (UnsatisfiedLinkError e) {
// It is probably already loaded, potentially by a different ClassLoader
// so just log the exception and continue
LWJGLUtil.logger().log("Failed to load jawt", e);
}
}
public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException {

View File

@ -209,7 +209,6 @@ final class WindowsDisplay implements DisplayImplementation {
private boolean iconsLoaded;
private int captureMouse = -1;
private boolean trackingMouse;
private boolean mouseInside;
static {
@ -226,11 +225,6 @@ final class WindowsDisplay implements DisplayImplementation {
}
public void createWindow(DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
close_requested = false;
is_dirty = false;
isMinimized = false;
isFocused = false;
redoMakeContextCurrent = false;
this.parent = parent;
hasParent = parent != null;
parent_hwnd = parent != null ? getHwnd(parent) : 0;
@ -295,7 +289,7 @@ final class WindowsDisplay implements DisplayImplementation {
private static native long nCreateWindow(int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException;
private static boolean isUndecorated() {
return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
return LWJGLUtil.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
}
private static long getHwnd(Canvas parent) throws LWJGLException {
@ -320,6 +314,15 @@ final class WindowsDisplay implements DisplayImplementation {
freeLargeIcon();
freeSmallIcon();
resetCursorClipping();
// reset state
close_requested = false;
is_dirty = false;
isMinimized = false;
isFocused = false;
redoMakeContextCurrent = false;
resizable = false;
mouseInside = false;
}
private static native void nReleaseDC(long hwnd, long hdc);
private static native void nDestroyWindow(long hwnd);
@ -377,16 +380,13 @@ final class WindowsDisplay implements DisplayImplementation {
}
setFocus(getHwnd());
redoMakeContextCurrent = true;
if (Display.isFullscreen())
updateClipping();
} else {
if ( keyboard != null )
keyboard.releaseAll(millis);
if ( Display.isFullscreen() ) {
showWindow(getHwnd(), SW_SHOWMINNOACTIVE);
resetDisplayMode();
} else
updateClipping();
}
}
updateCursor();
inAppActivate = false;
@ -600,7 +600,7 @@ final class WindowsDisplay implements DisplayImplementation {
}
public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) {
mouse.poll(coord_buffer, buttons);
mouse.poll(coord_buffer, buttons, this);
}
public void readMouse(ByteBuffer buffer) {
@ -608,7 +608,7 @@ final class WindowsDisplay implements DisplayImplementation {
}
public void grabMouse(boolean grab) {
mouse.grab(grab, shouldGrab());
mouse.grab(grab);
updateCursor();
}
@ -632,13 +632,15 @@ final class WindowsDisplay implements DisplayImplementation {
private void updateCursor() {
try {
if (mouse != null && shouldGrab())
if (mouse != null && shouldGrab()) {
centerCursor(hwnd);
nSetNativeCursor(getHwnd(), mouse.getBlankCursor());
else
} else
nSetNativeCursor(getHwnd(), current_cursor);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to update cursor: " + e);
}
updateClipping();
}
static native void nSetNativeCursor(long hwnd, Object handle) throws LWJGLException;
@ -859,12 +861,6 @@ final class WindowsDisplay implements DisplayImplementation {
return !isMinimized && isFocused && Mouse.isGrabbed();
}
private void handleMouseMoved(int x, int y, long millis) {
if (mouse != null) {
mouse.handleMouseMoved(x, y, millis, shouldGrab());
}
}
private static native long nSetCapture(long hwnd);
private static native boolean nReleaseCapture();
@ -915,10 +911,6 @@ final class WindowsDisplay implements DisplayImplementation {
private static native long defWindowProc(long hwnd, int msg, long wParam, long lParam);
private void checkCursorState() {
updateClipping();
}
private void updateClipping() {
if ((Display.isFullscreen() || (mouse != null && mouse.isGrabbed())) && !isMinimized && isFocused && (getForegroundWindow() == getHwnd() || hasParent)) {
try {
@ -932,8 +924,10 @@ final class WindowsDisplay implements DisplayImplementation {
}
private void setMinimized(boolean m) {
isMinimized = m;
checkCursorState();
if ( m != isMinimized ) {
isMinimized = m;
updateClipping();
}
}
private long doHandleMessage(long hwnd, int msg, long wParam, long lParam, long millis) {
@ -987,16 +981,6 @@ final class WindowsDisplay implements DisplayImplementation {
resized = true;
updateWidthAndHeight();
break;
case WM_SETCURSOR:
if((lParam & 0xFFFF) == HTCLIENT) {
// if the cursor is inside the client area, reset it
// to the current LWJGL-cursor
updateCursor();
return -1; //TRUE
} else {
// let Windows handle cursors outside the client area for resizing, etc.
return defWindowProc(hwnd, msg, wParam, lParam);
}
case WM_KILLFOCUS:
appActivate(false, millis);
return 0L;
@ -1011,14 +995,16 @@ final class WindowsDisplay implements DisplayImplementation {
}
break;
case WM_MOUSEMOVE:
int xPos = (int)(short)(lParam & 0xFFFF);
int yPos = transformY(getHwnd(), (int)(short)((lParam >> 16) & 0xFFFF));
handleMouseMoved(xPos, yPos, millis);
checkCursorState();
mouseInside = true;
if(!trackingMouse) {
trackingMouse = nTrackMouseEvent(hwnd);
}
if ( mouse != null ) {
int xPos = (short)(lParam & 0xFFFF);
int yPos = transformY(getHwnd(), (short)(lParam >>> 16));
mouse.handleMouseMoved(xPos, yPos, millis);
}
if ( !mouseInside ) {
mouseInside = true;
updateCursor();
nTrackMouseEvent(hwnd);
}
return 0L;
case WM_MOUSEWHEEL:
int dwheel = (int)(short)((wParam >> 16) & 0xFFFF);
@ -1101,7 +1087,6 @@ final class WindowsDisplay implements DisplayImplementation {
break;
case WM_MOUSELEAVE:
mouseInside = false;
trackingMouse = false;
break;
case WM_CANCELMODE:
nReleaseCapture();
@ -1247,4 +1232,4 @@ final class WindowsDisplay implements DisplayImplementation {
return "Rect: left = " + left + " top = " + top + " right = " + right + " bottom = " + bottom + ", width: " + (right - left) + ", height: " + (bottom - top);
}
}
}
}

View File

@ -70,10 +70,11 @@ final class WindowsKeyboard {
// Windows will not send an up event for the first button that was released in this case.
// There will only be one up event, for the last button only. We handle this problem
// here, using asynchronous state queries.
if ( isKeyDown(Keyboard.KEY_LSHIFT) && isKeyDown(Keyboard.KEY_RSHIFT) ) {
if ( !isKeyPressedAsync(WindowsKeycodes.VK_LSHIFT) ) handleKey(WindowsKeycodes.VK_SHIFT, Keyboard.KEY_LSHIFT, false, (byte)0, 0L, false);
if ( !isKeyPressedAsync(WindowsKeycodes.VK_RSHIFT) ) handleKey(WindowsKeycodes.VK_SHIFT, Keyboard.KEY_RSHIFT, false, (byte)0, 0L, false);
}
if ( isKeyDown(Keyboard.KEY_LSHIFT) && !isKeyPressedAsync(WindowsKeycodes.VK_LSHIFT) )
handleKey(WindowsKeycodes.VK_SHIFT, Keyboard.KEY_LSHIFT, false, (byte)0, 0L, false);
if ( isKeyDown(Keyboard.KEY_RSHIFT) && !isKeyPressedAsync(WindowsKeycodes.VK_RSHIFT) )
handleKey(WindowsKeycodes.VK_SHIFT, Keyboard.KEY_RSHIFT, false, (byte)0, 0L, false);
int old_position = keyDownBuffer.position();
keyDownBuffer.put(key_down_buffer);

View File

@ -90,7 +90,7 @@ final class WindowsMouse {
return mouse_button_count;
}
public void poll(IntBuffer coord_buffer, ByteBuffer buttons) {
public void poll(IntBuffer coord_buffer, ByteBuffer buttons, WindowsDisplay display) {
for (int i = 0; i < coord_buffer.remaining(); i++)
coord_buffer.put(coord_buffer.position() + i, 0);
int num_buttons = mouse_button_count;
@ -103,6 +103,9 @@ final class WindowsMouse {
if (isGrabbed()) {
coord_buffer.put(coord_buffer.position() + 0, accum_dx);
coord_buffer.put(coord_buffer.position() + 1, accum_dy);
if ( display.isActive() && display.isVisible() && (accum_dx != 0 || accum_dy != 0) )
WindowsDisplay.centerCursor(hwnd);
} else {
coord_buffer.put(coord_buffer.position() + 0, last_x);
coord_buffer.put(coord_buffer.position() + 1, last_y);
@ -132,25 +135,8 @@ final class WindowsMouse {
return blank_cursor;
}
public void grab(boolean grab, boolean should_center) {
if (grab) {
if (!mouse_grabbed) {
mouse_grabbed = true;
if (should_center) {
try {
WindowsDisplay.setupCursorClipping(hwnd);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to setup cursor clipping: " + e);
}
centerCursor();
}
}
} else {
if (mouse_grabbed) {
mouse_grabbed = false;
WindowsDisplay.resetCursorClipping();
}
}
public void grab(boolean grab) {
mouse_grabbed = grab;
event_queue.clearEvents();
}
@ -159,10 +145,6 @@ final class WindowsMouse {
putMouseEvent((byte)-1, (byte)0, event_dwheel, millis*1000000);
}
private void centerCursor() {
WindowsDisplay.centerCursor(hwnd);
}
public void setPosition(int x, int y) {
this.last_x = x;
this.last_y = y;
@ -172,7 +154,7 @@ final class WindowsMouse {
WindowsDisplay.doDestroyCursor(blank_cursor);
}
public void handleMouseMoved(int x, int y, long millis, boolean should_center) {
public void handleMouseMoved(int x, int y, long millis) {
int dx = x - last_x;
int dy = y - last_y;
if (dx != 0 || dy != 0) {
@ -183,8 +165,6 @@ final class WindowsMouse {
long nanos = millis*1000000;
if (mouse_grabbed) {
putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0, nanos);
if (should_center)
centerCursor();
} else {
putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0, nanos);
}

View File

@ -92,15 +92,28 @@ public class XRandR {
}
name = sa[0];
// save position of this screen, will be used later when current modeline is parsed
if ( "primary".equals(sa[2]) ) {
parseScreenHeader(currentScreenPosition, sa[3]);
// save primary
primaryScreenIdentifier = name;
} else {
parseScreenHeader(currentScreenPosition, sa[2]);
}
} else {
// enabled?
if (sa.length > 2) {
// save position of this screen, will be used later when current modeline is parsed
if ( "primary".equals(sa[2]) ) {
parseScreenHeader(currentScreenPosition, sa[3]);
// save primary
primaryScreenIdentifier = name;
} else {
parseScreenHeader(currentScreenPosition, sa[2]);
}
} else {
// disabled screen, no position info available
currentScreenPosition[0] = 0;
currentScreenPosition[1] = 0;
}
} else if ("disconnected".equals(sa[1])) {
// previous screen block is over
if (name != null) {
screens.put(name, possibles.toArray(new Screen[possibles.size()]));
name = null;
}
} else if (name != null) { // only read modelines after a valid screen identifier
Matcher m = SCREEN_MODELINE_PATTERN.matcher(sa[0]);
if ( m.matches() ) {
// found a new mode line
@ -113,7 +126,9 @@ public class XRandR {
}
}
screens.put(name, possibles.toArray(new Screen[possibles.size()]));
if (name != null) {
screens.put(name, possibles.toArray(new Screen[possibles.size()]));
}
current = currentList.toArray(new Screen[currentList.size()]);
@ -162,6 +177,9 @@ public class XRandR {
if ( screens.length == 0 )
throw new IllegalArgumentException("Must specify at least one screen");
if ( savedConfiguration == null )
saveConfiguration();
List<String> cmd = new ArrayList<String>();
cmd.add("xrandr");
@ -207,7 +225,7 @@ public class XRandR {
* This configuration can be restored on exit/crash by calling
* restoreConfiguration()
*/
public static void saveConfiguration() {
private static void saveConfiguration() {
populate();
savedConfiguration = current.clone();
}
@ -245,7 +263,7 @@ public class XRandR {
private static final Pattern SCREEN_HEADER_PATTERN = Pattern.compile("^(\\d+)x(\\d+)[+](\\d+)[+](\\d+)$");
private static final Pattern SCREEN_MODELINE_PATTERN = Pattern.compile("^(\\d+)x(\\d+)$");
private static final Pattern FREQ_PATTERN = Pattern.compile("^(\\d+)[.](\\d+)(?:\\s*[*])?(?:\\s*[+])?$");
private static final Pattern FREQ_PATTERN = Pattern.compile("^(\\d+[.]\\d+)(?:\\s*[*])?(?:\\s*[+])?$");
/**
* Parses a screen configuration and adds it to one of the lists if valid.
@ -271,7 +289,7 @@ public class XRandR {
return;
}
int freq = Integer.parseInt(m.group(1));
String freq = m.group(1);
Screen s = new Screen(name, width, height, freq, 0, 0);
if ( freqS.contains("*") ) {
@ -307,7 +325,7 @@ public class XRandR {
static Screen DisplayModetoScreen(DisplayMode mode) {
populate();
Screen primary = findPrimary(current);
return new Screen(primary.name, mode.getWidth(), mode.getHeight(), mode.getFrequency(), primary.xPos, primary.yPos);
return new Screen(primary.name, mode.getWidth(), mode.getHeight(), Integer.toString(mode.getFrequency()), primary.xPos, primary.yPos);
}
static DisplayMode ScreentoDisplayMode(Screen... screens) {
@ -345,17 +363,21 @@ public class XRandR {
/** Frequency in Hz */
public final int freq;
/** Frequency in Hz, in the original decimal format */
final String freqOriginal;
/** Position on the x-axis, in pixels */
public int xPos;
/** Position on the y-axis, in pixels */
public int yPos;
Screen(String name, int width, int height, int freq, int xPos, int yPos) {
Screen(String name, int width, int height, String freq, int xPos, int yPos) {
this.name = name;
this.width = width;
this.height = height;
this.freq = freq;
this.freq = (int)Float.parseFloat(freq);
this.freqOriginal = freq;
this.xPos = xPos;
this.yPos = yPos;
}
@ -366,14 +388,14 @@ public class XRandR {
argList.add("--mode");
argList.add(width + "x" + height);
argList.add("--rate");
argList.add(Integer.toString(freq));
argList.add(freqOriginal);
argList.add("--pos");
argList.add(xPos + "x" + yPos);
}
//@Override
public String toString() {
return name + " " + width + "x" + height + " @ " + xPos + "x" + yPos + " with " + freq + "Hz";
return name + " " + width + "x" + height + " @ " + xPos + "x" + yPos + " with " + freqOriginal + "Hz";
}
}
}

View File

@ -24,7 +24,7 @@ import java.util.Iterator;
*/
final class FastIntMap<V> implements Iterable<FastIntMap.Entry<V>> {
private Entry[] table;
private Entry<V>[] table;
private int size, mask, capacity, threshold;
/** Same as: FastIntMap(16, 0.75f); */
@ -45,7 +45,7 @@ final class FastIntMap<V> implements Iterable<FastIntMap.Entry<V>> {
while ( capacity < initialCapacity )
capacity <<= 1;
this.threshold = (int)(capacity * loadFactor);
this.table = new Entry[capacity];
this.table = (Entry<V>[]) new Entry[capacity];
this.mask = capacity - 1;
}
@ -81,7 +81,7 @@ final class FastIntMap<V> implements Iterable<FastIntMap.Entry<V>> {
final int newCapacity = 2 * capacity;
final int newMask = newCapacity - 1;
final Entry<V>[] newTable = new Entry[newCapacity];
final Entry<V>[] newTable = (Entry<V>[]) new Entry[newCapacity];
for ( int i = 0, index; i < table.length; i++ ) {
Entry<V> e = table[i];
@ -235,4 +235,4 @@ final class FastIntMap<V> implements Iterable<FastIntMap.Entry<V>> {
}
}
}

View File

@ -37,9 +37,6 @@ import org.lwjgl.Sys;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
@ -176,7 +173,7 @@ public final class GLContext {
majorVersion = Integer.parseInt(version_tokenizer.nextToken());
minorVersion = Integer.parseInt(version_tokenizer.nextToken());
} catch (NumberFormatException e) {
LWJGLUtil.log("The major and/or minor OpenGL version is malformed: " + e.getMessage());
LWJGLUtil.logger().log(() -> "The major and/or minor OpenGL version is malformed: " + e.getMessage());
}
// ----------------------[ 2.X ]----------------------
@ -205,7 +202,7 @@ public final class GLContext {
try {
doInitNativeStubs(extension_class);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to initialize extension " + extension_class + " - exception: " + e);
LWJGLUtil.logger().log(() -> "Failed to initialize extension " + extension_class + " - exception: " + e);
supported_extensions.remove(ext_name);
}
}
@ -213,19 +210,12 @@ public final class GLContext {
static void doInitNativeStubs(final Class<?> extension_class) throws LWJGLException {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs");
init_stubs_method.invoke(null);
return null;
}
});
} catch (PrivilegedActionException e) {
final Throwable c = e.getCause();
if ( c instanceof InvocationTargetException )
throw new LWJGLException(c.getCause());
else
throw new LWJGLException(c);
Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs");
init_stubs_method.invoke(null);
} catch (InvocationTargetException e) {
throw new LWJGLException(e.getCause());
} catch (Exception e) {
throw new LWJGLException(e);
}
}

View File

@ -56,7 +56,7 @@ public class NativeTest {
public static void main(String[] args) {
// try to "load" awt - work around for headless issue on linux
Toolkit.getDefaultToolkit();
new NativeTest().invokeSys();
System.out.println("OK");
new NativeTest().invokeSys();
System.out.println("OK");
}
}

View File

@ -137,7 +137,7 @@ public class WindowCreationTest {
// no need to run at full speed
try {
Thread.sleep(100);
Thread.sleep(10);
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -1,72 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.applet;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Canvas;
public class AppletLoaderTest extends Applet {
Test test;
public void destroy() {
super.destroy();
System.out.println("*** destroy ***");
}
public void start() {
super.start();
System.out.println("*** start ***");
}
public void stop() {
super.stop();
System.out.println("*** stop ***");
test.stop();
}
public void init() {
System.out.println("*** init ***");
setLayout(new BorderLayout());
try {
test = (Test) Class.forName(getParameter("test")).newInstance();
Canvas canvas = (Canvas) test;
canvas.setSize(getWidth(), getHeight());
add(canvas);
} catch (Exception e) {
e.printStackTrace();
}
test.start();
}
}

View File

@ -1,52 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.applet;
import java.awt.Canvas;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Controllers;
public class ControllersTest extends Canvas implements Test {
public void start() {
try {
Controllers.create();
} catch (LWJGLException e) {
e.printStackTrace();
return;
}
System.out.println("Controllers.getControllerCount() = " + Controllers.getControllerCount());
}
public void stop() {
}
}

View File

@ -1,405 +0,0 @@
package org.lwjgl.test.applet;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.nio.FloatBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GLContext;
import static org.lwjgl.opengl.ARBTransposeMatrix.*;
import static org.lwjgl.opengl.GL11.*;
public class GearsApplet extends Applet {
/** The Canvas where the LWJGL Display is added */
Canvas display_parent;
/** Thread which runs the main game loop */
Thread gameThread;
/** is the game loop running */
boolean running;
/** variables used to rotate the view */
private float view_rotx = 20.0f;
private float view_roty = 30.0f;
private float view_rotz;
private int gear1;
private int gear2;
private int gear3;
private float angle;
boolean keyDown;
private int prevMouseX, prevMouseY;
private boolean mouseButtonDown;
/**
* Once the Canvas is created its add notify method will call this method to
* start the LWJGL Display and game loop in another thread.
*/
public void startLWJGL() {
gameThread = new Thread() {
public void run() {
running = true;
try {
Display.setParent(display_parent);
//Display.setVSyncEnabled(true);
Display.create();
initGL();
} catch (LWJGLException e) {
e.printStackTrace();
}
gameLoop();
}
};
gameThread.start();
}
/**
* Tell game loop to stop running, after which the LWJGL Display will be destoryed.
* The main thread will wait for the Display.destroy() to complete
*/
private void stopLWJGL() {
running = false;
try {
gameThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void start() {
}
public void stop() {
}
/**
* Applet Destroy method will remove the canvas, before canvas is destroyed it will notify
* stopLWJGL() to stop main game loop and to destroy the Display
*/
public void destroy() {
remove(display_parent);
super.destroy();
System.out.println("Clear up");
}
/**
* initialise applet by adding a canvas to it, this canvas will start the LWJGL Display and game loop
* in another thread. It will also stop the game loop and destroy the display on canvas removal when
* applet is destroyed.
*/
public void init() {
setLayout(new BorderLayout());
try {
display_parent = new Canvas() {
public void addNotify() {
super.addNotify();
startLWJGL();
}
public void removeNotify() {
stopLWJGL();
super.removeNotify();
}
};
display_parent.setSize(getWidth(),getHeight());
add(display_parent);
display_parent.setFocusable(true);
display_parent.requestFocus();
display_parent.setIgnoreRepaint(true);
//setResizable(true);
setVisible(true);
} catch (Exception e) {
System.err.println(e);
throw new RuntimeException("Unable to create display");
}
}
public void gameLoop() {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
while(running) {
angle += 2.0f;
// draw the gears
drawLoop();
Display.update();
if (startTime > System.currentTimeMillis()) {
fps++;
} else {
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println(fps + " frames 2 in " + timeUsed / 1000f + " seconds = "
+ (fps / (timeUsed / 1000f)));
fps = 0;
}
if (Mouse.isButtonDown(0)) {
if (!mouseButtonDown) {
prevMouseX = Mouse.getX();
prevMouseY= Mouse.getY();
}
mouseButtonDown = true;
}
else {
mouseButtonDown = false;
}
if (mouseButtonDown) {
int x = Mouse.getX();
int y = Mouse.getY();
float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)display_parent.getWidth());
float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)display_parent.getHeight());
prevMouseX = x;
prevMouseY = y;
view_rotx += thetaX;
view_roty += thetaY;
}
// F Key Pressed (i.e. released)
if (keyDown && !Keyboard.isKeyDown(Keyboard.KEY_F)) {
keyDown = false;
try {
if (Display.isFullscreen()) {
Display.setFullscreen(false);
}
else {
Display.setFullscreen(true);
}
} catch (LWJGLException e) {
e.printStackTrace();
}
}
}
Display.destroy();
}
public void drawLoop() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
glPushMatrix();
glTranslatef(-3.0f, -2.0f, 0.0f);
glRotatef(angle, 0.0f, 0.0f, 1.0f);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1f, -2.0f, 0.0f);
glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1f, 4.2f, 0.0f);
glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
}
protected void initGL() {
try {
// setup ogl
FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f});
FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
pos.flip();
red.flip();
green.flip();
blue.flip();
glLight(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0f, 4.0f, 1.0f, 20, 0.7f);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5f, 2.0f, 2.0f, 10, 0.7f);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3f, 2.0f, 0.5f, 10, 0.7f);
glEndList();
glEnable(GL_NORMALIZE);
glMatrixMode(GL_PROJECTION);
System.err.println("LWJGL: " + Sys.getVersion() + " / " + LWJGLUtil.getPlatformName());
System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR));
System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER));
System.err.println("GL_VERSION: " + glGetString(GL_VERSION));
System.err.println();
System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix);
if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) {
// --- not using extensions
glLoadIdentity();
} else {
// --- using extensions
final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put(
new float[] { 1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1});
identityTranspose.flip();
glLoadTransposeMatrixARB(identityTranspose);
}
float h = (float) display_parent.getHeight() / (float) display_parent.getWidth();
glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -40.0f);
} catch (Exception e) {
System.err.println(e);
running = false;
}
}
/**
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* @param inner_radius radius of hole at center
* @param outer_radius radius at center of teeth
* @param width width of gear
* @param teeth number of teeth
* @param tooth_depth depth of tooth
*/
private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) {
int i;
float r0, r1, r2;
float angle, da;
float u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0f;
r2 = outer_radius + tooth_depth / 2.0f;
da = 2.0f * (float) Math.PI / teeth / 4.0f;
glShadeModel(GL_FLAT);
glNormal3f(0.0f, 0.0f, 1.0f);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
if (i < teeth) {
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
width * 0.5f);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
}
glEnd();
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle);
v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle);
len = (float) Math.sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da);
v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da);
glNormal3f(v, -u, 0.0f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
}
glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
}
glEnd();
}
}

View File

@ -1,183 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.applet;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.openal.AL;
import org.lwjgl.openal.AL10;
import org.lwjgl.opengl.AWTGLCanvas;
import org.lwjgl.opengl.Display;
import org.lwjgl.util.WaveData;
import static org.lwjgl.opengl.GL11.*;
public class OpenAL extends AWTGLCanvas implements Test {
float angle;
// create 1 buffer and 1 source
IntBuffer buffers = BufferUtils.createIntBuffer(1);
IntBuffer sources = BufferUtils.createIntBuffer(1);
public OpenAL() throws LWJGLException {
try {
AL.create();
} catch (Exception e) {
System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e);
return;
}
Thread t = new Thread() {
public void run() {
while (true) {
if (isVisible())
repaint();
Display.sync(60);
}
}
};
t.setDaemon(true);
t.start();
}
private void playOpenAL() {
int lastError;
// al generate buffers and sources
buffers.position(0).limit(1);
AL10.alGenBuffers(buffers);
if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
exit(lastError);
}
sources.position(0).limit(1);
AL10.alGenSources(sources);
if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
exit(lastError);
}
// load wave data from buffer
WaveData wavefile = WaveData.create(getClass().getClassLoader().getResourceAsStream("Footsteps.wav"));
//copy to buffers
AL10.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.samplerate);
//unload file again
wavefile.dispose();
if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
exit(lastError);
}
//set up source input
AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0));
if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
exit(lastError);
}
//lets loop the sound
AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_TRUE);
if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
exit(lastError);
}
//play source 0
AL10.alSourcePlay(sources.get(0));
if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
exit(lastError);
}
}
private void exit(int error) {
System.out.println("OpenAL Error: " + AL10.alGetString(error));
}
public void paintGL() {
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION_MATRIX);
glLoadIdentity();
glOrtho(0, 640, 0, 480, 1, -1);
glMatrixMode(GL_MODELVIEW_MATRIX);
glPushMatrix();
glTranslatef(320, 240, 0.0f);
glRotatef(angle, 0, 0, 1.0f);
glBegin(GL_QUADS);
glVertex2i(-50, -50);
glVertex2i(50, -50);
glVertex2i(50, 50);
glVertex2i(-50, 50);
glEnd();
glPopMatrix();
angle += 1;
try {
swapBuffers();
} catch (Exception e) {/*OK*/
}
}
public void start() {
playOpenAL();
}
public void stop() {
int lastError;
//stop source 0
AL10.alSourceStop(sources.get(0));
if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
exit(lastError);
}
//delete buffers and sources
sources.position(0).limit(1);
AL10.alDeleteSources(sources);
if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
exit(lastError);
}
buffers.position(0).limit(1);
AL10.alDeleteBuffers(buffers);
if((lastError = AL10.alGetError()) != AL10.AL_NO_ERROR) {
exit(lastError);
}
AL.destroy();
}
}

View File

@ -1,129 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.applet;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.AWTGLCanvas;
import static org.lwjgl.opengl.GL11.*;
public class OpenGL extends AWTGLCanvas implements Test {
float angle;
float x;
float y;
public OpenGL() throws LWJGLException {
}
public void initGL() {
glMatrixMode(GL_PROJECTION_MATRIX);
glLoadIdentity();
glOrtho(0, 640, 0, 480, 1, -1);
x = 320;
y = 240;
glMatrixMode(GL_MODELVIEW_MATRIX);
setVSyncEnabled(true);
}
public void paintGL() {
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glTranslatef(x, y, 0.0f);
glRotatef(angle, 0, 0, 1.0f);
glBegin(GL_QUADS);
glVertex2i(-50, -50);
glVertex2i(50, -50);
glVertex2i(50, 50);
glVertex2i(-50, 50);
glEnd();
glPopMatrix();
angle += 1;
if (Mouse.isCreated()) {
Mouse.poll();
while (Mouse.next()) {
x += Mouse.getEventDX();
y += Mouse.getEventDY();
}
}
if (Keyboard.isCreated()) {
Keyboard.poll();
}
while (Keyboard.isCreated() && Keyboard.next()) {
if (Keyboard.getEventKey() != Keyboard.KEY_NONE) {
String key_name = Keyboard.getKeyName(Keyboard.getEventKey());
if (Keyboard.getEventKeyState()) {
switch (Keyboard.getEventKey()) {
case Keyboard.KEY_G:
Mouse.setGrabbed(!Mouse.isGrabbed());
break;
default:
break;
}
System.out.println("Pressed: " + key_name);
} else
System.out.println("Released: " + key_name);
}
if (Keyboard.getEventCharacter() != Keyboard.CHAR_NONE)
System.out.println("Typed: " + Keyboard.getEventCharacter());
}
if (Keyboard.isCreated()) {
if (Keyboard.isKeyDown(Keyboard.KEY_UP))
y += 5;
else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN))
y -= 5;
if (Keyboard.isKeyDown(Keyboard.KEY_LEFT))
x -= 5;
else if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT))
x += 5;
}
try {
swapBuffers();
if (isVisible()) {
Thread.yield(); // Helps input responsiveness on linux
repaint();
}
} catch (Exception e) {/*OK*/
}
}
public void start() {
}
public void stop() {
}
}

View File

@ -1,92 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.applet;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.AWTGLCanvas;
import static org.lwjgl.opengl.GL11.*;
public class Speed extends AWTGLCanvas implements Test {
private float angle;
private long startTime = System.currentTimeMillis() + 5000;
private long fps;
public Speed() throws LWJGLException {
}
public void paintGL() {
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION_MATRIX);
glLoadIdentity();
glOrtho(0, 640, 0, 480, 1, -1);
glMatrixMode(GL_MODELVIEW_MATRIX);
glPushMatrix();
glTranslatef(320, 240, 0.0f);
glRotatef(angle, 0, 0, 1.0f);
glBegin(GL_QUADS);
glVertex2i(-50, -50);
glVertex2i(50, -50);
glVertex2i(50, 50);
glVertex2i(-50, 50);
glEnd();
glPopMatrix();
angle += 1;
try {
swapBuffers();
if (isVisible()) {
Thread.yield(); // Helps input responsiveness on linux
repaint();
}
} catch (Exception e) {/*OK*/
}
if (startTime > System.currentTimeMillis()) {
fps++;
} else {
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println(fps + " frames in " + timeUsed / 1000f + " seconds = "
+ (fps / (timeUsed / 1000f)));
fps = 0;
}
}
public void start() {
}
public void stop() {
}
}

View File

@ -1,38 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.applet;
public interface Test {
void start();
void stop();
}

View File

@ -35,6 +35,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Cursor;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@ -389,7 +390,11 @@ public class HWCursorTest {
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
//sync frame (only works on windows)
Display.setVSyncEnabled(true);
try {
Display.setVSyncEnabled(true);
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
}
/**

View File

@ -267,8 +267,13 @@ public class FullScreenWindowedTest {
glViewport(0, 0, mode.getWidth(), mode.getHeight());
//set clear color to black
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
//sync frame (only works on windows)
Display.setVSyncEnabled(true);
try {
//sync frame (only works on windows)
Display.setVSyncEnabled(true);
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
}
/**
* Test entry point

View File

@ -367,8 +367,12 @@ public class PbufferTest {
* Initializes OGL
*/
private void glInit() {
//sync frame (only works on windows)
Display.setVSyncEnabled(true);
try {
//sync frame (only works on windows)
Display.setVSyncEnabled(true);
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_TEXTURE_2D);

View File

@ -1,74 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.opengl.awt;
import java.awt.Frame;
import java.awt.Color;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import org.lwjgl.LWJGLException;
/**
* <p>
* AWT version of the gears demo
* <p>
* @version $Revision$
* @author Brian Matzon <brian@matzon.dk>
* $Id$
*/
public class AWTGears extends Frame {
/**
* C'tor
*/
public AWTGears() throws LWJGLException {
setTitle("Gears");
setBackground(Color.BLACK);
AWTGearsCanvas canvas = new AWTGearsCanvas();
canvas.setSize(300, 300);
add(canvas);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0);
}
});
setResizable(true);
pack();
setVisible(true);
}
public static void main(String[] args) throws LWJGLException {
new AWTGears();
}
}

View File

@ -1,326 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.opengl.awt;
import java.nio.FloatBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.AWTGLCanvas;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.test.applet.Test;
import static org.lwjgl.opengl.ARBTransposeMatrix.*;
import static org.lwjgl.opengl.GL11.*;
/**
* <p>
* AWT version of the gears demo
* <p>
* @version $Revision$
* @author Brian Matzon <brian@matzon.dk>
* $Id$
*/
public class AWTGearsCanvas extends AWTGLCanvas implements Test {
private float view_rotx = 20.0f;
private float view_roty = 30.0f;
private float view_rotz;
private int gear1;
private int gear2;
private int gear3;
private float angle;
long startTime;
long fps;
int current_width;
int current_height;
/**
* C'tor
*/
public AWTGearsCanvas() throws LWJGLException {
super();
}
public void paintGL() {
if(startTime == 0) {
setup();
startTime = System.currentTimeMillis() + 5000;
}
try {
angle += 2.0f;
if (getWidth() != current_width || getHeight() != current_height) {
current_width = getWidth();
current_height = getHeight();
glViewport(0, 0, current_width, current_height);
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
glPushMatrix();
glTranslatef(-3.0f, -2.0f, 0.0f);
glRotatef(angle, 0.0f, 0.0f, 1.0f);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1f, -2.0f, 0.0f);
glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1f, 4.2f, 0.0f);
glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
swapBuffers();
repaint();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
if (startTime > System.currentTimeMillis()) {
fps++;
} else {
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println(fps + " frames in " + timeUsed / 1000f + " seconds = "
+ (fps / (timeUsed / 1000f)));
fps = 0;
}
}
private void setup() {
// setup ogl
FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f});
FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
pos.flip();
red.flip();
green.flip();
blue.flip();
glLight(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0f, 4.0f, 1.0f, 20, 0.7f);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5f, 2.0f, 2.0f, 10, 0.7f);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3f, 2.0f, 0.5f, 10, 0.7f);
glEndList();
glEnable(GL_NORMALIZE);
glMatrixMode(GL_PROJECTION);
System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR));
System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER));
System.err.println("GL_VERSION: " + glGetString(GL_VERSION));
System.err.println();
System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix);
if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) {
// --- not using extensions
glLoadIdentity();
} else {
// --- using extensions
final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put(
new float[] { 1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1});
identityTranspose.flip();
glLoadTransposeMatrixARB(identityTranspose);
}
float h = (float) 300 / (float) 300;
glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -40.0f);
}
/**
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* @param inner_radius radius of hole at center
* @param outer_radius radius at center of teeth
* @param width width of gear
* @param teeth number of teeth
* @param tooth_depth depth of tooth
*/
private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) {
int i;
float r0, r1, r2;
float angle, da;
float u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0f;
r2 = outer_radius + tooth_depth / 2.0f;
da = 2.0f * (float) Math.PI / teeth / 4.0f;
glShadeModel(GL_FLAT);
glNormal3f(0.0f, 0.0f, 1.0f);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
if (i < teeth) {
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
width * 0.5f);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
}
glEnd();
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle);
v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle);
len = (float) Math.sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da);
v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da);
glNormal3f(v, -u, 0.0f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
}
glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
}
glEnd();
}
/*
* @see org.lwjgl.test.applet.Test#start()
*/
public void start() {
}
/*
* @see org.lwjgl.test.applet.Test#stop()
*/
public void stop() {
}
}

View File

@ -1,140 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.opengl.awt;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.AWTGLCanvas;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.util.glu.GLU.*;
/**
* <p>
* Tests AWTGLCanvas functionality
* <p>
* @version $Revision$
* @author $Author$
* $Id$
*/
public class AWTTest extends Frame {
/** AWT GL canvas */
private AWTGLCanvas canvas0, canvas1;
private volatile float angle;
/**
* C'tor
*/
public AWTTest() throws LWJGLException {
setTitle("LWJGL AWT Canvas Test");
setSize(640, 320);
setLayout(new GridLayout(1, 2));
add(canvas0 = new AWTGLCanvas() {
int current_height;
int current_width;
public void paintGL() {
try {
if (getWidth() != current_width || getHeight() != current_height) {
current_width = getWidth();
current_height = getHeight();
glViewport(0, 0, current_width, current_height);
}
glViewport(0, 0, getWidth(), getHeight());
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight());
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glColor3f(1f, 1f, 0f);
glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f);
glRotatef(angle, 0f, 0f, 1.0f);
glRectf(-50.0f, -50.0f, 50.0f, 50.0f);
glPopMatrix();
swapBuffers();
repaint();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
}
});
add(canvas1 = new AWTGLCanvas() {
int current_height;
int current_width;
public void paintGL() {
try {
angle += 1.0f;
if (getWidth() != current_width || getHeight() != current_height) {
current_width = getWidth();
current_height = getHeight();
glViewport(0, 0, current_width, current_height);
}
glViewport(0, 0, getWidth(), getHeight());
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight());
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f);
glRotatef(2*angle, 0f, 0f, -1.0f);
glRectf(-50.0f, -50.0f, 50.0f, 50.0f);
glPopMatrix();
swapBuffers();
repaint();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
}
});
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0);
}
});
setResizable(true);
setVisible(true);
}
public static void main(String[] args) throws LWJGLException {
new AWTTest();
}
}

View File

@ -1,639 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.opengl.awt;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Label;
import java.awt.List;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.nio.FloatBuffer;
import java.util.Enumeration;
import java.util.Hashtable;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.AWTGLCanvas;
import org.lwjgl.opengl.GLContext;
import static org.lwjgl.opengl.ARBTransposeMatrix.*;
import static org.lwjgl.opengl.GL11.*;
/**
* <p>
* </p>
* @version $Revision$
* @author Brian Matzon <brian@matzon.dk>
* $Id$
*/
public class DemoBox extends Frame {
/** GL canvas */
private DemoBoxGLCanvas demoCanvas;
/** Demo selection panel */
private Panel selectionPanel;
/** Hashtable of demos */
private Hashtable<String, Demo> selectableDemos;
/**
* Creates a new demo box instance
*/
public DemoBox() {
selectableDemos = new Hashtable<String, Demo>();
selectableDemos.put("default", new NullDemoBox());
selectableDemos.put("clear_color", new ClearColorDemoBox());
selectableDemos.put("gears", new GearsDemoBox());
}
/**
* @return
*/
public boolean initialize() {
setTitle("LWJGL - Demo Box");
setSize(640, 480);
setLayout(new GridBagLayout());
// Setup selection panel
// =================================
selectionPanel = new Panel();
selectionPanel.setLayout(new BorderLayout());
selectionPanel.add(new Label("Demo", Label.CENTER), BorderLayout.NORTH);
Button fullScreen = new Button("Fullscreen");
fullScreen.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
toggleFullscreen();
}
});
selectionPanel.add(fullScreen, BorderLayout.SOUTH);
final List demos = new List();
for (Enumeration e = selectableDemos.keys(); e.hasMoreElements();) {
demos.add(e.nextElement().toString());
}
selectionPanel.add(demos, BorderLayout.CENTER);
demos.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent event) {
demoSelected(event.getItemSelectable().getSelectedObjects()[0].toString());
}
});
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = java.awt.GridBagConstraints.BOTH;
gbc.weightx = 0.05;
gbc.weighty = 1.0;
add(selectionPanel, gbc);
// ---------------------------------
// setup demo canvas
// =================================
try {
demoCanvas = new DemoBoxGLCanvas(this);
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = java.awt.GridBagConstraints.BOTH;
gbc.weightx = 0.95;
gbc.weighty = 1.0;
add(demoCanvas, gbc);
} catch (LWJGLException le) {
le.printStackTrace();
return false;
}
// ---------------------------------
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
demoCanvas.destroyCanvas();
dispose();
System.exit(0);
}
});
//demos.select(0);
//demoSelected(demos.getSelectedItem());
return true;
}
public void updateFPS(float fps) {
if(fps != -1) {
setTitle("LWJGL - Demo Box (FPS: " + fps + ")");
} else {
setTitle("LWJGL - Demo Box");
}
}
/**
* Enter fullscreen mode for this demo
*/
protected void toggleFullscreen() {
System.out.println("Toggle Fullscreen");
}
/**
* Selected a demo
* @param demo Name of demo that was selected
*/
protected void demoSelected(String demo) {
System.out.println("Selecting demo: " + demo);
demoCanvas.setActiveDemo(selectableDemos.get(demo));
}
/**
* @param args
* @throws LWJGLException
*/
public static void main(String[] args) throws LWJGLException {
DemoBox demo = new DemoBox();
demo.initialize();
demo.setVisible(true);
}
/**
* Interface for a demo
*/
public interface Demo {
boolean isInitialized();
boolean initialize();
void render();
void destroy();
}
/**
*
*/
private class DemoBoxGLCanvas extends AWTGLCanvas implements Runnable {
/** Parent demo box */
DemoBox parent;
/** Currently active demo */
Demo activeDemo;
/** last active demo */
Demo lastActiveDemo;
/** Render thread */
private Thread renderThread;
private DemoBoxGLCanvas(DemoBox parent) throws LWJGLException {
super();
this.parent = parent;
}
// FPS
long startTime;
long fps;
protected void paintGL() {
synchronized (this) {
if (lastActiveDemo != null && lastActiveDemo != activeDemo) {
lastActiveDemo.destroy();
lastActiveDemo = null;
if (activeDemo != null) {
activeDemo.initialize();
startTime = System.currentTimeMillis() + 5000;
} else {
parent.updateFPS(-1);
}
}
if (activeDemo != null) {
if(!activeDemo.isInitialized()) {
activeDemo.initialize();
}
activeDemo.render();
try {
swapBuffers();
} catch (LWJGLException le) {
le.printStackTrace();
}
if (startTime > System.currentTimeMillis()) {
fps++;
} else {
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
parent.updateFPS((fps / (timeUsed / 1000f)));
fps = 0;
}
}
}
}
public void destroyCanvas() {
setActiveDemo(null);
renderThread = null;
}
public void setActiveDemo(Demo activeDemo) {
synchronized (this) {
// setting no current demo
if (activeDemo == null) {
lastActiveDemo = this.activeDemo;
this.activeDemo = null;
return;
}
// setting to new demo
lastActiveDemo = this.activeDemo;
this.activeDemo = activeDemo;
}
if (renderThread == null) {
renderThread = new Thread(this);
renderThread.setName("DemoBox-Renderer");
renderThread.start();
}
}
private DemoBoxGLCanvas() throws LWJGLException {
super();
}
public void run() {
long sleep_time = 1000;
while (renderThread != null) {
// check for change of demo
synchronized (this) {
// if no demo set, just sleep
if (activeDemo == null) {
sleep_time = 1000;
} else {
// we have a demo!
sleep_time = 16;
repaint();
}
}
sleep(sleep_time);
}
System.out.println("dead");
}
private void sleep(long time) {
try {
Thread.sleep(time);
} catch (InterruptedException inte) {
}
}
}
// Demo box demo
// ========================================================
public class ClearColorDemoBox implements Demo {
private boolean initialized;
int direction = 1;
float color;
public boolean isInitialized() {
return initialized;
}
public boolean initialize() {
return initialized = true;
}
public void render() {
glClearColor(color, color, color, 1f);
glClear(GL_COLOR_BUFFER_BIT);
color += direction * .05f;
if (color > 1f) {
color = 1f;
direction = -1 * direction;
} else if (color < 0f) {
direction = -1 * direction;
color = 0f;
}
}
public void destroy() {
initialized = false;
}
}
// --------------------------------------------------------
// Demo box demo
// ========================================================
public class NullDemoBox implements Demo {
private boolean initialized;
public boolean isInitialized() {
return initialized;
}
public boolean initialize() {
glClearColor(0, 0, 0, 1f);
return true;
}
public void render() {
glClear(GL_COLOR_BUFFER_BIT);
}
public void destroy() {
initialized = false;
}
}
// --------------------------------------------------------
// Demo box demo
// ========================================================
public class GearsDemoBox implements Demo {
private boolean initialized;
private float view_rotx = 20.0f;
private float view_roty = 30.0f;
private float view_rotz;
private int gear1;
private int gear2;
private int gear3;
private float angle;
public boolean isInitialized() {
return initialized;
}
public boolean initialize() {
// setup ogl
FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f});
FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
pos.flip();
red.flip();
green.flip();
blue.flip();
glClearColor(0, 0, 0, 1f);
glLight(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0f, 4.0f, 1.0f, 20, 0.7f);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5f, 2.0f, 2.0f, 10, 0.7f);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3f, 2.0f, 0.5f, 10, 0.7f);
glEndList();
glEnable(GL_NORMALIZE);
glMatrixMode(GL_PROJECTION);
System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR));
System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER));
System.err.println("GL_VERSION: " + glGetString(GL_VERSION));
System.err.println();
System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix);
if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) {
// --- not using extensions
glLoadIdentity();
} else {
// --- using extensions
final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put(
new float[] { 1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1});
identityTranspose.flip();
glLoadTransposeMatrixARB(identityTranspose);
}
float h = (float) 300 / (float) 300;
glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -40.0f);
return initialized = true;
}
public void render() {
angle += 2.0f;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
glPushMatrix();
glTranslatef(-3.0f, -2.0f, 0.0f);
glRotatef(angle, 0.0f, 0.0f, 1.0f);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1f, -2.0f, 0.0f);
glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1f, 4.2f, 0.0f);
glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
}
/**
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* @param inner_radius radius of hole at center
* @param outer_radius radius at center of teeth
* @param width width of gear
* @param teeth number of teeth
* @param tooth_depth depth of tooth
*/
private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) {
int i;
float r0, r1, r2;
float angle, da;
float u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0f;
r2 = outer_radius + tooth_depth / 2.0f;
da = 2.0f * (float) Math.PI / teeth / 4.0f;
glShadeModel(GL_FLAT);
glNormal3f(0.0f, 0.0f, 1.0f);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
if (i < teeth) {
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
width * 0.5f);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
}
glEnd();
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle);
v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle);
len = (float) Math.sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da);
v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da);
glNormal3f(v, -u, 0.0f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
}
glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
}
glEnd();
}
public void destroy() {
glDeleteLists(gear1, 1);
glDeleteLists(gear2, 1);
glDeleteLists(gear3, 1);
initialized = false;
}
}
// --------------------------------------------------------
}

View File

@ -1,133 +0,0 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.test.opengl.awt;
import java.awt.Canvas;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.util.glu.GLU.*;
/**
* <p>
* Tests Display.setParent()
* <p>
* @version $Revision$
* @author $Author$
* $Id$
*/
public class DisplayParentTest extends Frame {
boolean killswitch;
public DisplayParentTest() throws LWJGLException {
setTitle("LWJGL Display Parent Test");
setSize(640, 320);
setLayout(new GridLayout(1, 2));
final Canvas display_parent = new Canvas();
display_parent.setFocusable(true);
display_parent.setIgnoreRepaint(true);
add(display_parent);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
killswitch = true;
}
});
setResizable(true);
setVisible(true);
Display.setParent(display_parent);
Display.setVSyncEnabled(true);
Display.create();
float angle = 0f;
while (isVisible() && !killswitch) {
angle += 1.0f;
int width;
int height;
if (!Display.isFullscreen()) {
width = display_parent.getWidth();
height = display_parent.getHeight();
} else {
width = Display.getDisplayMode().getWidth();
height = Display.getDisplayMode().getHeight();
}
if(width < 1 || height < 1) {
continue;
}
glViewport(0, 0, width, height);
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0f, (float) width, 0.0f, (float) height);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef(width / 2.0f, height / 2.0f, 0.0f);
glRotatef(2*angle, 0f, 0f, -1.0f);
glRectf(-50.0f, -50.0f, 50.0f, 50.0f);
glPopMatrix();
Display.update();
while(Keyboard.next()) {
// closing on ESCAPE
if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState()) {
Display.destroy();
dispose();
break;
}
if(Keyboard.getEventKey() == Keyboard.KEY_SPACE && Keyboard.getEventKeyState()) {
Mouse.setGrabbed(!Mouse.isGrabbed());
}
if(Keyboard.getEventKey() == Keyboard.KEY_F && Keyboard.getEventKeyState()) {
Display.setFullscreen(!Display.isFullscreen());
}
}
/* while (Mouse.next()) {
System.out.println(" Mouse.getEventX() = " + Mouse.getEventX() + " | Mouse.getEventY() = " + Mouse.getEventY());
}*/
}
Display.destroy();
dispose();
}
public static void main(String[] args) throws LWJGLException {
new DisplayParentTest();
}
}

View File

@ -81,10 +81,10 @@ public final class BackgroundLoadTest {
Util.checkGLError();
while ( run ) {
if ( !Display.isVisible() )
while (run) {
if (!Display.isVisible()) {
Thread.yield();
else {
} else {
handleIO();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -100,8 +100,9 @@ public final class BackgroundLoadTest {
Display.update();
if ( Display.isCloseRequested() )
if (Display.isCloseRequested()) {
break;
}
}
cleanup();
@ -115,7 +116,8 @@ public final class BackgroundLoadTest {
DisplayMode displayMode = null;
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
displayMode = Display.getDisplayMode();
/*DisplayMode[] modes = Display.getAvailableDisplayModes();
displayMode = chooseMode(modes, 1024, 768);
if ( displayMode == null )
@ -126,7 +128,7 @@ public final class BackgroundLoadTest {
kill("Failed to set an appropriate display mode.");
System.out.println("Setting display mode to: " + displayMode);
Display.setDisplayMode(displayMode);
Display.setDisplayMode(displayMode);*/
Display.setTitle("Background Loading Test");
Display.create(new PixelFormat(8, 24, 0));
} catch (LWJGLException e) {
@ -189,18 +191,10 @@ public final class BackgroundLoadTest {
sphere = new Sphere();
if ( "PB".equalsIgnoreCase(args[0]) ) {
backgroundLoader = new BackgroundLoader() {
Drawable getDrawable() throws LWJGLException {
return new Pbuffer(2, 2, new PixelFormat(8, 24, 0), Display.getDrawable());
}
};
} else if ( "SD".equalsIgnoreCase(args[0]) ) {
backgroundLoader = new BackgroundLoader() {
Drawable getDrawable() throws LWJGLException {
return new SharedDrawable(Display.getDrawable());
}
};
if ("PB".equalsIgnoreCase(args[0])) {
backgroundLoader = new BackgroundLoader(() -> new Pbuffer(2, 2, new PixelFormat(8, 24, 0), Display.getDrawable()));
} else if ("SD".equalsIgnoreCase(args[0])) {
backgroundLoader = new BackgroundLoader(() -> new SharedDrawable(Display.getDrawable()));
} else {
argsError();
}
@ -227,7 +221,7 @@ public final class BackgroundLoadTest {
glColor3f(1.0f, 1.0f, 1.0f);
int texID = backgroundLoader.getTexID();
if ( texID == 0 ) {
if (texID == 0) {
sphere.setTextureFlag(false);
glDisable(GL_TEXTURE_2D);
} else {
@ -238,7 +232,8 @@ public final class BackgroundLoadTest {
sphere.draw(1.0f, 32, 32);
if ( texID != 0 ) { // Unbind so we can update from the background thread.
if (texID != 0) {
// Unbind so we can update from the background thread.
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
}
@ -247,9 +242,9 @@ public final class BackgroundLoadTest {
private static DisplayMode chooseMode(DisplayMode[] modes, int width, int height) {
DisplayMode bestMode = null;
for ( DisplayMode mode : modes ) {
if ( mode.getWidth() == width && mode.getHeight() == height && mode.getFrequency() <= 85 ) {
if ( bestMode == null || (mode.getBitsPerPixel() >= bestMode.getBitsPerPixel() && mode.getFrequency() > bestMode.getFrequency()) )
for (DisplayMode mode : modes) {
if (mode.getWidth() == width && mode.getHeight() == height && mode.getFrequency() <= 85) {
if (bestMode == null || (mode.getBitsPerPixel() >= bestMode.getBitsPerPixel() && mode.getFrequency() > bestMode.getFrequency()) )
bestMode = mode;
}
}
@ -258,7 +253,9 @@ public final class BackgroundLoadTest {
}
private static void cleanup() {
backgroundLoader.cleanup();
if (backgroundLoader != null) {
backgroundLoader.cleanup();
}
Thread.yield(); // Let background thread finish.
@ -294,4 +291,4 @@ public final class BackgroundLoadTest {
System.exit(-1);
}
}
}

View File

@ -46,55 +46,57 @@ import org.lwjgl.util.Color;
import org.lwjgl.util.ReadableColor;
import java.nio.ByteBuffer;
import java.util.concurrent.locks.ReentrantLock;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL32.*;
abstract class BackgroundLoader {
final class BackgroundLoader {
private static final int WIDTH = 32;
private static final int HEIGHT = 32;
private static final int WIDTH = 64;
private static final int HEIGHT = 64;
// CPU synchronization
private final ReentrantLock lock = new ReentrantLock();
// GPU synchronization
private GLSync fence;
private Drawable drawable;
private final DrawableSupplier drawableSupplier;
private Drawable drawable;
private int texID;
private boolean running;
private ByteBuffer texture;
private int texID;
protected BackgroundLoader() {
running = true;
texture = BufferUtils.createByteBuffer(WIDTH * HEIGHT * 3);
protected BackgroundLoader(DrawableSupplier drawableSupplier) {
this.drawableSupplier = drawableSupplier;
this.running = true;
}
abstract Drawable getDrawable() throws LWJGLException;
void cleanup() {
running = false;
}
private void uploadTexture(int texID, ByteBuffer texture, boolean useFences) {
glBindTexture(GL_TEXTURE_2D, texID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0);
if (useFences) {
//while (fence != null) {}
fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
} else {
// Best we can do without fences. This will force rendering on the main thread to happen after we upload the texture.
glFlush();
}
}
void start() throws LWJGLException {
// The shared context must be created on the main thread.
drawable = getDrawable();
this.drawable = this.drawableSupplier.get();
new Thread(new Runnable() {
public void run() {
new Thread(() -> {
System.out.println("-- Background Thread started --");
System.out.println("** Sleeping, no texture created yet **");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
// Make the shared context current in the worker thread
drawable.makeCurrent();
@ -104,69 +106,57 @@ abstract class BackgroundLoader {
System.out.println("** Drawable created **");
// Create a "dummy" texture while we wait for texture IO
createCheckerTexture(Color.RED, Color.WHITE, 2);
lock.lock();
texID = glGenTextures();
glBindTexture(GL_TEXTURE_2D, texID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0);
// OpenGL commands from different contexts may be executed in any order. So we need a way to synchronize
final boolean useFences = GLContext.getCapabilities().OpenGL32;
System.out.println("Using fences: " + useFences);
if ( useFences )
fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
else
glFlush(); // Best we can do without fences. This will force rendering on the main thread to happen after we upload the texture.
System.out.println("** Sleeping, no texture created yet **");
lock.unlock();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ByteBuffer texture = BufferUtils.createByteBuffer(WIDTH * HEIGHT * 3);
// Create a "dummy" texture while we wait for texture IO
createCheckerTexture(texture, Color.RED, Color.WHITE, 2);
texID = glGenTextures();
uploadTexture(texID, texture, useFences);
System.out.println("** Dummy texture created **");
long avgGenTime = 0L;
long avgUploadTime = 0L;
long lastUploadTime = 0L;
long lastTextureCreated = System.currentTimeMillis(); // Delay first texture creation
int count = 0;
while ( running ) {
long time = System.currentTimeMillis();
if ( time - lastTextureCreated < 5000 ) { // Update the texture every 5 seconds
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
/*long time = System.currentTimeMillis();
if (time - lastTextureCreated < 2) { // Update the texture every 5 seconds
continue;
}
}*/
// Create the "true" texture
if ( count % 2 == 0 )
createGradientTexture(Color.RED, Color.BLUE);
else
createGradientTexture(Color.GREEN, Color.YELLOW);
long start = System.nanoTime();
if ( count % 2 == 0 ) {
createGradientTexture(texture, Color.RED, Color.BLUE);
} else {
createGradientTexture(texture, Color.GREEN, Color.YELLOW);
}
long elapsed = System.nanoTime() - start;
avgGenTime = (avgGenTime + elapsed) >> 1;
lock.lock();
start = System.nanoTime();
uploadTexture(texID, texture, useFences);
lastUploadTime = System.nanoTime() - start;
avgUploadTime = (avgUploadTime + lastUploadTime) >> 1;
//System.out.println("Uploaded texture in " + elapsed + " ns.");
glBindTexture(GL_TEXTURE_2D, texID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
if ( useFences )
fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
else
glFlush();
lock.unlock();
System.out.println("** Created new gradient texture **");
//System.out.println("** Created new gradient texture **");
lastTextureCreated = System.currentTimeMillis();
count++;
@ -175,24 +165,26 @@ abstract class BackgroundLoader {
drawable.destroy();
System.out.println("-- Background Thread finished --");
}
System.out.println("Generated textures in " + avgGenTime + " ns on average.");
System.out.println("Uploaded textures in " + avgUploadTime + " ns on average.");
System.out.println("Most recently uploaded textures in " + lastUploadTime + " ns.");
}).start();
}
int getTexID() {
lock.lock();
public final int getTexID() {
//lock.lock();
try {
if ( fence != null ) {
if (fence != null) {
glWaitSync(fence, 0, GL_TIMEOUT_IGNORED);
fence = null;
}
return texID;
} finally {
lock.unlock();
//lock.unlock();
}
}
private void createCheckerTexture(final ReadableColor a, final ReadableColor b, final int size) {
private static void createCheckerTexture(ByteBuffer texture, final ReadableColor a, final ReadableColor b, final int size) {
int i = 0;
for ( int y = 0; y < HEIGHT; y++ ) {
for ( int x = 0; x < WIDTH; x++ ) {
@ -205,7 +197,7 @@ abstract class BackgroundLoader {
}
}
private void createGradientTexture(final ReadableColor a, final ReadableColor b) {
private static void createGradientTexture(ByteBuffer texture, final ReadableColor a, final ReadableColor b) {
float l = 0.0f;
int i = 0;
for ( int y = 0; y < HEIGHT; y++ ) {
@ -223,4 +215,4 @@ abstract class BackgroundLoader {
return (byte)Math.round(((1.0f - l) * a + l * b));
}
}
}

View File

@ -0,0 +1,9 @@
package org.lwjgl.test.opengl.multithread;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Drawable;
@FunctionalInterface
interface DrawableSupplier {
Drawable get() throws LWJGLException;
}

View File

@ -376,8 +376,12 @@ public final class PbufferTest {
* Initializes OGL
*/
private void glInit() {
// Sync frame (only works on windows)
Display.setVSyncEnabled(true);
try {
// Sync frame (only works on windows)
Display.setVSyncEnabled(true);
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
// Create shared texture
IntBuffer buffer = BufferUtils.createIntBuffer(1);

View File

@ -249,7 +249,7 @@ public final class SpriteShootout {
renderer.updateBalls(ballCount);
}
private void run() {
private void run() throws LWJGLException {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
@ -288,7 +288,7 @@ public final class SpriteShootout {
}
}
private void handleInput() {
private void handleInput() throws LWJGLException {
if ( Display.isCloseRequested() )
run = false;
@ -746,4 +746,4 @@ public final class SpriteShootout {
}
}
}

View File

@ -247,7 +247,7 @@ public final class SpriteShootout2P {
renderer.updateBalls(ballCount);
}
private void run() {
private void run() throws LWJGLException {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
@ -284,7 +284,7 @@ public final class SpriteShootout2P {
}
}
private void handleInput() {
private void handleInput() throws LWJGLException {
if ( Display.isCloseRequested() )
run = false;
@ -621,4 +621,4 @@ public final class SpriteShootout2P {
}
}
}

View File

@ -302,7 +302,7 @@ public final class SpriteShootoutCL {
renderer.updateBalls(ballCount);
}
private void run() {
private void run() throws LWJGLException {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
@ -338,7 +338,7 @@ public final class SpriteShootoutCL {
}
}
private void handleInput() {
private void handleInput() throws LWJGLException {
if ( Display.isCloseRequested() )
run = false;
@ -595,4 +595,4 @@ public final class SpriteShootoutCL {
}
}
}

View File

@ -281,7 +281,7 @@ public final class SpriteShootoutMapped {
renderer.updateBalls(ballCount);
}
private void run() {
private void run() throws LWJGLException {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
@ -320,7 +320,7 @@ public final class SpriteShootoutMapped {
}
}
private void handleInput() {
private void handleInput() throws LWJGLException {
if ( Display.isCloseRequested() )
run = false;
@ -835,4 +835,4 @@ public final class SpriteShootoutMapped {
}
}
}

View File

@ -279,7 +279,7 @@ public class FullScreenWindowedTest {
}
/** Initializes OGL */
private void glInit() {
private void glInit() throws LWJGLException {
// Go into orthographic projection mode.
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

View File

@ -34,6 +34,7 @@ package org.lwjgl.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.function.ToIntFunction;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
@ -47,9 +48,6 @@ import org.lwjgl.opengl.DisplayMode;
* $Id$
*/
public final class Display {
private static final boolean DEBUG = false;
/**
* Determine the available display modes that match the specified minimum and maximum criteria.
* If any given criterium is specified as -1 then it is ignored.
@ -70,15 +68,19 @@ public final class Display {
// First get the available display modes
DisplayMode[] modes = org.lwjgl.opengl.Display.getAvailableDisplayModes();
if (LWJGLUtil.DEBUG || DEBUG) {
System.out.println("Available screen modes:");
for ( DisplayMode mode : modes ) {
System.out.println(mode);
}
if (LWJGLUtil.DEBUG) {
LWJGLUtil.logger().log(() -> {
StringBuilder sb = new StringBuilder("Available display modes:");
for (DisplayMode mode : modes) {
sb.append('\n').append(mode);
}
return sb.toString();
});
}
ArrayList<DisplayMode> matches = new ArrayList<DisplayMode>(modes.length);
DisplayMode[] matches = new DisplayMode[modes.length];
int j = 0;
for (int i = 0; i < modes.length; i ++) {
assert modes[i] != null : ""+i+" "+modes.length;
if (minWidth != -1 && modes[i].getWidth() < minWidth)
@ -101,21 +103,52 @@ public final class Display {
if (maxFreq != -1 && modes[i].getFrequency() > maxFreq)
continue;
}
matches.add(modes[i]);
matches[j++] = modes[i];
}
DisplayMode[] ret = new DisplayMode[matches.size()];
matches.toArray(ret);
if (LWJGLUtil.DEBUG && DEBUG) {
System.out.println("Filtered screen modes:");
for ( DisplayMode mode : ret ) {
System.out.println(mode);
}
DisplayMode[] ret = Arrays.copyOf(matches, j);
if (LWJGLUtil.DEBUG) {
LWJGLUtil.logger().log(() -> {
StringBuilder sb = new StringBuilder("Filtered display modes:");
for (DisplayMode mode : ret) {
sb.append('\n').append(mode);
}
return sb.toString();
});
}
return ret;
}
private static final class FieldAccessor {
final ToIntFunction<DisplayMode> func;
final int order;
final int preferred;
final boolean usePreferred;
FieldAccessor(ToIntFunction<DisplayMode> func, int order, int preferred, boolean usePreferred) {
this.func = func;
this.order = order;
this.preferred = preferred;
this.usePreferred = usePreferred;
}
static ToIntFunction<DisplayMode> funcByName(String fieldName) {
switch (fieldName) {
case "width":
return DisplayMode::getWidth;
case "height":
return DisplayMode::getHeight;
case "freq":
return DisplayMode::getFrequency;
case "bpp":
return DisplayMode::getBitsPerPixel;
default:
throw new IllegalArgumentException("Unknown field " + fieldName);
}
}
}
/**
* Create the display by choosing from a list of display modes based on an order of preference.
* You must supply a list of allowable display modes, probably by calling getAvailableDisplayModes(),
@ -130,49 +163,20 @@ public final class Display {
* @see org.lwjgl.opengl.DisplayMode
*/
public static DisplayMode setDisplayMode(DisplayMode[] dm, final String[] param) throws Exception {
class FieldAccessor {
final String fieldName;
final int order;
final int preferred;
final boolean usePreferred;
FieldAccessor(String fieldName, int order, int preferred, boolean usePreferred) {
this.fieldName = fieldName;
this.order = order;
this.preferred = preferred;
this.usePreferred = usePreferred;
}
int getInt(DisplayMode mode) {
if ("width".equals(fieldName)) {
return mode.getWidth();
}
if ("height".equals(fieldName)) {
return mode.getHeight();
}
if ("freq".equals(fieldName)) {
return mode.getFrequency();
}
if ("bpp".equals(fieldName)) {
return mode.getBitsPerPixel();
}
throw new IllegalArgumentException("Unknown field "+fieldName);
}
}
class Sorter implements Comparator<DisplayMode> {
final FieldAccessor[] accessors;
Sorter() {
accessors = new FieldAccessor[param.length];
for (int i = 0; i < accessors.length; i ++) {
int idx = param[i].indexOf('=');
ToIntFunction<DisplayMode> func;
if (idx > 0) {
accessors[i] = new FieldAccessor(param[i].substring(0, idx), 0, Integer.parseInt(param[i].substring(idx + 1, param[i].length())), true);
accessors[i] = new FieldAccessor(FieldAccessor.funcByName(param[i].substring(0, idx)), 0, Integer.parseInt(param[i].substring(idx + 1, param[i].length())), true);
} else if (param[i].charAt(0) == '-') {
accessors[i] = new FieldAccessor(param[i].substring(1), -1, 0, false);
accessors[i] = new FieldAccessor(FieldAccessor.funcByName(param[i].substring(1)), -1, 0, false);
} else {
accessors[i] = new FieldAccessor(param[i], 1, 0, false);
accessors[i] = new FieldAccessor(FieldAccessor.funcByName(param[i]), 1, 0, false);
}
}
}
@ -181,9 +185,9 @@ public final class Display {
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
public int compare(DisplayMode dm1, DisplayMode dm2) {
for ( FieldAccessor accessor : accessors ) {
int f1 = accessor.getInt(dm1);
int f2 = accessor.getInt(dm2);
for (FieldAccessor accessor : accessors) {
int f1 = accessor.func.applyAsInt(dm1);
int f2 = accessor.func.applyAsInt(dm2);
if ( accessor.usePreferred && f1 != f2 ) {
if ( f1 == accessor.preferred )
@ -217,23 +221,24 @@ public final class Display {
Arrays.sort(dm, new Sorter());
// Try them out in the appropriate order
if (LWJGLUtil.DEBUG || DEBUG) {
System.out.println("Sorted display modes:");
for ( DisplayMode aDm : dm ) {
System.out.println(aDm);
}
if (LWJGLUtil.DEBUG) {
LWJGLUtil.logger().log(() -> {
StringBuilder sb = new StringBuilder("Sorted display modes:");
for (DisplayMode mode : dm) {
sb.append('\n').append(mode);
}
return sb.toString();
});
}
for ( DisplayMode aDm : dm ) {
for (DisplayMode aDm : dm) {
try {
if ( LWJGLUtil.DEBUG || DEBUG )
System.out.println("Attempting to set displaymode: " + aDm);
if (LWJGLUtil.DEBUG) {
LWJGLUtil.logger().log(() -> "Attempting to set display mode: " + aDm);
}
org.lwjgl.opengl.Display.setDisplayMode(aDm);
return aDm;
} catch (Exception e) {
if ( LWJGLUtil.DEBUG || DEBUG ) {
System.out.println("Failed to set display mode to " + aDm);
e.printStackTrace();
}
LWJGLUtil.logger().log(() -> "Failed to set display mode to " + aDm, e);
}
}

View File

@ -35,18 +35,24 @@ import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ShortBuffer;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.spi.AudioFileReader;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import org.lwjgl.openal.AL10;
import com.sun.media.sound.WaveFileReader;
import dev.pfaff.unfettered.Unfettered;
import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*;
/**
*
@ -57,6 +63,21 @@ import com.sun.media.sound.WaveFileReader;
* $Id$
*/
public class WaveData {
private static final MethodHandle MH_getWaveInputStream;
static {
MethodHandles.Lookup l = Unfettered.getTrustedLookup();
try {
Class<?> C_WaveFileReader = Class.forName("com.sun.media.sound.WaveFileReader");
MethodHandle MH_WaveFileReader_constructor = l.findConstructor(C_WaveFileReader, methodType(void.class));
MethodHandle MH_getAudioInputStream = l.findVirtual(AudioFileReader.class, "getAudioInputStream", methodType(AudioInputStream.class, InputStream.class));
MH_getAudioInputStream = MH_getAudioInputStream.asType(MH_getAudioInputStream.type().changeParameterType(0, C_WaveFileReader).changeParameterType(1, BufferedInputStream.class));
MH_getWaveInputStream = foldArguments(MH_getAudioInputStream, dropArguments(MH_WaveFileReader_constructor, 0, BufferedInputStream.class));
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
/** actual wave data */
public final ByteBuffer data;
@ -97,10 +118,10 @@ public class WaveData {
// due to an issue with AudioSystem.getAudioInputStream
// and mixing unsigned and signed code
// we will use the reader directly
WaveFileReader wfr = new WaveFileReader();
return create(wfr.getAudioInputStream(new BufferedInputStream(path.openStream())));
} catch (Exception e) {
org.lwjgl.LWJGLUtil.log("Unable to create from: " + path + ", " + e.getMessage());
AudioInputStream ais = (AudioInputStream) MH_getWaveInputStream.invokeExact(new BufferedInputStream(path.openStream()));
return create(ais);
} catch (Throwable e) {
org.lwjgl.LWJGLUtil.logger().log(() -> "Unable to create from: " + path + ", " + e.getMessage());
return null;
}
}
@ -126,7 +147,7 @@ public class WaveData {
return create(
AudioSystem.getAudioInputStream(is));
} catch (Exception e) {
org.lwjgl.LWJGLUtil.log("Unable to create from inputstream, " + e.getMessage());
org.lwjgl.LWJGLUtil.logger().log(() -> "Unable to create from inputstream, " + e.getMessage());
return null;
}
}
@ -143,7 +164,7 @@ public class WaveData {
AudioSystem.getAudioInputStream(
new BufferedInputStream(new ByteArrayInputStream(buffer))));
} catch (Exception e) {
org.lwjgl.LWJGLUtil.log("Unable to create from byte array, " + e.getMessage());
org.lwjgl.LWJGLUtil.logger().log(() -> "Unable to create from byte array, " + e.getMessage());
return null;
}
}
@ -168,7 +189,7 @@ public class WaveData {
}
return create(bytes);
} catch (Exception e) {
org.lwjgl.LWJGLUtil.log("Unable to create from ByteBuffer, " + e.getMessage());
org.lwjgl.LWJGLUtil.logger().log(() -> "Unable to create from ByteBuffer, " + e.getMessage());
return null;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) 2002-2008 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.
*/
package org.lwjgl.util.generator;
import java.nio.ByteBuffer;
import javax.lang.model.element.ElementKind;
import javax.lang.model.type.*;
import javax.lang.model.util.SimpleTypeVisitor6;
/**
* A TypeVisitor that translates (annotated) TypeMirrors to type descriptors.
*/
public final class DescriptorTypeTranslator extends SimpleTypeVisitor6<Void, Void> {
private String descriptor;
public void descriptor(String descriptor) {
this.descriptor = descriptor;
}
public String descriptor() {
return descriptor;
}
@Override
public Void visitArray(ArrayType t, Void o) {
final DescriptorTypeTranslator translator = new DescriptorTypeTranslator();
translator.visit(t.getComponentType());
descriptor(forArray(translator.descriptor()));
return DEFAULT_VALUE;
}
@Override
public Void visitPrimitive(PrimitiveType t, Void p) {
descriptor(forPrimitive(t.getKind()));
return DEFAULT_VALUE;
}
@Override
public Void visitDeclared(DeclaredType t, Void o) {
ElementKind kind = t.asElement().getKind();
if (kind.isClass() || kind.isInterface()) {
descriptor(forClass(t.toString()));
return DEFAULT_VALUE;
}
throw new RuntimeException(t.asElement().getKind() + " is not allowed");
}
@Override
public Void visitNoType(NoType t, Void p) {
descriptor(forClass(void.class));
return DEFAULT_VALUE;
}
public static String forArray(String componentType) {
return '[' + componentType;
}
public static String forClass(String qualName) {
return 'L' + qualName.replace('.', '/') + ';';
}
public static String forPrimitive(TypeKind kind) {
switch (kind) {
case LONG:
return forClass(long.class);
case INT:
return forClass(int.class);
case DOUBLE:
return forClass(double.class);
case FLOAT:
return forClass(float.class);
case SHORT:
return forClass(short.class);
case BYTE:
return forClass(byte.class);
case BOOLEAN:
return forClass(boolean.class);
case CHAR:
return forClass(char.class);
default:
throw new RuntimeException(kind + " is not a primitive");
}
}
public static String forClass(Class<?> clazz) {
if (clazz == long.class) return "J";
else if (clazz == int.class) return "I";
else if (clazz == double.class) return "D";
else if (clazz == float.class) return "F";
else if (clazz == short.class) return "S";
else if (clazz == byte.class) return "B";
else if (clazz == boolean.class) return "Z";
else if (clazz == char.class) return "C";
else if (clazz == void.class) return "V";
else if (clazz.isArray()) return forArray(forClass(clazz.componentType()));
return forClass(clazz.getName());
}
}

View File

@ -41,7 +41,8 @@ import javax.lang.model.type.PrimitiveType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
public class FieldsGenerator {
public final class FieldsGenerator {
private static final Object sync = new Object();
private static void validateField(VariableElement field) {
// Check if field is "public static final"
@ -69,7 +70,10 @@ public class FieldsGenerator {
throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type or String");
}
Object field_value = field.getConstantValue();
Object field_value;
synchronized (sync) {
field_value = field.getConstantValue();
}
if ( field_value == null ) {
throw new RuntimeException("Field " + field.getSimpleName() + " has no initial value");
}
@ -124,4 +128,4 @@ public class FieldsGenerator {
}
}
}
}

View File

@ -33,9 +33,11 @@ package org.lwjgl.util.generator;
import java.io.File;
import java.io.FileFilter;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Future;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
@ -43,6 +45,10 @@ import javax.lang.model.element.TypeElement;
import javax.lang.model.util.ElementFilter;
import javax.tools.Diagnostic;
import static org.lwjgl.util.generator.Utils.await;
import static org.lwjgl.util.generator.Utils.getRequiredOption;
import static org.lwjgl.util.generator.Utils.getOptionalOption;
/**
* Generator tool for creating the java classes and native code from an
* annotated template java interface.
@ -51,9 +57,9 @@ import javax.tools.Diagnostic;
* @version $Revision$ $Id$
*/
@SupportedAnnotationTypes({ "*" })
@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedOptions({ "binpath", "typemap", "generatechecks", "contextspecific" })
public class GeneratorProcessor extends AbstractProcessor {
@SupportedSourceVersion(SourceVersion.RELEASE_10)
@SupportedOptions({ "genJavaPath", "genNativePath", "typemap", "generatechecks", "nogeneratechecks", "contextspecific" })
public final class GeneratorProcessor extends AbstractProcessor {
private static boolean first_round = true;
@ -64,77 +70,31 @@ public class GeneratorProcessor extends AbstractProcessor {
return true;
}
Map<String, String> options = processingEnv.getOptions();
String typemap_classname = options.get("typemap");
String bin_path = options.get("binpath");
boolean generate_error_checks = options.containsKey("generatechecks");
String typemap_classname = getRequiredOption(options, "typemap", "the name of a TypeMap class.");
Path gen_java_path = getOptionalOption(options, "genJavaPath", "a path.", Path::of);
Path gen_native_path = getOptionalOption(options, "genNativePath", "a path.", Path::of);
boolean generate_error_checks = options.containsKey("generatechecks") && !options.containsKey("nogeneratechecks");
boolean context_specific = options.containsKey("contextspecific");
if ( bin_path == null ) {
throw new RuntimeException("No path specified for the bin directory with -Abinpath=<path>");
}
boolean validate = !options.containsKey("novalidate");
if ( typemap_classname == null ) {
throw new RuntimeException("No TypeMap class name specified with -Atypemap=<class-name>");
}
Element lastFile = null;
try {
long generatorLM = getGeneratorLastModified(bin_path);
TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance());
for ( Iterator<TypeElement> it = ElementFilter.typesIn(roundEnv.getRootElements()).iterator(); it.hasNext(); ) {
lastFile = it.next();
lastFile.accept(new GeneratorVisitor(processingEnv, type_map, generate_error_checks, context_specific, generatorLM), null);
GeneratorVisitor visitor = new GeneratorVisitor(processingEnv, gen_java_path, gen_native_path, type_map, generate_error_checks, context_specific, validate);
for (TypeElement file : ElementFilter.typesIn(roundEnv.getRootElements())) {
try {
file.accept(visitor, null);
} catch (Exception e) {
throw new RuntimeException("\n-- Failed to process template: " + file.asType().toString() + " --", e);
}
}
Future<Void> future;
while ((future = visitor.futures.poll()) != null) {
await(future);
}
first_round = false;
return true;
} catch (Exception e) {
if ( lastFile == null ) {
throw new RuntimeException(e);
} else {
throw new RuntimeException("\n-- Failed to process template: " + lastFile.asType().toString() + " --", e);
}
throw new RuntimeException("Failed to process typemap: " + typemap_classname, e);
}
}
/**
* Gets the time of the latest change on the Generator classes.
*
* @return time of the latest change
*/
private static long getGeneratorLastModified(final String bin_path) {
long lastModified = getDirectoryLastModified(bin_path, "/org/lwjgl/util/generator");
lastModified = Math.max(lastModified, getDirectoryLastModified(bin_path, "/org/lwjgl/util/generator/openal"));
lastModified = Math.max(lastModified, getDirectoryLastModified(bin_path, "/org/lwjgl/util/generator/opengl"));
lastModified = Math.max(lastModified, getDirectoryLastModified(bin_path, "/org/lwjgl/util/generator/opencl"));
return lastModified;
}
private static long getDirectoryLastModified(final String bin_path, final String path) {
final File pck = new File(bin_path + path);
if ( !pck.exists() || !pck.isDirectory() ) {
return Long.MAX_VALUE;
}
final File[] classes = pck.listFiles(new FileFilter() {
public boolean accept(final File pathname) {
return pathname.isFile() && pathname.getName().endsWith(".class");
}
});
if ( classes == null || classes.length == 0 ) {
return Long.MAX_VALUE;
}
long lastModified = 0;
for ( File clazz : classes ) {
long lm = clazz.lastModified();
if ( lastModified < lm ) {
lastModified = lm;
}
}
return lastModified;
}
}

View File

@ -31,16 +31,29 @@
*/
package org.lwjgl.util.generator;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.annotation.Annotation;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import javax.annotation.processing.Messager;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.*;
import javax.lang.model.type.TypeKind;
@ -51,26 +64,47 @@ import javax.tools.Diagnostic.Kind;
import javax.tools.FileObject;
import javax.tools.StandardLocation;
import static org.lwjgl.util.generator.Utils.await;
import static org.lwjgl.util.generator.Utils.spawn;
/**
* Generator visitor for the generator tool
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision$ $Id$
*/
public class GeneratorVisitor extends ElementKindVisitor6<Void, Void> {
public final class GeneratorVisitor extends ElementKindVisitor6<Void, Void> {
private static final String FAST_PREFIX = "";
private static final String SLOW_PREFIX = "\u001b[1;31m";
private static final String TIMING_SUFFIX = "\u001b[0m";
private final ProcessingEnvironment env;
private final TypeMap type_map;
private final boolean generate_error_checks;
private final boolean context_specific;
private final long generatorLM;
private static void printTiming(Messager messager, String message, long startTime) {
long elapsed = System.currentTimeMillis() - startTime;
if (elapsed > 5) {
message += SLOW_PREFIX;
} else {
message += FAST_PREFIX;
}
messager.printMessage(Diagnostic.Kind.NOTE, message + " in " + elapsed + " ms" + TIMING_SUFFIX + '.');
}
public GeneratorVisitor(ProcessingEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific, long generatorLM) {
private final ProcessingEnvironment env;
private final Path gen_java_path;
private final Path gen_native_path;
private final TypeMap type_map;
private final boolean generate_error_checks;
private final boolean context_specific;
private final boolean validate;
public final ArrayDeque<Future<Void>> futures = new ArrayDeque<>(128);
public GeneratorVisitor(ProcessingEnvironment env, Path gen_java_path, Path gen_native_path, TypeMap type_map, boolean generate_error_checks, boolean context_specific, boolean validate) {
this.env = env;
this.gen_java_path = gen_java_path;
this.gen_native_path = gen_native_path;
this.type_map = type_map;
this.generate_error_checks = generate_error_checks;
this.context_specific = context_specific;
this.generatorLM = generatorLM;
this.validate = validate;
}
private void validateMethod(ExecutableElement method) {
@ -113,7 +147,7 @@ public class GeneratorVisitor extends ElementKindVisitor6<Void, Void> {
private void validateType(ExecutableElement method, Class<? extends Annotation> annotation_type, Class type) {
Class[] valid_types = type_map.getValidAnnotationTypes(type);
for ( Class valid_type : valid_types ) {
if ( valid_type.equals(annotation_type) ) {
if ( valid_type.getName().equals(annotation_type) ) {
return;
}
}
@ -121,41 +155,50 @@ public class GeneratorVisitor extends ElementKindVisitor6<Void, Void> {
+ " in method " + method);
}
private void validateType(ExecutableElement method, Class<? extends Annotation> annotation_type, String type) {
// TODO: reimplement this if we even care
}
private void validateTypes(ExecutableElement method, List<? extends AnnotationMirror> annotations, TypeMirror type_mirror) {
if (true) {
// TODO: remove if we reimplement validateType.
return;
}
String desc = Utils.getDescriptor(type_mirror);
if ( BUFFER_DESC.equals(desc) ) return;
for ( AnnotationMirror annotation : annotations ) {
NativeType native_type_annotation = NativeTypeTranslator.getAnnotation(annotation, NativeType.class);
if ( native_type_annotation != null ) {
Class<? extends Annotation> annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
Class type = Utils.getJavaType(type_mirror);
if ( Buffer.class.equals(type) ) {
continue;
}
validateType(method, annotation_type, type);
validateType(method, annotation_type, desc);
}
}
}
private static final String BUFFER_DESC = DescriptorTypeTranslator.forClass(Buffer.class);
private static final String CHAR_SEQUENCE_DESC = DescriptorTypeTranslator.forClass(CharSequence.class);
private static final String CHAR_SEQUENCE_ARRAY_DESC = DescriptorTypeTranslator.forArray(CHAR_SEQUENCE_DESC);
private void validateParameters(ExecutableElement method) {
for ( VariableElement param : method.getParameters() ) {
method.getParameters().parallelStream().parallel().forEach(param -> {
validateTypes(method, param.getAnnotationMirrors(), param.asType());
Class<?> param_type = Utils.getJavaType(param.asType());
if ( Utils.getNIOBufferType(param.asType()) != null && param_type != CharSequence.class && param_type != CharSequence[].class ) {
String param_type = Utils.getDescriptor(param.asType());
if (Utils.getNIOBufferType(param.asType()) != null && !CHAR_SEQUENCE_DESC.equals(param_type) && !CHAR_SEQUENCE_ARRAY_DESC.equals(param_type)) {
Check parameter_check_annotation = param.getAnnotation(Check.class);
NullTerminated null_terminated_annotation = param.getAnnotation(NullTerminated.class);
if ( parameter_check_annotation == null && null_terminated_annotation == null ) {
if (parameter_check_annotation == null && null_terminated_annotation == null) {
boolean found_auto_size_param = false;
for ( VariableElement inner_param : method.getParameters() ) {
for (VariableElement inner_param : method.getParameters()) {
AutoSize auto_size_annotation = inner_param.getAnnotation(AutoSize.class);
if ( auto_size_annotation != null
&& auto_size_annotation.value().equals(param.getSimpleName().toString()) ) {
if (auto_size_annotation != null && auto_size_annotation.value().equals(param.getSimpleName().toString())) {
found_auto_size_param = true;
break;
}
}
if ( !found_auto_size_param
if (!found_auto_size_param
&& param.getAnnotation(Result.class) == null
&& param.getAnnotation(Constant.class) == null
&& !Utils.isReturnParameter(method, param) ) {
&& !Utils.isReturnParameter(method, param)) {
throw new RuntimeException(param + " has no Check, Result nor Constant annotation, is not the return parameter and no other parameter has"
+ " an @AutoSize annotation on it in method " + method);
}
@ -176,10 +219,10 @@ public class GeneratorVisitor extends ElementKindVisitor6<Void, Void> {
throw new RuntimeException(param + " type is not a buffer, but annotated as a CachedReference");
}
}
}
});
}
private static void generateMethodsNativePointers(PrintWriter writer, Collection<? extends ExecutableElement> methods) {
private static void generateMethodsNativePointers(PrintWriter writer, Collection<ExecutableElement> methods) {
for ( ExecutableElement method : methods ) {
if ( method.getAnnotation(Alternate.class) == null ) {
generateMethodNativePointers(writer, method);
@ -189,164 +232,194 @@ public class GeneratorVisitor extends ElementKindVisitor6<Void, Void> {
private static void generateMethodNativePointers(PrintWriter writer, ExecutableElement method) {
if ( method.getAnnotation(Extern.class) == null ) {
writer.print("static ");
writer.append("static ");
}
writer.println(Utils.getTypedefName(method) + " " + method.getSimpleName() + ";");
writer.append(Utils.getTypedefName(method)).append(' ').append(method.getSimpleName()).append(";\n");
}
private void generateJavaSource(TypeElement d, PrintWriter java_writer) throws IOException {
java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
java_writer.println();
java_writer.println("package " + env.getElementUtils().getPackageOf(d).getQualifiedName().toString() + ";");
java_writer.println();
java_writer.println("import org.lwjgl.*;");
java_writer.println("import java.nio.*;");
private void generateJavaSource(TypeElement d, PrintWriter java_writer, Collection<ExecutableElement> methods, Collection<VariableElement> fields) throws IOException {
java_writer.append("/* MACHINE GENERATED FILE, DO NOT EDIT */\n\n");
java_writer.append("package ").append(env.getElementUtils().getPackageOf(d).getQualifiedName().toString()).append(";\n\n");
java_writer.append("import org.lwjgl.*;\n"
+ "import java.nio.*;\n");
Imports imports = d.getAnnotation(Imports.class);
if ( imports != null ) {
for ( String i : imports.value() ) {
java_writer.println("import " + i + ";");
java_writer.append("import ").append(i).append(";\n");
}
}
java_writer.println();
java_writer.append('\n');
Utils.printDocComment(java_writer, d, env);
if ( d.getAnnotation(Private.class) == null ) {
java_writer.print("public ");
java_writer.append("public ");
}
boolean is_final = Utils.isFinal(d);
if ( is_final ) {
java_writer.write("final ");
java_writer.append("final ");
}
java_writer.print("class " + Utils.getSimpleClassName(d));
java_writer.append("class ").append(Utils.getSimpleClassName(d));
List<? extends TypeMirror> super_interfaces = d.getInterfaces();
if ( super_interfaces.size() > 1 ) {
throw new RuntimeException(d + " extends more than one interface");
}
if ( super_interfaces.size() == 1 ) {
TypeMirror super_interface = super_interfaces.iterator().next();
java_writer.print(" extends " + Utils.getSimpleClassName(env.getElementUtils().getTypeElement(super_interface.toString())));
java_writer.append(" extends ").append(Utils.getSimpleClassName(env.getElementUtils().getTypeElement(super_interface.toString())));
}
java_writer.println(" {");
FieldsGenerator.generateFields(env, java_writer, Utils.getFields(d));
java_writer.println();
java_writer.append(" {\n");
FieldsGenerator.generateFields(env, java_writer, fields);
java_writer.append('\n');
if ( is_final ) {
// Write private constructor to avoid instantiation
java_writer.println("\tprivate " + Utils.getSimpleClassName(d) + "() {}");
java_writer.append("\tprivate ").append(Utils.getSimpleClassName(d)).append("() {}\n");
}
if ( Utils.getMethods(d).size() > 0 && !context_specific ) {
java_writer.println();
java_writer.println("\tstatic native void " + Utils.STUB_INITIALIZER_NAME + "() throws LWJGLException;");
if ( !methods.isEmpty() && !context_specific ) {
java_writer.append('\n');
java_writer.append("\tstatic native void ").append(Utils.STUB_INITIALIZER_NAME).append("() throws LWJGLException;\n");
}
JavaMethodsGenerator.generateMethodsJava(env, type_map, java_writer, d, generate_error_checks, context_specific);
java_writer.println("}");
java_writer.close();
String qualified_interface_name = Utils.getQualifiedClassName(d);
env.getMessager().printMessage(Diagnostic.Kind.NOTE, "Generated class " + qualified_interface_name);
java_writer.append("}");
}
private void generateNativeSource(TypeElement d) throws IOException {
private void generateNativeSource(TypeElement d, Collection<ExecutableElement> methods, long startTime) throws IOException {
if ( d.getKind().equals(ElementKind.ANNOTATION_TYPE) ) {
return;
}
String qualified_interface_name = Utils.getQualifiedClassName(d);
String qualified_native_name = Utils.getNativeQualifiedName(qualified_interface_name) + ".c";
PrintWriter native_writer = new PrintWriter(env.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", qualified_native_name).openWriter());
native_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
native_writer.println();
native_writer.println("#include <jni.h>");
type_map.printNativeIncludes(native_writer);
native_writer.println();
TypedefsGenerator.generateNativeTypedefs(type_map, native_writer, Utils.getMethods(d));
native_writer.println();
if ( !context_specific ) {
generateMethodsNativePointers(native_writer, Utils.getMethods(d));
native_writer.println();
ByteArrayOutputStream native_writer1 = new ByteArrayOutputStream();
PrintWriter native_writer = new PrintWriter(native_writer1);
native_writer.append("/* MACHINE GENERATED FILE, DO NOT EDIT */\n\n");
native_writer.append("#include <jni.h>\n");
type_map.printNativeIncludes(native_writer);
native_writer.append('\n');
TypedefsGenerator.generateNativeTypedefs(type_map, native_writer, methods);
native_writer.append('\n');
if (!context_specific) {
generateMethodsNativePointers(native_writer, methods);
native_writer.append('\n');
}
NativeMethodStubsGenerator.generateNativeMethodStubs(env, type_map, native_writer, d, generate_error_checks, context_specific);
if (!context_specific) {
native_writer.append("JNIEXPORT void JNICALL ").append(Utils.getQualifiedNativeMethodName(qualified_interface_name, Utils.STUB_INITIALIZER_NAME));
native_writer.append("(JNIEnv *env, jclass clazz) {\n");
native_writer.append("\tJavaMethodAndExtFunction functions[] = {\n");
RegisterStubsGenerator.generateMethodsNativeStubBind(native_writer, d, generate_error_checks, context_specific);
native_writer.append("\t};\n");
native_writer.append("\tint num_functions = NUMFUNCTIONS(functions);\n");
native_writer.append('\t');
native_writer.append(type_map.getRegisterNativesFunctionName());
native_writer.append("(env, clazz, num_functions, functions);\n");
native_writer.append("}");
}
native_writer.flush();
saveGeneratedCSource(env.getMessager(), this.gen_native_path, d, spawn((Callable<byte[]>) () -> native_writer1.toByteArray()), startTime);
}
private void doJavaGen(TypeElement e, Collection<ExecutableElement> methods, Collection<VariableElement> fields) {
long startTime = System.currentTimeMillis();
ByteArrayOutputStream java_writer = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(java_writer);
try {
generateJavaSource(e, pw, methods, fields);
} catch (IOException ex) {
throw new RuntimeException("Failed to generate the Java sources for " + e, ex);
}
NativeMethodStubsGenerator.generateNativeMethodStubs(env, type_map, native_writer, d, generate_error_checks, context_specific);
if ( !context_specific ) {
native_writer.print("JNIEXPORT void JNICALL " + Utils.getQualifiedNativeMethodName(qualified_interface_name, Utils.STUB_INITIALIZER_NAME));
native_writer.println("(JNIEnv *env, jclass clazz) {");
native_writer.println("\tJavaMethodAndExtFunction functions[] = {");
RegisterStubsGenerator.generateMethodsNativeStubBind(native_writer, d, generate_error_checks, context_specific);
native_writer.println("\t};");
native_writer.println("\tint num_functions = NUMFUNCTIONS(functions);");
native_writer.print("\t");
native_writer.print(type_map.getRegisterNativesFunctionName());
native_writer.println("(env, clazz, num_functions, functions);");
native_writer.println("}");
pw.flush();
saveGeneratedJavaSource(env.getMessager(), this.gen_java_path, e, spawn((Callable<byte[]>) () -> java_writer.toByteArray()), startTime);
}
private void doNativeGen(TypeElement e, Collection<ExecutableElement> methods) {
long startTime = System.currentTimeMillis();
boolean noNative = true;
for (ExecutableElement method : methods) {
Alternate alt_annotation = method.getAnnotation(Alternate.class);
if ((alt_annotation == null || alt_annotation.nativeAlt()) && method.getAnnotation(Reuse.class) == null) {
noNative = false;
break;
}
}
if (!noNative) {
try {
generateNativeSource(e, methods, startTime);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
native_writer.close();
env.getMessager().printMessage(Kind.NOTE, "Generated C source " + qualified_interface_name);
}
@Override
public Void visitTypeAsInterface(TypeElement e, Void p) {
final File input = new File("src/templates/" + e.getQualifiedName().toString().replace('.', '/') + ".java");
final File outputJava = new File("src/generated/" + env.getElementUtils().getPackageOf(e).getQualifiedName().toString().replace('.', '/'), Utils.getSimpleClassName(e) + ".java");
PrintWriter java_writer = null;
try {
final Collection<? extends ExecutableElement> methods = Utils.getMethods(e);
if ( methods.isEmpty() && Utils.getFields(e).isEmpty() ) {
return DEFAULT_VALUE;
}
// Skip this class if the output exists and the input has not been modified.
if ( outputJava.exists() && Math.max(input.lastModified(), generatorLM) < outputJava.lastModified() )
return DEFAULT_VALUE;
//env.getMessager().printMessage(Kind.NOTE, "methods count : " + Utils.getMethods(e).size() + " fields count : " + Utils.getFields(e).size(), e);
for ( final ExecutableElement method : methods ) {
validateMethod(method);
}
// TODO: Back-port LWJGL 3's generation file handling (generate in-memory and avoid touching files if nothing has changed)
java_writer = new PrintWriter(env.getFiler().createSourceFile(Utils.getQualifiedClassName(e), env.getElementUtils().getPackageOf(e)).openWriter());
generateJavaSource(e, java_writer);
if ( methods.size() > 0 ) {
boolean noNative = true;
for ( final ExecutableElement method : methods ) {
Alternate alt_annotation = method.getAnnotation(Alternate.class);
if ( (alt_annotation == null || alt_annotation.nativeAlt()) && method.getAnnotation(Reuse.class) == null ) {
noNative = false;
break;
}
}
if ( noNative ) {
return DEFAULT_VALUE;
}
try {
generateNativeSource(e);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
final Collection<ExecutableElement> methods = List.copyOf(Utils.getMethods(e));
final Collection<VariableElement> fields = List.copyOf(Utils.getFields(e));
if (methods.isEmpty() && fields.isEmpty()) {
return DEFAULT_VALUE;
} catch (Exception ex) {
// If anything goes wrong mid-gen, delete output to allow regen next time we run.
if ( java_writer != null ) java_writer.close();
if ( outputJava.exists() ) outputJava.delete();
throw new RuntimeException(ex);
}
//env.getMessager().printMessage(Kind.NOTE, "methods count : " + Utils.getMethods(e).size() + " fields count : " + Utils.getFields(e).size(), e);
if (this.validate) {
this.futures.push(spawn(() -> {
long startTime = System.currentTimeMillis();
methods.parallelStream().parallel().forEach(method -> validateMethod(method));
printTiming(env.getMessager(), "Validated " + e, startTime);
return null;
}));
}
if (this.gen_java_path != null) {
//this.futures.push(spawn(() -> {
doJavaGen(e, methods, fields);
// return null;
//}));
}
if (methods.size() > 0 && this.gen_native_path != null) {
this.futures.push(spawn(() -> {
doNativeGen(e, methods);
return null;
}));
}
return DEFAULT_VALUE;
}
private static ByteBuffer readFile(final File file) throws IOException {
final FileChannel channel = new FileInputStream(file).getChannel();
final long bytesTotal = channel.size();
final ByteBuffer buffer = ByteBuffer.allocateDirect((int)bytesTotal);
long bytesRead = 0;
do {
bytesRead += channel.read(buffer);
} while ( bytesRead < bytesTotal );
buffer.flip();
channel.close();
return buffer;
public static void saveGeneratedJavaSource(Messager messager, Path gen_java_path, TypeElement e, Future<byte[]> content, long startTime) {
String qualified_interface_name = Utils.getQualifiedClassName(e);
saveGeneratedJavaSource(messager, gen_java_path, qualified_interface_name, content, startTime);
}
public static void saveGeneratedJavaSource(Messager messager, Path gen_java_path, String qualified_interface_name, Future<byte[]> content, long startTime) {
final Path output = gen_java_path.resolve(qualified_interface_name.replace('.', '/') + ".java");
saveGeneratedSource(messager, "java", qualified_interface_name, output, content, startTime);
}
public static void saveGeneratedCSource(Messager messager, Path gen_native_path, TypeElement e, Future<byte[]> content, long startTime) {
String qualified_interface_name = Utils.getQualifiedClassName(e);
final Path output = gen_native_path.resolve(Utils.getNativeQualifiedName(qualified_interface_name) + ".c");
saveGeneratedSource(messager, "c", qualified_interface_name, output, content, startTime);
}
public static void saveGeneratedSource(Messager messager, String type, String name, Path output, Future<byte[]> newStr, long startTime) {
try {
if (Files.exists(output)) {
Future<byte[]> actual = spawn(() -> Files.readAllBytes(output));
byte[] expected = await(newStr);
if (Arrays.equals(expected, await(actual))) {
printTiming(messager, "Skipped identical '." + type + "' " + name + " at " + output, startTime);
return;
}
} else {
Files.createDirectories(output.getParent());
}
} catch (IOException e) {
throw new RuntimeException("Failed to create the output file for " + name, e);
}
try {
Files.write(output, await(newStr));
} catch (Exception e) {
throw new RuntimeException(e);
}
printTiming(messager, "Generated '." + type + "' " + name + " at " + output, startTime);
}
}

View File

@ -49,7 +49,7 @@ import javax.lang.model.util.SimpleTypeVisitor6;
* @version $Revision$
* $Id$
*/
public class JNITypeTranslator extends SimpleTypeVisitor6<Void, Void> {
public final class JNITypeTranslator extends SimpleTypeVisitor6<Void, Void> {
private final StringBuilder signature = new StringBuilder();

View File

@ -41,6 +41,7 @@ package org.lwjgl.util.generator;
import org.lwjgl.PointerBuffer;
import org.lwjgl.util.generator.opengl.GLreturn;
import java.io.StringWriter;
import java.io.PrintWriter;
import java.nio.*;
import java.util.*;
@ -54,21 +55,24 @@ import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
public class JavaMethodsGenerator {
public final class JavaMethodsGenerator {
private static final String SAVED_PARAMETER_POSTFIX = "_saved";
public static void generateMethodsJava(ProcessingEnvironment env, TypeMap type_map, PrintWriter writer, TypeElement interface_decl, boolean generate_error_checks, boolean context_specific) {
for ( ExecutableElement method : Utils.getMethods(interface_decl) ) {
generateMethodJava(env, type_map, writer, interface_decl, method, generate_error_checks, context_specific);
}
List.copyOf(Utils.getMethods(interface_decl)).parallelStream().parallel().map(method -> {
StringWriter writer1 = new StringWriter();
PrintWriter writer2 = new PrintWriter(writer1);
generateMethodJava(env, type_map, writer2, interface_decl, method, generate_error_checks, context_specific);
return writer1.toString();
}).sequential().forEach(writer::append);
}
/**
* TODO : fix info multi-type methods print.
*/
private static void generateMethodJava(ProcessingEnvironment env, TypeMap type_map, PrintWriter writer, TypeElement interface_decl, ExecutableElement method, boolean generate_error_checks, boolean context_specific) {
writer.println();
writer.append('\n');
if ( Utils.isMethodIndirect(generate_error_checks, context_specific, method) ) {
if ( method.getAnnotation(GenerateAutos.class) != null ) {
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.AUTOS, generate_error_checks, context_specific);
@ -78,7 +82,8 @@ public class JavaMethodsGenerator {
printMethodWithMultiType(env, type_map, writer, interface_decl, method, typeinfos_instance, Mode.NORMAL, generate_error_checks, context_specific);
}
}
if ( method.getAnnotation(CachedResult.class) != null && !method.getAnnotation(CachedResult.class).isRange() ) {
CachedResult cached_result = method.getAnnotation(CachedResult.class);
if ( cached_result != null && !cached_result.isRange() ) {
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.CACHEDRESULT, generate_error_checks, context_specific);
}
@ -104,32 +109,35 @@ public class JavaMethodsGenerator {
private static void printJavaNativeStub(ProcessingEnvironment env, PrintWriter writer, ExecutableElement method, Mode mode, boolean generate_error_checks, boolean context_specific) {
if ( Utils.isMethodIndirect(generate_error_checks, context_specific, method) ) {
writer.print("\tstatic native ");
writer.append("\tpublic static native ");
} else {
Utils.printDocComment(writer, method, env);
writer.print("\tpublic static native ");
writer.append("\tpublic static native ");
}
writer.print(getResultType(method, true));
writer.print(" " + Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific));
writer.append(getResultType(method, true));
writer.append(' ').append(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific));
if ( mode == Mode.BUFFEROBJECT ) {
writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX);
writer.append(Utils.BUFFER_OBJECT_METHOD_POSTFIX);
}
writer.print("(");
writer.append('(');
boolean first_parameter = generateParametersJava(writer, method, TypeInfo.getDefaultTypeInfoMap(method), true, true, mode);
if ( context_specific ) {
if ( !first_parameter ) {
writer.print(", ");
writer.append(", ");
}
writer.print("long " + Utils.FUNCTION_POINTER_VAR_NAME);
writer.append("long ").append(Utils.FUNCTION_POINTER_VAR_NAME);
}
writer.println(");");
writer.append(");\n");
}
private static boolean generateParametersJava(PrintWriter writer, ExecutableElement method, Map<VariableElement, TypeInfo> typeinfos_instance, boolean native_stub, final boolean printTypes, Mode mode) {
boolean first_parameter = true;
for ( VariableElement param : method.getParameters() ) {
if ( native_stub && (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) {
continue;
if (native_stub) {
Helper helper = param.getAnnotation(Helper.class);
if (helper != null && !helper.passToNative()) {
continue;
}
}
final Constant constant_annotation = param.getAnnotation(Constant.class);
if ( constant_annotation != null && constant_annotation.isNative() ) {
@ -144,13 +152,13 @@ public class JavaMethodsGenerator {
TypeInfo auto_param_type_info = typeinfos_instance.get(auto_parameter);
if ( auto_param_type_info.getSignedness() == Signedness.BOTH ) {
if ( !first_parameter ) {
writer.print(", ");
writer.append(", ");
}
first_parameter = false;
if ( printTypes ) {
writer.print("boolean ");
writer.append("boolean ");
}
writer.print(TypeInfo.UNSIGNED_PARAMETER_NAME);
writer.append(TypeInfo.UNSIGNED_PARAMETER_NAME);
}
}
} else if ( param.getAnnotation(Result.class) == null
@ -166,33 +174,33 @@ public class JavaMethodsGenerator {
if ( auto_size_annotation == null || !auto_size_annotation.isNative() ) {
if ( cached_result_annotation == null || !cached_result_annotation.isRange() ) {
if ( !first_parameter ) {
writer.print(", ");
writer.append(", ");
}
first_parameter = false;
if ( printTypes ) {
writer.print("long ");
writer.append("long ");
}
writer.print(Utils.RESULT_SIZE_NAME);
writer.append(Utils.RESULT_SIZE_NAME);
}
}
}
if ( cached_result_annotation != null ) {
if ( !first_parameter ) {
writer.print(", ");
writer.append(", ");
}
if ( mode == Mode.CACHEDRESULT ) {
if ( printTypes ) {
writer.print("long ");
writer.append("long ");
}
writer.print(Utils.CACHED_BUFFER_LENGTH_NAME + ", ");
writer.append(Utils.CACHED_BUFFER_LENGTH_NAME).append(", ");
}
first_parameter = false;
if ( printTypes ) {
writer.print(getResultType(method, native_stub));
writer.append(getResultType(method, native_stub));
}
writer.print(" " + Utils.CACHED_BUFFER_NAME);
writer.append(' ').append(Utils.CACHED_BUFFER_NAME);
}
return first_parameter;
}
@ -200,7 +208,7 @@ public class JavaMethodsGenerator {
private static boolean generateParameterJava(PrintWriter writer, VariableElement param, TypeInfo type_info, boolean native_stub, final boolean printTypes, boolean first_parameter, Mode mode) {
Class buffer_type = Utils.getNIOBufferType(param.asType());
if ( !first_parameter ) {
writer.print(", ");
writer.append(", ");
}
BufferObject bo_annotation = param.getAnnotation(BufferObject.class);
if ( bo_annotation != null && mode == Mode.BUFFEROBJECT ) {
@ -208,43 +216,35 @@ public class JavaMethodsGenerator {
throw new RuntimeException("type of " + param + " is not a nio Buffer parameter but is annotated as buffer object");
}
if ( printTypes ) {
writer.print("long ");
writer.append("long ");
}
writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
writer.append(param.getSimpleName()).append(Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
} else {
if ( native_stub && param.getAnnotation(PointerWrapper.class) != null ) {
writer.print("long ");
writer.append("long ");
} else {
Class type = type_info.getType();
if ( native_stub && (type == CharSequence.class || type == CharSequence[].class || type == PointerBuffer.class || Buffer.class.isAssignableFrom(type)) ) {
writer.print("long ");
writer.append("long ");
} else if ( printTypes ) {
writer.print(type.getSimpleName() + " ");
writer.append(type.getSimpleName()).append(' ');
}
}
AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class);
if ( auto_size_annotation != null ) {
writer.print(auto_size_annotation.value() + "_");
writer.append(auto_size_annotation.value()).append('_');
}
writer.print(param.getSimpleName());
writer.append(param.getSimpleName());
}
return false;
}
private static void printBufferObjectCheck(PrintWriter writer, BufferKind kind, Mode mode, boolean context_specific) {
String bo_check_method_name = kind.toString();
writer.print("\t\t" + Utils.CHECKS_CLASS_NAME + ".ensure" + bo_check_method_name);
if ( mode == Mode.BUFFEROBJECT ) {
writer.print("enabled");
} else {
writer.print("disabled");
}
writer.append("\t\t" + Utils.CHECKS_CLASS_NAME + ".ensure").append(bo_check_method_name);
writer.append(mode == Mode.BUFFEROBJECT ? "enabled" : "disabled");
if ( context_specific ) {
writer.println("(caps);");
} else {
writer.println("();");
}
writer.append(context_specific ? "(caps);\n" : "();\n");
}
private static void printBufferObjectChecks(PrintWriter writer, ExecutableElement method, Mode mode, boolean context_specific) {
@ -263,14 +263,14 @@ public class JavaMethodsGenerator {
private static void printMethodWithMultiType(ProcessingEnvironment env, TypeMap type_map, PrintWriter writer, TypeElement interface_decl, ExecutableElement method, Map<VariableElement, TypeInfo> typeinfos_instance, Mode mode, boolean generate_error_checks, boolean context_specific) {
Utils.printDocComment(writer, method, env);
if ( method.getAnnotation(Deprecated.class) != null ) {
writer.println("\t@Deprecated");
writer.append("\t@Deprecated\n");
}
if ( interface_decl.getAnnotation(Private.class) == null && method.getAnnotation(Private.class) == null ) {
writer.print("\tpublic static ");
writer.append("\tpublic static ");
} else {
writer.print("\tstatic ");
writer.append("\tstatic ");
}
writer.print(getResultType(method, false));
writer.append(getResultType(method, false));
StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class);
String method_name;
Alternate alt_annotation = method.getAnnotation(Alternate.class);
@ -278,116 +278,113 @@ public class JavaMethodsGenerator {
if ( strip_annotation != null && mode == Mode.NORMAL ) {
method_name = getPostfixStrippedName(type_map, interface_decl, method);
}
writer.print(" " + method_name + "(");
writer.append(' ').append(method_name).append('(');
generateParametersJava(writer, method, typeinfos_instance, false, true, mode);
writer.println(") {");
writer.append(") {\n");
final TypeMirror result_type = Utils.getMethodReturnType(method);
boolean has_result = !result_type.equals(env.getTypeUtils().getNoType(TypeKind.VOID));
GLreturn gl_return = method.getAnnotation(GLreturn.class);
final Reuse reuse_annotation = method.getAnnotation(Reuse.class);
if ( reuse_annotation != null ) {
writer.print("\t\t");
if ( has_result || method.getAnnotation(GLreturn.class) != null ) {
writer.print("return ");
writer.append("\t\t");
if ( has_result || gl_return != null ) {
writer.append("return ");
}
writer.print(reuse_annotation.value() + "." + (reuse_annotation.method().length() > 0 ? reuse_annotation.method() : method_name) + "(");
writer.append(reuse_annotation.value() + "." + (reuse_annotation.method().length() > 0 ? reuse_annotation.method() : method_name) + "(");
generateParametersJava(writer, method, typeinfos_instance, false, false, mode);
writer.println(");\n\t}");
writer.append(");\n\t}\n");
return;
}
if ( context_specific ) {
type_map.printCapabilitiesInit(writer);
writer.print("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = " + type_map.getCapabilities() + ".");
writer.println(Utils.getFunctionAddressName(interface_decl, method, true) + ";");
writer.print("\t\tBufferChecks.checkFunctionAddress(");
writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");");
writer.append("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = ").append(type_map.getCapabilities()).append('.');
writer.append(Utils.getFunctionAddressName(interface_decl, method, true)).append(";\n");
writer.append("\t\tBufferChecks.checkFunctionAddress(");
writer.append(Utils.FUNCTION_POINTER_VAR_NAME + ");\n");
}
final Code code_annotation = method.getAnnotation(Code.class);
if ( code_annotation != null && code_annotation.value().length() > 0 ) {
writer.println(code_annotation.value());
writer.append(code_annotation.value()).append('\n');
}
printBufferObjectChecks(writer, method, mode, context_specific);
printParameterChecks(writer, method, typeinfos_instance, mode, generate_error_checks);
printParameterCaching(writer, interface_decl, method, mode, context_specific);
if ( code_annotation != null && code_annotation.javaBeforeNative().length() > 0 ) {
writer.println(code_annotation.javaBeforeNative());
writer.append(code_annotation.javaBeforeNative()).append('\n');
}
writer.print("\t\t");
writer.append("\t\t");
final PointerWrapper pointer_wrapper_annotation = method.getAnnotation(PointerWrapper.class);
if ( has_result ) {
writer.print(getResultType(method, false) + " " + Utils.RESULT_VAR_NAME);
writer.append(getResultType(method, false)).append(" " + Utils.RESULT_VAR_NAME);
if ( code_annotation != null && code_annotation.tryBlock() ) {
writer.print(" = " + getDefaultResultValue(method));
writer.println(";\n\t\ttry {");
writer.print("\t\t\t" + Utils.RESULT_VAR_NAME);
writer.append(" = ").append(getDefaultResultValue(method)).append(";\n\t\ttry {\n" + "\t\t\t" + Utils.RESULT_VAR_NAME);
}
writer.print(" = ");
writer.append(" = ");
if ( pointer_wrapper_annotation != null ) {
if ( pointer_wrapper_annotation.factory().length() > 0 ) {
writer.print(pointer_wrapper_annotation.factory() + "(");
writer.append(pointer_wrapper_annotation.factory()).append('(');
} else {
writer.print("new " + getResultType(method, false) + "(");
writer.append("new ").append(getResultType(method, false)).append('(');
}
}
} else if ( method.getAnnotation(GLreturn.class) != null ) {
} else if ( gl_return != null ) {
has_result = true;
Utils.printGLReturnPre(writer, method, method.getAnnotation(GLreturn.class), type_map);
Utils.printGLReturnPre(writer, method, gl_return, type_map);
}
writer.print(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific));
writer.append(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific));
if ( mode == Mode.BUFFEROBJECT ) {
writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX);
writer.append(Utils.BUFFER_OBJECT_METHOD_POSTFIX);
}
writer.print("(");
writer.append('(');
boolean first_parameter = printMethodCallArguments(writer, method, typeinfos_instance, mode, type_map);
if ( context_specific ) {
if ( !first_parameter ) {
writer.print(", ");
writer.append(", ");
}
writer.print(Utils.FUNCTION_POINTER_VAR_NAME);
writer.append(Utils.FUNCTION_POINTER_VAR_NAME);
}
if ( has_result && pointer_wrapper_annotation != null ) {
writer.print(")");
writer.append(')');
if ( pointer_wrapper_annotation.params().length() > 0 ) {
writer.print(", " + pointer_wrapper_annotation.params());
writer.append(", ").append(pointer_wrapper_annotation.params());
}
}
writer.println(");");
writer.append(");\n");
if ( code_annotation != null && code_annotation.javaAfterNative().length() > 0 ) {
writer.println(code_annotation.javaAfterNative());
writer.append(code_annotation.javaAfterNative()).append('\n');
}
final String tabs = code_annotation != null && code_annotation.tryBlock() ? "\t\t\t" : "\t\t";
if ( generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null ) {
type_map.printErrorCheckMethod(writer, method, tabs);
}
// DISABLED: indirect buffer support
//printNondirectParameterCopies(writer, method, mode);
if ( has_result ) {
if ( method.getAnnotation(GLreturn.class) == null ) {
if ( gl_return == null ) {
if ( ByteBuffer.class.equals(Utils.getJavaType(result_type)) ) {
writer.println(tabs + "return LWJGLUtil.CHECKS && " + Utils.RESULT_VAR_NAME + " == null ? null : " + Utils.RESULT_VAR_NAME + ".order(ByteOrder.nativeOrder());"); // safeNewBuffer returns a direct ByteBuffer with BIG_ENDIAN order.
writer.append(tabs).append("return LWJGLUtil.CHECKS && " + Utils.RESULT_VAR_NAME + " == null ? null : " + Utils.RESULT_VAR_NAME + ".order(ByteOrder.nativeOrder());\n"); // safeNewBuffer returns a direct ByteBuffer with BIG_ENDIAN order.
} else {
writer.println(tabs + "return " + Utils.RESULT_VAR_NAME + ";");
writer.append(tabs).append("return " + Utils.RESULT_VAR_NAME + ";\n");
}
} else {
Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class), type_map);
Utils.printGLReturnPost(writer, method, gl_return, type_map);
}
}
if ( code_annotation != null && code_annotation.tryBlock() ) {
writer.println("\t\t} finally {");
writer.println(code_annotation.javaFinally());
writer.println("\t\t}");
writer.append("\t\t} finally {\n");
writer.append(code_annotation.javaFinally()).append('\n');
writer.append("\t\t}\n");
}
writer.println("\t}");
writer.append("\t}\n");
}
private static String getExtensionPostfix(TypeElement interface_decl) {
@ -501,13 +498,13 @@ public class JavaMethodsGenerator {
private static boolean printMethodCallArgument(PrintWriter writer, ExecutableElement method, VariableElement param, Map<VariableElement, TypeInfo> typeinfos_instance, Mode mode, boolean first_parameter, TypeMap type_map) {
if ( !first_parameter ) {
writer.print(", ");
writer.append(", ");
}
AnnotationMirror auto_annotation = Utils.getParameterAutoAnnotation(param);
Constant constant_annotation = param.getAnnotation(Constant.class);
if ( constant_annotation != null ) {
writer.print(constant_annotation.value());
writer.append(constant_annotation.value());
} else if ( auto_annotation != null && mode == Mode.NORMAL ) {
Class param_type = NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType());
if ( AutoType.class.equals(param_type) ) {
@ -517,7 +514,7 @@ public class JavaMethodsGenerator {
if ( auto_type == null ) {
throw new RuntimeException("No auto type for parameter " + param.getSimpleName() + " in method " + method);
}
writer.print(auto_type);
writer.append(auto_type);
} else if ( AutoSize.class.equals(param_type) ) {
final AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class);
if ( !auto_size_annotation.useExpression() ) {
@ -529,65 +526,65 @@ public class JavaMethodsGenerator {
if ( shift_remaining ) {
shifting = getBufferElementSizeExponent(auto_target_type_info.getType());
if ( shifting > 0 ) {
writer.print("(");
writer.append('(');
}
}
if ( auto_size_annotation.canBeNull() ) {
writer.print("(" + auto_parameter_name + " == null ? 0 : " + auto_parameter_name + ".remaining())");
writer.append('(').append(auto_parameter_name).append(" == null ? 0 : ").append(auto_parameter_name).append(".remaining())");
} else {
writer.print(auto_parameter_name + ".remaining()");
writer.append(auto_parameter_name).append(".remaining()");
}
// Shift the remaining if the target parameter is multityped and there's no AutoType to track type
if ( shift_remaining && shifting > 0 ) {
writer.print(" << " + shifting);
writer.print(")");
if ( shifting > 0 ) {
writer.append(" << ").append(String.valueOf(shifting));
writer.append(')');
}
}
writer.print(auto_size_annotation.expression());
writer.append(auto_size_annotation.expression());
} else {
throw new RuntimeException("Unknown auto annotation " + param_type);
}
} else {
if ( mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null ) {
writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
writer.append(param.getSimpleName()).append(Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
} else {
Class type = typeinfos_instance.get(param).getType();
Check check_annotation = param.getAnnotation(Check.class);
boolean hide_buffer = mode == Mode.AUTOS && getAutoTypeParameter(method, param) != null;
if ( hide_buffer ) {
writer.print("0L");
writer.append("0L");
} else {
if ( type == CharSequence.class || type == CharSequence[].class ) {
final String offset = Utils.getStringOffset(method, param);
writer.print("APIUtil.getBuffer");
writer.append("APIUtil.getBuffer");
if ( param.getAnnotation(NullTerminated.class) != null ) {
writer.print("NT");
writer.append("NT");
}
writer.print('(');
writer.print(type_map.getAPIUtilParam(true));
writer.print(param.getSimpleName());
writer.append('(');
writer.append(type_map.getAPIUtilParam(true));
writer.append(param.getSimpleName());
if ( offset != null ) {
writer.print(", " + offset);
writer.append(", ").append(offset);
}
writer.print(")");
writer.append(')');
} else {
final AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class);
if ( auto_size_annotation != null ) {
writer.print(auto_size_annotation.value() + "_");
writer.append(auto_size_annotation.value()).append('_');
}
final Class buffer_type = Utils.getNIOBufferType(param.asType());
if ( buffer_type == null ) {
writer.print(param.getSimpleName());
writer.append(param.getSimpleName());
} else {
writer.print("MemoryUtil.getAddress");
writer.append("MemoryUtil.getAddress");
if ( check_annotation != null && check_annotation.canBeNull() ) {
writer.print("Safe");
writer.append("Safe");
}
writer.print("(");
writer.print(param.getSimpleName());
writer.print(")");
writer.append('(');
writer.append(param.getSimpleName());
writer.append(')');
}
}
}
@ -595,9 +592,9 @@ public class JavaMethodsGenerator {
PointerWrapper pointer_annotation = param.getAnnotation(PointerWrapper.class);
if ( pointer_annotation != null ) {
if ( pointer_annotation.canBeNull() ) {
writer.print(" == null ? 0 : " + param.getSimpleName());
writer.append(" == null ? 0 : ").append(param.getSimpleName());
}
writer.print(".getPointer()");
writer.append(".getPointer()");
}
}
}
@ -608,9 +605,10 @@ public class JavaMethodsGenerator {
private static boolean printMethodCallArguments(PrintWriter writer, ExecutableElement method, Map<VariableElement, TypeInfo> typeinfos_instance, Mode mode, TypeMap type_map) {
boolean first_parameter = true;
for ( VariableElement param : method.getParameters() ) {
if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) {
continue;
}
if (param.getAnnotation(Result.class) != null) continue;
Helper helper = param.getAnnotation(Helper.class);
if (helper != null && !helper.passToNative()) continue;
final Constant constant_annotation = param.getAnnotation(Constant.class);
if ( constant_annotation == null || !constant_annotation.isNative() ) {
@ -618,14 +616,15 @@ public class JavaMethodsGenerator {
}
}
if ( Utils.getNIOBufferType(Utils.getMethodReturnType(method)) != null ) {
if ( method.getAnnotation(CachedResult.class) != null && method.getAnnotation(CachedResult.class).isRange() ) {
CachedResult cached_result = method.getAnnotation(CachedResult.class);
if ( cached_result != null && cached_result.isRange() ) {
first_parameter = false;
Utils.printExtraCallArguments(writer, method, "");
} else {
AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class);
if ( auto_size_annotation == null || !auto_size_annotation.isNative() ) {
if ( !first_parameter ) {
writer.print(", ");
writer.append(", ");
}
first_parameter = false;
@ -653,21 +652,21 @@ public class JavaMethodsGenerator {
&& cachedReference != null
&& (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null)
&& param.getAnnotation(Result.class) == null ) {
writer.print("\t\tif ( LWJGLUtil.CHECKS ) StateTracker.");
writer.append("\t\tif ( LWJGLUtil.CHECKS ) StateTracker.");
if ( context_specific ) {
writer.print("getReferences(caps).");
writer.append("getReferences(caps).");
} else {
writer.print("getTracker().");
writer.append("getTracker().");
}
if ( cachedReference.name().length() > 0 ) {
writer.print(cachedReference.name());
writer.append(cachedReference.name());
} else {
writer.print(Utils.getReferenceName(interface_decl, method, param));
writer.append(Utils.getReferenceName(interface_decl, method, param));
}
if ( cachedReference.index().length() > 0 ) {
writer.print("[" + cachedReference.index() + "]");
writer.append('[').append(cachedReference.index()).append(']');
}
writer.println(" = " + param.getSimpleName() + ";");
writer.append(" = ").append(param.getSimpleName()).append(";\n");
}
}
}
@ -682,12 +681,11 @@ public class JavaMethodsGenerator {
final int shifting = getBufferElementSizeExponent(typeinfos.get(param).getType());
final Check check_annotation = param.getAnnotation(Check.class);
writer.print("\t\tlong " + param.getSimpleName() + "_size = ");
if ( check_annotation == null || !check_annotation.canBeNull() ) {
writer.println(param.getSimpleName() + ".remaining() << " + shifting + ";");
} else {
writer.println(param.getSimpleName() + " == null ? 0 : " + param.getSimpleName() + ".remaining() << " + shifting + ";");
writer.append("\t\tlong ").append(param.getSimpleName()).append("_size = ");
if ( check_annotation != null && check_annotation.canBeNull() ) {
writer.append(param.getSimpleName()).append(" == null ? 0 : ");
}
writer.append(param.getSimpleName()).append(".remaining() << ").append(String.valueOf(shifting)).append(";\n");
}
}
}
@ -712,7 +710,7 @@ public class JavaMethodsGenerator {
printParameterCheck(writer, method, param.getSimpleName().toString(), typeinfo.getType().getSimpleName(), check_value, can_be_null, param.getAnnotation(NullTerminated.class), generate_error_checks);
} else if ( String.class.equals(java_type) ) {
if ( !can_be_null ) {
writer.println("\t\tBufferChecks.checkNotNull(" + param.getSimpleName() + ");");
writer.append("\t\tBufferChecks.checkNotNull(").append(param.getSimpleName()).append(");\n");
}
} else if ( java_type.isArray() ) {
printArrayParameterCheck(writer, param.getSimpleName().toString(), check_value, can_be_null);
@ -727,44 +725,43 @@ public class JavaMethodsGenerator {
private static void printParameterCheck(PrintWriter writer, ExecutableElement method, String name, String type, String check_value, boolean can_be_null, NullTerminated null_terminated, boolean generate_error_checks) {
String tabs;
if ( can_be_null ) {
writer.print("\t\tif (" + name + " != null)");
writer.append("\t\tif (").append(name).append(" != null)");
if ( null_terminated != null ) {
writer.println(" {");
writer.append(" {\n");
} else {
writer.println();
writer.append('\n');
}
tabs = "\t\t\t";
} else {
tabs = "\t\t";
}
writer.print(tabs + "BufferChecks.check");
writer.append(tabs).append("BufferChecks.check");
if ( check_value != null && check_value.length() > 0 ) {
writer.print("Buffer");
writer.append("Buffer");
if ( "Buffer".equals(type) ) {
writer.print("Size"); // Check size only, Buffer.isDirect() was added in 1.6, cannot use yet. TODO: Remove?
writer.append("Size"); // Check size only, Buffer.isDirect() was added in 1.6, cannot use yet. TODO: Remove?
}
writer.print("(" + name + ", " + check_value);
writer.append('(').append(name).append(", ").append(check_value);
} else {
writer.print("Direct(" + name);
writer.append("Direct(").append(name);
}
writer.println(");");
writer.append(");\n");
if ( can_be_null && generate_error_checks ) {
final Check check_annotation = method.getAnnotation(Check.class);
if ( check_annotation != null && check_annotation.value().equals(name) ) {
writer.println("\t\telse");
writer.println("\t\t\t" + name + " = APIUtil.getBufferIntDebug();"); // Use an exclusive buffer here
writer.append("\t\telse\n");
writer.append("\t\t\t").append(name).append(" = APIUtil.getBufferIntDebug();\n"); // Use an exclusive buffer here
}
}
if ( null_terminated != null ) {
writer.print(tabs + "BufferChecks.checkNullTerminated(");
writer.print(name);
writer.append(tabs).append("BufferChecks.checkNullTerminated(");
writer.append(name);
if ( null_terminated.value().length() > 0 ) {
writer.print(", ");
writer.print(null_terminated.value());
writer.append(", ").append(null_terminated.value());
}
writer.println(");");
writer.append(");\n");
if ( can_be_null ) {
writer.println("\t\t}");
writer.append("\t\t}\n");
}
}
}
@ -772,32 +769,36 @@ public class JavaMethodsGenerator {
private static void printArrayParameterCheck(PrintWriter writer, String name, String check_value, boolean can_be_null) {
String tabs;
if ( can_be_null ) {
writer.println("\t\tif (" + name + " != null)");
writer.append("\t\tif (").append(name).append(" != null)\n");
tabs = "\t\t\t";
} else {
tabs = "\t\t";
}
writer.print(tabs + "BufferChecks.checkArray(" + name);
writer.append(tabs).append("BufferChecks.checkArray(").append(name);
if ( check_value != null && check_value.length() > 0 ) {
writer.print(", " + check_value);
writer.append(", ").append(check_value);
}
writer.println(");");
writer.append(");\n");
}
private static String getResultType(ExecutableElement method, boolean native_stub) {
if ( native_stub && method.getAnnotation(PointerWrapper.class) != null ) {
return "long";
} else if ( !native_stub && method.getAnnotation(GLreturn.class) != null ) {
return Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false);
if (native_stub) {
if (method.getAnnotation(PointerWrapper.class) != null) return "long";
} else {
return Utils.getJavaType(Utils.getMethodReturnType(method)).getSimpleName();
GLreturn gl_return = method.getAnnotation(GLreturn.class);
if (gl_return != null) {
return Utils.getMethodReturnType(method, gl_return, false);
}
}
return Utils.getJavaType(Utils.getMethodReturnType(method)).getSimpleName();
}
private static String getDefaultResultValue(ExecutableElement method) {
if ( method.getAnnotation(GLreturn.class) != null ) {
final String type = Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false);
GLreturn gl_return = method.getAnnotation(GLreturn.class);
if (gl_return != null) {
final String type = Utils.getMethodReturnType(method, gl_return, false);
if ( "boolean".equals(type) ) {
return "false";
} else if ( Character.isLowerCase(type.charAt(0)) ) {

View File

@ -42,7 +42,7 @@ import javax.lang.model.util.SimpleTypeVisitor6;
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision$ $Id$
*/
public class JavaTypeTranslator extends SimpleTypeVisitor6<Void, Void> {
public final class JavaTypeTranslator extends SimpleTypeVisitor6<Void, Void> {
private Class type;
@ -53,23 +53,27 @@ public class JavaTypeTranslator extends SimpleTypeVisitor6<Void, Void> {
@Override
public Void visitArray(ArrayType t, Void o) {
final TypeMirror componentType = t.getComponentType();
try {
final Class c = Class.forName(t.getComponentType().toString());
if ( CharSequence.class.isAssignableFrom(c) || ByteBuffer.class.isAssignableFrom(c) || org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) {
type = Class.forName("[L" + t.getComponentType() + ";");
}
} catch (ClassNotFoundException ex) {
type = null;
} finally {
if ( type == null ) {
if ( componentType instanceof PrimitiveType ) {
type = getPrimitiveArrayClassFromKind(componentType.getKind());
} else {
throw new RuntimeException(t + " is not allowed");
}
}
if (componentType instanceof PrimitiveType) {
type = getPrimitiveArrayClassFromKind(componentType.getKind());
return DEFAULT_VALUE;
}
Class c;
try {
c = Class.forName(componentType.toString());
} catch (ClassNotFoundException ex) {
type = null;
throw new RuntimeException(t + " is not allowed");
}
if (c == CharSequence.class || c == ByteBuffer.class || c == org.lwjgl.PointerWrapper.class || CharSequence.class.isAssignableFrom(c) || ByteBuffer.class.isAssignableFrom(c) || org.lwjgl.PointerWrapper.class.isAssignableFrom(c)) {
type = c.arrayType();
return DEFAULT_VALUE;
}
type = null;
throw new RuntimeException(t + " is not allowed");
}
public static Class getPrimitiveClassFromKind(TypeKind kind) {
@ -93,7 +97,7 @@ public class JavaTypeTranslator extends SimpleTypeVisitor6<Void, Void> {
}
}
private static Class getPrimitiveArrayClassFromKind(TypeKind kind) {
public static Class getPrimitiveArrayClassFromKind(TypeKind kind) {
switch ( kind ) {
case LONG:
return long[].class;

View File

@ -54,7 +54,7 @@ import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
public class NativeMethodStubsGenerator {
public final class NativeMethodStubsGenerator {
private static final String BUFFER_ADDRESS_POSTFIX = "_address";
public static final String BUFFER_POSITION_POSTFIX = "_position";
private static final String STRING_LIST_NAME = "_str";
@ -84,13 +84,13 @@ public class NativeMethodStubsGenerator {
private static void generateParameter(PrintWriter writer, VariableElement param, Mode mode) {
writer.print(", ");
if ( mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null ) {
writer.print("jlong " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
writer.append("jlong ").append(param.getSimpleName()).append(Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
} else if ( param.getAnnotation(PointerWrapper.class) != null ) {
writer.print("jlong " + param.getSimpleName());
writer.append("jlong ").append(param.getSimpleName());
} else {
JNITypeTranslator translator = new JNITypeTranslator();
param.asType().accept(translator, null);
writer.print(translator.getSignature() + " " + param.getSimpleName());
writer.append(translator.getSignature()).append(' ').append(param.getSimpleName());
}
}
@ -127,15 +127,15 @@ public class NativeMethodStubsGenerator {
if ( context_specific ) {
writer.print(", jlong " + Utils.FUNCTION_POINTER_VAR_NAME);
}
writer.println(") {");
writer.append(") {\n");
generateBufferParameterAddresses(type_map, writer, method, mode);
Alternate alt_annotation = method.getAnnotation(Alternate.class);
if ( context_specific ) {
String typedef_name = Utils.getTypedefName(method);
writer.print("\t" + typedef_name + " " + (alt_annotation == null ? method.getSimpleName() : alt_annotation.value()));
writer.print(" = (" + typedef_name + ")((intptr_t)");
writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");");
writer.append('\t').append(typedef_name).append(' ').append(alt_annotation == null ? method.getSimpleName() : alt_annotation.value());
writer.append(" = (").append(typedef_name).append(")((intptr_t)");
writer.append(Utils.FUNCTION_POINTER_VAR_NAME + ");\n");
}
final Code code_annotation = method.getAnnotation(Code.class);
@ -146,29 +146,28 @@ public class NativeMethodStubsGenerator {
printResultParam(type_map, writer, method, result_type, true);
if ( code_annotation != null && code_annotation.nativeAfterVars().length() > 0 )
writer.println(code_annotation.nativeAfterVars());
writer.append(code_annotation.nativeAfterVars()).append('\n');
generatePointerArrayInits(type_map, writer, method.getParameters());
if ( code_annotation != null && code_annotation.nativeBeforeCall().length() > 0 )
writer.println(code_annotation.nativeBeforeCall());
writer.append(code_annotation.nativeBeforeCall()).append('\n');
writer.print("\t");
if ( resultPreDeclare )
writer.print(Utils.RESULT_VAR_NAME + " = ");
else if ( hasResult )
printResultParam(type_map, writer, method, result_type, false);
writer.print((alt_annotation == null ? method.getSimpleName() : alt_annotation.value()) + "(");
writer.append(alt_annotation == null ? method.getSimpleName() : alt_annotation.value()).append('(');
generateCallParameters(writer, type_map, method.getParameters());
writer.print(")");
writer.println(";");
writer.append(");\n");
if ( code_annotation != null && code_annotation.nativeAfterCall().length() > 0 )
writer.println(code_annotation.nativeAfterCall());
writer.append(code_annotation.nativeAfterCall()).append('\n');
generateStringDeallocations(writer, method.getParameters());
if ( !result_type.equals(env.getTypeUtils().getNoType(TypeKind.VOID)) ) {
writer.print("\treturn ");
writer.append("\treturn ");
Class java_result_type = Utils.getJavaType(result_type);
if ( Buffer.class.isAssignableFrom(java_result_type) ) {
if ( cached_result_annotation != null )
@ -194,10 +193,9 @@ public class NativeMethodStubsGenerator {
if ( Buffer.class.isAssignableFrom(java_result_type) ||
String.class.equals(java_result_type) )
writer.print(")");
writer.println(";");
writer.append(";\n");
}
writer.println("}");
writer.println();
writer.append("}\n");
}
private static void printResultParam(final TypeMap type_map, final PrintWriter writer, final ExecutableElement method, final TypeMirror result_type, final boolean preDeclare) {
@ -207,11 +205,11 @@ public class NativeMethodStubsGenerator {
result_type.accept(result_translator, null);
if ( preDeclare )
writer.print("\t");
writer.print(result_translator.getSignature() + " " + Utils.RESULT_VAR_NAME);
writer.append(result_translator.getSignature()).append(' ').append(Utils.RESULT_VAR_NAME);
if ( preDeclare )
writer.println(";");
writer.append(";\n");
else
writer.print(result_param == null ? " = " : ";\n\t");
writer.append(result_param == null ? " = " : ";\n\t");
}
private static void generateCallParameters(PrintWriter writer, TypeMap type_map, List<? extends VariableElement> params) {
@ -224,7 +222,7 @@ public class NativeMethodStubsGenerator {
if ( first )
first = false;
else
writer.print(", ");
writer.append(", ");
generateCallParameter(writer, type_map, param);
}
@ -237,31 +235,31 @@ public class NativeMethodStubsGenerator {
final Constant constant_annotation = param.getAnnotation(Constant.class);
if ( constant_annotation != null && constant_annotation.isNative() ) {
writer.print(constant_annotation.value());
writer.append(constant_annotation.value());
return;
}
boolean is_indirect = param.getAnnotation(Indirect.class) != null;
if ( is_indirect || param.getAnnotation(PointerArray.class) != null ) {
writer.print("(");
writer.append('(');
final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
param.asType().accept(translator, null);
writer.print(translator.getSignature());
writer.print("*)");
writer.append(translator.getSignature());
writer.append("*)");
}
if ( param.getAnnotation(PointerWrapper.class) != null )
writer.print("(" + param.getAnnotation(PointerWrapper.class).value() + ")(intptr_t)");
writer.append('(').append(param.getAnnotation(PointerWrapper.class).value()).append(")(intptr_t)");
if ( param.getAnnotation(Result.class) != null || is_indirect )
writer.print("&");
writer.append('&');
if ( param.getAnnotation(Result.class) != null ) {
writer.print(Utils.RESULT_VAR_NAME);
writer.append(Utils.RESULT_VAR_NAME);
} else {
writer.print(param.getSimpleName());
writer.append(param.getSimpleName());
if ( param.getAnnotation(PointerArray.class) != null )
writer.print(getPointerArrayName(Utils.getJavaType(param.asType())));
writer.append(getPointerArrayName(Utils.getJavaType(param.asType())));
else if ( Utils.isAddressableType(param.asType()) )
writer.print(BUFFER_ADDRESS_POSTFIX);
writer.append(BUFFER_ADDRESS_POSTFIX);
}
}
@ -269,9 +267,9 @@ public class NativeMethodStubsGenerator {
for ( VariableElement param : params ) {
final Class java_type = Utils.getJavaType(param.asType());
if ( java_type.equals(String.class) && param.getAnnotation(Result.class) == null )
writer.println("\tfree(" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ");");
writer.append("\tfree(" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ");\n");
else if ( param.getAnnotation(PointerArray.class) != null ) // Free the string array mem
writer.println("\tfree(" + param.getSimpleName() + getPointerArrayName(java_type) + ");");
writer.append("\tfree(" + param.getSimpleName() + getPointerArrayName(java_type) + ");\n");
}
}
@ -298,22 +296,22 @@ public class NativeMethodStubsGenerator {
final String native_type = translator.getSignature();
if ( !java_type.isArray() || CharSequence.class.isAssignableFrom(java_type.getComponentType()) ) {
writer.print("\t" + native_type + param.getSimpleName());
writer.print(BUFFER_ADDRESS_POSTFIX + " = (");
writer.print(native_type);
writer.print(")(intptr_t)");
writer.append('\t').append(native_type).append(param.getSimpleName());
writer.append(BUFFER_ADDRESS_POSTFIX + " = (");
writer.append(native_type);
writer.append(")(intptr_t)");
if ( mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null ) {
writer.print("offsetToPointer(" + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX + ")");
writer.append("offsetToPointer(").append(param.getSimpleName()).append(Utils.BUFFER_OBJECT_PARAMETER_POSTFIX + ')');
} else {
if ( Buffer.class.isAssignableFrom(java_type) || java_type.equals(CharSequence.class) || java_type.equals(CharSequence[].class) || PointerBuffer.class.isAssignableFrom(java_type) ) {
writer.print(param.getSimpleName());
writer.append(param.getSimpleName());
} else if ( java_type.equals(String.class) ) {
writer.print("GetStringNativeChars(env, " + param.getSimpleName() + ")");
writer.append("GetStringNativeChars(env, ").append(param.getSimpleName()).append(')');
} else if ( array_annotation == null )
throw new RuntimeException("Illegal type " + java_type);
}
writer.println(";");
writer.append(";\n");
}
if ( array_annotation != null ) {
@ -327,8 +325,8 @@ public class NativeMethodStubsGenerator {
// Declare loop counters and allocate object array
if ( !ptrLoopDeclared ) {
writer.println("\tint " + n + "_i;");
writer.println("\tjobject " + n + "_object;");
writer.append("\tint ").append(n).append("_i;\n");
writer.append("\tjobject ").append(n).append("_object;\n");
ptrLoopDeclared = true;
}
} else {
@ -339,16 +337,16 @@ public class NativeMethodStubsGenerator {
// Declare loop counters and allocate string array
if ( !strLoopDeclared ) {
writer.println("\tint " + n + "_i;");
writer.println("\t" + arrayType + n + "_address;");
writer.append("\tint ").append(n).append("_i;\n");
writer.append("\t").append(arrayType).append(n).append("_address;\n");
strLoopDeclared = true;
}
}
writer.print("\t" + arrayType + "*" + param.getSimpleName() + n + " = ");
writer.append('\t').append(arrayType).append('*').append(param.getSimpleName()).append(n).append(" = ");
if ( check_annotation != null && check_annotation.canBeNull() )
writer.print(array_annotation.value() + " == 0 ? NULL : ");
writer.println("(" + arrayType + "*) malloc(" + array_annotation.value() + " * sizeof(" + arrayType + "));");
writer.append(array_annotation.value()).append(" == 0 ? NULL : ");
writer.append('(').append(arrayType).append("*) malloc(").append(array_annotation.value()).append(" * sizeof(" + arrayType + "));\n");
}
}
@ -381,32 +379,33 @@ public class NativeMethodStubsGenerator {
final String n = getPointerArrayName(java_type);
if ( POINTER_LIST_NAME.equals(n) ) {
// Init vars
writer.println("\t" + n + "_i = 0;");
writer.append('\t').append(n).append("_i = 0;\n");
// Fill pointer array with the buffer pointers
writer.println("\twhile ( " + n + "_i < " + pointerArray_annotation.value() + " ) {");
writer.println("\t\t" + n + "_object = (*env)->GetObjectArrayElement(env, " + param.getSimpleName() + ", " + n + "_i);");
writer.print("\t\t" + param.getSimpleName() + n + "[" + n + "_i++] = (" + translator.getSignature(true) + ")");
writer.append("\twhile ( ").append(n).append("_i < ").append(pointerArray_annotation.value()).append(" ) {\n");
writer.append("\t\t").append(n).append("_object = (*env)->GetObjectArrayElement(env, ").append(param.getSimpleName()).append(", ").append(n).append("_i);\n");
writer.append("\t\t").append(param.getSimpleName()).append(n).append('[').append(n).append("_i++] = (").append(translator.getSignature(true)).append(')');
if ( Buffer.class.isAssignableFrom(component_type) )
writer.println("(*env)->GetDirectBufferAddress(env, " + n + "_object);");
writer.append("(*env)->GetDirectBufferAddress(env, ");
else
writer.println("(intptr_t)getPointerWrapperAddress(env, " + n + "_object);");
writer.println("\t}");
writer.append("(intptr_t)getPointerWrapperAddress(env, ");
writer.append(n).append("_object);\n")
.append("\t}\n");
} else {
final String lengths = pointerArray_annotation.lengths();
// Init vars
writer.println("\t" + n + "_i = 0;");
writer.println("\t" + n + "_address = (" + translator.getSignature(true) + ")" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ";");
writer.append('\t').append(n).append("_i = 0;\n");
writer.append('\t').append(n).append("_address = (").append(translator.getSignature(true)).append(')').append(param.getSimpleName()).append(BUFFER_ADDRESS_POSTFIX + ";\n");
// Fill string array with the string pointers
writer.println("\twhile ( " + n + "_i < " + pointerArray_annotation.value() + " ) {");
writer.append("\twhile ( ").append(n).append("_i < ").append(pointerArray_annotation.value()).append(" ) {\n");
if ( lengths.length() == 0 ) {
writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i++] = " + n + "_address;");
writer.println("\t\t" + n + "_address += strlen((const char *)" + n + "_address) + 1;");
writer.append("\t\t").append(param.getSimpleName()).append(n).append('[').append(n).append("_i++] = ").append(n).append("_address;\n");
writer.append("\t\t").append(n).append("_address += strlen((const char *)").append(n).append("_address) + 1;\n");
} else {
writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i] = " + n + "_address;");
writer.println("\t\t" + n + "_address += " + lengths + BUFFER_ADDRESS_POSTFIX + "[" + n + "_i++];");
writer.append("\t\t").append(param.getSimpleName()).append(n).append('[').append(n).append("_i] = ").append(n).append("_address;\n");
writer.append("\t\t").append(n).append("_address += ").append(lengths).append(BUFFER_ADDRESS_POSTFIX + "[").append(n).append("_i++];\n");
}
writer.println("\t}");
writer.append("\t}\n");
}
}
}

View File

@ -59,7 +59,7 @@ import javax.lang.model.util.SimpleTypeVisitor6;
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision$
*/
public class NativeTypeTranslator extends SimpleTypeVisitor6<Void, Void> {
public final class NativeTypeTranslator extends SimpleTypeVisitor6<Void, Void> {
private Collection<Class> native_types;
private boolean is_indirect;
@ -214,7 +214,10 @@ public class NativeTypeTranslator extends SimpleTypeVisitor6<Void, Void> {
* @discuss compare (DeclaredType).getAnnotation(Class) and (Element).getAnnotation(Class), they mean different Annotation's.
*/
public static <T extends Annotation> T getAnnotation(AnnotationMirror annotation, Class<T> type) {
return annotation.getAnnotationType().asElement().getAnnotation(type);
Element e = annotation.getAnnotationType().asElement();
synchronized (e) {
return e.getAnnotation(type);
}
}
private static Class translateAnnotation(AnnotationMirror annotation) {

View File

@ -51,7 +51,7 @@ import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
public class TypeInfo {
public final class TypeInfo {
public static final String UNSIGNED_PARAMETER_NAME = "unsigned";

View File

@ -51,7 +51,6 @@ public interface TypeMap {
void printCapabilitiesInit(PrintWriter writer);
String getCapabilities();
String getAPIUtilParam(boolean comma);
void printErrorCheckMethod(PrintWriter writer, ExecutableElement method, String tabs);
String getRegisterNativesFunctionName();
TypeKind getPrimitiveTypeFromNativeType(Class<? extends Annotation> native_type);
String getTypedefPostfix();

View File

@ -49,6 +49,10 @@ import java.io.PrintWriter;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;
import java.util.function.Function;
import java.util.regex.Pattern;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.*;
@ -57,7 +61,7 @@ import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVisitor;
import javax.lang.model.util.ElementFilter;
public class Utils {
public final class Utils {
public static final String TYPEDEF_POSTFIX = "PROC";
public static final String FUNCTION_POINTER_VAR_NAME = "function_pointer";
@ -73,6 +77,24 @@ public class Utils {
public static final String CACHED_BUFFER_NAME = "old_buffer";
private static final String OVERLOADED_METHOD_PREFIX = "n";
public static String getRequiredOption(Map<String, String> options, String name, String description) {
String optionValue = options.get(name);
if (optionValue == null) {
throw new IllegalArgumentException("No value specified for the '" + name + "' option. Expected " + description);
}
return optionValue;
}
public static <T> T getRequiredOption(Map<String, String> options, String name, String description, Function<String, T> adapter) {
return adapter.apply(getRequiredOption(options, name, description));
}
public static <T> T getOptionalOption(Map<String, String> options, String name, String description, Function<String, T> adapter) {
String optionValue = options.get(name);
if (optionValue == null) return null;
return adapter.apply(optionValue);
}
public static String getTypedefName(ExecutableElement method) {
Alternate alt_annotation = method.getAnnotation(Alternate.class);
return (alt_annotation == null ? method.getSimpleName() : alt_annotation.value()) + TYPEDEF_POSTFIX;
@ -147,12 +169,19 @@ public class Utils {
return Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) || CharSequence.class.isAssignableFrom(type);
}
@Deprecated
public static Class getJavaType(TypeMirror type_mirror) {
JavaTypeTranslator translator = new JavaTypeTranslator();
type_mirror.accept((TypeVisitor)translator, null);
return translator.getType();
}
public static String getDescriptor(TypeMirror type_mirror) {
DescriptorTypeTranslator translator = new DescriptorTypeTranslator();
type_mirror.accept((TypeVisitor)translator, null);
return translator.descriptor();
}
private static boolean hasParameterMultipleTypes(VariableElement param) {
int num_native_annotations = 0;
for ( AnnotationMirror annotation : param.getAnnotationMirrors() ) {
@ -164,7 +193,7 @@ public class Utils {
}
public static boolean isParameterMultiTyped(VariableElement param) {
boolean result = Buffer.class.equals(Utils.getJavaType(param.asType()));
boolean result = DescriptorTypeTranslator.forClass(Buffer.class).equals(Utils.getDescriptor(param.asType()));
if ( !result && hasParameterMultipleTypes(param) ) {
throw new RuntimeException(param + " not defined as java.nio.Buffer but has multiple types");
}
@ -191,11 +220,11 @@ public class Utils {
String doc_comment = pe.getElementUtils().getDocComment(decl);
if ( doc_comment != null ) {
final String tab = (decl instanceof TypeElement) ? "" : "\t";
writer.println(tab + "/**");
writer.append(tab).append("/**\n");
if ( overloadsComment != null ) {
writer.println("\t * " + overloadsComment);
writer.println("\t * <p>");
writer.append("\t * ").append(overloadsComment).append('\n');
writer.append("\t * <p>").append('\n');
}
final StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n", true);
@ -204,18 +233,18 @@ public class Utils {
final String t = doc_lines.nextToken();
if ( "\n".equals(t) ) {
if ( lastWasNL ) {
writer.println(tab + " * <p>");
writer.append(tab).append(" * <p>").append('\n');
}
lastWasNL = true;
} else {
writer.println(tab + " * " + t);
writer.append(tab).append(" * ").append(t).append('\n');
lastWasNL = false;
}
}
writer.println(tab + " */");
writer.append(tab).append(" */\n");
} else if ( overloadsComment != null ) {
writer.println("\t/** " + overloadsComment + " */");
writer.append("\t/** ").append(overloadsComment).append(" */\n");
}
}
@ -244,10 +273,8 @@ public class Utils {
return true;
}
private static final Pattern DOT_PATTERN = Pattern.compile("\\.");
public static String getNativeQualifiedName(String qualified_name) {
return DOT_PATTERN.matcher(qualified_name).replaceAll("_");
return qualified_name.replace('.', '_');
}
public static String getQualifiedNativeMethodName(String qualified_class_name, String method_name) {
@ -318,9 +345,9 @@ public class Utils {
}
public static void printExtraCallArguments(PrintWriter writer, ExecutableElement method, String size_parameter_name) {
writer.print(size_parameter_name);
writer.append(size_parameter_name);
if ( method.getAnnotation(CachedResult.class) != null ) {
writer.print(", " + CACHED_BUFFER_NAME);
writer.append(", ").append(CACHED_BUFFER_NAME);
}
}
@ -394,7 +421,7 @@ public class Utils {
throw new RuntimeException("The parameter specified in @GLreturn is annotated with @Check in method: " + method);
}
if ( param.getAnnotation(GLchar.class) != null && Utils.getJavaType(param.asType()).equals(ByteBuffer.class) && string_annotation.maxLength().length() == 0 ) {
if ( param.getAnnotation(GLchar.class) != null && DescriptorTypeTranslator.forClass(ByteBuffer.class).equals(Utils.getDescriptor(param.asType())) && string_annotation.maxLength().length() == 0 ) {
throw new RuntimeException("The @GLreturn annotation is missing a maxLength parameter in method: " + method);
}
@ -412,15 +439,15 @@ public class Utils {
continue;
}
final Class type = Utils.getJavaType(p.asType());
if ( type.equals(CharSequence.class) ) {
final String type = Utils.getDescriptor(p.asType());
if (DescriptorTypeTranslator.forClass(CharSequence.class).equals(type)) {
if ( offset == null ) {
offset = p.getSimpleName() + ".length()";
} else {
offset += " + " + p.getSimpleName() + ".length()";
}
//if ( p.getAnnotation(NullTerminated.class) != null ) offset += " + 1";
} else if ( type.equals(CharSequence[].class) ) {
} else if (DescriptorTypeTranslator.forArray(DescriptorTypeTranslator.forClass(CharSequence.class)).equals(type)) {
if ( offset == null ) {
offset = "APIUtil.getTotalLength(" + p.getSimpleName() + ")";
} else {
@ -438,10 +465,9 @@ public class Utils {
if ( "String".equals(return_type) ) {
if ( !return_annotation.forceMaxLength() ) {
writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtil.getLengths(" + type_map.getAPIUtilParam(false) + ");");
writer.print("\t\t");
writer.append("IntBuffer ").append(return_annotation.value()).append("_length = APIUtil.getLengths(").append(type_map.getAPIUtilParam(false)).append(");\n\t\t");
}
writer.print("ByteBuffer " + return_annotation.value() + " = APIUtil.getBufferByte(" + type_map.getAPIUtilParam(true) + return_annotation.maxLength());
writer.append("ByteBuffer ").append(return_annotation.value()).append(" = APIUtil.getBufferByte(").append(type_map.getAPIUtilParam(true)).append(return_annotation.maxLength());
/*
Params that use the return buffer will advance its position while filling it. When we return, the position will be
at the right spot for grabbing the returned string bytes. We only have to make sure that the original buffer was
@ -449,24 +475,27 @@ public class Utils {
*/
final String offset = getStringOffset(method, null);
if ( offset != null ) {
writer.print(" + " + offset);
writer.append(" + ").append(offset);
}
writer.println(");");
writer.append(");\n");
} else {
final String buffer_type = "Boolean".equals(return_type) ? "Byte" : return_type;
writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtil.getBuffer" + buffer_type + "(" + type_map.getAPIUtilParam(false));
writer.append(buffer_type).append("Buffer ").append(return_annotation.value()).append(" = APIUtil.getBuffer").append(buffer_type).append('(').append(type_map.getAPIUtilParam(false));
if ( "Byte".equals(buffer_type) ) {
writer.print((type_map.getAPIUtilParam(false).length() > 0 ? ", " : "") + "1");
if (type_map.getAPIUtilParam(false).length() > 0) {
writer.append(", ");
}
writer.append('1');
}
writer.println(");");
writer.append(");\n");
}
final Code code_annotation = method.getAnnotation(Code.class);
if ( code_annotation != null && code_annotation.tryBlock() ) {
writer.println("\t\ttry {");
writer.print("\t\t\t");
writer.append("\t\ttry {\n");
writer.append("\t\t\t");
} else {
writer.print("\t\t");
writer.append("\t\t");
}
}
@ -474,33 +503,49 @@ public class Utils {
final String return_type = getMethodReturnType(method, return_annotation, true);
if ( "String".equals(return_type) ) {
writer.print("\t\t" + return_annotation.value() + ".limit(");
writer.append("\t\t").append(return_annotation.value()).append(".limit(");
final String offset = getStringOffset(method, null);
if ( offset != null ) {
writer.print(offset + " + ");
writer.append(offset).append(" + ");
}
if ( return_annotation.forceMaxLength() ) {
writer.print(return_annotation.maxLength());
writer.append(return_annotation.maxLength());
} else {
writer.print(return_annotation.value() + "_length.get(0)");
writer.append(return_annotation.value()).append("_length.get(0)");
}
writer.println(");");
writer.println("\t\treturn APIUtil.getString(" + type_map.getAPIUtilParam(true) + return_annotation.value() + ");");
writer.append(");\n");
writer.append("\t\treturn APIUtil.getString(").append(type_map.getAPIUtilParam(true)).append(return_annotation.value()).append(");\n");
} else {
writer.print("\t\treturn " + return_annotation.value() + ".get(0)");
writer.append("\t\treturn ").append(return_annotation.value()).append(".get(0)");
if ( "Boolean".equals(return_type) ) {
writer.print(" == 1");
writer.append(" == 1");
}
writer.println(";");
writer.append(";\n");
}
}
public static Collection<VariableElement> getFields(TypeElement d) {
return ElementFilter.fieldsIn(new LinkedHashSet<Element>(d.getEnclosedElements()));
return ElementFilter.fieldsIn(d.getEnclosedElements());
}
public static Collection<ExecutableElement> getMethods(TypeElement d) {
return ElementFilter.methodsIn(new LinkedHashSet<Element>(d.getEnclosedElements()));
return ElementFilter.methodsIn(d.getEnclosedElements());
}
/**
* Awaits the future and throws unchecked exceptions.
*/
public static <T> T await(Future<T> future) {
try {
return future.get();
} catch (java.util.concurrent.ExecutionException e) {
throw new RuntimeException(e.getCause());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
public static <T> Future<T> spawn(Callable<T> f) {
return ForkJoinPool.commonPool().submit(f);
}
}

View File

@ -53,7 +53,7 @@ import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.type.TypeKind;
public class ALTypeMap implements TypeMap {
public final class ALTypeMap implements TypeMap {
private static final Map<Class, TypeKind> native_types_to_primitive;
static {
@ -190,11 +190,6 @@ public class ALTypeMap implements TypeMap {
return "";
}
@Override
public void printErrorCheckMethod(final PrintWriter writer, final ExecutableElement method, final String tabs) {
writer.println(tabs + "Util.checkALError();");
}
@Override
public String getRegisterNativesFunctionName() {
return "extal_InitializeClass";

View File

@ -45,7 +45,7 @@ import javax.lang.model.element.TypeElement;
*
* @author Spasi
*/
public class CLCapabilitiesGenerator {
public final class CLCapabilitiesGenerator {
static void generateClassPrologue(final PrintWriter writer) {
writer.println("public final class " + CLGeneratorProcessor.CLCAPS_CLASS_NAME + " {");

View File

@ -35,24 +35,34 @@ import org.lwjgl.PointerWrapper;
import org.lwjgl.opencl.CLDevice;
import org.lwjgl.opencl.CLPlatform;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Path;
import java.lang.annotation.Annotation;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.ElementFilter;
import static org.lwjgl.util.generator.GeneratorVisitor.saveGeneratedJavaSource;
import static org.lwjgl.util.generator.Utils.getRequiredOption;
import static org.lwjgl.util.generator.Utils.await;
import static org.lwjgl.util.generator.Utils.spawn;
/**
* Generator tool for creating the OpenCL capabilities classes
*
* @author Spasi
*/
@SupportedAnnotationTypes({ "*" })
@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedOptions({ "generatechecks", "contextspecific" })
public class CLGeneratorProcessor extends AbstractProcessor {
@SupportedSourceVersion(SourceVersion.RELEASE_10)
@SupportedOptions({ "genJavaPath", "generatechecks", "contextspecific" })
public final class CLGeneratorProcessor extends AbstractProcessor {
public static final String CLCAPS_CLASS_NAME = "CLCapabilities";
public static final String PLATFORM_CAPS_CLASS_NAME = "CLPlatformCapabilities";
@ -77,15 +87,19 @@ public class CLGeneratorProcessor extends AbstractProcessor {
System.exit(0);
return true;
}
Map<String, String> options = processingEnv.getOptions();
Path genJavaPath = Path.of(getRequiredOption(options, "genJavaPath", "a path."));
try {
Set<TypeElement> templates = ElementFilter.typesIn(roundEnv.getRootElements());
/**
* provide the full set of ex-InterfaceDeclaration
* annotated templates elements
*/
generateCLCapabilitiesSource(templates);
generateCLPDCapabilitiesSource(templates, CLPlatformExtension.class, PLATFORM_CAPS_CLASS_NAME, CLPlatform.class, "platform");
generateCLPDCapabilitiesSource(templates, CLDeviceExtension.class, DEVICE_CAPS_CLASS_NAME, CLDevice.class, "device");
generateCLCapabilitiesSource(genJavaPath, templates);
generateCLPDCapabilitiesSource(genJavaPath, templates, CLPlatformExtension.class, PLATFORM_CAPS_CLASS_NAME, CLPlatform.class, "platform");
generateCLPDCapabilitiesSource(genJavaPath, templates, CLDeviceExtension.class, DEVICE_CAPS_CLASS_NAME, CLDevice.class, "device");
first_round = false;
return true;
} catch (IOException e) {
@ -100,8 +114,10 @@ public class CLGeneratorProcessor extends AbstractProcessor {
writer.println();
}
private void generateCLCapabilitiesSource(Set<TypeElement> templates) throws IOException {
final PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opencl." + CLCAPS_CLASS_NAME, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opencl")).openWriter());
private void generateCLCapabilitiesSource(Path genJavaPath, Set<TypeElement> templates) throws IOException {
long startTime = System.currentTimeMillis();
ByteArrayOutputStream writer1 = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(writer1);
printHeader(writer);
CLCapabilitiesGenerator.generateClassPrologue(writer);
@ -122,11 +138,14 @@ public class CLGeneratorProcessor extends AbstractProcessor {
}
writer.println("}");
writer.close();
writer.flush();
saveGeneratedJavaSource(processingEnv.getMessager(), genJavaPath, "org.lwjgl.opencl." + CLCAPS_CLASS_NAME, spawn((Callable<byte[]>) () -> writer1.toByteArray()), startTime);
}
private void generateCLPDCapabilitiesSource(Set<TypeElement> templates, final Class<? extends Annotation> capsType, final String capsName, final Class<? extends PointerWrapper> objectType, final String objectName) throws IOException {
final PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opencl." + capsName, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opencl")).openWriter());
private void generateCLPDCapabilitiesSource(Path genJavaPath, Set<TypeElement> templates, final Class<? extends Annotation> capsType, final String capsName, final Class<? extends PointerWrapper> objectType, final String objectName) throws IOException {
long startTime = System.currentTimeMillis();
ByteArrayOutputStream writer1 = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(writer1);
printHeader(writer);
writer.println("import java.util.*;");
writer.println();
@ -147,6 +166,7 @@ public class CLGeneratorProcessor extends AbstractProcessor {
CLPDCapabilitiesGenerator.generateToString(writer, templates, capsType);
writer.println("}");
writer.close();
writer.flush();
saveGeneratedJavaSource(processingEnv.getMessager(), genJavaPath, "org.lwjgl.opencl." + capsName, spawn((Callable<byte[]>) () -> writer1.toByteArray()), startTime);
}
}

View File

@ -48,7 +48,7 @@ import javax.lang.model.element.TypeElement;
*
* @author Spasi
*/
public class CLPDCapabilitiesGenerator {
public final class CLPDCapabilitiesGenerator {
// TODO: Add future versions here
private static final int[][] CL_VERSIONS = {
@ -56,7 +56,7 @@ public class CLPDCapabilitiesGenerator {
};
static void generateClassPrologue(final PrintWriter writer, final String name) {
writer.println("public class " + name + " {");
writer.println("public final class " + name + " {");
writer.println();
writer.println("\tpublic final int majorVersion;");
writer.println("\tpublic final int minorVersion;");
@ -151,4 +151,4 @@ public class CLPDCapabilitiesGenerator {
writer.println("\t}\n");
}
}
}

View File

@ -53,7 +53,7 @@ import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeKind;
public class CLTypeMap implements TypeMap {
public final class CLTypeMap implements TypeMap {
private static final Map<Class, TypeKind> native_types_to_primitive;
@ -96,29 +96,6 @@ public class CLTypeMap implements TypeMap {
return "";
}
@Override
public void printErrorCheckMethod(final PrintWriter writer, final ExecutableElement method, final String tabs) {
final Check check = method.getAnnotation(Check.class);
if ( check != null ) // Get the error code from an IntBuffer output parameter
writer.println(tabs + "Util.checkCLError(" + check.value() + ".get(" + check.value() + ".position()));");
else {
final Class return_type = Utils.getJavaType(method.getReturnType());
if ( return_type == int.class )
writer.println(tabs + "Util.checkCLError(__result);");
else {
boolean hasErrCodeParam = false;
for ( final VariableElement param : method.getParameters() ) {
if ( "errcode_ret".equals(param.getSimpleName().toString()) && Utils.getJavaType(param.asType()) == IntBuffer.class ) {
hasErrCodeParam = true;
break;
}
}
if ( hasErrCodeParam )
throw new RuntimeException("A method is missing the @Check annotation: " + method.toString());
}
}
}
@Override
public String getRegisterNativesFunctionName() {
return "extcl_InitializeClass";
@ -285,4 +262,4 @@ public class CLTypeMap implements TypeMap {
public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
return null;
}
}
}

View File

@ -39,7 +39,7 @@ import java.util.Arrays;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.*;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
@ -51,7 +51,7 @@ import javax.lang.model.type.TypeMirror;
* @version $Revision: 3355 $
* $Id: ContextCapabilitiesGenerator.java 3355 2010-05-27 22:56:29Z spasi $
*/
public class GLCapabilitiesGenerator {
public final class GLCapabilitiesGenerator {
private static final String STUBS_LOADED_NAME = "loaded_stubs";
private static final String ALL_INIT_METHOD_NAME = "initAllStubs";
@ -62,26 +62,23 @@ public class GLCapabilitiesGenerator {
private static final String CORE_PREFIX = "Open";
public static void generateClassPrologue(PrintWriter writer, boolean context_specific, boolean generate_error_checks) {
writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {");
writer.println("\tstatic final boolean DEBUG = " + Boolean.toString(generate_error_checks) + ";");
writer.println("\tfinal APIUtil util = new APIUtil();");
writer.println("\tfinal StateTracker tracker = new StateTracker();");
writer.println();
writer.append("public final class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {\n");
writer.append("\tstatic final boolean DEBUG = ").append(Boolean.toString(generate_error_checks)).append(";\n");
writer.append("\tfinal APIUtil util = new APIUtil();\n");
writer.append("\tfinal StateTracker tracker = new StateTracker();\n\n");
if ( !context_specific ) {
writer.println("\tprivate static boolean " + STUBS_LOADED_NAME + " = false;");
writer.append("\tprivate static boolean " + STUBS_LOADED_NAME + " = false;\n");
}
}
public static void generateInitializerPrologue(PrintWriter writer) {
writer.println("\t" + Utils.CONTEXT_CAPS_CLASS_NAME + "(boolean forwardCompatible) throws LWJGLException {");
writer.println("\t\tSet<String> " + CACHED_EXTS_VAR_NAME + " = " + ALL_INIT_METHOD_NAME + "(forwardCompatible);");
writer.append("\t" + Utils.CONTEXT_CAPS_CLASS_NAME + "(boolean forwardCompatible) throws LWJGLException {\n");
writer.append("\t\tSet<String> " + CACHED_EXTS_VAR_NAME + " = " + ALL_INIT_METHOD_NAME + "(forwardCompatible);\n");
}
private static String translateFieldName(String interface_name) {
if ( interface_name.startsWith("GL") )
return CORE_PREFIX + interface_name;
else
return EXTENSION_PREFIX + interface_name;
private static PrintWriter translateFieldName(PrintWriter writer, String interface_name) {
return writer.append(interface_name.startsWith("GL") ? CORE_PREFIX : EXTENSION_PREFIX)
.append(interface_name);
}
public static void generateSuperClassAdds(PrintWriter writer, TypeElement d, ProcessingEnvironment env) {
@ -90,83 +87,81 @@ public class GLCapabilitiesGenerator {
throw new RuntimeException(d + " extends more than one other interface");
if ( super_interfaces.size() == 1 ) {
TypeMirror super_interface = super_interfaces.iterator().next();
writer.print("\t\tif (" + CACHED_EXTS_VAR_NAME + ".contains(\"");
writer.println(translateFieldName(d.getSimpleName().toString()) + "\"))");
writer.print("\t\t\t");
writer.append("\t\tif (" + CACHED_EXTS_VAR_NAME + ".contains(\"");
translateFieldName(writer, d.getSimpleName().toString()).append("\"))\n" + "\t\t\t");
generateAddExtension(writer, env.getElementUtils().getTypeElement(super_interface.toString()));
}
}
public static void generateInitializer(PrintWriter writer, TypeElement d, ProcessingEnvironment env) {
String translated_field_name = translateFieldName(d.getSimpleName().toString());
writer.print("\t\tthis." + translated_field_name + " = ");
writer.print(CACHED_EXTS_VAR_NAME + ".contains(\"");
writer.print(translated_field_name + "\")");
String non_translated_field_name = d.getSimpleName().toString();
translateFieldName(writer.append("\t\tthis."), non_translated_field_name).append(" = ");
writer.append(CACHED_EXTS_VAR_NAME + ".contains(\"");
translateFieldName(writer, non_translated_field_name).append("\")");
List<? extends TypeMirror> super_interfaces = d.getInterfaces();
if ( super_interfaces.size() > 1 )
throw new RuntimeException(d + " extends more than one other interface");
if ( super_interfaces.size() == 1 ) {
TypeMirror super_interface = super_interfaces.iterator().next();
writer.println();
writer.print("\t\t\t&& " + CACHED_EXTS_VAR_NAME + ".contains(\"");
writer.print(translateFieldName(env.getElementUtils().getTypeElement(super_interface.toString()).getSimpleName().toString()) + "\")");
writer.append("\n\t\t\t&& " + CACHED_EXTS_VAR_NAME + ".contains(\"");
translateFieldName(writer, env.getElementUtils().getTypeElement(super_interface.toString()).getSimpleName().toString()).append("\")");
}
Alias alias_annotation = d.getAnnotation(Alias.class);
if ( alias_annotation != null ) {
writer.println();
writer.print("\t\t\t|| " + CACHED_EXTS_VAR_NAME + ".contains(\"");
writer.print(translateFieldName(alias_annotation.value()) + "\")");
writer.append("\n\t\t\t|| " + CACHED_EXTS_VAR_NAME + ".contains(\"");
translateFieldName(writer, alias_annotation.value()).append("\")");
}
writer.println(";");
writer.append(";\n");
}
private static String getAddressesInitializerName(String class_name) {
return class_name + POINTER_INITIALIZER_POSTFIX;
private static PrintWriter getAddressesInitializerName(PrintWriter writer, String class_name) {
return writer.append(class_name).append(POINTER_INITIALIZER_POSTFIX);
}
public static void generateInitStubsPrologue(PrintWriter writer, boolean context_specific) {
writer.println("\tprivate Set<String> " + ALL_INIT_METHOD_NAME + "(boolean forwardCompatible) throws LWJGLException {");
writer.append("\tprivate Set<String> " + ALL_INIT_METHOD_NAME + "(boolean forwardCompatible) throws LWJGLException {\n");
// Load the basic pointers we need to detect OpenGL version and supported extensions.
writer.println("\t\tglGetError = GLContext.getFunctionAddress(\"glGetError\");");
writer.println("\t\tglGetString = GLContext.getFunctionAddress(\"glGetString\");");
writer.append("\t\tglGetError = GLContext.getFunctionAddress(\"glGetError\");\n");
writer.append("\t\tglGetString = GLContext.getFunctionAddress(\"glGetString\");\n");
// Initialize GL11.glGetIntegerv and GL30.glGetStringi here, in case we have created an OpenGL 3.0 context.
// (they will be used in GLContext.getSupportedExtensions)
writer.println("\t\tglGetIntegerv = GLContext.getFunctionAddress(\"glGetIntegerv\");");
writer.println("\t\tglGetStringi = GLContext.getFunctionAddress(\"glGetStringi\");");
writer.append("\t\tglGetIntegerv = GLContext.getFunctionAddress(\"glGetIntegerv\");\n");
writer.append("\t\tglGetStringi = GLContext.getFunctionAddress(\"glGetStringi\");\n");
// Get the supported extensions set.
writer.println("\t\tGLContext.setCapabilities(this);");
writer.println("\t\tSet<String> " + CACHED_EXTS_VAR_NAME + " = new HashSet<String>(256);");
writer.println("\t\tint " + PROFILE_MASK_VAR_NAME + " = GLContext.getSupportedExtensions(" + CACHED_EXTS_VAR_NAME + ");");
writer.append("\t\tGLContext.setCapabilities(this);\n");
writer.append("\t\tSet<String> " + CACHED_EXTS_VAR_NAME + " = new HashSet<String>(256);\n");
writer.append("\t\tint " + PROFILE_MASK_VAR_NAME + " = GLContext.getSupportedExtensions(" + CACHED_EXTS_VAR_NAME + ");\n");
// Force forward compatible mode when OpenGL version is 3.1 or higher and ARB_compatibility is not available.
writer.println("\t\tif ( supported_extensions.contains(\"OpenGL31\") && !(supported_extensions.contains(\"GL_ARB_compatibility\") || (profileMask & GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0) )");
writer.println("\t\t\tforwardCompatible = true;");
writer.append("\t\tif (" + CACHED_EXTS_VAR_NAME + ".contains(\"OpenGL31\") && !(" + CACHED_EXTS_VAR_NAME + ".contains(\"GL_ARB_compatibility\") || (" + PROFILE_MASK_VAR_NAME + " & GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0)) {\n");
writer.append("\t\t\tforwardCompatible = true;\n");
writer.append("\t\t\tLWJGLUtil.logger().log(() -> \"Forcing forwardCompatible=true because OpenGL version is 3.1 or higher AND ARB_compatibility is not available OR " + PROFILE_MASK_VAR_NAME + " has GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT set.\");\n");
writer.append("\t\t}\n");
if ( !context_specific ) {
writer.println("\t\tif (" + STUBS_LOADED_NAME + ")");
writer.println("\t\t\treturn GLContext.getSupportedExtensions();");
writer.println("\t\torg.lwjgl.opengl.GL11." + Utils.STUB_INITIALIZER_NAME + "();");
writer.append("\t\tif (" + STUBS_LOADED_NAME + ")\n");
writer.append("\t\t\treturn GLContext.getSupportedExtensions();\n");
writer.append("\t\torg.lwjgl.opengl.GL11." + Utils.STUB_INITIALIZER_NAME + "();\n");
} else {
writer.println("\t\tif (!" + getAddressesInitializerName("GL11") + "(forwardCompatible))");
writer.println("\t\t\tthrow new LWJGLException(\"GL11 not supported\");");
writer.append("\t\tif (!");
getAddressesInitializerName(writer, "GL11").append("(forwardCompatible))\n" + "\t\t\tthrow new LWJGLException(\"GL11 not supported\");\n");
}
}
public static void generateInitStubsEpilogue(PrintWriter writer, boolean context_specific) {
if ( !context_specific ) {
writer.println("\t\t" + STUBS_LOADED_NAME + " = true;");
writer.append("\t\t" + STUBS_LOADED_NAME + " = true;\n");
}
writer.println("\t\treturn " + CACHED_EXTS_VAR_NAME + ";");
writer.println("\t}");
writer.append("\t\treturn " + CACHED_EXTS_VAR_NAME + ";\n");
writer.append("\t}\n");
}
public static void generateUnloadStubs(ProcessingEnvironment env, PrintWriter writer, TypeElement d) {
if ( Utils.getMethods(d).size() > 0 ) {
writer.print("\t\tGLContext.resetNativeStubs(" + Utils.getSimpleClassName(d));
writer.println(".class);");
writer.append("\t\tGLContext.resetNativeStubs(").append(Utils.getSimpleClassName(d)).append(".class);\n");
}
}
@ -175,70 +170,79 @@ public class GLCapabilitiesGenerator {
if ( context_specific ) {
final Alias alias_annotation = d.getAnnotation(Alias.class);
if ( d.getAnnotation(ForceInit.class) != null )
writer.println("\t\t" + CACHED_EXTS_VAR_NAME + ".add(\"" + translateFieldName(d.getSimpleName().toString()) + "\");");
writer.print("\t\tif (");
if ( alias_annotation != null )
writer.print("(");
writer.print(CACHED_EXTS_VAR_NAME + ".contains(\"");
writer.print(translateFieldName(d.getSimpleName().toString()) + "\")");
if ( alias_annotation != null ) {
writer.print(" || " + CACHED_EXTS_VAR_NAME + ".contains(\"");
writer.print(translateFieldName(alias_annotation.value()) + "\"))");
if ( d.getAnnotation(ForceInit.class) != null ) {
writer.append("\t\t" + CACHED_EXTS_VAR_NAME + ".add(\"");
translateFieldName(writer, d.getSimpleName().toString()).append("\");\n");
}
writer.append("\t\tif (");
if ( alias_annotation != null ) {
writer.append('(');
}
writer.append(CACHED_EXTS_VAR_NAME + ".contains(\"");
translateFieldName(writer, d.getSimpleName().toString()).append("\")");
if ( alias_annotation != null ) {
writer.append(" || " + CACHED_EXTS_VAR_NAME + ".contains(\"");
translateFieldName(writer, alias_annotation.value()).append("\"))");
}
writer.append(" && !");
getAddressesInitializerName(writer, d.getSimpleName().toString()).append('(');
if ( d.getAnnotation(DeprecatedGL.class) != null ) {
writer.append("forwardCompatible");
}
writer.print(" && !" + getAddressesInitializerName(d.getSimpleName().toString()) + "(");
if ( d.getAnnotation(DeprecatedGL.class) != null )
writer.print("forwardCompatible");
if ( d.getAnnotation(Dependent.class) != null ) {
if ( d.getAnnotation(DeprecatedGL.class) != null )
writer.print(",");
writer.print("supported_extensions");
if ( d.getAnnotation(DeprecatedGL.class) != null ) {
writer.append(",");
}
writer.append(CACHED_EXTS_VAR_NAME);
}
if ( alias_annotation != null ) {
writer.println(")) {");
writer.print("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \"");
writer.println(translateFieldName(alias_annotation.value()) + "\");");
} else
writer.println("))");
writer.print("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \"");
writer.println(translateFieldName(d.getSimpleName().toString()) + "\");");
if ( alias_annotation != null )
writer.println("\t\t}");
writer.append(")) {\n" + "\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \"");
translateFieldName(writer, alias_annotation.value()).append("\");\n");
} else {
writer.append("))\n");
}
writer.append("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \"");
translateFieldName(writer, d.getSimpleName().toString()).append("\");\n");
if ( alias_annotation != null ) {
writer.append("\t\t}\n");
}
} else {
writer.print("\t\tGLContext." + Utils.STUB_INITIALIZER_NAME + "(" + Utils.getSimpleClassName(d));
writer.println(".class, " + CACHED_EXTS_VAR_NAME + ", \"" + translateFieldName(d.getSimpleName().toString()) + "\");");
writer.append("\t\tGLContext." + Utils.STUB_INITIALIZER_NAME + '(').append(Utils.getSimpleClassName(d));
writer.append(".class, " + CACHED_EXTS_VAR_NAME + ", \"");
translateFieldName(writer, d.getSimpleName().toString()).append("\");\n");
}
}
}
private static void generateAddExtension(PrintWriter writer, TypeElement d) {
writer.print(CACHED_EXTS_VAR_NAME + ".add(\"");
writer.println(translateFieldName(d.getSimpleName().toString()) + "\");");
writer.append(CACHED_EXTS_VAR_NAME + ".add(\"");
translateFieldName(writer, d.getSimpleName().toString()).append("\");\n");
}
public static void generateAddressesInitializers(ProcessingEnvironment env, PrintWriter writer, TypeElement d) {
Iterator<? extends ExecutableElement> methods = Utils.getMethods(d).iterator();
if ( !methods.hasNext() )
return;
if (!methods.hasNext()) return;
writer.print("\tprivate boolean " + getAddressesInitializerName(d.getSimpleName().toString()) + "(");
writer.append("\tprivate boolean ");
getAddressesInitializerName(writer, d.getSimpleName().toString()).append('(');
boolean optional;
boolean deprecated = d.getAnnotation(DeprecatedGL.class) != null;
Dependent dependent = d.getAnnotation(Dependent.class);
if ( deprecated )
writer.print("boolean forwardCompatible");
if ( dependent != null ) {
if ( deprecated )
writer.print(",");
writer.print("Set<String> supported_extensions");
if (deprecated) {
writer.append("boolean forwardCompatible");
}
if (dependent != null) {
if (deprecated) {
writer.append(',');
}
writer.append("Set<String> " + CACHED_EXTS_VAR_NAME);
}
Alias alias_annotation = d.getAnnotation(Alias.class);
boolean aliased = alias_annotation != null && alias_annotation.postfix().length() > 0;
writer.println(") {");
writer.println("\t\treturn ");
writer.append(") {\n" + "\t\treturn \n");
boolean first = true;
while ( methods.hasNext() ) {
@ -246,84 +250,91 @@ public class GLCapabilitiesGenerator {
if ( method.getAnnotation(Alternate.class) != null )
continue;
if ( !first )
writer.println(" &");
else
if (!first) {
writer.append(" &\n");
} else {
first = false;
}
optional = method.getAnnotation(Optional.class) != null;
deprecated = method.getAnnotation(DeprecatedGL.class) != null;
dependent = method.getAnnotation(Dependent.class);
writer.print("\t\t\t(");
if ( optional )
writer.print('(');
if ( deprecated )
writer.print("forwardCompatible || ");
if ( dependent != null ) {
if ( dependent.value().indexOf(',') == -1 )
writer.print("!supported_extensions.contains(\"" + dependent.value() + "\") || ");
writer.append("\t\t\t(");
if (optional) {
writer.append('(');
}
if (deprecated) {
writer.append("forwardCompatible || ");
}
if (dependent != null) {
if (dependent.value().indexOf(',') == -1)
writer.append("!" + CACHED_EXTS_VAR_NAME + ".contains(\"").append(dependent.value()).append("\") || ");
else {
writer.print("!(false");
for ( String extension : dependent.value().split(",") )
writer.print(" || supported_extensions.contains(\"" + extension + "\")");
writer.print(") || ");
writer.append("!(false");
for (String extension : dependent.value().split(",")) {
writer.append(" || " + CACHED_EXTS_VAR_NAME + ".contains(\"").append(extension).append("\")");
}
writer.append(") || ");
}
}
if ( deprecated || dependent != null )
writer.print('(');
writer.print(Utils.getFunctionAddressName(d, method) + " = ");
if (deprecated || dependent != null) {
writer.append('(');
}
writer.append(Utils.getFunctionAddressName(d, method)).append(" = ");
PlatformDependent platform_dependent = method.getAnnotation(PlatformDependent.class);
if ( platform_dependent != null ) {
if (platform_dependent != null) {
EnumSet<Platform> platform_set = EnumSet.copyOf(Arrays.asList(platform_dependent.value()));
writer.print("GLContext.getPlatformSpecificFunctionAddress(\"");
writer.print(Platform.ALL.getPrefix() + "\", ");
writer.print("new String[]{");
writer.append("GLContext.getPlatformSpecificFunctionAddress(\"").append(Platform.ALL.getPrefix()).append("\", " + "new String[]{");
Iterator<Platform> platforms = platform_set.iterator();
while ( platforms.hasNext() ) {
writer.print("\"" + platforms.next().getOSPrefix() + "\"");
if ( platforms.hasNext() )
writer.print(", ");
writer.append("\"").append(platforms.next().getOSPrefix()).append("\"");
if (platforms.hasNext()) {
writer.append(", ");
}
}
writer.print("}, new String[]{");
writer.append("}, new String[]{");
platforms = platform_set.iterator();
while ( platforms.hasNext() ) {
writer.print("\"" + platforms.next().getPrefix() + "\"");
if ( platforms.hasNext() )
writer.print(", ");
while (platforms.hasNext()) {
writer.append("\"").append(platforms.next().getPrefix()).append("\"");
if (platforms.hasNext()) {
writer.append(", ");
}
}
writer.print("}, ");
} else if ( aliased ) {
writer.print("GLContext.getFunctionAddress(new String[] {\"" + method.getSimpleName() + "\",\"" + method.getSimpleName() + alias_annotation.postfix() + "\"})) != 0");
} else
writer.print("GLContext.getFunctionAddress(");
if ( !aliased )
writer.print("\"" + method.getSimpleName() + "\")) != 0");
if ( deprecated || dependent != null )
writer.print(')');
if ( optional )
writer.print(" || true)");
writer.append("}, ");
} else if (aliased) {
writer.append("GLContext.getFunctionAddress(new String[] {\"").append(method.getSimpleName()).append("\",\"").append(method.getSimpleName()).append(alias_annotation.postfix()).append("\"})) != 0");
} else {
writer.append("GLContext.getFunctionAddress(");
}
if (!aliased) {
writer.append("\"").append(method.getSimpleName()).append("\")) != 0");
}
if (deprecated || dependent != null) {
writer.append(')');
}
if (optional) {
writer.append(" || true)");
}
}
writer.println(";");
writer.println("\t}");
writer.println();
writer.append(";\n" + "\t}\n");
}
public static void generateSymbolAddresses(ProcessingEnvironment env, PrintWriter writer, TypeElement d) {
boolean first = true;
for ( final ExecutableElement method : Utils.getMethods(d) ) {
if ( method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null )
continue;
for (final ExecutableElement method : Utils.getMethods(d)) {
if (method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null) continue;
if ( first ) {
writer.println("\t// " + d.getSimpleName());
if (first) {
writer.append("\t// ").append(d.getSimpleName()).append('\n');
first = false;
}
writer.println("\tlong " + Utils.getFunctionAddressName(d, method) + ";");
writer.append("\tpublic long ").append(Utils.getFunctionAddressName(d, method)).append(";\n");
}
}
public static void generateField(PrintWriter writer, TypeElement d) {
writer.println("\tpublic final boolean " + translateFieldName(d.getSimpleName().toString()) + ";");
writer.append("\tpublic final boolean ");
translateFieldName(writer, d.getSimpleName().toString()).append(";\n");
}
}
}

View File

@ -51,7 +51,7 @@ import javax.lang.model.type.TypeMirror;
* @version $Revision: 3334 $
* $Id: ContextCapabilitiesGenerator.java 3334 2010-04-22 23:21:48Z spasi $
*/
public class GLESCapabilitiesGenerator {
public final class GLESCapabilitiesGenerator {
private static final String STUBS_LOADED_NAME = "loaded_stubs";
private static final String ALL_INIT_METHOD_NAME = "initAllStubs";
@ -61,7 +61,7 @@ public class GLESCapabilitiesGenerator {
private static final String CORE_PREFIX = "Open";
public static void generateClassPrologue(PrintWriter writer, boolean context_specific, boolean generate_error_checks) {
writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {");
writer.println("public final class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {");
writer.println("\tstatic final boolean DEBUG = " + Boolean.toString(generate_error_checks) + ";");
writer.println();
if ( !context_specific ) {
@ -305,4 +305,4 @@ public class GLESCapabilitiesGenerator {
writer.println("\tpublic final boolean " + translateFieldName(d.getSimpleName().toString()) + ";");
}
}
}

View File

@ -33,15 +33,22 @@ package org.lwjgl.util.generator.opengl;
import org.lwjgl.util.generator.Utils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Path;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.ElementFilter;
import static org.lwjgl.util.generator.GeneratorVisitor.saveGeneratedJavaSource;
import static org.lwjgl.util.generator.Utils.getRequiredOption;
import static org.lwjgl.util.generator.Utils.spawn;
/**
* Generator tool for creating the ContexCapabilities class
*
@ -50,9 +57,9 @@ import javax.lang.model.util.ElementFilter;
* 2010-04-09 23:57:40Z spasi $
*/
@SupportedAnnotationTypes({ "*" })
@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedOptions({ "contextspecific", "generatechecks" })
public class GLESGeneratorProcessor extends AbstractProcessor {
@SupportedSourceVersion(SourceVersion.RELEASE_10)
@SupportedOptions({ "genJavaPath", "contextspecific", "generatechecks" })
public final class GLESGeneratorProcessor extends AbstractProcessor {
private static boolean first_round = true;
@ -65,8 +72,10 @@ public class GLESGeneratorProcessor extends AbstractProcessor {
Map<String, String> options = processingEnv.getOptions();
boolean generate_error_checks = options.containsKey("generatechecks");
boolean context_specific = options.containsKey("contextspecific");
Path genJavaPath = Path.of(getRequiredOption(options, "genJavaPath", "a path."));
try {
generateContextCapabilitiesSource(ElementFilter.typesIn(roundEnv.getRootElements()), context_specific, generate_error_checks);
generateContextCapabilitiesSource(genJavaPath, ElementFilter.typesIn(roundEnv.getRootElements()), context_specific, generate_error_checks);
first_round = false;
return true;
} catch (IOException e) {
@ -74,8 +83,13 @@ public class GLESGeneratorProcessor extends AbstractProcessor {
}
}
private void generateContextCapabilitiesSource(Set<TypeElement> templates, boolean context_specific, boolean generate_error_checks) throws IOException {
PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opengles." + Utils.CONTEXT_CAPS_CLASS_NAME, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opengles")).openWriter());
private void generateContextCapabilitiesSource(Path genJavaPath, Set<TypeElement> templates, boolean context_specific, boolean generate_error_checks) throws IOException {
long startTime = System.currentTimeMillis();
ProcessingEnvironment env = this.processingEnv;
ByteArrayOutputStream writer1 = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(writer1);
writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
writer.println();
writer.println("package org.lwjgl.opengles;");
@ -131,20 +145,17 @@ public class GLESGeneratorProcessor extends AbstractProcessor {
}
}
GLESCapabilitiesGenerator.generateInitStubsEpilogue(writer, context_specific);
writer.println();
writer.println("\tstatic void unloadAllStubs() {");
writer.append("\n\tstatic void unloadAllStubs() {\n");
if ( !context_specific ) {
writer.println("\t\tif (!loaded_stubs)");
writer.println("\t\t\treturn;");
writer.append("\t\tif (!loaded_stubs)\n" + "\t\t\treturn;\n");
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
GLESCapabilitiesGenerator.generateUnloadStubs(processingEnv, writer, interface_decl);
}
}
writer.println("\t\tloaded_stubs = false;");
writer.append("\t\tloaded_stubs = false;\n");
}
writer.println("\t}");
writer.println();
writer.append("\t}\n\n");
GLESCapabilitiesGenerator.generateInitializerPrologue(writer);
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
@ -153,9 +164,12 @@ public class GLESGeneratorProcessor extends AbstractProcessor {
}
}
}
writer.println("\t}");
writer.println("}");
writer.close();
writer.append("\t}\n}\n");
saveGeneratedJavaSource(env.getMessager(), genJavaPath, "org.lwjgl.opengles." + Utils.CONTEXT_CAPS_CLASS_NAME, spawn((Callable<byte[]>) () -> {
writer.flush();
return writer1.toByteArray();
}), startTime);
}
}

View File

@ -55,7 +55,7 @@ import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.type.TypeKind;
public class GLESTypeMap implements TypeMap {
public final class GLESTypeMap implements TypeMap {
private static final Map<Class<? extends Annotation>, TypeKind> native_types_to_primitive;
@ -107,11 +107,6 @@ public class GLESTypeMap implements TypeMap {
return "";
}
@Override
public void printErrorCheckMethod(final PrintWriter writer, final ExecutableElement method, final String tabs) {
writer.println(tabs + "Util.checkGLError();");
}
@Override
public String getRegisterNativesFunctionName() {
return "extgl_InitializeClass";

View File

@ -33,40 +33,50 @@ package org.lwjgl.util.generator.opengl;
import org.lwjgl.util.generator.Utils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Path;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.ElementFilter;
import static org.lwjgl.util.generator.GeneratorVisitor.saveGeneratedJavaSource;
import static org.lwjgl.util.generator.Utils.getRequiredOption;
import static org.lwjgl.util.generator.Utils.spawn;
/**
* Generator tool for creating the ContexCapabilities class
* Generator tool for creating the ContextCapabilities class
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision: 3316 $ $Id: ContextGeneratorProcessorFactory.java 3316
* 2010-04-09 23:57:40Z spasi $
*/
@SupportedAnnotationTypes({ "*" })
@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedOptions({ "generatechecks", "contextspecific" })
public class GLGeneratorProcessor extends AbstractProcessor {
@SupportedSourceVersion(SourceVersion.RELEASE_10)
@SupportedOptions({ "genJavaPath", "generatechecks", "contextspecific" })
public final class GLGeneratorProcessor extends AbstractProcessor {
private static boolean first_round = true;
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if ( roundEnv.processingOver() || !first_round ) {
if (roundEnv.processingOver() || !first_round) {
System.exit(0);
return true;
}
Map<String, String> options = processingEnv.getOptions();
Path genJavaPath = Path.of(getRequiredOption(options, "genJavaPath", "a path."));
boolean generate_error_checks = options.containsKey("generatechecks");
boolean context_specific = options.containsKey("contextspecific");
try {
generateContextCapabilitiesSource(ElementFilter.typesIn(roundEnv.getRootElements()), context_specific, generate_error_checks);
generateContextCapabilitiesSource(genJavaPath, ElementFilter.typesIn(roundEnv.getRootElements()), context_specific, generate_error_checks);
first_round = false;
return true;
} catch (IOException e) {
@ -74,17 +84,19 @@ public class GLGeneratorProcessor extends AbstractProcessor {
}
}
private void generateContextCapabilitiesSource(Set<TypeElement> templates, boolean context_specific, boolean generate_error_checks) throws IOException {
PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opengl." + Utils.CONTEXT_CAPS_CLASS_NAME, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opengl")).openWriter());
writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
writer.println();
writer.println("package org.lwjgl.opengl;");
writer.println();
writer.println("import org.lwjgl.LWJGLException;");
writer.println("import org.lwjgl.LWJGLUtil;");
writer.println("import java.util.Set;");
writer.println("import java.util.HashSet;");
writer.println();
private void generateContextCapabilitiesSource(Path genJavaPath, Set<TypeElement> templates, boolean context_specific, boolean generate_error_checks) throws IOException {
long startTime = System.currentTimeMillis();
ProcessingEnvironment env = this.processingEnv;
ByteArrayOutputStream writer1 = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(writer1);
writer.append("/* MACHINE GENERATED FILE, DO NOT EDIT */\n\n"
+ "package org.lwjgl.opengl;\n\n"
+ "import org.lwjgl.LWJGLException;\n"
+ "import org.lwjgl.LWJGLUtil;\n"
+ "import java.util.Set;\n"
+ "import java.util.HashSet;\n\n");
GLCapabilitiesGenerator.generateClassPrologue(writer, context_specific, generate_error_checks);
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
@ -93,26 +105,26 @@ public class GLGeneratorProcessor extends AbstractProcessor {
}
}
}
writer.println();
writer.append('\n');
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
GLCapabilitiesGenerator.generateSymbolAddresses(processingEnv, writer, interface_decl);
}
}
writer.println();
writer.append('\n');
if ( context_specific ) {
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
GLCapabilitiesGenerator.generateAddressesInitializers(processingEnv, writer, interface_decl);
}
}
writer.println();
writer.append('\n');
}
writer.println("\tprivate static void remove(Set supported_extensions, String extension) {");
writer.println("\t\tLWJGLUtil.log(extension + \" was reported as available but an entry point is missing\");");
writer.println("\t\tsupported_extensions.remove(extension);");
writer.println("\t}\n");
writer.append("\tprivate static void remove(Set supported_extensions, String extension) {\n"
+ "\t\tLWJGLUtil.logger().log(() -> extension + \" was reported as available but an entry point is missing\");\n"
+ "\t\tsupported_extensions.remove(extension);\n"
+ "\t}\n\n");
GLCapabilitiesGenerator.generateInitStubsPrologue(writer, context_specific);
for ( TypeElement interface_decl : templates ) {
@ -130,20 +142,18 @@ public class GLGeneratorProcessor extends AbstractProcessor {
}
}
GLCapabilitiesGenerator.generateInitStubsEpilogue(writer, context_specific);
writer.println();
writer.println("\tstatic void unloadAllStubs() {");
writer.append("\n\tstatic void unloadAllStubs() {\n");
if ( !context_specific ) {
writer.println("\t\tif (!loaded_stubs)");
writer.println("\t\t\treturn;");
writer.append("\t\tif (!loaded_stubs)\n"
+ "\t\t\treturn;\n");
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
GLCapabilitiesGenerator.generateUnloadStubs(processingEnv, writer, interface_decl);
}
}
writer.println("\t\tloaded_stubs = false;");
writer.append("\t\tloaded_stubs = false;\n");
}
writer.println("\t}");
writer.println();
writer.append("\t}\n\n");
GLCapabilitiesGenerator.generateInitializerPrologue(writer);
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
@ -152,9 +162,13 @@ public class GLGeneratorProcessor extends AbstractProcessor {
}
}
}
writer.println("\t\ttracker.init();");
writer.println("\t}");
writer.println("}");
writer.close();
writer.append("\t\ttracker.init();\n"
+ "\t}\n"
+ "}\n");
saveGeneratedJavaSource(env.getMessager(), genJavaPath, "org.lwjgl.opengl." + Utils.CONTEXT_CAPS_CLASS_NAME, spawn((Callable<byte[]>) () -> {
writer.flush();
return writer1.toByteArray();
}), startTime);
}
}

View File

@ -35,9 +35,14 @@ import org.lwjgl.util.generator.Alternate;
import org.lwjgl.util.generator.CachedReference;
import org.lwjgl.util.generator.Utils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Path;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.ExecutableElement;
@ -45,6 +50,11 @@ import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.util.ElementFilter;
import static org.lwjgl.util.generator.GeneratorVisitor.saveGeneratedJavaSource;
import static org.lwjgl.util.generator.Utils.getRequiredOption;
import static org.lwjgl.util.generator.Utils.await;
import static org.lwjgl.util.generator.Utils.spawn;
/**
* Generator tool for creating the References class
*
@ -53,9 +63,9 @@ import javax.lang.model.util.ElementFilter;
* 2009-09-08 15:07:15Z spasi $
*/
@SupportedAnnotationTypes({ "*" })
@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedOptions({ "generatechecks", "contextspecific" })
public class GLReferencesGeneratorProcessor extends AbstractProcessor {
@SupportedSourceVersion(SourceVersion.RELEASE_10)
@SupportedOptions({ "genJavaPath", "generatechecks", "contextspecific" })
public final class GLReferencesGeneratorProcessor extends AbstractProcessor {
private static final String REFERENCES_CLASS_NAME = "References";
private static final String REFERENCES_PARAMETER_NAME = "references";
@ -68,8 +78,12 @@ public class GLReferencesGeneratorProcessor extends AbstractProcessor {
System.exit(0);
return true;
}
Map<String, String> options = processingEnv.getOptions();
Path genJavaPath = Path.of(getRequiredOption(options, "genJavaPath", "a path."));
try {
generateReferencesSource(processingEnv, ElementFilter.typesIn(roundEnv.getRootElements()));
generateReferencesSource(processingEnv, genJavaPath, ElementFilter.typesIn(roundEnv.getRootElements()));
first_round = false;
return true;
} catch (IOException e) {
@ -83,7 +97,7 @@ public class GLReferencesGeneratorProcessor extends AbstractProcessor {
if ( cached_reference_annotation != null && cached_reference_annotation.name().length() == 0 ) {
Class nio_type = Utils.getNIOBufferType(param.asType());
String reference_name = Utils.getReferenceName(interface_decl, method, param);
writer.println("\t\tthis." + reference_name + " = null;");
writer.append("\t\tthis.").append(reference_name).append(" = null;\n");
}
}
}
@ -94,8 +108,7 @@ public class GLReferencesGeneratorProcessor extends AbstractProcessor {
if ( cached_reference_annotation != null && cached_reference_annotation.name().length() == 0 ) {
Class nio_type = Utils.getNIOBufferType(param.asType());
String reference_name = Utils.getReferenceName(interface_decl, method, param);
writer.print("\t\t\tthis." + reference_name + " = ");
writer.println(REFERENCES_PARAMETER_NAME + "." + reference_name + ";");
writer.append("\t\t\tthis.").append(reference_name).append(" = " + REFERENCES_PARAMETER_NAME + ".").append(reference_name).append(";\n");
}
}
}
@ -129,8 +142,7 @@ public class GLReferencesGeneratorProcessor extends AbstractProcessor {
throw new RuntimeException(param + " in method " + method + " in " + interface_decl + " is annotated with "
+ cached_reference_annotation.annotationType().getSimpleName() + " but the parameter is not a NIO buffer");
}
writer.print("\t" + nio_type.getName() + " " + Utils.getReferenceName(interface_decl, method, param));
writer.println(";");
writer.append('\t').append(nio_type.getName()).append(' ').append(Utils.getReferenceName(interface_decl, method, param)).append(";\n");
}
}
}
@ -145,42 +157,55 @@ public class GLReferencesGeneratorProcessor extends AbstractProcessor {
}
}
private void generateReferencesSource(ProcessingEnvironment env, Set<TypeElement> templates) throws IOException {
PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opengl." + REFERENCES_CLASS_NAME, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opengl")).openWriter());
writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
writer.println();
writer.println("package org.lwjgl.opengl;");
writer.println();
writer.println("class " + REFERENCES_CLASS_NAME + " extends BaseReferences {");
writer.println("\t" + REFERENCES_CLASS_NAME + "(ContextCapabilities caps) {");
writer.println("\t\tsuper(caps);");
writer.println("\t}");
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
generateReferencesFromMethods(env, writer, interface_decl);
}
}
writer.println();
writer.println("\tvoid copy(" + REFERENCES_CLASS_NAME + " " + REFERENCES_PARAMETER_NAME + ", int mask) {");
writer.println("\t\tsuper.copy(" + REFERENCES_PARAMETER_NAME + ", mask);");
writer.println("\t\tif ( (mask & GL11.GL_CLIENT_VERTEX_ARRAY_BIT) != 0 ) {");
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
generateCopiesFromMethods(processingEnv, writer, interface_decl);
}
}
writer.println("\t\t}");
writer.println("\t}");
writer.println("\tvoid clear() {");
writer.println("\t\tsuper.clear();");
for ( TypeElement interface_decl : templates ) {
if ( interface_decl.getKind().isInterface() ) {
generateClearsFromMethods(processingEnv, writer, interface_decl);
}
}
writer.println("\t}");
writer.println("}");
writer.close();
private void generateReferencesSource(ProcessingEnvironment env, Path genJavaPath, Set<TypeElement> templates) throws IOException {
long startTime = System.currentTimeMillis();
ByteArrayOutputStream writer1 = new ByteArrayOutputStream();
// interesting note: autoFlush does absolutely nothing
PrintWriter writer = new PrintWriter(writer1);
writer.append("/* MACHINE GENERATED FILE, DO NOT EDIT */\n\n"
+ "package org.lwjgl.opengl;\n\n"
+ "class " + REFERENCES_CLASS_NAME + " extends BaseReferences {\n"
+ "\t" + REFERENCES_CLASS_NAME + "(ContextCapabilities caps) {\n"
+ "\t\tsuper(caps);\n"
+ "\t}\n\n");
writer.flush();
templates.parallelStream().parallel().filter(tmpl -> tmpl.getKind().isInterface()).map(interface_decl -> {
ByteArrayOutputStream writer2 = new ByteArrayOutputStream();
PrintWriter writer3 = new PrintWriter(writer2);
generateReferencesFromMethods(env, writer3, interface_decl);
writer3.flush();
return writer2.toByteArray();
}).sequential().forEach(writer1::writeBytes);
writer.append("\tvoid copy(" + REFERENCES_CLASS_NAME + " " + REFERENCES_PARAMETER_NAME + ", int mask) {\n"
+ "\t\tsuper.copy(" + REFERENCES_PARAMETER_NAME + ", mask);\n"
+ "\t\tif ( (mask & GL11.GL_CLIENT_VERTEX_ARRAY_BIT) != 0 ) {\n");
writer.flush();
templates.parallelStream().parallel().filter(tmpl -> tmpl.getKind().isInterface()).map(interface_decl -> {
ByteArrayOutputStream writer2 = new ByteArrayOutputStream();
PrintWriter writer3 = new PrintWriter(writer2);
generateCopiesFromMethods(processingEnv, writer3, interface_decl);
writer3.flush();
return writer2.toByteArray();
}).sequential().forEach(writer1::writeBytes);
writer.append("\t\t}\n"
+ "\t}\n"
+ "\tvoid clear() {\n"
+ "\t\tsuper.clear();\n");
writer.flush();
templates.parallelStream().parallel().filter(tmpl -> tmpl.getKind().isInterface()).map(interface_decl -> {
ByteArrayOutputStream writer2 = new ByteArrayOutputStream();
PrintWriter writer3 = new PrintWriter(writer2);
generateClearsFromMethods(processingEnv, writer3, interface_decl);
writer3.flush();
return writer2.toByteArray();
}).sequential().forEach(writer1::writeBytes);
writer.append("\t}\n"
+ "}\n");
saveGeneratedJavaSource(env.getMessager(), genJavaPath, "org.lwjgl.opengl." + REFERENCES_CLASS_NAME, spawn((Callable<byte[]>) () -> {
writer.flush();
return writer1.toByteArray();
}), startTime);
}
}

View File

@ -54,7 +54,7 @@ import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.type.TypeKind;
public class GLTypeMap implements TypeMap {
public final class GLTypeMap implements TypeMap {
private static final Map<Class, TypeKind> native_types_to_primitive;
@ -113,11 +113,6 @@ public class GLTypeMap implements TypeMap {
return comma ? "caps, " : "caps";
}
@Override
public void printErrorCheckMethod(final PrintWriter writer, final ExecutableElement method, final String tabs) {
writer.println(tabs + "Util.checkGLError();");
}
@Override
public String getRegisterNativesFunctionName() {
return "extgl_InitializeClass";

View File

@ -255,8 +255,10 @@ public class MappedObjectTransformer {
assert !pad.after() || ((byteOffset + byteLengthPadded) % CacheUtil.getCacheLineSize() == 0);
}
if ( PRINT_ACTIVITY )
LWJGLUtil.log(MappedObjectTransformer.class.getSimpleName() + ": " + className + "." + field.getName() + " [type=" + field.getType().getSimpleName() + ", offset=" + byteOffset + "]");
if (PRINT_ACTIVITY) {
long byteOffset1 = byteOffset;
LWJGLUtil.logger().log(() -> MappedObjectTransformer.class.getSimpleName() + ": " + className + '.' + field.getName() + " [type=" + field.getType().getSimpleName() + ", offset=" + byteOffset1 + ']');
}
return new FieldInfo(byteOffset, byteLength, byteLengthPadded, Type.getType(field.getType()), Modifier.isVolatile(field.getModifiers()), pointer != null);
}
@ -316,8 +318,9 @@ public class MappedObjectTransformer {
return bytecode;
bytecode = cw.toByteArray();
if ( PRINT_BYTECODE )
if (PRINT_BYTECODE) {
printBytecode(bytecode);
}
return bytecode;
}
@ -509,8 +512,9 @@ public class MappedObjectTransformer {
// remove redirected fields
final MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className);
if ( mappedSubtype != null && mappedSubtype.fields.containsKey(name) ) {
if ( PRINT_ACTIVITY )
LWJGLUtil.log(MappedObjectTransformer.class.getSimpleName() + ": discarding field: " + className + "." + name + ":" + desc);
if (PRINT_ACTIVITY) {
LWJGLUtil.logger().log(() -> MappedObjectTransformer.class.getSimpleName() + ": discarding field: " + className + '.' + name + ':' + desc);
}
return null;
}
@ -1311,9 +1315,8 @@ public class MappedObjectTransformer {
StringWriter sw = new StringWriter();
ClassVisitor tracer = new TraceClassVisitor(new ClassWriter(0), new PrintWriter(sw));
new ClassReader(bytecode).accept(tracer, 0);
String dump = sw.toString();
LWJGLUtil.log(dump);
LWJGLUtil.logger().log(sw::toString);
}
}
}

View File

@ -52,21 +52,21 @@ public class Vector2f extends Vector implements Serializable, ReadableVector2f,
public float x, y;
/**
* Constructor for Vector3f.
* Constructor for Vector2f.
*/
public Vector2f() {
super();
}
/**
* Constructor
* Constructor.
*/
public Vector2f(ReadableVector2f src) {
set(src);
}
/**
* Constructor
* Constructor.
*/
public Vector2f(float x, float y) {
set(x, y);

View File

@ -0,0 +1,41 @@
module org.lwjgl {
requires java.desktop;
requires dev.pfaff.unfettered;
requires static jinput;
exports org.lwjgl;
exports org.lwjgl.examples;
exports org.lwjgl.examples.spaceinvaders;
exports org.lwjgl.input;
exports org.lwjgl.openal;
exports org.lwjgl.opencl;
exports org.lwjgl.opencl.api;
exports org.lwjgl.opengl;
exports org.lwjgl.opengles;
/*exports org.lwjgl.test;
exports org.lwjgl.test.glu;
exports org.lwjgl.test.glu.tessellation;
exports org.lwjgl.test.input;
exports org.lwjgl.test.mapped;
exports org.lwjgl.test.openal;
exports org.lwjgl.test.opencl;
exports org.lwjgl.test.opencl.gl;
exports org.lwjgl.test.opengl;
exports org.lwjgl.test.opengl.multithread;
exports org.lwjgl.test.opengl.pbuffers;
exports org.lwjgl.test.opengl.shaders;
exports org.lwjgl.test.opengl.sprites;
exports org.lwjgl.test.opengles;
exports org.lwjgl.test.opengles.util;*/
exports org.lwjgl.util;
/*exports org.lwjgl.util.generator;
exports org.lwjgl.util.generator.openal;
exports org.lwjgl.util.generator.opencl;
exports org.lwjgl.util.generator.opengl;*/
exports org.lwjgl.util.glu;
exports org.lwjgl.util.glu.tessellation;
exports org.lwjgl.util.input;
exports org.lwjgl.util.jinput;
//exports org.lwjgl.util.mapped;
exports org.lwjgl.util.vector;
}

View File

@ -270,8 +270,10 @@ bool ext_InitializeFunctions(ExtGetProcAddressPROC gpa, int num_functions, ExtFu
ExtFunction *function = functions + i;
if (function->ext_function_name != NULL) {
void *ext_func_pointer = gpa(function->ext_function_name);
if (ext_func_pointer == NULL)
if (ext_func_pointer == NULL) {
printfDebug("Could not locate symbol %s\n", function->ext_function_name);
return false;
}
ext_function_pointer_pointer = function->ext_function_pointer;
*ext_function_pointer_pointer = ext_func_pointer;
}
@ -308,6 +310,8 @@ void ext_InitializeClass(JNIEnv *env, jclass clazz, ExtGetProcAddressPROC gpa, i
if (function->ext_function_name != NULL) {
ext_func_pointer = gpa(function->ext_function_name);
if (ext_func_pointer == NULL) {
printfDebug("Could not locate symbol %s\n", function->ext_function_name);
if ( function->optional )
continue;

View File

@ -65,9 +65,6 @@ void* extal_GetProcAddress(const char* function) {
/* p = alGetProcAddress((const ALubyte*)function);
if (p == NULL) {*/
p = extal_NativeGetFunctionPointer(function);
if (p == NULL) {
printfDebug("Could not locate symbol %s\n", function);
}
// }
return p;
}

View File

@ -0,0 +1,53 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_CallbackUtil */
#ifndef _Included_org_lwjgl_opengl_CallbackUtil
#define _Included_org_lwjgl_opengl_CallbackUtil
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_CallbackUtil
* Method: ncreateGlobalRef
* Signature: (Ljava/lang/Object;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_CallbackUtil
* Method: deleteGlobalRef
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CallbackUtil_deleteGlobalRef
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_CallbackUtil
* Method: getDebugOutputCallbackARB
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackARB
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_CallbackUtil
* Method: getDebugOutputCallbackAMD
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackAMD
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_CallbackUtil
* Method: getDebugCallbackKHR
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugCallbackKHR
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,45 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_GLContext */
#ifndef _Included_org_lwjgl_opengl_GLContext
#define _Included_org_lwjgl_opengl_GLContext
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_GLContext
* Method: ngetFunctionAddress
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_GLContext_ngetFunctionAddress
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_GLContext
* Method: nLoadOpenGLLibrary
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nLoadOpenGLLibrary
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_GLContext
* Method: nUnloadOpenGLLibrary
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nUnloadOpenGLLibrary
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_GLContext
* Method: resetNativeStubs
* Signature: (Ljava/lang/Class;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_resetNativeStubs
(JNIEnv *, jclass, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,37 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_NVPresentVideoUtil */
#ifndef _Included_org_lwjgl_opengl_NVPresentVideoUtil
#define _Included_org_lwjgl_opengl_NVPresentVideoUtil
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_NVPresentVideoUtil
* Method: nglEnumerateVideoDevicesNV
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/LongBuffer;I)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_NVPresentVideoUtil_nglEnumerateVideoDevicesNV
(JNIEnv *, jclass, jobject, jobject, jint);
/*
* Class: org_lwjgl_opengl_NVPresentVideoUtil
* Method: nglBindVideoDeviceNV
* Signature: (Ljava/nio/ByteBuffer;IJLjava/nio/IntBuffer;I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVPresentVideoUtil_nglBindVideoDeviceNV
(JNIEnv *, jclass, jobject, jint, jlong, jobject, jint);
/*
* Class: org_lwjgl_opengl_NVPresentVideoUtil
* Method: nglQueryContextNV
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVPresentVideoUtil_nglQueryContextNV
(JNIEnv *, jclass, jobject, jobject, jint, jobject, jint);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,53 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_NVVideoCaptureUtil */
#ifndef _Included_org_lwjgl_opengl_NVVideoCaptureUtil
#define _Included_org_lwjgl_opengl_NVVideoCaptureUtil
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_NVVideoCaptureUtil
* Method: nglBindVideoCaptureDeviceNV
* Signature: (Ljava/nio/ByteBuffer;IJ)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglBindVideoCaptureDeviceNV
(JNIEnv *, jclass, jobject, jint, jlong);
/*
* Class: org_lwjgl_opengl_NVVideoCaptureUtil
* Method: nglEnumerateVideoCaptureDevicesNV
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/LongBuffer;I)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglEnumerateVideoCaptureDevicesNV
(JNIEnv *, jclass, jobject, jobject, jint);
/*
* Class: org_lwjgl_opengl_NVVideoCaptureUtil
* Method: nglLockVideoCaptureDeviceNV
* Signature: (Ljava/nio/ByteBuffer;J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglLockVideoCaptureDeviceNV
(JNIEnv *, jclass, jobject, jlong);
/*
* Class: org_lwjgl_opengl_NVVideoCaptureUtil
* Method: nglQueryVideoCaptureDeviceNV
* Signature: (Ljava/nio/ByteBuffer;JILjava/nio/IntBuffer;I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglQueryVideoCaptureDeviceNV
(JNIEnv *, jclass, jobject, jlong, jint, jobject, jint);
/*
* Class: org_lwjgl_opengl_NVVideoCaptureUtil
* Method: nglReleaseVideoCaptureDeviceNV
* Signature: (Ljava/nio/ByteBuffer;J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglReleaseVideoCaptureDeviceNV
(JNIEnv *, jclass, jobject, jlong);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,47 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_Pbuffer */
#ifndef _Included_org_lwjgl_opengl_Pbuffer
#define _Included_org_lwjgl_opengl_Pbuffer
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED
#define org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED 1L
#undef org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_SUPPORTED
#define org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_SUPPORTED 2L
#undef org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_RECTANGLE_SUPPORTED
#define org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_RECTANGLE_SUPPORTED 4L
#undef org_lwjgl_opengl_Pbuffer_RENDER_DEPTH_TEXTURE_SUPPORTED
#define org_lwjgl_opengl_Pbuffer_RENDER_DEPTH_TEXTURE_SUPPORTED 8L
#undef org_lwjgl_opengl_Pbuffer_MIPMAP_LEVEL
#define org_lwjgl_opengl_Pbuffer_MIPMAP_LEVEL 8315L
#undef org_lwjgl_opengl_Pbuffer_CUBE_MAP_FACE
#define org_lwjgl_opengl_Pbuffer_CUBE_MAP_FACE 8316L
#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_X
#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_X 8317L
#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_X
#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_X 8318L
#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_Y
#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_Y 8319L
#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_Y
#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_Y 8320L
#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_Z
#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_Z 8321L
#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_Z
#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_Z 8322L
#undef org_lwjgl_opengl_Pbuffer_FRONT_LEFT_BUFFER
#define org_lwjgl_opengl_Pbuffer_FRONT_LEFT_BUFFER 8323L
#undef org_lwjgl_opengl_Pbuffer_FRONT_RIGHT_BUFFER
#define org_lwjgl_opengl_Pbuffer_FRONT_RIGHT_BUFFER 8324L
#undef org_lwjgl_opengl_Pbuffer_BACK_LEFT_BUFFER
#define org_lwjgl_opengl_Pbuffer_BACK_LEFT_BUFFER 8325L
#undef org_lwjgl_opengl_Pbuffer_BACK_RIGHT_BUFFER
#define org_lwjgl_opengl_Pbuffer_BACK_RIGHT_BUFFER 8326L
#undef org_lwjgl_opengl_Pbuffer_DEPTH_BUFFER
#define org_lwjgl_opengl_Pbuffer_DEPTH_BUFFER 8359L
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,4 +1,4 @@
#include "org_lwjgl_BufferUtils.h"
//#include "org_lwjgl_BufferUtils.h"
#include "common_tools.h"
JNIEXPORT void JNICALL Java_org_lwjgl_BufferUtils_zeroBuffer0(JNIEnv *env, jclass clazz, jobject buffer, jlong offset, jlong size) {

View File

@ -0,0 +1,37 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_DefaultSysImplementation */
#ifndef _Included_org_lwjgl_DefaultSysImplementation
#define _Included_org_lwjgl_DefaultSysImplementation
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_DefaultSysImplementation
* Method: getJNIVersion
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion
(JNIEnv *, jobject);
/*
* Class: org_lwjgl_DefaultSysImplementation
* Method: getPointerSize
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getPointerSize
(JNIEnv *, jobject);
/*
* Class: org_lwjgl_DefaultSysImplementation
* Method: setDebug
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_DefaultSysImplementation_setDebug
(JNIEnv *, jobject, jboolean);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,19 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_input_Cursor */
#ifndef _Included_org_lwjgl_input_Cursor
#define _Included_org_lwjgl_input_Cursor
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_input_Cursor_CURSOR_ONE_BIT_TRANSPARENCY
#define org_lwjgl_input_Cursor_CURSOR_ONE_BIT_TRANSPARENCY 1L
#undef org_lwjgl_input_Cursor_CURSOR_8_BIT_ALPHA
#define org_lwjgl_input_Cursor_CURSOR_8_BIT_ALPHA 2L
#undef org_lwjgl_input_Cursor_CURSOR_ANIMATION
#define org_lwjgl_input_Cursor_CURSOR_ANIMATION 4L
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,45 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_openal_AL */
#ifndef _Included_org_lwjgl_openal_AL
#define _Included_org_lwjgl_openal_AL
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_openal_AL
* Method: nCreate
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreate
(JNIEnv *, jclass, jstring);
/*
* Class: org_lwjgl_openal_AL
* Method: nCreateDefault
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreateDefault
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_openal_AL
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nDestroy
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_openal_AL
* Method: resetNativeStubs
* Signature: (Ljava/lang/Class;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_resetNativeStubs
(JNIEnv *, jclass, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,61 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opencl_CL */
#ifndef _Included_org_lwjgl_opencl_CL
#define _Included_org_lwjgl_opencl_CL
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opencl_CL
* Method: nCreate
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreate
(JNIEnv *, jclass, jstring);
/*
* Class: org_lwjgl_opencl_CL
* Method: nCreateDefault
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreateDefault
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opencl_CL
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nDestroy
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opencl_CL
* Method: ngetFunctionAddress
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_ngetFunctionAddress
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opencl_CL
* Method: getHostBuffer
* Signature: (JI)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opencl_CL_getHostBuffer
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opencl_CL
* Method: resetNativeStubs
* Signature: (Ljava/lang/Class;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_resetNativeStubs
(JNIEnv *, jclass, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -39,7 +39,7 @@
#include <jni.h>
#include "common_tools.h"
#include "extcl.h"
#include "org_lwjgl_opencl_CallbackUtil.h"
//#include "org_lwjgl_opencl_CallbackUtil.h"
static jmethodID contextCallbackJ;
static jmethodID memObjectDestructorCallbackJ;

View File

@ -40,7 +40,7 @@
#include <jni.h>
#ifdef __MACH__
#include <JavaVM/jawt_md.h>
#include <jawt_md.h>
#else
#include <jawt_md.h>
#endif

View File

@ -0,0 +1,39 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_AWTSurfaceLock */
#ifndef _Included_org_lwjgl_opengl_AWTSurfaceLock
#define _Included_org_lwjgl_opengl_AWTSurfaceLock
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_AWTSurfaceLock_WAIT_DELAY_MILLIS
#define org_lwjgl_opengl_AWTSurfaceLock_WAIT_DELAY_MILLIS 100L
/*
* Class: org_lwjgl_opengl_AWTSurfaceLock
* Method: createHandle
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_createHandle
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_AWTSurfaceLock
* Method: lockAndInitHandle
* Signature: (Ljava/nio/ByteBuffer;Ljava/awt/Canvas;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_lockAndInitHandle
(JNIEnv *, jclass, jobject, jobject);
/*
* Class: org_lwjgl_opengl_AWTSurfaceLock
* Method: nUnlock
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_nUnlock
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -228,17 +228,20 @@ static XVisualInfo *chooseVisualGLXFromBPP(JNIEnv *env, Display *disp, int scree
putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe);
putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe);
putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha);
if (stereo)
if (stereo) {
putAttrib(&attrib_list, GLX_STEREO);
}
// Assume the caller has checked support for multisample
if (samples > 0) {
putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1);
putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0
if ( colorSamples > 0 )
if ( colorSamples > 0 ) {
putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples);
}
}
if (sRGB)
if (sRGB) {
putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
}
putAttrib(&attrib_list, None);
return lwjgl_glXChooseVisual(disp, screen, attrib_list.attribs);
}

View File

@ -252,9 +252,6 @@ void *extgl_GetProcAddress(const char *name) {
void *t = (void*)lwjgl_glXGetProcAddressARB((const GLubyte*)name);
if (t == NULL) {
t = dlsym(lib_gl_handle, name);
if (t == NULL) {
printfDebug("Could not locate symbol %s\n", name);
}
}
return t;
}

View File

@ -174,15 +174,25 @@ static bool isLegacyFullscreen(jint window_mode) {
}
static void setWindowTitle(Display *disp, Window window, jlong title, jint len) {
Atom UTF8_STRING = XInternAtom(disp, "UTF8_STRING", True);
Atom _NET_WM_NAME = XInternAtom(disp, "_NET_WM_NAME", True);
Atom _NET_WM_ICON_NAME = XInternAtom(disp, "_NET_WM_ICON_NAME", True);
// ASCII fallback if XChangeProperty fails.
XStoreName(disp, window, (const char *)(intptr_t)title);
XmbSetWMProperties(disp, window, (const char *)(intptr_t)title, (const char *)(intptr_t)title, NULL, 0, NULL, NULL, NULL);
// Set the UTF-8 encoded title
XChangeProperty(disp, window,
XInternAtom(disp, "_NET_WM_NAME", False),
XInternAtom(disp, "UTF8_STRING", False),
8, PropModeReplace, (const unsigned char *)(intptr_t)title,
len);
if ( _NET_WM_NAME )
XChangeProperty(
disp, window, _NET_WM_NAME, UTF8_STRING,
8, PropModeReplace, (const unsigned char *)(intptr_t)title, len
);
if ( _NET_WM_ICON_NAME )
XChangeProperty(
disp, window, _NET_WM_ICON_NAME, UTF8_STRING,
8, PropModeReplace, (const unsigned char *)(intptr_t)title, len
);
}
static void setClassHint(Display *disp, Window window, jlong wm_name, jlong wm_class) {

View File

@ -0,0 +1,29 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo */
#ifndef _Included_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo
#define _Included_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo
* Method: getScreenFromSurfaceInfo
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_getScreenFromSurfaceInfo
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo
* Method: nInitHandle
* Signature: (ILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_nInitHandle
(JNIEnv *, jclass, jint, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,21 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxCanvasImplementation */
#ifndef _Included_org_lwjgl_opengl_LinuxCanvasImplementation
#define _Included_org_lwjgl_opengl_LinuxCanvasImplementation
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_LinuxCanvasImplementation
* Method: nFindVisualIDFromFormat
* Signature: (JILorg/lwjgl/opengl/PixelFormat;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat
(JNIEnv *, jclass, jlong, jint, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,85 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxContextImplementation */
#ifndef _Included_org_lwjgl_opengl_LinuxContextImplementation
#define _Included_org_lwjgl_opengl_LinuxContextImplementation
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_LinuxContextImplementation
* Method: nCreate
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nCreate
(JNIEnv *, jclass, jobject, jobject, jobject);
/*
* Class: org_lwjgl_opengl_LinuxContextImplementation
* Method: getGLXContext
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getGLXContext
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_LinuxContextImplementation
* Method: getDisplay
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getDisplay
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_LinuxContextImplementation
* Method: nSwapBuffers
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSwapBuffers
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxContextImplementation
* Method: nReleaseCurrentContext
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nReleaseCurrentContext
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxContextImplementation
* Method: nMakeCurrent
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nMakeCurrent
(JNIEnv *, jclass, jobject, jobject);
/*
* Class: org_lwjgl_opengl_LinuxContextImplementation
* Method: nIsCurrent
* Signature: (Ljava/nio/ByteBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nIsCurrent
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxContextImplementation
* Method: nSetSwapInterval
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSetSwapInterval
(JNIEnv *, jclass, jobject, jobject, jint);
/*
* Class: org_lwjgl_opengl_LinuxContextImplementation
* Method: nDestroy
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nDestroy
(JNIEnv *, jclass, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,29 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxDisplayPeerInfo */
#ifndef _Included_org_lwjgl_opengl_LinuxDisplayPeerInfo
#define _Included_org_lwjgl_opengl_LinuxDisplayPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_LinuxDisplayPeerInfo
* Method: initDefaultPeerInfo
* Signature: (JILjava/nio/ByteBuffer;Lorg/lwjgl/opengl/PixelFormat;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo
(JNIEnv *, jclass, jlong, jint, jobject, jobject);
/*
* Class: org_lwjgl_opengl_LinuxDisplayPeerInfo
* Method: initDrawable
* Signature: (JLjava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable
(JNIEnv *, jclass, jlong, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,29 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxPbufferPeerInfo */
#ifndef _Included_org_lwjgl_opengl_LinuxPbufferPeerInfo
#define _Included_org_lwjgl_opengl_LinuxPbufferPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_LinuxPbufferPeerInfo
* Method: nInitHandle
* Signature: (JILjava/nio/ByteBuffer;IILorg/lwjgl/opengl/PixelFormat;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle
(JNIEnv *, jclass, jlong, jint, jobject, jint, jint, jobject);
/*
* Class: org_lwjgl_opengl_LinuxPbufferPeerInfo
* Method: nDestroy
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nDestroy
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -58,12 +58,10 @@ void *extgl_GetProcAddress(const char *name) {
if ( t == NULL ) {
t = dlsym(lib_gl_handle, name);
if ( t == NULL )
printfDebug("Could not locate symbol %s\n", name);
}
//if ( t != NULL )
//printfDebug("Located symbol %s\n", name);
return t;
}
}

View File

@ -0,0 +1,15 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_LinuxSysImplementation */
#ifndef _Included_org_lwjgl_LinuxSysImplementation
#define _Included_org_lwjgl_LinuxSysImplementation
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_LinuxSysImplementation_JNI_VERSION
#define org_lwjgl_LinuxSysImplementation_JNI_VERSION 19L
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,503 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxDisplay */
#ifndef _Included_org_lwjgl_opengl_LinuxDisplay
#define _Included_org_lwjgl_opengl_LinuxDisplay
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_LinuxDisplay_CurrentTime
#define org_lwjgl_opengl_LinuxDisplay_CurrentTime 0L
#undef org_lwjgl_opengl_LinuxDisplay_GrabSuccess
#define org_lwjgl_opengl_LinuxDisplay_GrabSuccess 0L
#undef org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeOff
#define org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeOff 0L
#undef org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeOn
#define org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeOn 1L
#undef org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeDefault
#define org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeDefault 2L
#undef org_lwjgl_opengl_LinuxDisplay_None
#define org_lwjgl_opengl_LinuxDisplay_None 0L
#undef org_lwjgl_opengl_LinuxDisplay_KeyPressMask
#define org_lwjgl_opengl_LinuxDisplay_KeyPressMask 1L
#undef org_lwjgl_opengl_LinuxDisplay_KeyReleaseMask
#define org_lwjgl_opengl_LinuxDisplay_KeyReleaseMask 2L
#undef org_lwjgl_opengl_LinuxDisplay_ButtonPressMask
#define org_lwjgl_opengl_LinuxDisplay_ButtonPressMask 4L
#undef org_lwjgl_opengl_LinuxDisplay_ButtonReleaseMask
#define org_lwjgl_opengl_LinuxDisplay_ButtonReleaseMask 8L
#undef org_lwjgl_opengl_LinuxDisplay_NotifyAncestor
#define org_lwjgl_opengl_LinuxDisplay_NotifyAncestor 0L
#undef org_lwjgl_opengl_LinuxDisplay_NotifyNonlinear
#define org_lwjgl_opengl_LinuxDisplay_NotifyNonlinear 3L
#undef org_lwjgl_opengl_LinuxDisplay_NotifyPointer
#define org_lwjgl_opengl_LinuxDisplay_NotifyPointer 5L
#undef org_lwjgl_opengl_LinuxDisplay_NotifyPointerRoot
#define org_lwjgl_opengl_LinuxDisplay_NotifyPointerRoot 6L
#undef org_lwjgl_opengl_LinuxDisplay_NotifyDetailNone
#define org_lwjgl_opengl_LinuxDisplay_NotifyDetailNone 7L
#undef org_lwjgl_opengl_LinuxDisplay_SetModeInsert
#define org_lwjgl_opengl_LinuxDisplay_SetModeInsert 0L
#undef org_lwjgl_opengl_LinuxDisplay_SaveSetRoot
#define org_lwjgl_opengl_LinuxDisplay_SaveSetRoot 1L
#undef org_lwjgl_opengl_LinuxDisplay_SaveSetUnmap
#define org_lwjgl_opengl_LinuxDisplay_SaveSetUnmap 1L
#undef org_lwjgl_opengl_LinuxDisplay_X_SetInputFocus
#define org_lwjgl_opengl_LinuxDisplay_X_SetInputFocus 42L
#undef org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY
#define org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY 1L
#undef org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM
#define org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM 2L
#undef org_lwjgl_opengl_LinuxDisplay_WINDOWED
#define org_lwjgl_opengl_LinuxDisplay_WINDOWED 3L
#undef org_lwjgl_opengl_LinuxDisplay_XRANDR
#define org_lwjgl_opengl_LinuxDisplay_XRANDR 10L
#undef org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE
#define org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE 11L
#undef org_lwjgl_opengl_LinuxDisplay_NONE
#define org_lwjgl_opengl_LinuxDisplay_NONE 12L
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetCurrentGammaRamp
* Signature: (JI)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nIsXrandrSupported
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXrandrSupported
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nIsXF86VidModeSupported
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXF86VidModeSupported
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nIsNetWMFullscreenSupported
* Signature: (JI)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nLockAWT
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nLockAWT
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nUnlockAWT
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUnlockAWT
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: callErrorHandler
* Signature: (JJJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_callErrorHandler
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: setErrorHandler
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setErrorHandler
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: resetErrorHandler
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_resetErrorHandler
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: synchronize
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_synchronize
(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: getErrorText
* Signature: (JJ)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: openDisplay
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: closeDisplay
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_closeDisplay
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetDefaultScreen
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetDefaultScreen
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nUngrabKeyboard
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabKeyboard
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGrabKeyboard
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabKeyboard
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGrabPointer
* Signature: (JJJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabPointer
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nSetViewPort
* Signature: (JJI)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetViewPort
(JNIEnv *, jclass, jlong, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nUngrabPointer
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabPointer
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nDefineCursor
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDefineCursor
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nCreateWindow
* Signature: (JILjava/nio/ByteBuffer;Lorg/lwjgl/opengl/DisplayMode;IIIZJZ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow
(JNIEnv *, jclass, jlong, jint, jobject, jobject, jint, jint, jint, jboolean, jlong, jboolean);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: getRootWindow
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getRootWindow
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: hasProperty
* Signature: (JJJ)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_hasProperty
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: getParentWindow
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getParentWindow
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: getChildCount
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getChildCount
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: mapRaised
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_mapRaised
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: reparentWindow
* Signature: (JJJII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_reparentWindow
(JNIEnv *, jclass, jlong, jlong, jlong, jint, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetInputFocus
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nSetInputFocus
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetInputFocus
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nSetWindowSize
* Signature: (JJIIZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowSize
(JNIEnv *, jclass, jlong, jlong, jint, jint, jboolean);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetX
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetX
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetY
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetY
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetWidth
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetWidth
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetHeight
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetHeight
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nDestroyWindow
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nSwitchDisplayMode
* Signature: (JIILorg/lwjgl/opengl/DisplayMode;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode
(JNIEnv *, jclass, jlong, jint, jint, jobject);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nInternAtom
* Signature: (JLjava/lang/String;Z)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom
(JNIEnv *, jclass, jlong, jstring, jboolean);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetGammaRampLength
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nSetGammaRamp
* Signature: (JILjava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp
(JNIEnv *, jclass, jlong, jint, jobject);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nConvertToNativeRamp
* Signature: (Ljava/nio/FloatBuffer;II)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nConvertToNativeRamp
(JNIEnv *, jclass, jobject, jint, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetCurrentXRandrMode
* Signature: (JI)Lorg/lwjgl/opengl/DisplayMode;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nSetTitle
* Signature: (JJJI)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle
(JNIEnv *, jclass, jlong, jlong, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nSetClassHint
* Signature: (JJJJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetClassHint
(JNIEnv *, jclass, jlong, jlong, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nReshape
* Signature: (JJIIII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape
(JNIEnv *, jclass, jlong, jlong, jint, jint, jint, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetAvailableDisplayModes
* Signature: (JII)[Lorg/lwjgl/opengl/DisplayMode;
*/
JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes
(JNIEnv *, jclass, jlong, jint, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nSync
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSync
(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nIconifyWindow
* Signature: (JJI)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIconifyWindow
(JNIEnv *, jclass, jlong, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetNativeCursorCapabilities
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetNativeCursorCapabilities
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetMinCursorSize
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMinCursorSize
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetMaxCursorSize
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMaxCursorSize
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nCreateCursor
* Signature: (JIIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateCursor
(JNIEnv *, jclass, jlong, jint, jint, jint, jint, jint, jobject, jint, jobject, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nCreateBlankCursor
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateBlankCursor
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nDestroyCursor
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyCursor
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nGetPbufferCapabilities
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetPbufferCapabilities
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxDisplay
* Method: nSetWindowIcon
* Signature: (JJLjava/nio/ByteBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowIcon
(JNIEnv *, jclass, jlong, jlong, jobject, jint);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,257 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxEvent */
#ifndef _Included_org_lwjgl_opengl_LinuxEvent
#define _Included_org_lwjgl_opengl_LinuxEvent
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_LinuxEvent_FocusIn
#define org_lwjgl_opengl_LinuxEvent_FocusIn 9L
#undef org_lwjgl_opengl_LinuxEvent_FocusOut
#define org_lwjgl_opengl_LinuxEvent_FocusOut 10L
#undef org_lwjgl_opengl_LinuxEvent_KeyPress
#define org_lwjgl_opengl_LinuxEvent_KeyPress 2L
#undef org_lwjgl_opengl_LinuxEvent_KeyRelease
#define org_lwjgl_opengl_LinuxEvent_KeyRelease 3L
#undef org_lwjgl_opengl_LinuxEvent_ButtonPress
#define org_lwjgl_opengl_LinuxEvent_ButtonPress 4L
#undef org_lwjgl_opengl_LinuxEvent_ButtonRelease
#define org_lwjgl_opengl_LinuxEvent_ButtonRelease 5L
#undef org_lwjgl_opengl_LinuxEvent_MotionNotify
#define org_lwjgl_opengl_LinuxEvent_MotionNotify 6L
#undef org_lwjgl_opengl_LinuxEvent_EnterNotify
#define org_lwjgl_opengl_LinuxEvent_EnterNotify 7L
#undef org_lwjgl_opengl_LinuxEvent_LeaveNotify
#define org_lwjgl_opengl_LinuxEvent_LeaveNotify 8L
#undef org_lwjgl_opengl_LinuxEvent_UnmapNotify
#define org_lwjgl_opengl_LinuxEvent_UnmapNotify 18L
#undef org_lwjgl_opengl_LinuxEvent_MapNotify
#define org_lwjgl_opengl_LinuxEvent_MapNotify 19L
#undef org_lwjgl_opengl_LinuxEvent_Expose
#define org_lwjgl_opengl_LinuxEvent_Expose 12L
#undef org_lwjgl_opengl_LinuxEvent_ConfigureNotify
#define org_lwjgl_opengl_LinuxEvent_ConfigureNotify 22L
#undef org_lwjgl_opengl_LinuxEvent_ClientMessage
#define org_lwjgl_opengl_LinuxEvent_ClientMessage 33L
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: createEventBuffer
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxEvent_createEventBuffer
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: getPending
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_getPending
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nSendEvent
* Signature: (Ljava/nio/ByteBuffer;JJZJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nSendEvent
(JNIEnv *, jclass, jobject, jlong, jlong, jboolean, jlong);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nFilterEvent
* Signature: (Ljava/nio/ByteBuffer;J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxEvent_nFilterEvent
(JNIEnv *, jclass, jobject, jlong);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nNextEvent
* Signature: (JLjava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nNextEvent
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetType
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetType
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetWindow
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetWindow
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nSetWindow
* Signature: (Ljava/nio/ByteBuffer;J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nSetWindow
(JNIEnv *, jclass, jobject, jlong);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetFocusMode
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetFocusMode
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetFocusDetail
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetFocusDetail
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetClientMessageType
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientMessageType
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetClientData
* Signature: (Ljava/nio/ByteBuffer;I)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientData
(JNIEnv *, jclass, jobject, jint);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetClientFormat
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientFormat
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetButtonTime
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonTime
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetButtonState
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonState
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetButtonType
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonType
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetButtonButton
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonButton
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetButtonRoot
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonRoot
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetButtonXRoot
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonXRoot
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetButtonYRoot
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonYRoot
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetButtonX
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonX
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetButtonY
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonY
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetKeyAddress
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyAddress
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetKeyTime
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyTime
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetKeyType
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyType
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetKeyKeyCode
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyKeyCode
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxEvent
* Method: nGetKeyState
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyState
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -78,6 +78,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupModifierMap(JNI
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_keycodeToKeySym(JNIEnv *env, jclass unused, jlong display_ptr, jint key_code) {
Display *disp = (Display *)(intptr_t)display_ptr;
// TODO: verify that XkbKeycodeToKeysym does not introduce any unwanted behaviour, then switch to it.
KeySym key_sym = XKeycodeToKeysym(disp, key_code, 0);
return key_sym;
}

View File

@ -0,0 +1,155 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxKeyboard */
#ifndef _Included_org_lwjgl_opengl_LinuxKeyboard
#define _Included_org_lwjgl_opengl_LinuxKeyboard
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_LinuxKeyboard_LockMapIndex
#define org_lwjgl_opengl_LinuxKeyboard_LockMapIndex 1L
#undef org_lwjgl_opengl_LinuxKeyboard_NoSymbol
#define org_lwjgl_opengl_LinuxKeyboard_NoSymbol 0LL
#undef org_lwjgl_opengl_LinuxKeyboard_ShiftMask
#define org_lwjgl_opengl_LinuxKeyboard_ShiftMask 1LL
#undef org_lwjgl_opengl_LinuxKeyboard_LockMask
#define org_lwjgl_opengl_LinuxKeyboard_LockMask 2LL
#undef org_lwjgl_opengl_LinuxKeyboard_XLookupChars
#define org_lwjgl_opengl_LinuxKeyboard_XLookupChars 2L
#undef org_lwjgl_opengl_LinuxKeyboard_XLookupBoth
#define org_lwjgl_opengl_LinuxKeyboard_XLookupBoth 4L
#undef org_lwjgl_opengl_LinuxKeyboard_KEYBOARD_BUFFER_SIZE
#define org_lwjgl_opengl_LinuxKeyboard_KEYBOARD_BUFFER_SIZE 50L
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: getModifierMapping
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_getModifierMapping
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: freeModifierMapping
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_freeModifierMapping
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: getMaxKeyPerMod
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_getMaxKeyPerMod
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: lookupModifierMap
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupModifierMap
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: keycodeToKeySym
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_keycodeToKeySym
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: openIM
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_openIM
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: createIC
* Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_createIC
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: setupIMEventMask
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_setupIMEventMask
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: allocateComposeStatus
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_allocateComposeStatus
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: nSetDetectableKeyRepeat
* Signature: (JZ)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_nSetDetectableKeyRepeat
(JNIEnv *, jclass, jlong, jboolean);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: destroyIC
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_destroyIC
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: closeIM
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_closeIM
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: lookupString
* Signature: (JLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupString
(JNIEnv *, jclass, jlong, jobject, jobject);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: utf8LookupString
* Signature: (JJLjava/nio/ByteBuffer;II)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_utf8LookupString
(JNIEnv *, jclass, jlong, jlong, jobject, jint, jint);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: lookupKeysym
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupKeysym
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_LinuxKeyboard
* Method: toUpper
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_toUpper
(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,87 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxMouse */
#ifndef _Included_org_lwjgl_opengl_LinuxMouse
#define _Included_org_lwjgl_opengl_LinuxMouse
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_LinuxMouse_POINTER_WARP_BORDER
#define org_lwjgl_opengl_LinuxMouse_POINTER_WARP_BORDER 10L
#undef org_lwjgl_opengl_LinuxMouse_WHEEL_SCALE
#define org_lwjgl_opengl_LinuxMouse_WHEEL_SCALE 120L
#undef org_lwjgl_opengl_LinuxMouse_Button1
#define org_lwjgl_opengl_LinuxMouse_Button1 1L
#undef org_lwjgl_opengl_LinuxMouse_Button2
#define org_lwjgl_opengl_LinuxMouse_Button2 2L
#undef org_lwjgl_opengl_LinuxMouse_Button3
#define org_lwjgl_opengl_LinuxMouse_Button3 3L
#undef org_lwjgl_opengl_LinuxMouse_Button4
#define org_lwjgl_opengl_LinuxMouse_Button4 4L
#undef org_lwjgl_opengl_LinuxMouse_Button5
#define org_lwjgl_opengl_LinuxMouse_Button5 5L
#undef org_lwjgl_opengl_LinuxMouse_Button6
#define org_lwjgl_opengl_LinuxMouse_Button6 6L
#undef org_lwjgl_opengl_LinuxMouse_Button7
#define org_lwjgl_opengl_LinuxMouse_Button7 7L
#undef org_lwjgl_opengl_LinuxMouse_Button8
#define org_lwjgl_opengl_LinuxMouse_Button8 8L
#undef org_lwjgl_opengl_LinuxMouse_Button9
#define org_lwjgl_opengl_LinuxMouse_Button9 9L
#undef org_lwjgl_opengl_LinuxMouse_ButtonPress
#define org_lwjgl_opengl_LinuxMouse_ButtonPress 4L
#undef org_lwjgl_opengl_LinuxMouse_ButtonRelease
#define org_lwjgl_opengl_LinuxMouse_ButtonRelease 5L
/*
* Class: org_lwjgl_opengl_LinuxMouse
* Method: nSendWarpEvent
* Signature: (JJJII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxMouse_nSendWarpEvent
(JNIEnv *, jclass, jlong, jlong, jlong, jint, jint);
/*
* Class: org_lwjgl_opengl_LinuxMouse
* Method: nGetWindowHeight
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxMouse_nGetWindowHeight
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxMouse
* Method: nGetWindowWidth
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxMouse_nGetWindowWidth
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_LinuxMouse
* Method: nGetButtonCount
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxMouse_nGetButtonCount
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_LinuxMouse
* Method: nQueryPointer
* Signature: (JJLjava/nio/IntBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxMouse_nQueryPointer
(JNIEnv *, jclass, jlong, jlong, jobject);
/*
* Class: org_lwjgl_opengl_LinuxMouse
* Method: nWarpCursor
* Signature: (JJII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxMouse_nWarpCursor
(JNIEnv *, jclass, jlong, jlong, jint, jint);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,37 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_LinuxPeerInfo */
#ifndef _Included_org_lwjgl_opengl_LinuxPeerInfo
#define _Included_org_lwjgl_opengl_LinuxPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_LinuxPeerInfo
* Method: createHandle
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_createHandle
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_LinuxPeerInfo
* Method: nGetDisplay
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_nGetDisplay
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_LinuxPeerInfo
* Method: nGetDrawable
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_nGetDrawable
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -117,7 +117,7 @@ typedef struct {
@interface GLLayer : CAOpenGLLayer {
@public
JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi;
JAWT_DrawingSurfaceInfo *macosx_dsi;
JAWT_Rectangle canvasBounds;
MacOSXWindowInfo *window_info;
bool setViewport;

View File

@ -46,8 +46,6 @@ void *extgl_GetProcAddress(const char *name) {
CFStringRef cf_name = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8);
void *address = CFBundleGetFunctionPointerForName(opengl_bundle, cf_name);
CFRelease(cf_name);
if (address == NULL)
printfDebug("Could not locate symbol %s\n", name);
return address;
}
@ -87,6 +85,25 @@ void extgl_Close(void)
}
}
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
size_t CGDisplayBitsPerPixel(CGDirectDisplayID display) {
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(display);
size_t depth = 0;
CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(mode);
if(CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
depth = 32;
else if(CFStringCompare(pixEnc, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
depth = 16;
else if(CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
depth = 8;
return depth;
}
#else
// CGDisplayBitsPerPixel is defined
#endif
NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool gl32, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered) {
int bpp;
jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format);

View File

@ -0,0 +1,15 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_MacOSXSysImplementation */
#ifndef _Included_org_lwjgl_MacOSXSysImplementation
#define _Included_org_lwjgl_MacOSXSysImplementation
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_MacOSXSysImplementation_JNI_VERSION
#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION 25L
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,37 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_MacOSXCanvasPeerInfo */
#ifndef _Included_org_lwjgl_opengl_MacOSXCanvasPeerInfo
#define _Included_org_lwjgl_opengl_MacOSXCanvasPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_MacOSXCanvasPeerInfo
* Method: nInitHandle
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;ZZII)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle
(JNIEnv *, jclass, jobject, jobject, jobject, jboolean, jboolean, jint, jint);
/*
* Class: org_lwjgl_opengl_MacOSXCanvasPeerInfo
* Method: nSetLayerPosition
* Signature: (Ljava/nio/ByteBuffer;II)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nSetLayerPosition
(JNIEnv *, jclass, jobject, jint, jint);
/*
* Class: org_lwjgl_opengl_MacOSXCanvasPeerInfo
* Method: nSetLayerBounds
* Signature: (Ljava/nio/ByteBuffer;IIII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nSetLayerBounds
(JNIEnv *, jclass, jobject, jint, jint, jint, jint);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -53,7 +53,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle
MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle);
JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi = (JAWT_MacOSXDrawingSurfaceInfo *)surface->dsi->platformInfo;
JAWT_DrawingSurfaceInfo *macosx_dsi = (JAWT_DrawingSurfaceInfo *)surface->dsi->platformInfo;
// force CALayer usage or check if CALayer is supported (i.e. on Java 5 and Java 6)
if(forceCALayer || (surface->awt.version & 0x80000000)) { //JAWT_MACOSX_USE_CALAYER) {
@ -93,11 +93,16 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle
return window_handle;
}
}
// no CALayer support, fallback to using legacy method of getting the NSView of an AWT Canvas
peer_info->parent = macosx_dsi->cocoaViewRef;
peer_info->isCALayer = false;
peer_info->isWindowed = true;
// no CALayer support
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
throwException(env, "No CALayer support and no support legacy for getting NSView of an AWT Canvas");
#else
// fallback to using legacy method of getting the NSView of an AWT Canvas
peer_info->parent = macosx_dsi->cocoaViewRef;
peer_info->isCALayer = false;
peer_info->isWindowed = true;
#endif
[pool release];
return NULL;
@ -335,4 +340,4 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nSetLayerBound
}
@end
@end

View File

@ -0,0 +1,101 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_MacOSXContextImplementation */
#ifndef _Included_org_lwjgl_opengl_MacOSXContextImplementation
#define _Included_org_lwjgl_opengl_MacOSXContextImplementation
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: nCreate
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nCreate
(JNIEnv *, jclass, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: getCGLShareGroup
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_getCGLShareGroup
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: nSwapBuffers
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nSwapBuffers
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: nUpdate
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nUpdate
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: nReleaseCurrentContext
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nReleaseCurrentContext
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: clearDrawable
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_clearDrawable
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: setView
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_setView
(JNIEnv *, jclass, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: nMakeCurrent
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nMakeCurrent
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: nIsCurrent
* Signature: (Ljava/nio/ByteBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nIsCurrent
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: nSetSwapInterval
* Signature: (Ljava/nio/ByteBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nSetSwapInterval
(JNIEnv *, jclass, jobject, jint);
/*
* Class: org_lwjgl_opengl_MacOSXContextImplementation
* Method: nDestroy
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nDestroy
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -132,7 +132,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nUpdate
(JNIEnv *env, jclass clazz, jobject context_handle) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle);
[context_info->context update];
[context_info->context performSelectorOnMainThread:@selector(update) withObject:nil waitUntilDone:YES];
[pool release];
}
@ -163,7 +163,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_setView
peer_info->glLayer->setViewport = YES;
}
[context_info->context setView: peer_info->window_info->view];
[context_info->context performSelectorOnMainThread:@selector(setView:) withObject:peer_info->window_info->view waitUntilDone:YES];
}
else {
[context_info->context setPixelBuffer:peer_info->pbuffer cubeMapFace:0 mipMapLevel:0 currentVirtualScreen:0];

View File

@ -0,0 +1,161 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_MacOSXDisplay */
#ifndef _Included_org_lwjgl_opengl_MacOSXDisplay
#define _Included_org_lwjgl_opengl_MacOSXDisplay
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_MacOSXDisplay_PBUFFER_HANDLE_SIZE
#define org_lwjgl_opengl_MacOSXDisplay_PBUFFER_HANDLE_SIZE 24L
#undef org_lwjgl_opengl_MacOSXDisplay_GAMMA_LENGTH
#define org_lwjgl_opengl_MacOSXDisplay_GAMMA_LENGTH 256L
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nCreateWindow
* Signature: (IIIIZZZZZZLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nCreateWindow
(JNIEnv *, jobject, jint, jint, jint, jint, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nGetCurrentDisplayMode
* Signature: ()Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetCurrentDisplayMode
(JNIEnv *, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nGetDisplayModes
* Signature: (Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetDisplayModes
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nIsMiniaturized
* Signature: (Ljava/nio/ByteBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsMiniaturized
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nIsFocused
* Signature: (Ljava/nio/ByteBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsFocused
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nSetResizable
* Signature: (Ljava/nio/ByteBuffer;Z)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nSetResizable
(JNIEnv *, jobject, jobject, jboolean);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nResizeWindow
* Signature: (Ljava/nio/ByteBuffer;IIII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nResizeWindow
(JNIEnv *, jobject, jobject, jint, jint, jint, jint);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nWasResized
* Signature: (Ljava/nio/ByteBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nWasResized
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nGetX
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetX
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nGetY
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetY
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nGetWidth
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetWidth
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nGetHeight
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetHeight
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nIsNativeMode
* Signature: (Ljava/nio/ByteBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsNativeMode
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nDestroyCALayer
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nDestroyCALayer
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nDestroyWindow
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nDestroyWindow
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: setGammaRamp
* Signature: (Ljava/nio/FloatBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setGammaRamp
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: restoreGamma
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_restoreGamma
(JNIEnv *, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXDisplay
* Method: nSetTitle
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nSetTitle
(JNIEnv *, jobject, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,43 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_MacOSXMouseEventQueue */
#ifndef _Included_org_lwjgl_opengl_MacOSXMouseEventQueue
#define _Included_org_lwjgl_opengl_MacOSXMouseEventQueue
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_MacOSXMouseEventQueue_QUEUE_SIZE
#define org_lwjgl_opengl_MacOSXMouseEventQueue_QUEUE_SIZE 200L
#undef org_lwjgl_opengl_MacOSXMouseEventQueue_WHEEL_SCALE
#define org_lwjgl_opengl_MacOSXMouseEventQueue_WHEEL_SCALE 120L
#undef org_lwjgl_opengl_MacOSXMouseEventQueue_NUM_BUTTONS
#define org_lwjgl_opengl_MacOSXMouseEventQueue_NUM_BUTTONS 3L
/*
* Class: org_lwjgl_opengl_MacOSXMouseEventQueue
* Method: getMouseDeltas
* Signature: (Ljava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_getMouseDeltas
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXMouseEventQueue
* Method: nWarpCursor
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nWarpCursor
(JNIEnv *, jclass, jint, jint);
/*
* Class: org_lwjgl_opengl_MacOSXMouseEventQueue
* Method: nGrabMouse
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nGrabMouse
(JNIEnv *, jclass, jboolean);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,31 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_MacOSXNativeKeyboard */
#ifndef _Included_org_lwjgl_opengl_MacOSXNativeKeyboard
#define _Included_org_lwjgl_opengl_MacOSXNativeKeyboard
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_MacOSXNativeKeyboard_QUEUE_SIZE
#define org_lwjgl_opengl_MacOSXNativeKeyboard_QUEUE_SIZE 200L
/*
* Class: org_lwjgl_opengl_MacOSXNativeKeyboard
* Method: nRegisterKeyListener
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeKeyboard_nRegisterKeyListener
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXNativeKeyboard
* Method: nUnregisterKeyListener
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeKeyboard_nUnregisterKeyListener
(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,75 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_MacOSXNativeMouse */
#ifndef _Included_org_lwjgl_opengl_MacOSXNativeMouse
#define _Included_org_lwjgl_opengl_MacOSXNativeMouse
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_MacOSXNativeMouse_QUEUE_SIZE
#define org_lwjgl_opengl_MacOSXNativeMouse_QUEUE_SIZE 200L
#undef org_lwjgl_opengl_MacOSXNativeMouse_WHEEL_SCALE
#define org_lwjgl_opengl_MacOSXNativeMouse_WHEEL_SCALE 120L
#undef org_lwjgl_opengl_MacOSXNativeMouse_NUM_BUTTONS
#define org_lwjgl_opengl_MacOSXNativeMouse_NUM_BUTTONS 3L
/*
* Class: org_lwjgl_opengl_MacOSXNativeMouse
* Method: nSetCursorPosition
* Signature: (Ljava/nio/ByteBuffer;II)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nSetCursorPosition
(JNIEnv *, jobject, jobject, jint, jint);
/*
* Class: org_lwjgl_opengl_MacOSXNativeMouse
* Method: nGrabMouse
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nGrabMouse
(JNIEnv *, jclass, jboolean);
/*
* Class: org_lwjgl_opengl_MacOSXNativeMouse
* Method: nRegisterMouseListener
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nRegisterMouseListener
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXNativeMouse
* Method: nUnregisterMouseListener
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nUnregisterMouseListener
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_MacOSXNativeMouse
* Method: nCreateCursor
* Signature: (IIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nCreateCursor
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint, jobject, jint);
/*
* Class: org_lwjgl_opengl_MacOSXNativeMouse
* Method: nDestroyCursor
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nDestroyCursor
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_MacOSXNativeMouse
* Method: nSetCursor
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nSetCursor
(JNIEnv *, jclass, jlong);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,29 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_MacOSXPbufferPeerInfo */
#ifndef _Included_org_lwjgl_opengl_MacOSXPbufferPeerInfo
#define _Included_org_lwjgl_opengl_MacOSXPbufferPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_MacOSXPbufferPeerInfo
* Method: nCreate
* Signature: (Ljava/nio/ByteBuffer;II)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nCreate
(JNIEnv *, jclass, jobject, jint, jint);
/*
* Class: org_lwjgl_opengl_MacOSXPbufferPeerInfo
* Method: nDestroy
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nDestroy
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,37 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_MacOSXPeerInfo */
#ifndef _Included_org_lwjgl_opengl_MacOSXPeerInfo
#define _Included_org_lwjgl_opengl_MacOSXPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_MacOSXPeerInfo
* Method: createHandle
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_createHandle
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_MacOSXPeerInfo
* Method: nChoosePixelFormat
* Signature: (Ljava/nio/ByteBuffer;Lorg/lwjgl/opengl/PixelFormat;ZZZZZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nChoosePixelFormat
(JNIEnv *, jclass, jobject, jobject, jboolean, jboolean, jboolean, jboolean, jboolean);
/*
* Class: org_lwjgl_opengl_MacOSXPeerInfo
* Method: nDestroy
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nDestroy
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -45,10 +45,6 @@ void *extgl_GetProcAddress(const char *name) {
if (t == NULL)
{
t = GetProcAddress(lib_gl_handle, name);
if (t == NULL)
{
printfDebug("Could not locate symbol %s\n", name);
}
}
return t;
}

View File

@ -0,0 +1,85 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsContextImplementation */
#ifndef _Included_org_lwjgl_opengl_WindowsContextImplementation
#define _Included_org_lwjgl_opengl_WindowsContextImplementation
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_WindowsContextImplementation
* Method: nCreate
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nCreate
(JNIEnv *, jclass, jobject, jobject, jobject);
/*
* Class: org_lwjgl_opengl_WindowsContextImplementation
* Method: getHGLRC
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHGLRC
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_WindowsContextImplementation
* Method: getHDC
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHDC
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_WindowsContextImplementation
* Method: nSwapBuffers
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSwapBuffers
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsContextImplementation
* Method: nReleaseCurrentContext
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nReleaseCurrentContext
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsContextImplementation
* Method: nMakeCurrent
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nMakeCurrent
(JNIEnv *, jclass, jobject, jobject);
/*
* Class: org_lwjgl_opengl_WindowsContextImplementation
* Method: nIsCurrent
* Signature: (Ljava/nio/ByteBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nIsCurrent
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsContextImplementation
* Method: nSetSwapInterval
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSetSwapInterval
(JNIEnv *, jclass, jint);
/*
* Class: org_lwjgl_opengl_WindowsContextImplementation
* Method: nDestroy
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nDestroy
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,61 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsPbufferPeerInfo */
#ifndef _Included_org_lwjgl_opengl_WindowsPbufferPeerInfo
#define _Included_org_lwjgl_opengl_WindowsPbufferPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_WindowsPbufferPeerInfo
* Method: nCreate
* Signature: (Ljava/nio/ByteBuffer;IILorg/lwjgl/opengl/PixelFormat;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nCreate
(JNIEnv *, jclass, jobject, jint, jint, jobject, jobject, jobject);
/*
* Class: org_lwjgl_opengl_WindowsPbufferPeerInfo
* Method: nIsBufferLost
* Signature: (Ljava/nio/ByteBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nIsBufferLost
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsPbufferPeerInfo
* Method: nSetPbufferAttrib
* Signature: (Ljava/nio/ByteBuffer;II)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nSetPbufferAttrib
(JNIEnv *, jclass, jobject, jint, jint);
/*
* Class: org_lwjgl_opengl_WindowsPbufferPeerInfo
* Method: nBindTexImageToPbuffer
* Signature: (Ljava/nio/ByteBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nBindTexImageToPbuffer
(JNIEnv *, jclass, jobject, jint);
/*
* Class: org_lwjgl_opengl_WindowsPbufferPeerInfo
* Method: nReleaseTexImageFromPbuffer
* Signature: (Ljava/nio/ByteBuffer;I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nReleaseTexImageFromPbuffer
(JNIEnv *, jclass, jobject, jint);
/*
* Class: org_lwjgl_opengl_WindowsPbufferPeerInfo
* Method: nDestroy
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nDestroy
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,53 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsPeerInfo */
#ifndef _Included_org_lwjgl_opengl_WindowsPeerInfo
#define _Included_org_lwjgl_opengl_WindowsPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: createHandle
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: nChoosePixelFormat
* Signature: (JIILorg/lwjgl/opengl/PixelFormat;Ljava/nio/IntBuffer;ZZZZ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nChoosePixelFormat
(JNIEnv *, jclass, jlong, jint, jint, jobject, jobject, jboolean, jboolean, jboolean, jboolean);
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: setPixelFormat
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_setPixelFormat
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: nGetHdc
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: nGetHwnd
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -44,10 +44,6 @@ void *extgl_GetProcAddress(const char *name) {
if (t == NULL)
{
t = GetProcAddress(lib_gl_handle, name);
if (t == NULL)
{
printfDebug("Could not locate symbol %s\n", name);
}
}
return t;
}

View File

@ -0,0 +1,53 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsPeerInfo */
#ifndef _Included_org_lwjgl_opengl_WindowsPeerInfo
#define _Included_org_lwjgl_opengl_WindowsPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: createHandle
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: nChoosePixelFormat
* Signature: (JIILorg/lwjgl/opengl/PixelFormat;Ljava/nio/IntBuffer;ZZZZ)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nChoosePixelFormat
(JNIEnv *, jclass, jlong, jint, jint, jobject, jobject, jboolean, jboolean, jboolean, jboolean);
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: setPixelFormat
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_setPixelFormat
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: nGetHdc
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsPeerInfo
* Method: nGetHwnd
* Signature: (Ljava/nio/ByteBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,47 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_WindowsSysImplementation */
#ifndef _Included_org_lwjgl_WindowsSysImplementation
#define _Included_org_lwjgl_WindowsSysImplementation
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_WindowsSysImplementation_JNI_VERSION
#define org_lwjgl_WindowsSysImplementation_JNI_VERSION 24L
/*
* Class: org_lwjgl_WindowsSysImplementation
* Method: nGetTime
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetTime
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_WindowsSysImplementation
* Method: nAlert
* Signature: (JJJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_nAlert
(JNIEnv *, jclass, jlong, jlong, jlong);
/*
* Class: org_lwjgl_WindowsSysImplementation
* Method: initCommonControls
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_initCommonControls
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_WindowsSysImplementation
* Method: nGetClipboard
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetClipboard
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,21 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo */
#ifndef _Included_org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo
#define _Included_org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo
* Method: nInitHandle
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo_nInitHandle
(JNIEnv *, jclass, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,545 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsDisplay */
#ifndef _Included_org_lwjgl_opengl_WindowsDisplay
#define _Included_org_lwjgl_opengl_WindowsDisplay
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH
#define org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH 256L
#undef org_lwjgl_opengl_WindowsDisplay_WM_WINDOWPOSCHANGED
#define org_lwjgl_opengl_WindowsDisplay_WM_WINDOWPOSCHANGED 71L
#undef org_lwjgl_opengl_WindowsDisplay_WM_MOVE
#define org_lwjgl_opengl_WindowsDisplay_WM_MOVE 3L
#undef org_lwjgl_opengl_WindowsDisplay_WM_CANCELMODE
#define org_lwjgl_opengl_WindowsDisplay_WM_CANCELMODE 31L
#undef org_lwjgl_opengl_WindowsDisplay_WM_MOUSEMOVE
#define org_lwjgl_opengl_WindowsDisplay_WM_MOUSEMOVE 512L
#undef org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONDOWN
#define org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONDOWN 513L
#undef org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONUP
#define org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONUP 514L
#undef org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONDBLCLK
#define org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONDBLCLK 515L
#undef org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONDOWN
#define org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONDOWN 516L
#undef org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONUP
#define org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONUP 517L
#undef org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONDBLCLK
#define org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONDBLCLK 518L
#undef org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONDOWN
#define org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONDOWN 519L
#undef org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONUP
#define org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONUP 520L
#undef org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONDBLCLK
#define org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONDBLCLK 521L
#undef org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONDOWN
#define org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONDOWN 523L
#undef org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONUP
#define org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONUP 524L
#undef org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONDBLCLK
#define org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONDBLCLK 525L
#undef org_lwjgl_opengl_WindowsDisplay_WM_MOUSEWHEEL
#define org_lwjgl_opengl_WindowsDisplay_WM_MOUSEWHEEL 522L
#undef org_lwjgl_opengl_WindowsDisplay_WM_CAPTURECHANGED
#define org_lwjgl_opengl_WindowsDisplay_WM_CAPTURECHANGED 533L
#undef org_lwjgl_opengl_WindowsDisplay_WM_MOUSELEAVE
#define org_lwjgl_opengl_WindowsDisplay_WM_MOUSELEAVE 675L
#undef org_lwjgl_opengl_WindowsDisplay_WM_ENTERSIZEMOVE
#define org_lwjgl_opengl_WindowsDisplay_WM_ENTERSIZEMOVE 561L
#undef org_lwjgl_opengl_WindowsDisplay_WM_EXITSIZEMOVE
#define org_lwjgl_opengl_WindowsDisplay_WM_EXITSIZEMOVE 562L
#undef org_lwjgl_opengl_WindowsDisplay_WM_SIZING
#define org_lwjgl_opengl_WindowsDisplay_WM_SIZING 532L
#undef org_lwjgl_opengl_WindowsDisplay_WM_KEYDOWN
#define org_lwjgl_opengl_WindowsDisplay_WM_KEYDOWN 256L
#undef org_lwjgl_opengl_WindowsDisplay_WM_KEYUP
#define org_lwjgl_opengl_WindowsDisplay_WM_KEYUP 257L
#undef org_lwjgl_opengl_WindowsDisplay_WM_SYSKEYUP
#define org_lwjgl_opengl_WindowsDisplay_WM_SYSKEYUP 261L
#undef org_lwjgl_opengl_WindowsDisplay_WM_SYSKEYDOWN
#define org_lwjgl_opengl_WindowsDisplay_WM_SYSKEYDOWN 260L
#undef org_lwjgl_opengl_WindowsDisplay_WM_SYSCHAR
#define org_lwjgl_opengl_WindowsDisplay_WM_SYSCHAR 262L
#undef org_lwjgl_opengl_WindowsDisplay_WM_CHAR
#define org_lwjgl_opengl_WindowsDisplay_WM_CHAR 258L
#undef org_lwjgl_opengl_WindowsDisplay_WM_GETICON
#define org_lwjgl_opengl_WindowsDisplay_WM_GETICON 127L
#undef org_lwjgl_opengl_WindowsDisplay_WM_SETICON
#define org_lwjgl_opengl_WindowsDisplay_WM_SETICON 128L
#undef org_lwjgl_opengl_WindowsDisplay_WM_SETCURSOR
#define org_lwjgl_opengl_WindowsDisplay_WM_SETCURSOR 32L
#undef org_lwjgl_opengl_WindowsDisplay_WM_MOUSEACTIVATE
#define org_lwjgl_opengl_WindowsDisplay_WM_MOUSEACTIVATE 33L
#undef org_lwjgl_opengl_WindowsDisplay_WM_QUIT
#define org_lwjgl_opengl_WindowsDisplay_WM_QUIT 18L
#undef org_lwjgl_opengl_WindowsDisplay_WM_SYSCOMMAND
#define org_lwjgl_opengl_WindowsDisplay_WM_SYSCOMMAND 274L
#undef org_lwjgl_opengl_WindowsDisplay_WM_PAINT
#define org_lwjgl_opengl_WindowsDisplay_WM_PAINT 15L
#undef org_lwjgl_opengl_WindowsDisplay_WM_KILLFOCUS
#define org_lwjgl_opengl_WindowsDisplay_WM_KILLFOCUS 8L
#undef org_lwjgl_opengl_WindowsDisplay_WM_SETFOCUS
#define org_lwjgl_opengl_WindowsDisplay_WM_SETFOCUS 7L
#undef org_lwjgl_opengl_WindowsDisplay_SC_SIZE
#define org_lwjgl_opengl_WindowsDisplay_SC_SIZE 61440L
#undef org_lwjgl_opengl_WindowsDisplay_SC_MOVE
#define org_lwjgl_opengl_WindowsDisplay_SC_MOVE 61456L
#undef org_lwjgl_opengl_WindowsDisplay_SC_MINIMIZE
#define org_lwjgl_opengl_WindowsDisplay_SC_MINIMIZE 61472L
#undef org_lwjgl_opengl_WindowsDisplay_SC_MAXIMIZE
#define org_lwjgl_opengl_WindowsDisplay_SC_MAXIMIZE 61488L
#undef org_lwjgl_opengl_WindowsDisplay_SC_NEXTWINDOW
#define org_lwjgl_opengl_WindowsDisplay_SC_NEXTWINDOW 61504L
#undef org_lwjgl_opengl_WindowsDisplay_SC_PREVWINDOW
#define org_lwjgl_opengl_WindowsDisplay_SC_PREVWINDOW 61520L
#undef org_lwjgl_opengl_WindowsDisplay_SC_CLOSE
#define org_lwjgl_opengl_WindowsDisplay_SC_CLOSE 61536L
#undef org_lwjgl_opengl_WindowsDisplay_SC_VSCROLL
#define org_lwjgl_opengl_WindowsDisplay_SC_VSCROLL 61552L
#undef org_lwjgl_opengl_WindowsDisplay_SC_HSCROLL
#define org_lwjgl_opengl_WindowsDisplay_SC_HSCROLL 61568L
#undef org_lwjgl_opengl_WindowsDisplay_SC_MOUSEMENU
#define org_lwjgl_opengl_WindowsDisplay_SC_MOUSEMENU 61584L
#undef org_lwjgl_opengl_WindowsDisplay_SC_KEYMENU
#define org_lwjgl_opengl_WindowsDisplay_SC_KEYMENU 61696L
#undef org_lwjgl_opengl_WindowsDisplay_SC_ARRANGE
#define org_lwjgl_opengl_WindowsDisplay_SC_ARRANGE 61712L
#undef org_lwjgl_opengl_WindowsDisplay_SC_RESTORE
#define org_lwjgl_opengl_WindowsDisplay_SC_RESTORE 61728L
#undef org_lwjgl_opengl_WindowsDisplay_SC_TASKLIST
#define org_lwjgl_opengl_WindowsDisplay_SC_TASKLIST 61744L
#undef org_lwjgl_opengl_WindowsDisplay_SC_SCREENSAVE
#define org_lwjgl_opengl_WindowsDisplay_SC_SCREENSAVE 61760L
#undef org_lwjgl_opengl_WindowsDisplay_SC_HOTKEY
#define org_lwjgl_opengl_WindowsDisplay_SC_HOTKEY 61776L
#undef org_lwjgl_opengl_WindowsDisplay_SC_DEFAULT
#define org_lwjgl_opengl_WindowsDisplay_SC_DEFAULT 61792L
#undef org_lwjgl_opengl_WindowsDisplay_SC_MONITORPOWER
#define org_lwjgl_opengl_WindowsDisplay_SC_MONITORPOWER 61808L
#undef org_lwjgl_opengl_WindowsDisplay_SC_CONTEXTHELP
#define org_lwjgl_opengl_WindowsDisplay_SC_CONTEXTHELP 61824L
#undef org_lwjgl_opengl_WindowsDisplay_SC_SEPARATOR
#define org_lwjgl_opengl_WindowsDisplay_SC_SEPARATOR 61455L
#undef org_lwjgl_opengl_WindowsDisplay_SM_CXCURSOR
#define org_lwjgl_opengl_WindowsDisplay_SM_CXCURSOR 13L
#undef org_lwjgl_opengl_WindowsDisplay_SM_CYCURSOR
#define org_lwjgl_opengl_WindowsDisplay_SM_CYCURSOR 14L
#undef org_lwjgl_opengl_WindowsDisplay_SM_CMOUSEBUTTONS
#define org_lwjgl_opengl_WindowsDisplay_SM_CMOUSEBUTTONS 43L
#undef org_lwjgl_opengl_WindowsDisplay_SM_MOUSEWHEELPRESENT
#define org_lwjgl_opengl_WindowsDisplay_SM_MOUSEWHEELPRESENT 75L
#undef org_lwjgl_opengl_WindowsDisplay_SIZE_RESTORED
#define org_lwjgl_opengl_WindowsDisplay_SIZE_RESTORED 0L
#undef org_lwjgl_opengl_WindowsDisplay_SIZE_MINIMIZED
#define org_lwjgl_opengl_WindowsDisplay_SIZE_MINIMIZED 1L
#undef org_lwjgl_opengl_WindowsDisplay_SIZE_MAXIMIZED
#define org_lwjgl_opengl_WindowsDisplay_SIZE_MAXIMIZED 2L
#undef org_lwjgl_opengl_WindowsDisplay_WM_SIZE
#define org_lwjgl_opengl_WindowsDisplay_WM_SIZE 5L
#undef org_lwjgl_opengl_WindowsDisplay_WM_ACTIVATE
#define org_lwjgl_opengl_WindowsDisplay_WM_ACTIVATE 6L
#undef org_lwjgl_opengl_WindowsDisplay_WA_INACTIVE
#define org_lwjgl_opengl_WindowsDisplay_WA_INACTIVE 0L
#undef org_lwjgl_opengl_WindowsDisplay_WA_ACTIVE
#define org_lwjgl_opengl_WindowsDisplay_WA_ACTIVE 1L
#undef org_lwjgl_opengl_WindowsDisplay_WA_CLICKACTIVE
#define org_lwjgl_opengl_WindowsDisplay_WA_CLICKACTIVE 2L
#undef org_lwjgl_opengl_WindowsDisplay_SW_NORMAL
#define org_lwjgl_opengl_WindowsDisplay_SW_NORMAL 1L
#undef org_lwjgl_opengl_WindowsDisplay_SW_SHOWMINNOACTIVE
#define org_lwjgl_opengl_WindowsDisplay_SW_SHOWMINNOACTIVE 7L
#undef org_lwjgl_opengl_WindowsDisplay_SW_SHOWDEFAULT
#define org_lwjgl_opengl_WindowsDisplay_SW_SHOWDEFAULT 10L
#undef org_lwjgl_opengl_WindowsDisplay_SW_RESTORE
#define org_lwjgl_opengl_WindowsDisplay_SW_RESTORE 9L
#undef org_lwjgl_opengl_WindowsDisplay_SW_MAXIMIZE
#define org_lwjgl_opengl_WindowsDisplay_SW_MAXIMIZE 3L
#undef org_lwjgl_opengl_WindowsDisplay_ICON_SMALL
#define org_lwjgl_opengl_WindowsDisplay_ICON_SMALL 0L
#undef org_lwjgl_opengl_WindowsDisplay_ICON_BIG
#define org_lwjgl_opengl_WindowsDisplay_ICON_BIG 1L
#undef org_lwjgl_opengl_WindowsDisplay_HWND_TOP
#define org_lwjgl_opengl_WindowsDisplay_HWND_TOP 0LL
#undef org_lwjgl_opengl_WindowsDisplay_HWND_BOTTOM
#define org_lwjgl_opengl_WindowsDisplay_HWND_BOTTOM 1LL
#undef org_lwjgl_opengl_WindowsDisplay_HWND_TOPMOST
#define org_lwjgl_opengl_WindowsDisplay_HWND_TOPMOST -1LL
#undef org_lwjgl_opengl_WindowsDisplay_HWND_NOTOPMOST
#define org_lwjgl_opengl_WindowsDisplay_HWND_NOTOPMOST -2LL
#undef org_lwjgl_opengl_WindowsDisplay_SWP_NOSIZE
#define org_lwjgl_opengl_WindowsDisplay_SWP_NOSIZE 1L
#undef org_lwjgl_opengl_WindowsDisplay_SWP_NOMOVE
#define org_lwjgl_opengl_WindowsDisplay_SWP_NOMOVE 2L
#undef org_lwjgl_opengl_WindowsDisplay_SWP_NOZORDER
#define org_lwjgl_opengl_WindowsDisplay_SWP_NOZORDER 4L
#undef org_lwjgl_opengl_WindowsDisplay_SWP_FRAMECHANGED
#define org_lwjgl_opengl_WindowsDisplay_SWP_FRAMECHANGED 32L
#undef org_lwjgl_opengl_WindowsDisplay_GWL_STYLE
#define org_lwjgl_opengl_WindowsDisplay_GWL_STYLE -16L
#undef org_lwjgl_opengl_WindowsDisplay_GWL_EXSTYLE
#define org_lwjgl_opengl_WindowsDisplay_GWL_EXSTYLE -20L
#undef org_lwjgl_opengl_WindowsDisplay_WS_THICKFRAME
#define org_lwjgl_opengl_WindowsDisplay_WS_THICKFRAME 262144L
#undef org_lwjgl_opengl_WindowsDisplay_WS_MAXIMIZEBOX
#define org_lwjgl_opengl_WindowsDisplay_WS_MAXIMIZEBOX 65536L
#undef org_lwjgl_opengl_WindowsDisplay_HTCLIENT
#define org_lwjgl_opengl_WindowsDisplay_HTCLIENT 1L
#undef org_lwjgl_opengl_WindowsDisplay_MK_XBUTTON1
#define org_lwjgl_opengl_WindowsDisplay_MK_XBUTTON1 32L
#undef org_lwjgl_opengl_WindowsDisplay_MK_XBUTTON2
#define org_lwjgl_opengl_WindowsDisplay_MK_XBUTTON2 64L
#undef org_lwjgl_opengl_WindowsDisplay_XBUTTON1
#define org_lwjgl_opengl_WindowsDisplay_XBUTTON1 1L
#undef org_lwjgl_opengl_WindowsDisplay_XBUTTON2
#define org_lwjgl_opengl_WindowsDisplay_XBUTTON2 2L
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nCreateWindow
* Signature: (IIIIZZJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow
(JNIEnv *, jclass, jint, jint, jint, jint, jboolean, jboolean, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nReleaseDC
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReleaseDC
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nDestroyWindow
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nDestroyWindow
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: clipCursor
* Signature: (Ljava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_clipCursor
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nSwitchDisplayMode
* Signature: (Lorg/lwjgl/opengl/DisplayMode;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSwitchDisplayMode
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: showWindow
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_showWindow
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: setForegroundWindow
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setForegroundWindow
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: setFocus
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setFocus
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nResetDisplayMode
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nResetDisplayMode
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: convertToNativeRamp
* Signature: (Ljava/nio/FloatBuffer;)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_convertToNativeRamp
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getCurrentGammaRamp
* Signature: ()Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getCurrentGammaRamp
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nSetGammaRamp
* Signature: (Ljava/nio/ByteBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetGammaRamp
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nGetVersion
* Signature: (Ljava/lang/String;)Lorg/lwjgl/opengl/WindowsFileVersion;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetVersion
(JNIEnv *, jobject, jstring);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getCurrentDisplayMode
* Signature: ()Lorg/lwjgl/opengl/DisplayMode;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getCurrentDisplayMode
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nSetTitle
* Signature: (JJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetTitle
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nUpdate
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nUpdate
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nReshape
* Signature: (JIIIIZZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReshape
(JNIEnv *, jclass, jlong, jint, jint, jint, jint, jboolean, jboolean);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getAvailableDisplayModes
* Signature: ()[Lorg/lwjgl/opengl/DisplayMode;
*/
JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getAvailableDisplayModes
(JNIEnv *, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nSetCursorPosition
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetCursorPosition
(JNIEnv *, jclass, jint, jint);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nSetNativeCursor
* Signature: (JLjava/lang/Object;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetNativeCursor
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getSystemMetrics
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getSystemMetrics
(JNIEnv *, jclass, jint);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getDllInstance
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDllInstance
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getDC
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDC
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getDesktopWindow
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDesktopWindow
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getForegroundWindow
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getForegroundWindow
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nCreateCursor
* Signature: (IIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateCursor
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint, jobject, jint);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: doDestroyCursor
* Signature: (Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_doDestroyCursor
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nGetPbufferCapabilities
* Signature: (Lorg/lwjgl/opengl/PixelFormat;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetPbufferCapabilities
(JNIEnv *, jobject, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: createIcon
* Signature: (IILjava/nio/IntBuffer;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_createIcon
(JNIEnv *, jclass, jint, jint, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: destroyIcon
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_destroyIcon
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: sendMessage
* Signature: (JJJJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_sendMessage
(JNIEnv *, jclass, jlong, jlong, jlong, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: setWindowLongPtr
* Signature: (JIJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowLongPtr
(JNIEnv *, jclass, jlong, jint, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getWindowLongPtr
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getWindowLongPtr
(JNIEnv *, jclass, jlong, jint);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: setWindowPos
* Signature: (JJIIIIJ)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowPos
(JNIEnv *, jclass, jlong, jlong, jint, jint, jint, jint, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nSetCapture
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetCapture
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nReleaseCapture
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReleaseCapture
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getClientRect
* Signature: (JLjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getClientRect
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: clientToScreen
* Signature: (JLjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_clientToScreen
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: setWindowProc
* Signature: (Ljava/lang/reflect/Method;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowProc
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: defWindowProc
* Signature: (JIJJ)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_defWindowProc
(JNIEnv *, jclass, jlong, jint, jlong, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: getWindowRect
* Signature: (JLjava/nio/IntBuffer;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getWindowRect
(JNIEnv *, jobject, jlong, jobject);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: nTrackMouseEvent
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nTrackMouseEvent
(JNIEnv *, jobject, jlong);
/*
* Class: org_lwjgl_opengl_WindowsDisplay
* Method: adjustWindowRectEx
* Signature: (Ljava/nio/IntBuffer;IZI)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_adjustWindowRectEx
(JNIEnv *, jobject, jobject, jint, jboolean, jint);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,21 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsDisplayPeerInfo */
#ifndef _Included_org_lwjgl_opengl_WindowsDisplayPeerInfo
#define _Included_org_lwjgl_opengl_WindowsDisplayPeerInfo
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_WindowsDisplayPeerInfo
* Method: nInitDC
* Signature: (Ljava/nio/ByteBuffer;JJ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplayPeerInfo_nInitDC
(JNIEnv *, jclass, jobject, jlong, jlong);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,13 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsDisplay_Rect */
#ifndef _Included_org_lwjgl_opengl_WindowsDisplay_Rect
#define _Included_org_lwjgl_opengl_WindowsDisplay_Rect
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,69 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsKeyboard */
#ifndef _Included_org_lwjgl_opengl_WindowsKeyboard
#define _Included_org_lwjgl_opengl_WindowsKeyboard
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_lwjgl_opengl_WindowsKeyboard
* Method: isWindowsNT
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_isWindowsNT
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_WindowsKeyboard
* Method: MapVirtualKey
* Signature: (II)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_MapVirtualKey
(JNIEnv *, jclass, jint, jint);
/*
* Class: org_lwjgl_opengl_WindowsKeyboard
* Method: ToUnicode
* Signature: (IILjava/nio/ByteBuffer;Ljava/nio/CharBuffer;II)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_ToUnicode
(JNIEnv *, jclass, jint, jint, jobject, jobject, jint, jint);
/*
* Class: org_lwjgl_opengl_WindowsKeyboard
* Method: ToAscii
* Signature: (IILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;I)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_ToAscii
(JNIEnv *, jclass, jint, jint, jobject, jobject, jint);
/*
* Class: org_lwjgl_opengl_WindowsKeyboard
* Method: GetKeyboardState
* Signature: (Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetKeyboardState
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_opengl_WindowsKeyboard
* Method: GetKeyState
* Signature: (I)S
*/
JNIEXPORT jshort JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetKeyState
(JNIEnv *, jclass, jint);
/*
* Class: org_lwjgl_opengl_WindowsKeyboard
* Method: GetAsyncKeyState
* Signature: (I)S
*/
JNIEXPORT jshort JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetAsyncKeyState
(JNIEnv *, jclass, jint);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,29 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_WindowsRegistry */
#ifndef _Included_org_lwjgl_opengl_WindowsRegistry
#define _Included_org_lwjgl_opengl_WindowsRegistry
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_opengl_WindowsRegistry_HKEY_CLASSES_ROOT
#define org_lwjgl_opengl_WindowsRegistry_HKEY_CLASSES_ROOT 1L
#undef org_lwjgl_opengl_WindowsRegistry_HKEY_CURRENT_USER
#define org_lwjgl_opengl_WindowsRegistry_HKEY_CURRENT_USER 2L
#undef org_lwjgl_opengl_WindowsRegistry_HKEY_LOCAL_MACHINE
#define org_lwjgl_opengl_WindowsRegistry_HKEY_LOCAL_MACHINE 3L
#undef org_lwjgl_opengl_WindowsRegistry_HKEY_USERS
#define org_lwjgl_opengl_WindowsRegistry_HKEY_USERS 4L
/*
* Class: org_lwjgl_opengl_WindowsRegistry
* Method: nQueryRegistrationKey
* Signature: (ILjava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_WindowsRegistry_nQueryRegistrationKey
(JNIEnv *, jclass, jint, jstring, jstring);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -576,7 +576,7 @@ public interface CL10 {
@size_t long image_width,
@size_t long image_height,
@size_t long image_row_pitch,
@Check(value = "CLChecks.calculateImage2DSize(image_format, image_width, image_height, image_row_pitch)", canBeNull = true)
@Check(value = "CLChecks.calculateImage2DSize(host_ptr, image_format, image_width, image_height, image_row_pitch)", canBeNull = true)
@cl_byte
@cl_short
@cl_int
@ -593,7 +593,7 @@ public interface CL10 {
@size_t long image_depth,
@size_t long image_row_pitch,
@size_t long image_slice_pitch,
@Check(value = "CLChecks.calculateImage3DSize(image_format, image_width, image_height, image_height, image_row_pitch, image_slice_pitch)", canBeNull = true)
@Check(value = "CLChecks.calculateImage3DSize(host_ptr, image_format, image_width, image_height, image_height, image_row_pitch, image_slice_pitch)", canBeNull = true)
@cl_byte
@cl_short
@cl_int

View File

@ -34,6 +34,7 @@ package org.lwjgl.opengl;
import org.lwjgl.util.generator.*;
import org.lwjgl.util.generator.opengl.*;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
@ -281,23 +282,43 @@ public interface NV_path_rendering {
void glPathCommandsNV(@GLuint int path,
@AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands,
@AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType,
@Const @GLvoid ByteBuffer coords);
@AutoSize("coords") @GLsizei int numCoords, @AutoType("coords") @GLenum int coordType,
@Const
@GLbyte
@GLubyte
@GLshort
@GLushort
@GLfloat Buffer coords);
void glPathCoordsNV(@GLuint int path,
@AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType,
@Const @GLvoid ByteBuffer coords);
@AutoSize("coords") @GLsizei int numCoords, @AutoType("coords") @GLenum int coordType,
@Const
@GLbyte
@GLubyte
@GLshort
@GLushort
@GLfloat Buffer coords);
void glPathSubCommandsNV(@GLuint int path,
@GLsizei int commandStart, @GLsizei int commandsToDelete,
@AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands,
@AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType,
@Const @GLvoid ByteBuffer coords);
@AutoSize("coords") @GLsizei int numCoords, @AutoType("coords") @GLenum int coordType,
@Const
@GLbyte
@GLubyte
@GLshort
@GLushort
@GLfloat Buffer coords);
void glPathSubCoordsNV(@GLuint int path,
@GLsizei int coordStart,
@AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType,
@Const @GLvoid ByteBuffer coords);
@AutoSize("coords") @GLsizei int numCoords, @AutoType("coords") @GLenum int coordType,
@Const
@GLbyte
@GLubyte
@GLshort
@GLushort
@GLfloat Buffer coords);
void glPathStringNV(@GLuint int path, @GLenum int format,
@AutoSize("pathString") @GLsizei int length, @Const @GLvoid ByteBuffer pathString);
@ -371,19 +392,21 @@ public interface NV_path_rendering {
void glStencilStrokePathNV(@GLuint int path,
int reference, @GLuint int mask);
void glStencilFillPathInstancedNV(@AutoSize(value="paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
void glStencilFillPathInstancedNV(@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
@GLuint int pathBase,
@GLenum int fillMode, @GLuint int mask,
@GLenum int transformType,
@Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
@Check(value = "numPaths * GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
void glStencilStrokePathInstancedNV(@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
void glStencilStrokePathInstancedNV(@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
@GLuint int pathBase,
int reference, @GLuint int mask,
@GLenum int transformType,
@Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
@Check(value = "numPaths * GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
// PATH COVERING
@ -391,11 +414,11 @@ public interface NV_path_rendering {
void glPathColorGenNV(@GLenum int color,
@GLenum int genMode,
@GLenum int colorFormat, @Check(value = "GLChecks.calculatePathColorGenCoeffsCount(genMode, colorFormat)", canBeNull = true) @Const FloatBuffer coeffs);
@GLenum int colorFormat, @Check(value = "GLChecks.calculatePathColorGenModeElements(genMode) * GLChecks.calculatePathColorGenFormatComponents(colorFormat)", canBeNull = true) @Const FloatBuffer coeffs);
void glPathTexGenNV(@GLenum int texCoordSet,
@GLenum int genMode,
@AutoSize(value="coeffs", expression="GLChecks.calculatePathTextGenCoeffsPerComponent(coeffs, genMode)", useExpression = true, canBeNull = true) int components, @Check(canBeNull = true) @Const FloatBuffer coeffs);
int components, @Check(value = "GLChecks.calculatePathColorGenModeElements(genMode) * components", canBeNull = true) @Const FloatBuffer coeffs);
void glPathFogGenNV(@GLenum int genMode);
@ -403,19 +426,21 @@ public interface NV_path_rendering {
void glCoverStrokePathNV(@GLuint int name, @GLenum int coverMode);
void glCoverFillPathInstancedNV(@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
void glCoverFillPathInstancedNV(@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
@GLuint int pathBase,
@GLenum int coverMode,
@GLenum int transformType,
@Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
@Check(value = "numPaths * GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
void glCoverStrokePathInstancedNV(@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
void glCoverStrokePathInstancedNV(@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
@GLuint int pathBase,
@GLenum int coverMode,
@GLenum int transformType,
@Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
@Check(value = "numPaths * GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues);
// PATH QUERIES
@ -440,18 +465,19 @@ public interface NV_path_rendering {
void glGetPathDashArrayNV(@GLuint int name, @Check @OutParameter FloatBuffer dashArray);
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
void glGetPathMetricsNV(@GLbitfield int metricQueryMask,
@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths,
@AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths,
@GLenum int pathNameType, @Const @GLvoid ByteBuffer paths,
@GLuint int pathBase,
@GLsizei int stride,
@Check("GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics);
@Check("numPaths * GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics);
void glGetPathMetricRangeNV(@GLbitfield int metricQueryMask,
@GLuint int fistPathName,
@GLsizei int numPaths,
@GLsizei int stride,
@Check("GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics);
@Check("numPaths * GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics);
@Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);")
void glGetPathSpacingNV(@GLenum int pathListMode,