当前位置: 首页>>代码示例>>Java>>正文


Java LWJGLUtil.PLATFORM_MACOSX属性代码示例

本文整理汇总了Java中org.lwjgl.LWJGLUtil.PLATFORM_MACOSX属性的典型用法代码示例。如果您正苦于以下问题:Java LWJGLUtil.PLATFORM_MACOSX属性的具体用法?Java LWJGLUtil.PLATFORM_MACOSX怎么用?Java LWJGLUtil.PLATFORM_MACOSX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.lwjgl.LWJGLUtil的用法示例。


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

示例1: getNativeCursorCapabilities

public static int getNativeCursorCapabilities() {
	if (LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_MACOSX || LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 4)) {
		int cursor_colors = Toolkit.getDefaultToolkit().getMaximumCursorColors();
		boolean supported = cursor_colors >= Short.MAX_VALUE && getMaxCursorSize() > 0;
		int caps = supported ? org.lwjgl.input.Cursor.CURSOR_8_BIT_ALPHA | org.lwjgl.input.Cursor.CURSOR_ONE_BIT_TRANSPARENCY: 0 | org.lwjgl.input.Cursor.CURSOR_ANIMATION;
		return caps;
	} else {
		/* Return no capability in Mac OS X 10.3 and earlier , as there are two unsolved bugs (both reported to apple along with
		   minimal test case):
		   1. When a custom cursor (or some standard) java.awt.Cursor is assigned to a
		   Componennt, it is reset to the default pointer cursor when the window is de-
		   activated and the re-activated. The Cursor can not be reset to the custom cursor,
		   with another setCursor.
		   2. When the cursor is moving in the top pixel row (y = 0 in AWT coordinates) in fullscreen
		   mode, no mouse moved events are reported, even though mouse pressed/released and dragged
		   events are reported
		 */
		return 0;
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:AWTUtil.java

示例2: createImplementation

static AWTCanvasImplementation createImplementation() {
	switch ( LWJGLUtil.getPlatform() ) {
		case LWJGLUtil.PLATFORM_LINUX:
			return new LinuxCanvasImplementation();
		case LWJGLUtil.PLATFORM_WINDOWS:
			return new WindowsCanvasImplementation();
		case LWJGLUtil.PLATFORM_MACOSX:
			return new MacOSXCanvasImplementation();
		default:
			throw new IllegalStateException("Unsupported platform");
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:AWTGLCanvas.java

示例3: createDisplayImplementation

private static DisplayImplementation createDisplayImplementation() {
	switch ( LWJGLUtil.getPlatform() ) {
		case LWJGLUtil.PLATFORM_LINUX:
			return new LinuxDisplay();
		case LWJGLUtil.PLATFORM_WINDOWS:
			return new WindowsDisplay();
		case LWJGLUtil.PLATFORM_MACOSX:
			return new MacOSXDisplay();
		default:
			throw new IllegalStateException("Unsupported platform");
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:Display.java

示例4: setCLSharingProperties

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,代码行数:29,代码来源:ContextGL.java

示例5: createImplementation

private static ContextImplementation createImplementation() {
	switch ( LWJGLUtil.getPlatform() ) {
		case LWJGLUtil.PLATFORM_LINUX:
			return new LinuxContextImplementation();
		case LWJGLUtil.PLATFORM_WINDOWS:
			return new WindowsContextImplementation();
		case LWJGLUtil.PLATFORM_MACOSX:
			return new MacOSXContextImplementation();
		default:
			throw new IllegalStateException("Unsupported platform");
	}
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:12,代码来源:ContextGL.java

示例6: getAttribList

IntBuffer getAttribList() {
	if ( LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX )
		return null;

	ContextAttribsImplementation implementation = getImplementation();

	int attribCount = 0;

	if ( !(majorVersion == 1 && minorVersion == 0) )
		attribCount += 2;
	if ( 0 < layerPlane )
		attribCount++;

	int flags = 0;
	if ( debug )
		flags |= implementation.getDebugBit();
	if ( forwardCompatible )
		flags |= implementation.getForwardCompatibleBit();
	if ( robustAccess )
		flags |= CONTEXT_ROBUST_ACCESS_BIT_ARB;
	if ( contextResetIsolation )
		flags |= CONTEXT_RESET_ISOLATION_BIT_ARB;
	if ( 0 < flags )
		attribCount++;

	int profileMask = 0;
	if ( profileCore )
		profileMask |= implementation.getProfileCoreBit();
	else if ( profileCompatibility )
		profileMask |= implementation.getProfileCompatibilityBit();
	else if ( profileES )
		profileMask |= CONTEXT_ES2_PROFILE_BIT_EXT;
	if ( 0 < profileMask )
		attribCount++;

	if ( loseContextOnReset )
		attribCount++;

	if ( attribCount == 0 )
		return null;

	final IntBuffer attribs = BufferUtils.createIntBuffer((attribCount * 2) + 1);

	if ( !(majorVersion == 1 && minorVersion == 0) ) {
		attribs.put(implementation.getMajorVersionAttrib()).put(majorVersion);
		attribs.put(implementation.getMinorVersionAttrib()).put(minorVersion);
	}
	if ( 0 < layerPlane )
		attribs.put(implementation.getLayerPlaneAttrib()).put(layerPlane);
	if ( 0 < flags )
		attribs.put(implementation.getFlagsAttrib()).put(flags);
	if ( 0 < profileMask )
		attribs.put(implementation.getProfileMaskAttrib()).put(profileMask);
	if ( loseContextOnReset )
		attribs.put(CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB).put(LOSE_CONTEXT_ON_RESET_ARB);

	attribs.put(0);
	attribs.rewind();
	return attribs;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:60,代码来源:ContextAttribs.java

示例7: create

/**
 * @param openDevice Whether to automatically open the device
 * @see #create(String, int, int, boolean)
 */
public static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized, boolean openDevice)
	throws LWJGLException {

	if (created)
		throw new IllegalStateException("Only one OpenAL context may be instantiated at any one time.");
	String libname;
	String[] library_names;
	switch (LWJGLUtil.getPlatform()) {
		case LWJGLUtil.PLATFORM_WINDOWS:
			libname = "OpenAL32";
			library_names = new String[]{"OpenAL64.dll", "OpenAL32.dll"};
			break;
		case LWJGLUtil.PLATFORM_LINUX:
			libname = "openal";
			library_names = new String[]{"libopenal64.so", "libopenal.so", "libopenal.so.0"};
			break;
		case LWJGLUtil.PLATFORM_MACOSX:
			libname = "openal";
			library_names = new String[]{"openal.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");
	for ( String oalPath : oalPaths ) {
		try {
			nCreate(oalPath);
			created = true;
			init(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, openDevice);
			break;
		} catch (LWJGLException e) {
			LWJGLUtil.log("Failed to load " + oalPath + ": " + e.getMessage());
		}
	}
	if (!created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX) {
		// Try to load OpenAL from the framework instead
		nCreateDefault();
		created = true;
		init(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, openDevice);
	}
	if (!created)
		throw new LWJGLException("Could not locate OpenAL library.");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:48,代码来源:AL.java

示例8: create

public static void create() throws LWJGLException {
	if ( created )
		return;
	//throw new IllegalStateException("OpenCL has already been created.");

	final String libname;
	final String[] library_names;
	switch ( LWJGLUtil.getPlatform() ) {
		case LWJGLUtil.PLATFORM_WINDOWS:
			libname = "OpenCL";
			library_names = new String[] { "OpenCL.dll" };
			break;
		case LWJGLUtil.PLATFORM_LINUX:
			libname = "OpenCL";
			library_names = new String[] { "libOpenCL64.so", "libOpenCL.so" }; // TODO: Fix this
			break;
		case LWJGLUtil.PLATFORM_MACOSX:
			libname = "OpenCL";
			library_names = new String[] { "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");
	for ( String oclPath : oclPaths ) {
		try {
			nCreate(oclPath);
			created = true;
			break;
		} catch (LWJGLException e) {
			LWJGLUtil.log("Failed to load " + oclPath + ": " + e.getMessage());
		}
	}

	if ( !created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX ) {
		// Try to load OpenCL from the framework instead
		nCreateDefault();
		created = true;
	}

	if ( !created )
		throw new LWJGLException("Could not locate OpenCL library.");

	if ( !CLCapabilities.OpenCL10 )
		throw new RuntimeException("OpenCL 1.0 not supported.");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:48,代码来源:CL.java


注:本文中的org.lwjgl.LWJGLUtil.PLATFORM_MACOSX属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。