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


Java GL2.glColor3f方法代码示例

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


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

示例1: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
    if (!isFilterEnabled()) {
        return;
    }
    final float LINE_WIDTH = 5f; // in pixels
    GL2 gl = drawable.getGL().getGL2(); // when we getString this we are already set up with scale 1=1 pixel, at LL corner
    gl.glLineWidth(LINE_WIDTH);
    double thetaRad = getThetaRad();
    double cosTheta = Math.cos(thetaRad);
    double sinTheta = Math.sin(thetaRad);
    gl.glColor3f(0, 0, 1);
    gl.glBegin(GL.GL_LINES);
    if ((thetaRad > (Math.PI / 4)) && (thetaRad < ((3 * Math.PI) / 4))) {
        gl.glVertex2d(0, yFromX(0, cosTheta, sinTheta));
        gl.glVertex2d(sx2 * 2, yFromX(sx2 * 2, cosTheta, sinTheta));
    } else {
        gl.glVertex2d(xFromY(0, cosTheta, sinTheta), 0);
        gl.glVertex2d(xFromY(sy2 * 2, cosTheta, sinTheta), sy2 * 2);
    }
    gl.glEnd();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:HoughLineTracker.java

示例2: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Displays intensity along with normal 2d histograms.
 *
 * @param drawable
 */
@Override
public void display(GLAutoDrawable drawable) {
	super.display(drawable);
	if (intensityDisplayEnabled && (hasIntensity != null)) {
		GL2 gl = drawable.getGL().getGL2();
		gl.glLineWidth(10);
		gl.glColor3f(0, 1, 0);
		gl.glBegin(GL.GL_LINES);
		gl.glVertex2f(-1, 0);
		float f = hasIntensity.getIntensity()*intensityScale;
		f = f * getChipCanvas().getChip().getSizeY();
		gl.glVertex2f(-1, f);
		gl.glEnd();
		{
			renderer.begin3DRendering();
			renderer.setColor(1, 1, 1, 1f);
			renderer.draw3D("Intensity", -10, 3, 0, .2f); // TODO fix string n lines
			renderer.draw3D(String.format("%.2f", hasIntensity.getIntensity()), -10, 0, 0, .2f); // TODO fix string n lines
			renderer.end3DRendering();
		}

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

示例3: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的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

示例4: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
	GL2 gl = drawable.getGL().getGL2();


	gl.glColor3f(0, 1, 1);
	gl.glLineWidth(5f);
	gl.glBegin(GL.GL_LINES);
	for (int n = 0; n < numberOfLinesInUse; n++) {

		gl.glVertex2d((sx2 * (lsx[n] + 1)), (sy2 * (lsy[n] + 1)));
		gl.glVertex2d((sx2 * (lex[n] + 1)), (sy2 * (ley[n] + 1)));
		//            g.drawLine((int) (sx2 * (gsx + 1) * 4), (int) (sy2 * (gsy + 1) * 4), (int) (sx2 * (gex + 1) * 4), (int) (sy2 * (gey + 1) * 4));

	}
	gl.glEnd();

	// show matrix
	MultilineAnnotationTextRenderer.resetToYPositionPixels(chip.getSizeY());
	StringBuilder sb = new StringBuilder("PigTracker\n");
	sb.append(String.format("# lines = %d\nm=\n", numberOfLinesInUse));
	sb.append(String.format("%6.3f %6.3f %6.3f\n", cm[0], cm[1], cm[2]));
	sb.append(String.format("%6.3f %6.3f %6.3f\n", cm[3], cm[4], cm[5]));
	sb.append(String.format("%6.3f %6.3f %6.3f\n", cm[6], cm[7], cm[8]));
	MultilineAnnotationTextRenderer.renderMultilineString(sb.toString());
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:27,代码来源:PigTracker.java

示例5: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的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

示例6: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {         //shows the class in the jAER window
    if ((drawable == null) || (chip.getCanvas() == null) || !classifyEvents || model == null) {
        return;
    }
    titleRenderer = new TextRenderer(new Font("Helvetica", Font.PLAIN, 40));
    Rectangle2D bounds = titleRenderer.getBounds("Unkown");
    titleArea = new Rectangle((int) bounds.getWidth(), (int) bounds.getHeight());
    GL2 gl = drawable.getGL().getGL2();
    gl.glColor3f(1, 1, 1);
    gl.glRasterPos3f(10, 10, 0);
    titleRenderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
    titleRenderer.setColor(Color.WHITE);
    titleRenderer.draw(String.format("Class: %d", labeledClass), titleArea.x, titleArea.y);
    titleRenderer.endRendering();
    gl.glPushMatrix();
    gl.glLoadIdentity();
    gl.glTranslatef(drawable.getSurfaceWidth() / 2, drawable.getSurfaceHeight() / 2, 0);
    gl.glColor3f(1, 1, 1);
    float w = drawable.getSurfaceWidth() * lastdot * 5;
    gl.glRectf(0, -10, w, 10);
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:24,代码来源:CochleaSVMTwoEars.java

示例7: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
    AWTGraphics3D g = (AWTGraphics3D) graphics;
    GL2 gl = g.getGL2();  // get the OpenGL 2 graphics context
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear color and depth buffers
    gl.glLoadIdentity();  // reset the model-view matrix

    gl.glTranslatef(0.0f, 0.0f, -15.0f); // translate into the screen
    gl.glScaled(15, 15, 15);
    gl.glRotated(angleY, 0, 1, 0);

    //Draw Bunny Model
    bunny.draw(g);

    //Draw Bounding Box
    gl.glColor3f(0, 1, 1);
    //g.drawBoundingBox(bunnyVBO.getBoundingBox());
    renderOctree(g, octree);

    //Rotate Model
    if (rotate) {
        angleY += 1;
    }
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:25,代码来源:OctreeRender.java

示例8: drawAxis

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public static void drawAxis(GL2 gl, float axisSize) {

		//Draw Axis
		gl.glLineWidth(2.5f);

		//Draw X Axis
		gl.glColor3f(1, 0, 0);
		gl.glBegin(GL.GL_LINES);
		gl.glVertex3f(0, 0, 0);
		gl.glVertex3f(axisSize, 0, 0);
		gl.glEnd();

		//Draw Y Axis
		gl.glColor3f(0, 1, 0);
		gl.glBegin(GL.GL_LINES);
		gl.glVertex3f(0, 0, 0);
		gl.glVertex3f(0, axisSize, 0);
		gl.glEnd();

		//Draw Z Axis
		gl.glColor3f(0, 0, 1);
		gl.glBegin(GL.GL_LINES);
		gl.glVertex3f(0, 0, 0);
		gl.glVertex3f(0, 0, axisSize);
		gl.glEnd();
	}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:27,代码来源:StandardExample.java

示例9: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
	public void annotate (GLAutoDrawable drawable){
        GL2 gl = drawable.getGL().getGL2();
//        gl.glColor3f(1,1,1);
//        gl.glRasterPos3f(10,10,0);
//        glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,gender.toString());
        // title
        titleRenderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
        switch (gender) {
            case Male:
                titleRenderer.setColor(Color.RED);
                break;
            case Female:
                titleRenderer.setColor(Color.GREEN);
                break;
            case Unknown:
                titleRenderer.setColor(Color.WHITE);
                break;
        }
        titleRenderer.draw(String.format("%10s %-6.2f", gender.toString(), SCALE * genderDotProduct), titleArea.width / 2, titleArea.height / 2);
        titleRenderer.endRendering();
        gl.glPushMatrix();
        gl.glLoadIdentity();
        gl.glTranslatef(drawable.getSurfaceWidth() / 2,drawable.getSurfaceHeight() / 2,0);
        switch ( gender ){
            case Male:
                gl.glColor3f(1,0,0);
                break;
            case Female:
                gl.glColor3f(0,1,0);
                break;
            case Unknown:
                gl.glColor3f(1,1,1);
                break;
        }
        float w = drawable.getSurfaceWidth() * genderDotProduct*5;
        gl.glRectf(0,-10,w,10);

        gl.glPopMatrix();
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:41,代码来源:CochleaGenderClassifier.java

示例10: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();  // get the OpenGL 2 graphics context
	gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear color and depth buffers
	gl.glLoadIdentity();  // reset the model-view matrix

	gl.glTranslatef(0.0f, 0.0f, -6.0f); // translate into the screen
	gl.glColor3f(1, 1, 1); //set the triangle color 
	gl.glBegin(GL.GL_TRIANGLES); // draw using triangles
	gl.glVertex3f(0.0f, 1.0f, 0.0f);
	gl.glVertex3f(-1.0f, -1.0f, 0.0f);
	gl.glVertex3f(1.0f, -1.0f, 0.0f);
	gl.glEnd();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:16,代码来源:Example1.java

示例11: paintCovarianceEllipse

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected static void paintCovarianceEllipse( double[] pos, double[][] cov, final double nsigmas, float[] color, GL2 gl )
{
	final int no_points_ellipse = 12;

	final double a = cov[0][0];
	final double b = cov[1][0];
	final double c = cov[1][1];
	final double d = Math.sqrt( (((a*a) + (4*b*b)) - (2*a*c)) + (c*c) );
	final double scale1 = Math.sqrt( 0.5 * ( a+c+d ) ) * nsigmas;
	final double scale2 = Math.sqrt( 0.5 * ( (a+c)-d ) ) * nsigmas;
	final double theta = (0.5 * Math.atan2( (2*b), (a-c) ) * 180.0) / Math.PI;

	gl.glPushMatrix();

	gl.glTranslated(pos[0], pos[1], 0);
	gl.glRotated(theta, 0, 0, 1);
	gl.glScaled(scale1, scale2, 1);

	gl.glColor3f( color[0], color[1], color[2] );
	gl.glLineWidth(2);

	gl.glBegin(GL.GL_LINE_LOOP);
	final double angle = (2*Math.PI) / no_points_ellipse;
	for (int i = 0;i<no_points_ellipse;i++) {
		gl.glVertex2d( Math.cos( i*angle ), Math.sin( i*angle ) );
	}
	gl.glEnd();

	gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:31,代码来源:KalmanEventFilter.java

示例12: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
    public void annotate(GLAutoDrawable drawable) {
        if ((drawable == null) || (chip.getCanvas() == null)) {
            return;
        }
        canvas = chip.getCanvas();
        glCanvas = (GLCanvas) canvas.getCanvas();
//        int sx = chip.getSizeX(), sy = chip.getSizeY();
        GL2 gl = drawable.getGL().getGL2();
        if (selecting) {
            drawSelection(gl, selection, SELECT_COLOR);
        }
        gl.glPushMatrix();
        {
            if (!multiSelectionEnabled) {
                gl.glColor3f(0, 0, 1);
                gl.glLineWidth(2f);
                gl.glBegin(GL.GL_LINE_LOOP);
                gl.glVertex2i(startX, startY);
                gl.glVertex2i(endX, startY);
                gl.glVertex2i(endX, endY);
                gl.glVertex2i(startX, endY);
                gl.glEnd();
            } else {
                for (SelectionRectangle r : selectionList) {
                    r.draw(gl);
                }
            }
        }
        gl.glPopMatrix();

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

示例13: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的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("ITD(us)=%s",fmt.format(ITD)));
	glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format("  ILD(m)=%s",fmt.format(ILD)));
	glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format("  azm=%s",azm));
	gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:16,代码来源:CochleaXCorrelator.java

示例14: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
synchronized public void annotate (GLAutoDrawable drawable){
	if ( !isFilterEnabled() ){
		return;

	}
	GL2 gl = drawable.getGL().getGL2(); // when we getString this we are already set up with scale 1=1 pixel, at LL corner
	if ( gl == null ){
		log.warning("null GL in BlurringTunnelTracker.annotate");
		return;
	}
	gl.glPushMatrix();
	try{
		for (int i=0; i<clusters.size(); i++ ){
			Cluster c = clusters.get(i);
			if ( showClusters && c.isVisible() ){
				c.draw(drawable);
			}
			// text annoations on clusters, setup
			final int font = GLUT.BITMAP_HELVETICA_18;
			gl.glColor3f(1,1,1);
			gl.glRasterPos3f(chip.getSizeX()/2,chip.getSizeY()+10,0);

			// annotate the cluster with hash ID
			if ( sendClusterInfo ){
				chip.getCanvas().getGlut().glutBitmapString(font,String.format("Flow: %d",flow));
			}
		}
	} catch ( java.util.ConcurrentModificationException e ){
		// this is in case cluster list is modified by real time filter during rendering of clusters
		log.warning(e.getMessage());
	}
	gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:35,代码来源:BlurringTunnelTracker.java

示例15: draw

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
synchronized private void draw(GLAutoDrawable drawable) {
    int n = rateSamples.size();
    if ((n < 2) || ((endTimeMs - startTimeMs) == 0)) {
        return;
    }
    GL2 gl = drawable.getGL().getGL2();
    gl.glColor3f(.8f, .8f, .8f);
    gl.glLineWidth(1.5f);
    // draw xaxis
    gl.glBegin(GL.GL_LINES);
    float x0 = 0;
    final int ypos = chip.getSizeY() / 3; // where graph starts along y axis of chip

    gl.glVertex2f(x0, ypos);
    gl.glVertex2f(chip.getSizeX(), ypos);
    gl.glEnd();
    // draw y axis
    gl.glBegin(GL.GL_LINE_STRIP);
    gl.glVertex2f(x0, ypos);
    gl.glVertex2f(x0, ypos + (chip.getSizeY() * .2f));
    gl.glEnd();

    gl.glPushMatrix();
    gl.glColor3f(1, 1, .8f);
    gl.glLineWidth(1.5f);
    gl.glTranslatef(0.5f, ypos, 0);
    //            gl.glRotatef(90, 0, 0, 1);
    //            gl.glRotatef(-90, 0, 0, 1);
    gl.glScalef((float) (chip.getSizeX() - 1) / (endTimeMs - startTimeMs), (chip.getSizeY() * .2f) / (maxRate), 1);
    gl.glBegin(GL.GL_LINE_STRIP);
    for (RateSample s : rateSamples) {
        gl.glVertex2f(s.time - startTimeMs, s.rate);
    }
    gl.glEnd();

    gl.glPopMatrix();
    gl.glPushMatrix();
    maxRateString = String.format("max %s eps", engFmt.format(maxRate));
    maxTimeString = String.format("%s s", engFmt.format((endTimeMs - startTimeMs) * .001f));

    GLUT glut = chip.getCanvas().getGlut();
    int font = GLUT.BITMAP_9_BY_15;
    ChipCanvas.Borders borders = chip.getCanvas().getBorders();
    float w = drawable.getSurfaceWidth() - (2 * borders.leftRight * chip.getCanvas().getScale());
    int ntypes = eventRateFilter.getNumCellTypes();
    final int sx = chip.getSizeX(), sy = chip.getSizeY();
    float sw = (glut.glutBitmapLength(font, maxRateString) / w) * sx;
    gl.glRasterPos3f(0, sy / 2, 0);
    glut.glutBitmapString(font, maxRateString);
    sw = (glut.glutBitmapLength(font, maxTimeString) / w) * sx;
    gl.glRasterPos3f(sx - sw, sy * .3f, 0);
    glut.glutBitmapString(font, maxTimeString);

    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:56,代码来源:Info.java


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