本文整理汇总了Java中javax.media.opengl.GLContext.CONTEXT_CURRENT属性的典型用法代码示例。如果您正苦于以下问题:Java GLContext.CONTEXT_CURRENT属性的具体用法?Java GLContext.CONTEXT_CURRENT怎么用?Java GLContext.CONTEXT_CURRENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.media.opengl.GLContext
的用法示例。
在下文中一共展示了GLContext.CONTEXT_CURRENT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispose
public void dispose() {
if (vertices != null) {
vertices.clear();
}
vertices = null;
if (points != null)
points.clear();
points = null;
subImage = null;
if (texture != null) {
GLContext context = ww.getSceneController().getDrawContext().getGLContext();
int i = context.makeCurrent();
if (i == GLContext.CONTEXT_CURRENT) {
((Disposable) texture).dispose();
context.release();
} else
System.err.println("Could not make GLContext current");
}
texture = null;
}
示例2: contextOn
public static GL3 contextOn(GLAutoDrawable drawable) {
try {
final int status = drawable.getContext().makeCurrent();
if ((status != GLContext.CONTEXT_CURRENT) && (status != GLContext.CONTEXT_CURRENT_NEW)) {
logger.error("Error swapping context to onscreen.");
}
} catch (final GLException e) {
logger.error("Exception while swapping context to onscreen.");
logger.error(e.getMessage());
}
return GLContext.getCurrentGL().getGL3();
}
示例3: render
/**
* Draw to the drawable now. This causes the drawable's context to be made
* current and the GL commands are issued. Derived classes should not
* override this method, instead they should use the display()
* or init() methods as needed.
*
* @return false if the rendering should not continue
*/
public final boolean render(GraphicsProfilingData profilingData)
{
if(terminate)
{
terminateCleanup();
return false;
}
try
{
if(!singleThreaded || !initComplete || !contextIsCurrent)
{
int status = glContext.makeCurrent();
switch(status)
{
case GLContext.CONTEXT_CURRENT:
if(!initComplete)
init();
contextIsCurrent = true;
break;
case GLContext.CONTEXT_CURRENT_NEW:
init();
contextIsCurrent = true;
break;
case GLContext.CONTEXT_NOT_CURRENT:
// Exit right now as there's nothing left to do.
errorReporter.errorReport(FAILED_CONTEXT_MSG, null);
contextIsCurrent = false;
return false;
}
}
if(contextIsCurrent && !terminate)
display(profilingData);
if(terminate)
terminateCleanup();
}
catch(GLException ie)
{
// Ignore interrupted exceptions, but it probably means we've
// be shutdown.
if(ie.getCause() instanceof InterruptedException)
terminate = true;
else
errorReporter.errorReport(GL_RENDER_ERROR, ie);
}
return !terminate;
}