本文整理汇总了Java中com.jogamp.opencl.gl.CLGLContext类的典型用法代码示例。如果您正苦于以下问题:Java CLGLContext类的具体用法?Java CLGLContext怎么用?Java CLGLContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CLGLContext类属于com.jogamp.opencl.gl包,在下文中一共展示了CLGLContext类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JavaCVCL
import com.jogamp.opencl.gl.CLGLContext; //导入依赖的package包/类
public JavaCVCL(CLContext context, CLDevice device) {
this.pbuffer = null;
this.context = context;
this.glu = context instanceof CLGLContext ? new GLU() : null;
this.commandQueue = device.createCommandQueue(/*Mode.PROFILING_MODE*/);
CLKernel[] kernels = buildKernels(fastCompilerOptions, "JavaCV.cl", "pyrDown", "remap", "remapBayer");
this.pyrDownKernel = kernels[0];
this.remapKernel = kernels[1];
this.remapBayerKernel = kernels[2];
}
示例2: getCLGLContext
import com.jogamp.opencl.gl.CLGLContext; //导入依赖的package包/类
public CLGLContext getCLGLContext() {
return context instanceof CLGLContext ? (CLGLContext)context : null;
}
示例3: getGLContext
import com.jogamp.opencl.gl.CLGLContext; //导入依赖的package包/类
public GLContext getGLContext() {
return context instanceof CLGLContext ? ((CLGLContext)context).getGLContext() : null;
}
示例4: init
import com.jogamp.opencl.gl.CLGLContext; //导入依赖的package包/类
/**
* Implementation of GLEventListener: Called to initialize the
* GLAutoDrawable. This method will initialize the JCudaDriver
* and cause the initialization of CUDA and the OpenGL PBO.
*/
public void init(GLAutoDrawable drawable)
{
// Perform the default GL initialization
GL gl = drawable.getGL();
gl.setSwapInterval(0);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
setupView(drawable);
// Initialize the GL_ARB_pixel_buffer_object extension
if (!gl.isExtensionAvailable("GL_ARB_pixel_buffer_object"))
{
new Thread(new Runnable()
{
public void run()
{
JOptionPane.showMessageDialog(null,
"GL_ARB_pixel_buffer_object extension not available",
"Unavailable extension", JOptionPane.ERROR_MESSAGE);
runExit();
}
}).start();
}
// Create a TextRenderer for the status messages
renderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 12));
if (initialized)
{
return;
}
try {
// find gl compatible device
device = OpenCLUtil.getStaticContext().getMaxFlopsDevice();
// create OpenCL context before creating any OpenGL objects
// you want to share with OpenCL (AMD driver requirement)
glCtx = CLGLContext.create(drawable.getContext(), device);
// create the program
program = glCtx.createProgram(getClass().getResourceAsStream("volumeRender.cl")).build();
System.out.println(program.getBuildStatus());
System.out.println(program.isExecutable());
System.out.println(program.getBuildLog());
commandQueue = device.createCommandQueue();
kernelFunction = program.createCLKernel("d_render");
} catch (Exception e) {
e.printStackTrace();
unload();
}
// Initialize CUDA with the current volume data
initCL();
// Initialize the OpenGL pixel buffer object
initPBO(gl);
initialized = true;
}
示例5: init
import com.jogamp.opencl.gl.CLGLContext; //导入依赖的package包/类
@Override
public void init(GLAutoDrawable drawable) {
if(clContext == null) {
// find gl compatible device
CLDevice[] devices = CLPlatform.getDefault().listCLDevices();
CLDevice device = null;
for (CLDevice d : devices) {
if(d.isGLMemorySharingSupported()) {
device = d;
break;
}
}
if(null==device) {
throw new RuntimeException("couldn't find any CL/GL memory sharing devices ..");
}
// create OpenCL context before creating any OpenGL objects
// you want to share with OpenCL (AMD driver requirement)
clContext = CLGLContext.create(drawable.getContext(), device);
// enable GL error checking using the composable pipeline
drawable.setGL(new DebugGL2(drawable.getGL().getGL2()));
// OpenGL initialization
GL2 gl = drawable.getGL().getGL2();
gl.setSwapInterval(1);
gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
gl.glGenBuffers(glObjects.length, glObjects, 0);
// gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, glObjects[INDICES]);
// gl.glBufferData(GL2.GL_ELEMENT_ARRAY_BUFFER, ib.capacity() * SIZEOF_INT, ib, GL2.GL_STATIC_DRAW);
// gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, 0);
final int bsz = MESH_SIZE * MESH_SIZE * 4 * SIZEOF_FLOAT;
gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, glObjects[VERTICES]);
gl.glBufferData(GL2.GL_ARRAY_BUFFER, bsz, null, GL2.GL_DYNAMIC_DRAW);
gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
pushPerspectiveView(gl);
gl.glFinish();
// init OpenCL
initCL(gl, bsz);
// start rendering thread
Animator animator = new Animator(drawable);
animator.start();
}
}