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


Java GLContext.release方法代码示例

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


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

示例1: dispose

import javax.media.opengl.GLContext; //导入方法依赖的package包/类
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;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:25,代码来源:FenceDiagram.java

示例2: setup

import javax.media.opengl.GLContext; //导入方法依赖的package包/类
private static void setup( GLCanvas glcanvas, GLContext glcontext ) {
    Rectangle rectangle = glcanvas.getClientArea();

    glcanvas.setCurrent();
    glcontext.makeCurrent();

    GL2 gl = glcontext.getGL().getGL2();
    gl.glMatrixMode( GL2.GL_PROJECTION );
    gl.glLoadIdentity();

    // coordinate system origin at lower left with width and height same as the window
    GLU glu = new GLU();
    glu.gluOrtho2D( 0.0f, rectangle.width, 0.0f, rectangle.height );

    gl.glMatrixMode( GL2.GL_MODELVIEW );
    gl.glLoadIdentity();

    gl.glViewport( 0, 0, rectangle.width, rectangle.height );
    glcontext.release();
}
 
开发者ID:momega,项目名称:spacesimulator,代码行数:21,代码来源:Main.java

示例3: render

import javax.media.opengl.GLContext; //导入方法依赖的package包/类
private static void render( GLCanvas glcanvas, GLContext glcontext ) {
    Rectangle rectangle = glcanvas.getClientArea();

    glcanvas.setCurrent();
    glcontext.makeCurrent();

    GL2 gl = glcontext.getGL().getGL2();
    gl.glClear( GL.GL_COLOR_BUFFER_BIT );

    // draw a triangle filling the window
    gl.glLoadIdentity();
    gl.glBegin( GL.GL_TRIANGLES );
    gl.glColor3f( 1, 0, 0 );
    gl.glVertex2f( 0, 0 );
    gl.glColor3f( 0, 1, 0 );
    gl.glVertex2f( rectangle.width, 0 );
    gl.glColor3f( 0, 0, 1 );
    gl.glVertex2f( rectangle.width / 2, rectangle.height );
    gl.glEnd();

    glcanvas.swapBuffers();
    glcontext.release();
}
 
开发者ID:momega,项目名称:spacesimulator,代码行数:24,代码来源:Main.java

示例4: submitToGL

import javax.media.opengl.GLContext; //导入方法依赖的package包/类
public <T> GLFutureTask<T> submitToGL(Callable<T> c){
final GLFutureTask<T> result = new GLFutureTask<T>(tr.getRootWindow().getCanvas(),c);
if(isGLThread())
    if(gpuFeature.getGl().getContext().isCurrent()){
	result.run();
	return result;
    }else{
	final GLContext context = gpuFeature.getGl().getContext();
	context.makeCurrent();
	result.run();
	context.release();
    }
result.enqueue();
return result;
   }
 
开发者ID:jtrfp,项目名称:terminal-recall,代码行数:16,代码来源:ThreadManager.java

示例5: checkForUpdate

import javax.media.opengl.GLContext; //导入方法依赖的package包/类
/**
      * {@inheritDoc}
      */
     @Override
     protected boolean checkForUpdate() {

         // Linux-specific workaround: On Linux JOGL holds the SunToolkit AWT lock in mtgame commit methods.
         // In order to avoid deadlock with any threads which are already holding the AWT lock and which
         // want to acquire the lock on the dirty rectangle so they can draw (e.g Embedded Swing threads)
         // we need to temporarily release the AWT lock before we lock the dirty rectangle and then reacquire
         // the AWT lock afterward.
         // NOTE: we need to do this manually, rather than using a swingsafe processor, because
         // we need to be holding the AWT lock when we return from this method. 
         // TODO: low: MTgame probably provides a cleaner way to reacquire the lock.
         GLContext glContext = null;
         if (isAWTLockHeldByCurrentThreadMethod != null) {
             try {
                 Boolean ret = (Boolean) isAWTLockHeldByCurrentThreadMethod.invoke(null);
                 if (ret.booleanValue()) {
                     glContext = GLContext.getCurrent();
                     glContext.release();
                 }
             } catch (Exception ex) {
             }
         }

         final int texid = getTexture().getTextureId();

         // In this implementation, we need to check our DirtyTrackingGraphics to see whether it is dirty.
         // If it is dirty, we copy the entire buffered image into the imageGraphics.
         g.executeAtomic(new Runnable() {

             public void run() {
                 Rectangle dirtyRect = g.getDirtyRectangle();
                 if (dirtyRect != null) {

                     //System.err.println("DBSI: Rendering into texid = " + texid);

int x1 = dirtyRect.x;
int y1 = dirtyRect.y;
int x2 = dirtyRect.x + dirtyRect.width - 1;
int y2 = dirtyRect.y + dirtyRect.height - 1;

                     if (!imageGraphics.drawImage(bufImage, x1, y1, x2, y2,
                                    x1, y1, x2, y2, null, null)) {
                         logger.warning("drawImage returned false. Skipping image rendering.");
                     }

                     g.clearDirty();
                     checkForUpdateReturn = true;
                 } else {
                     checkForUpdateReturn = false;
                 }
             }
         });

         // Linux-specific workaround: Reacquire the lock if necessary.
         if (glContext != null) {
             glContext.makeCurrent();
         }

         return checkForUpdateReturn;
     }
 
开发者ID:josmas,项目名称:openwonderland,代码行数:64,代码来源:DrawingSurfaceBufferedImage.java


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