• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java KHRGLSharing类的典型用法和代码示例

java 8次浏览

本文整理汇总了Java中org.lwjgl.opencl.KHRGLSharing的典型用法代码示例。如果您正苦于以下问题:Java KHRGLSharing类的具体用法?Java KHRGLSharing怎么用?Java KHRGLSharing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

KHRGLSharing类属于org.lwjgl.opencl包,在下文中一共展示了KHRGLSharing类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setCLSharingProperties

点赞 2

import org.lwjgl.opencl.KHRGLSharing; //导入依赖的package包/类
public synchronized void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException {
	final ByteBuffer peer_handle = peer_info.lockAndGetHandle();
	try {
		switch ( LWJGLUtil.getPlatform() ) {
			case LWJGLUtil.PLATFORM_WINDOWS:
				final WindowsContextImplementation implWindows = (WindowsContextImplementation)implementation;
				properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implWindows.getHGLRC(handle));
				properties.put(KHRGLSharing.CL_WGL_HDC_KHR).put(implWindows.getHDC(peer_handle));
				break;
			case LWJGLUtil.PLATFORM_LINUX:
				final LinuxContextImplementation implLinux = (LinuxContextImplementation)implementation;
				properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implLinux.getGLXContext(handle));
				properties.put(KHRGLSharing.CL_GLX_DISPLAY_KHR).put(implLinux.getDisplay(peer_handle));
				break;
			case LWJGLUtil.PLATFORM_MACOSX:
				if (LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 6)) { // only supported on OS X 10.6+
					// http://oscarbg.blogspot.com/2009/10/about-opencl-opengl-interop.html
					final MacOSXContextImplementation implMacOSX = (MacOSXContextImplementation)implementation;
					final long CGLShareGroup = implMacOSX.getCGLShareGroup(handle);
					properties.put(APPLEGLSharing.CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE).put(CGLShareGroup);
					break;
				}
			default:
				throw new UnsupportedOperationException("CL/GL context sharing is not supported on this platform.");
		}
	} finally {
		peer_info.unlock();
	}
}
 

开发者ID:Superloup10,
项目名称:Wolf_game,
代码行数:30,
代码来源:ContextGL.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)