本文整理汇总了Java中javax.media.opengl.GLContext.getGL方法的典型用法代码示例。如果您正苦于以下问题:Java GLContext.getGL方法的具体用法?Java GLContext.getGL怎么用?Java GLContext.getGL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.opengl.GLContext
的用法示例。
在下文中一共展示了GLContext.getGL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isOpenGLAvailable
import javax.media.opengl.GLContext; //导入方法依赖的package包/类
/**
* Check current graphic card/drivers OpenGL capabilities to see if they match those required by WorldWind to work
* @return true if we are good, false otherwise
*/
public boolean isOpenGLAvailable() {
if (_openGlAvailable == null) {
synchronized (this) {
if (_openGlAvailable == null) {
try {
// create an offscreen context with the current graphic device
final GLProfile glProfile = GLProfile.getDefault(GLProfile.getDefaultDevice());
final GLCapabilities caps = new GLCapabilities(glProfile);
caps.setOnscreen(false);
caps.setPBuffer(false);
final GLDrawable offscreenDrawable = GLDrawableFactory.getFactory(glProfile).createOffscreenDrawable(null, caps,
new DefaultGLCapabilitiesChooser(), 1, 1);
offscreenDrawable.setRealized(true);
final GLContext context = offscreenDrawable.createContext(null);
final int additionalCtxCreationFlags = 0;
context.setContextCreationFlags(additionalCtxCreationFlags);
context.makeCurrent();
final GL gl = context.getGL();
// WWJ will need those to render the globe
_openGlAvailable = gl.isExtensionAvailable(GLExtensions.EXT_texture_compression_s3tc)
|| gl.isExtensionAvailable(GLExtensions.NV_texture_compression_vtc);
} catch (final Throwable e) {
_openGlAvailable = false;
}
}
}
}
return _openGlAvailable;
}
示例2: dispose
import javax.media.opengl.GLContext; //导入方法依赖的package包/类
public void dispose( )
{
GLContext ctx = GLContext.getCurrent();
if( ctx == null )
return;
GL gl = ctx.getGL();
gl.glDeleteLists( gl_id, 1);
}
示例3: getGL
import javax.media.opengl.GLContext; //导入方法依赖的package包/类
public GL getGL() {
GLContext glContext = getGLContext();
return glContext != null ? glContext.getGL() : null;
}