use of com.jme3.opencl in project jmonkeyengine by jMonkeyEngine.
the class JmeDesktopSystem method newAudioRenderer.
@Override
public AudioRenderer newAudioRenderer(AppSettings settings) {
initialize(settings);
AL al;
ALC alc;
EFX efx;
if (settings.getAudioRenderer().startsWith("LWJGL")) {
al = newObject("com.jme3.audio.lwjgl.LwjglAL");
alc = newObject("com.jme3.audio.lwjgl.LwjglALC");
efx = newObject("com.jme3.audio.lwjgl.LwjglEFX");
} else if (settings.getAudioRenderer().startsWith("JOAL")) {
al = newObject("com.jme3.audio.joal.JoalAL");
alc = newObject("com.jme3.audio.joal.JoalALC");
efx = newObject("com.jme3.audio.joal.JoalEFX");
} else {
throw new UnsupportedOperationException("Unrecognizable audio renderer specified: " + settings.getAudioRenderer());
}
if (al == null || alc == null || efx == null) {
return null;
}
return new ALAudioRenderer(al, alc, efx);
}
use of com.jme3.opencl in project jmonkeyengine by jMonkeyEngine.
the class JmeBatchRenderBackend method createAtlasTextureInternal.
// internal implementations
private Texture2D createAtlasTextureInternal(final int width, final int height) throws Exception {
ByteBuffer initialData = BufferUtils.createByteBuffer(width * height * 4);
for (int i = 0; i < width * height * 4; i++) {
initialData.put((byte) 0x00);
}
initialData.rewind();
Texture2D texture = new Texture2D(new com.jme3.texture.Image(Format.RGBA8, width, height, initialData, ColorSpace.sRGB));
texture.setMinFilter(MinFilter.NearestNoMipMaps);
texture.setMagFilter(MagFilter.Nearest);
return texture;
}
use of com.jme3.opencl in project jmonkeyengine by jMonkeyEngine.
the class JmeBatchRenderBackend method modifyTexture.
private void modifyTexture(final Texture2D textureAtlas, final com.jme3.texture.Image image, final int x, final int y) {
Renderer renderer = display.getRenderer();
if (renderer == null) {
// we have no renderer (yet) so we'll need to cache this call to the next beginFrame() call
modifyTextureCalls.add(new ModifyTexture(textureAtlas, image, x, y));
return;
}
// all is well, we can execute the modify right away
renderer.modifyTexture(textureAtlas, image, x, y);
}
use of com.jme3.opencl in project jmonkeyengine by jMonkeyEngine.
the class TestWriteToTexture method initOpenCL1.
private void initOpenCL1() {
clContext = context.getOpenCLContext();
clQueue = clContext.createQueue().register();
programCache = new ProgramCache(clContext);
//create kernel
String cacheID = getClass().getName() + ".Julia";
Program program = programCache.loadFromCache(cacheID);
if (program == null) {
LOG.info("Program not loaded from cache, create from sources instead");
program = clContext.createProgramFromSourceFiles(assetManager, "jme3test/opencl/JuliaSet.cl");
program.build();
programCache.saveToCache(cacheID, program);
}
program.register();
kernel = program.createKernel("JuliaSet").register();
C = new Vector2f(0.12f, -0.2f);
}
use of com.jme3.opencl in project jmonkeyengine by jMonkeyEngine.
the class HelloOpenCL method simpleInitApp.
@Override
public void simpleInitApp() {
BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
Context clContext = context.getOpenCLContext();
if (clContext == null) {
BitmapText txt = new BitmapText(fnt);
txt.setText("No OpenCL Context created!\nSee output log for details.");
txt.setLocalTranslation(5, settings.getHeight() - 5, 0);
guiNode.attachChild(txt);
return;
}
CommandQueue clQueue = clContext.createQueue();
StringBuilder str = new StringBuilder();
str.append("OpenCL Context created:\n Platform: ").append(clContext.getDevices().get(0).getPlatform().getName()).append("\n Devices: ").append(clContext.getDevices());
str.append("\nTests:");
str.append("\n Buffers: ").append(testBuffer(clContext, clQueue));
str.append("\n Kernel: ").append(testKernel(clContext, clQueue));
str.append("\n Images: ").append(testImages(clContext, clQueue));
clQueue.release();
BitmapText txt1 = new BitmapText(fnt);
txt1.setText(str.toString());
txt1.setLocalTranslation(5, settings.getHeight() - 5, 0);
guiNode.attachChild(txt1);
flyCam.setEnabled(false);
inputManager.setCursorVisible(true);
}
Aggregations