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


Java GLDrawable类代码示例

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


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

示例1: display

import javax.media.opengl.GLDrawable; //导入依赖的package包/类
public void display(GLDrawable gLDrawable)
{
  String [] fonts = { "BitMap 9 by 15", "BitMap 8 by 13",
        "Times Roman 10 Point ", "Times Roman 24 Point ",
        "Helvetica 10 Point ","Helvetica 12 Point ","Helvetica 18 Point "};
       
  final GL2 gl = SumoPlatform.getApplication().getGeoContext().getGL().getGL2();
  final GLUT glut = new GLUT();
	 
  gl.glClear (GL.GL_COLOR_BUFFER_BIT);  // Set display window to color.
  gl.glColor3f (0.0f, 0.0f, 0.0f);  // Set text e.color to black
  gl.glMatrixMode (GL2.GL_MODELVIEW);
  gl.glLoadIdentity();
 
  int x = 20, y=15;
  for (int i=0; i<7;i++){
        gl.glRasterPos2i(x,y); // set position
        glut.glutBitmapString(i+2, fonts[i]);
         y+= 20;
  }

}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:23,代码来源:GLTextRender.java

示例2: paint

import javax.media.opengl.GLDrawable; //导入依赖的package包/类
@Override
public void paint(){
	// Compute maximum width of text we're going to draw
	TextRenderer textRenderer = new TextRenderer(new Font(Font.SERIF,0 , 18));
	
    int maxTextWidth = (int) textRenderer.getBounds(this.text).getWidth();
    maxTextWidth = Math.min(maxTextWidth+10,size.width);
	
	GL2 gl=glContext.getGL2();
	gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	gl.glPolygonMode (GL2.GL_FRONT, GL2.GL_LINE_STRIP);
    gl.glColor3f(0.5f, 0.5f, 0.5f);

    gl.glBegin(GL2.GL_LINE_STRIP);
    gl.glVertex2i( this.posx,this.posy);							//x1,y1
    gl.glVertex2i( this.posx+maxTextWidth,this.posy );				//x2,y1
    gl.glVertex2i( this.posx+maxTextWidth,this.posy +size.height); 	//x2,y2 
    gl.glVertex2i( this.posx,this.posy+size.height);				//x1,y2
    gl.glVertex2i( this.posx,this.posy);	
    gl.glEnd( );
    
    
    GLDrawable draw=gl.getGL().getContext().getGLDrawable();
	textRenderer.beginRendering(draw.getWidth(),draw.getHeight());
	textRenderer.setColor(Color.WHITE);
	textRenderer.setSmoothing(true);
	textRenderer.draw(this.text,(int)posx,(int)posy+5); //text and position
	textRenderer.flush();
	textRenderer.endRendering();
	
	gl.glFlush();
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:33,代码来源:GLButton.java

示例3: isOpenGLAvailable

import javax.media.opengl.GLDrawable; //导入依赖的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;
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:34,代码来源:Env.java

示例4: getPosition

import javax.media.opengl.GLDrawable; //导入依赖的package包/类
public static Point getPosition(GLDrawable drawable, MouseEvent e) {
    int x = e.getX();
    int y = e.getY();
    if (drawable.isGLOriented()) {
        y = drawable.getSurfaceHeight() - y;
    }
    return new Point(x, y);
}
 
开发者ID:momega,项目名称:spacesimulator,代码行数:9,代码来源:GLUtils.java

示例5: getGLDrawable

import javax.media.opengl.GLDrawable; //导入依赖的package包/类
/**
 *
 * @return the GL Drawable
 */
public GLDrawable getGLDrawable() {
    return glContext.getGLDrawable();

}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:9,代码来源:OpenGLContext.java

示例6: displayChanged

import javax.media.opengl.GLDrawable; //导入依赖的package包/类
public void displayChanged(GLDrawable gLDrawable, boolean modeChanged, boolean deviceChanged)
{
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:4,代码来源:GLTextRender.java

示例7: getGLDrawable

import javax.media.opengl.GLDrawable; //导入依赖的package包/类
public final GLDrawable getGLDrawable()
{
    return this.getGLContext().getGLDrawable();
}
 
开发者ID:vcucek,项目名称:WildPlot,代码行数:5,代码来源:DrawContextImpl.java

示例8: start

import javax.media.opengl.GLDrawable; //导入依赖的package包/类
/**
 * Initiate the capture sequence
 */
public void start( RecorderListener listener ) {
	fileTime = 0;
	renderTime = 0;
	if ( outputDir == null ) {
		errorReporter.warningReport( 
			LOG_NAME +": Unable to record, output directory "+
			"is not initialized.", null );
		return;
	}
	
	this.listener = listener;
	
	int tmp_width = 0;
	int tmp_height = 0;
	if ( canvas instanceof Component ) {
		Dimension size = ((Component)canvas).getSize( );
		tmp_width = (int)size.getWidth( );
		tmp_height = (int)size.getHeight( );
	} else if ( canvas instanceof GLDrawable ) {
		tmp_width = ((GLDrawable)canvas).getWidth( );
		tmp_height = ((GLDrawable)canvas).getHeight( );
	}
	
	// configure the size from the rendering surface,
	// only if the surface returns something non-zero
	if ( ( tmp_width > 0 ) && ( tmp_height > 0 ) ) {
		width = tmp_width;
		height = tmp_height;
	}
	
	number = 0;
	recordingComplete = false;
	
	VRMLScene scene = core.getScene( );
	VRMLNodeType node = (VRMLNodeType)(scene.getDEFNodes( ).get( timeSensorName ));
	if ( node != null ) {
		timeSensor = (BaseTimeSensor)node;
		fraction_changed_index = timeSensor.getFieldIndex( "fraction_changed" );
		timeSensor.addNodeListener( this );

		startFrameTime = System.nanoTime( );
		
		core.captureScreenStart( this, width, height );
		
		if ( listener != null ) {
			listener.recorderStatusChanged( 
				new RecorderEvent( 
				this, 
				RecorderEvent.ACTIVE, 
				number ) );
		}
	} else {
		errorReporter.warningReport( 
			LOG_NAME +": Unable to record, No TimeSensor named "+ 
			timeSensorName +" found.", null );
	}
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:61,代码来源:TimeSensorSceneRecorder.java

示例9: reshape

import javax.media.opengl.GLDrawable; //导入依赖的package包/类
public void reshape(GLDrawable gLDrawable, int x, int y, int width, int height)
{
 
       
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:6,代码来源:GLTextRender.java


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