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


Java GLUT类代码示例

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


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

示例1: display

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的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: annotate

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
@Override
public synchronized void annotate (GLAutoDrawable drawable){
	if ( !isFilterEnabled() ){
		return;
	}
	super.annotate(drawable);
	final int sx = chip.getSizeX(),  sy = chip.getSizeY();
	final GL2 gl = drawable.getGL().getGL2();
	gl.glLineWidth(2f);
	gl.glColor3f(0,0,1);
	gl.glRasterPos3f(0,sy * getTopLine(),0);
	glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_24,String.format("%d exited",nOut));
	gl.glRasterPos3f(0,sy * getBotLine(),0);
	glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_24,String.format("%d entered",nIn));
	gl.glBegin(GL.GL_LINES);
	gl.glVertex2f(0,sy * getTopLine());
	gl.glVertex2f(sx,sy * getTopLine());
	gl.glVertex2f(0,sy * getBotLine());
	gl.glVertex2f(sx,sy * getBotLine());
	gl.glEnd();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:22,代码来源:BeeCounter.java

示例3: draw

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
public void draw(GL2 gl) {
    GLUT cGLUT = chip.getCanvas().getGlut();
    final int font = GLUT.BITMAP_HELVETICA_12;
    gl.glColor3f(1, 1, 1);
    cGLUT.glutBitmapString(font, toString()); // annotate
    gl.glRasterPos3f(location.x, location.y, 0);
    float amplitude = 1000 * getAmplitude();
    float phase = getPhase(0);
    gl.glPushMatrix();
    gl.glTranslatef(location.x, location.y, 0);
    gl.glLineWidth(3);
    gl.glBegin(GL.GL_LINES);
    gl.glVertex2f(0, 0);
    gl.glVertex2d(amplitude * Math.cos(phase), amplitude * Math.sin(phase));
    gl.glEnd();
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:18,代码来源:PllTracker.java

示例4: annotate

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
	if (!isFilterEnabled()) {
		return;
	}
	GL2 gl = drawable.getGL().getGL2();
	gl.glPushMatrix();
	final GLUT glut = new GLUT();
	gl.glColor3f(1, 1, 1);
	gl.glRasterPos3f(0, 0, 0);
	if (showAnnotations == true) {
		glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("avgITD(us)=%s", fmt.format(bestITD)));
		glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("  ITDConfidence=%f", avgITDConfidence));
		glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("  ILD=%f", ILD));
		if ((useLaterSpikeForWeight == true) || (usePriorSpikeForWeight == true)) {
			glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("  lastWeight=%f", lastWeight));
		}
	}
	if ((display == true) && (frame != null)) {
		//frame.setITD(avgITD);
		frame.setText(String.format("avgITD(us)=%s   ITDConfidence=%f   ILD=%f", fmt.format(bestITD), avgITDConfidence, ILD));
	}
	gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:25,代码来源:ITDFilter.java

示例5: annotate

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
    if (!isFilterEnabled()) {
        return;
    }
    GL2 gl = drawable.getGL().getGL2();
    gl.glPushMatrix();
    final GLUT glut = new GLUT();
    gl.glColor3f(1, 1, 1);
    gl.glRasterPos3f(0, 0, 0);
    if (showAnnotations == true) {
        glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("avgITD(us)=%s", fmt.format(bestITD)));
        glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("  ITDConfidence=%f", avgITDConfidence));
        glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("  ILD=%f", ILD));
        if ((useLaterSpikeForWeight == true) || (usePriorSpikeForWeight == true)) {
            glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("  lastWeight=%f", lastWeight));
        }
    }
    if ((display == true) && (frame != null)) {
        //frame.setITD(avgITD);
        frame.setText(String.format("avgITD(us)=%s   ITDConfidence=%f   ILD=%f", fmt.format(bestITD), avgITDConfidence, ILD));
    }
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:25,代码来源:ITDFilter_robothead6DOF.java

示例6: annotate

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
	if(!isFilterEnabled()) {
		return;
	}
	GL2 gl=drawable.getGL().getGL2();
	//gl.glPushMatrix();
	final GLUT glut=new GLUT();
	gl.glColor3f(1,1,1);
	gl.glRasterPos3f(0,5,5);

	glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format(state));
	if(state=="tracking"){
		glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format(" Tracked Angle = %s",trackedAngle));


	}


	//glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format("  Angle=%s",ANG));
	//gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:ControlFilter.java

示例7: annotate

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {

	if(!isFilterEnabled()) {
		return;
	}
	GL2 gl=drawable.getGL().getGL2();
	//gl.glPushMatrix();
	final GLUT glut=new GLUT();
	gl.glColor3f(1,1,1);
	gl.glRasterPos3f(0,10,10);
	if(LEDRecognized){
		glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12,String.format(" LED Detected: x = %s",fmt.format(LED.getLocation().getX())));
		glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12,String.format(" y = %s",fmt.format(LED.getLocation().getY())));
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:17,代码来源:LEDTracker.java

示例8: draw

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
/** Draws the beat on the cluster location.
 *
 * @param drawable the GL drawable to draw on.
 */
public void draw(GLAutoDrawable drawable) {
	if (isDoneRendering()) {
		return;
	}
	GL2 gl = drawable.getGL().getGL2(); // when we get this we are already set up with scale 1=1 pixel, at LL corner
	gl.glPushMatrix();
	gl.glColor3f(0, 1, 0); // green
	gl.glLineWidth(3); // will get scaled
	final int pos = 10;
	final String beatString = string;

	// render string at location of cluster. size of string is sized to match cluster size

	float sw = glut.glutStrokeLength(GLUT.STROKE_ROMAN, beatString); // length in model space
	float cw = cluster.getRadius() ; // cluster size (actually radius, to make string half total width)
	float scale = cw / sw; // scaling to make string come out size of cluster /2

	// set origin to put string centered on cluster
	gl.glTranslatef(location.x - (cw/2), location.y, 0);
	gl.glScalef(scale, scale, 1); // scale transform to make string right size

	glut.glutStrokeString(GLUT.STROKE_ROMAN, beatString); // stroke the string
	gl.glPopMatrix();
	framesLeftToRender--;  // decrease counter for rendering
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:30,代码来源:DetectedBeat.java

示例9: annotate

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable)
{
	if(!isFilterEnabled()) {
		return;
	}
	GL2 gl=drawable.getGL().getGL2();
	gl.glPushMatrix();
	final GLUT glut=new GLUT();
	gl.glColor3f(1,1,1);
	gl.glRasterPos3f(0,0,0);
	glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("Total = %s", fmt.format(rate)));
	glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("; Coch0 = %s", fmt.format(coch0Rate)));
	glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, String.format("; Coch1 = %s", fmt.format(coch1Rate)));
	gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:17,代码来源:CochleaEventRate.java

示例10: annotate

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
    if (!isFilterEnabled()) {
        return;
    }
    GL2 gl = drawable.getGL().getGL2();
    gl.glPushMatrix();
    final GLUT glut = new GLUT();
    gl.glColor3f(1, 1, 1); // must set color before raster position (raster position is like glVertex)
    gl.glRasterPos3f(0, 0, 0);
    final float filteredOutPercent = 100 * (float) filteredOutEventCount / totalEventCount;
    String s = null;
    if (adaptiveFilteringEnabled) {
        s = String.format("dt=%.1fms, filteredOutPercent=%%%.1f, entropyReduction=%.1f",
                dt * 1e-3f, filteredOutPercent, entropyReduction);
    } else {
        s = String.format("filteredOutPercent=%%%.1f",
                filteredOutPercent);
    }
    glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, s);
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:SpatioTemporalCorrelationFilter.java

示例11: init

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
/** Called by the drawable immediately after the OpenGL context is
    initialized. Can be used to perform one-time OpenGL
    initialization such as setup of lights and display lists. Note
    that this method may be called more than once if the underlying
    OpenGL context for the GLAutoDrawable is destroyed and
    recreated, for example if a GLCanvas is removed from the widget
    hierarchy and later added again.
 */
@Override
public void init(GLAutoDrawable drawable){
	GL2 gl = drawable.getGL().getGL2();

	gl.setSwapInterval(1);
	gl.glShadeModel(GLLightingFunc.GL_FLAT);

	gl.glClearColor(0,0,0,0f);
	gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	gl.glLoadIdentity();

	gl.glRasterPos3f(0,0,0);
	gl.glColor3f(1,1,1);
	glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,"Initialized display");

	reval();

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:27,代码来源:EyeTarget.java

示例12: annotate

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
	GL2 gl = drawable.getGL().getGL2();
	gl.glPushMatrix();
	String s = state.toString();
	gl.glScalef(.1f, .1f, 1);
	//        float l=glut.glutStrokeLengthf(GLUT.STROKE_ROMAN,s);
	gl.glTranslatef(0, chip.getSizeY() * .8f, 0);
	gl.glLineWidth(3);
	gl.glColor3f(1, 0, 0);
	glut.glutStrokeString(GLUT.STROKE_ROMAN, s);
	gl.glPopMatrix();
	switch (state) {
		case Replay:
			// draw replay progress bar
			gl.glPushMatrix();
			gl.glColor3f(0, 0, 1);
			gl.glRectf(1, 1, (chip.getSizeX() * (float) currentReplayPosition) / numEventsRecorded, 3);
			gl.glPopMatrix();
			break;
		case Live:
		case Init:
			//                info.annotate(drawable);
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:26,代码来源:AutomaticReplayPlayer.java

示例13: drawCylinder

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
private void drawCylinder(Vector3f from, Vector3f to, float size) {
    GLUT glut = new GLUT();
    Vector3f zAxis = new Vector3f(0, 0, 1);
    Vector3f vector = new Vector3f(to.x - from.x, to.y - from.y, to.z - from.z);
    float length = vector.length();
    vector.normalize();
    float angle = zAxis.angle(vector);
    Vector3f axis = new Vector3f();
    axis.cross(zAxis, vector);
    float convert = (float) (180f / Math.PI);

    gl.glPushMatrix();

    gl.glTranslatef(from.x, from.y, from.z);
    gl.glRotatef(angle * convert, axis.x, axis.y, axis.z);
    glut.glutSolidCylinder(size, length, 10, 1);
    gl.glPopMatrix();

}
 
开发者ID:Fidentis,项目名称:Analyst,代码行数:20,代码来源:ComparisonGLEventListener.java

示例14: drawVertex

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
private Vector3f drawVertex(Vector3f vert, double size, float[] color, GL2 gl, GLUT glut) {
    gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2.GL_AMBIENT, color, 0);
    gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2.GL_DIFFUSE, color, 0);
    gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL2.GL_SHININESS, 10);

    gl.glPushAttrib(GL2.GL_LIGHTING_BIT);
    gl.glDisable(GL2.GL_TEXTURE_2D);
    gl.glEnable(GL2.GL_LIGHTING);

    gl.glPushMatrix();
    gl.glTranslatef(vert.getX(), vert.getY(), vert.getZ());

    glut.glutSolidSphere(size, 20, 20);
    gl.glPopMatrix();

    gl.glEnable(GL2.GL_TEXTURE_2D);
    gl.glDisable(GL2.GL_LIGHTING);
    gl.glPopAttrib();

    return vert;
}
 
开发者ID:Fidentis,项目名称:Analyst,代码行数:22,代码来源:PApainting.java

示例15: drawCylinder

import com.jogamp.opengl.util.gl2.GLUT; //导入依赖的package包/类
private void drawCylinder(Vector3f from, Vector3f to, GL2 gl, GLUT glut) {
    Vector3f zAxis = new Vector3f(0, 0, 1);
    Vector3f vector = new Vector3f(to.x - from.x, to.y - from.y, to.z - from.z);
    float length = vector.length();
    vector.normalize();
    float angle = zAxis.angle(vector);
    Vector3f axis = new Vector3f();
    axis.cross(zAxis, vector);
    float convert = (float) (180f / Math.PI);

    gl.glPushMatrix();

    gl.glTranslatef(from.x, from.y, from.z);
    gl.glRotatef(angle * convert, axis.x, axis.y, axis.z);
    glut.glutSolidCylinder(info.getPointSize() / 4.5, length - info.getPointSize(), 20, 20);
    gl.glPopMatrix();

}
 
开发者ID:Fidentis,项目名称:Analyst,代码行数:19,代码来源:PApainting.java


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