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


Java GL2.glColor3fv方法代码示例

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


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

示例1: drawOrientationVector

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected void drawOrientationVector(GL2 gl, OrientationEventInterface e) {
    if (!e.isHasOrientation()) {
        return;
    }

    byte ori = e.getOrientation();
    OrientationEventInterface.UnitVector d = OrientationEventInterface.unitVectors[ori];
    float jx = 0, jy = 0;
    if (jitterVectorLocations) {
        jx = (random.nextFloat() - .5f) * jitterAmountPixels;
        jy = (random.nextFloat() - .5f) * jitterAmountPixels;
    }
    gl.glLineWidth(3f);
    float[] c = chip.getRenderer().makeTypeColors(e.getNumCellTypes())[ori];
    gl.glColor3fv(c, 0);
    gl.glBegin(GL.GL_LINES);
    gl.glVertex2f((e.getX() - (d.x * length)) + jx, (e.getY() - (d.y * length)) + jy);
    gl.glVertex2f((e.getX() + (d.x * length)) + jx, (e.getY() + (d.y * length)) + jy);
    gl.glEnd();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:21,代码来源:AbstractOrientationFilter.java

示例2: drawMotionVector

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** plots a single motion vector which is the number of pixels per second times scaling
 * 
 * @param gl the OpenGL context
 * @param e the event
 * @param c a 2D array of colors vectors; the first dimension is the event type, and the second is a 3-vector of RGB colors
 */
protected void drawMotionVector(GL2 gl, MotionOrientationEventInterface e,float[][] c) {
    float jx = 0, jy = 0;
    MotionOrientationEventInterface.Dir d = MotionOrientationEventInterface.unitDirs[e.getDirection()];

    if (jitterVectorLocations) {
        jx = (r.nextFloat() - .5f) * jitterAmountPixels;
        jy = (r.nextFloat() - .5f) * jitterAmountPixels;
    }
    // motion vector points in direction of motion, *from* dir value (minus sign) which points in direction from prevous event
    gl.glPushMatrix();
        gl.glColor3fv(c[e.getType()],0);
        DrawGL.drawVector(gl, e.getX()+jx, e.getY()+jy, -d.x, -d.y, 1, e.getSpeed() * ppsScale);
    gl.glPopMatrix();
    
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:22,代码来源:AbstractDirectionSelectiveFilter.java

示例3: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Annotates the output to show the probability of transmission as an overlying shading.
 *
 * @param drawable the drawable context.
 */
public void annotate (GLAutoDrawable drawable){
    if ( !isOverlayProbabilty() ){
        return;
    }
    if(isi==null) return; // don't annoate until this map of isi's exists
    GL2 gl = drawable.getGL().getGL2();
    gl.glPushMatrix();
    gl.glClearColor(0,0,0,0);
    gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
    int sx = chip.getSizeX();
    int sy = chip.getSizeY();
    int st = chip.getNumCellTypes();
    float[] rgb = new float[ 3 ];
    for ( int x = 0 ; x < sx ; x++ ){
        for ( int y = 0 ; y < sy ; y++ ){
            for ( int t = 0 ; t < st ; t++ ){
                float v = probOfTransmission(isi[x][y][t],t);
                rgb[t] = v;
            }
            gl.glColor3fv(rgb,0);
            gl.glRectf(x,y,x + 1,y + 1);
        }
    }
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:30,代码来源:ProbFPNCorrectionFilter.java

示例4: drawSelection

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawSelection(GL2 gl, Rectangle r, float[] c) {
    if (r == null) {
        return;
    }
    gl.glPushMatrix();
    gl.glColor3fv(c, 0);
    gl.glLineWidth(lineWidth);
    gl.glTranslatef(-.5f, -.5f, 0);
    gl.glBegin(GL.GL_LINE_LOOP);
    gl.glVertex2f(selection.x, selection.y);
    gl.glVertex2f(selection.x + selection.width, selection.y);
    gl.glVertex2f(selection.x + selection.width, selection.y + selection.height);
    gl.glVertex2f(selection.x, selection.y + selection.height);
    gl.glEnd();
    gl.glPopMatrix();

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

示例5: drawMotionVector

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
     * Plots a single motion vector which is the number of pixels per second
     * times scaling. Color vectors by angle to x-axis.
     *
     * @param gl the OpenGL context
     * @param e the event
     */
    protected void drawMotionVector(GL2 gl, MotionOrientationEventInterface e) {
        float[] rgb = null;
        if (useColorForMotionVectors) {
            rgb = motionColor(e);
        } else {
            rgb = new float[]{0, 0, 1};
        }
        gl.glColor3fv(rgb, 0);
        float scale = ppsScale;
        if (ppsScaleDisplayRelativeOFLength && displayGlobalMotion) {
            scale = 100 * ppsScale / motionFlowStatistics.getGlobalMotion().meanGlobalSpeed;
        }
        if (displayVectorsEnabled) {
            gl.glPushMatrix();
            gl.glLineWidth(motionVectorLineWidthPixels);
            // start arrow from event
//        DrawGL.drawVector(gl, e.getX() + .5f, e.getY() + .5f, e.getVelocity().x, e.getVelocity().y, motionVectorLineWidthPixels, ppsScale);
            // center arrow on location, rather that start from event location
            float dx, dy;
            dx = e.getVelocity().x * scale;
            dy = e.getVelocity().y * scale;
            if (displayVectorsAsUnitVectors) {
                float s = 100 * scale / (float) Math.sqrt(dx * dx + dy * dy);
                dx *= s;
                dy *= s;
            }

            float x0 = e.getX() - (dx / 2) + .5f, y0 = e.getY() - (dy / 2) + .5f;
            DrawGL.drawVector(gl, x0, y0, dx, dy, motionVectorLineWidthPixels, 1);
            gl.glPopMatrix();
        }
        if (displayVectorsAsColorDots) {
            gl.glPointSize(motionVectorLineWidthPixels * 5);
            gl.glEnable(GL2.GL_POINT_SMOOTH);
            gl.glBegin(GL.GL_POINTS);
            gl.glVertex2f(e.getX(), e.getY());
            gl.glEnd();
        }
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:47,代码来源:AbstractMotionFlowIMU.java

示例6: draw

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void draw(GLAutoDrawable drawable, GL2 gl, float linewidth) {

//            if (getTargetLocation() != null && getTargetLocation().location == null) {
//                textRenderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
//                textRenderer.draw("Target not visible", chip.getSizeX() / 2, chip.getSizeY() / 2);
//                textRenderer.endRendering();
//                return;
//            }
            gl.glPushMatrix();
            gl.glTranslatef(location.x, location.y, 0f);
            float[] compArray = new float[4];
            gl.glColor3fv(targetTypeColors[targetClassID % targetTypeColors.length].getColorComponents(compArray), 0);
//            gl.glColor4f(0, 1, 0, .5f);
            gl.glLineWidth(linewidth);
            gl.glBegin(GL.GL_LINE_LOOP);
            gl.glVertex2f(-width / 2, -height / 2);
            gl.glVertex2f(+width / 2, -height / 2);
            gl.glVertex2f(+width / 2, +height / 2);
            gl.glVertex2f(-width / 2, +height / 2);
            gl.glEnd();
//            if (mouseQuad == null) {
//                mouseQuad = glu.gluNewQuadric();
//            }
//            glu.gluQuadricDrawStyle(mouseQuad, GLU.GLU_LINE);
//            //glu.gluDisk(mouseQuad, getTargetRadius(), getTargetRadius(), 32, 1);
//            int maxDim = Math.max(width, height);
//            glu.gluDisk(mouseQuad, maxDim / 2, (maxDim / 2) + 0.1, 32, 1);
            //getTargetRadius(), getTargetRadius() + 1, 32, 1);
            gl.glPopMatrix();
        }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:31,代码来源:TargetLabeler.java

示例7: drawReceptiveField

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Draws the neuron using OpenGL.
*
* @param drawable area to drawReceptiveField this.
*/
public void drawReceptiveField(GLAutoDrawable drawable) {
 final float BOX_LINE_WIDTH = 2f; // in chip
 GL2 gl = drawable.getGL().getGL2();

 // set color and line width
 gl.glColor3fv(rgb, 0);
 gl.glLineWidth(BOX_LINE_WIDTH);

 // draws the receptive field of a neuron
 gl.glPushMatrix();
 gl.glTranslatef((int) getLocation().x, (int) getLocation().y, 0);

 if (filledReceptiveField) {
	 gl.glBegin(GL2.GL_QUADS);
 } else {
	 gl.glBegin(GL.GL_LINE_LOOP);
 }

 int halfSize = receptiveFieldSize / 2;
 gl.glVertex2i(-halfSize, -halfSize);
 gl.glVertex2i(+halfSize, -halfSize);
 gl.glVertex2i(+halfSize, +halfSize);
 gl.glVertex2i(-halfSize, +halfSize);

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

示例8: drawSelection

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawSelection(GL2 gl, Rectangle r, float[] c) {
    gl.glPushMatrix();
    gl.glColor3fv(c, 0);
    gl.glLineWidth(lineWidth);
    gl.glTranslatef(-.5f, -.5f, 0);
    gl.glBegin(GL.GL_LINE_LOOP);
    gl.glVertex2f(selection.x, selection.y);
    gl.glVertex2f(selection.x + selection.width, selection.y);
    gl.glVertex2f(selection.x + selection.width, selection.y + selection.height);
    gl.glVertex2f(selection.x, selection.y + selection.height);
    gl.glEnd();
    gl.glPopMatrix();

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

示例9: drawSelection

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawSelection(GL2 gl, Rectangle r, float[] c) {
    gl.glPushMatrix();
    gl.glColor3fv(c, 0);
    gl.glLineWidth(lineWidth);
    gl.glTranslatef(-.5f, -.5f, 0);
    gl.glBegin(GL2.GL_LINE_LOOP);
    gl.glVertex2f(selection.x, selection.y);
    gl.glVertex2f(selection.x + selection.width, selection.y);
    gl.glVertex2f(selection.x + selection.width, selection.y + selection.height);
    gl.glVertex2f(selection.x, selection.y + selection.height);
    gl.glEnd();
    gl.glPopMatrix();

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

示例10: drawSelectionRectangle

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * draws selectionRectangle rectangle on annotation
 *
 * @param gl GL context
 * @param r the rectangle
 * @param c the 3 vector RGB color to draw rectangle
 */
private void drawSelectionRectangle(GL2 gl, Rectangle r, float[] c) {
    gl.glPushMatrix();
    gl.glColor3fv(c, 0);
    gl.glLineWidth(lineWidth);
    gl.glTranslatef(-.5f, -.5f, 0);
    gl.glBegin(GL.GL_LINE_LOOP);
    gl.glVertex2f(getSelectionRectangle().x, getSelectionRectangle().y);
    gl.glVertex2f(getSelectionRectangle().x + getSelectionRectangle().width, getSelectionRectangle().y);
    gl.glVertex2f(getSelectionRectangle().x + getSelectionRectangle().width, getSelectionRectangle().y + getSelectionRectangle().height);
    gl.glVertex2f(getSelectionRectangle().x, getSelectionRectangle().y + getSelectionRectangle().height);
    gl.glEnd();
    gl.glPopMatrix();

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

示例11: drawStaticBackground

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Draw the background of the chart. The grid could be drawn by this method.
 * An OpenGL list is created for this.
 */
@Override
protected void drawStaticBackground(GL2 gl) {
	float[] fg = new float[4];
	getForeground().getColorComponents(fg);
	gl.glColor3fv(fg, 0);
	gl.glBegin(GL.GL_LINE_LOOP);
	gl.glVertex2f(0.0f, 0.0f);
	gl.glVertex2f(1.0f, 0.0f);
	gl.glVertex2f(1.0f, 1.0f);
	gl.glVertex2f(0.0f, 1.0f);
	gl.glEnd();

	if (isGridEnabled()) {
		gl.glBegin(GL.GL_LINES);
		gl.glVertex2f(0.0f, 0.25f);
		gl.glVertex2f(1.0f, 0.25f);
		gl.glVertex2f(0.0f, 0.5f);
		gl.glVertex2f(1.0f, 0.5f);
		gl.glVertex2f(0.0f, 0.75f);
		gl.glVertex2f(1.0f, 0.75f);
		gl.glColor3f(0.5f, 0.5f, 0.5f);
		gl.glVertex2f(0.0f, 0.125f);
		gl.glVertex2f(1.0f, 0.125f);
		gl.glVertex2f(0.0f, 0.375f);
		gl.glVertex2f(1.0f, 0.375f);
		gl.glVertex2f(0.0f, 0.625f);
		gl.glVertex2f(1.0f, 0.625f);
		gl.glVertex2f(0.0f, 0.875f);
		gl.glVertex2f(1.0f, 0.875f);
		gl.glEnd();
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:37,代码来源:XYChart.java

示例12: drawStaticBackground

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Draw the background of the chart. The grid could be drawn by this method.
 * An OpenGL list is created for this.
 */
@Override
protected void drawStaticBackground(GL2 gl) {
	float[] fg = new float[4];
	getForeground().getColorComponents(fg);
	gl.glColor3fv(fg, 0);
	gl.glBegin(GL.GL_LINE_LOOP);
	gl.glVertex2f(0.0f, 0.0f);
	gl.glVertex2f(1.0f, 0.0f);
	gl.glVertex2f(1.0f, 1.0f);
	gl.glVertex2f(0.0f, 1.0f);
	gl.glEnd();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:17,代码来源:VectorFieldChart.java

示例13: draw

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Draws this cluster using OpenGL.
 *
 * @param drawable area to draw this.
 */
public void draw (GLAutoDrawable drawable){
	final float BOX_LINE_WIDTH = 2f; // in chip
	final float PATH_POINT_SIZE = 4f;
	final float SUPER_POINT_SIZE = 8f;
	final float VEL_LINE_WIDTH = 4f;
	GL2 gl = drawable.getGL().getGL2();
	int x = (int)getLocation().x;
	int y = (int)getLocation().y;

	// set color and line width of cluster annotation
	getColor().getRGBComponents(rgb);
	gl.glColor3fv(rgb,0);
	gl.glLineWidth(BOX_LINE_WIDTH);

	// draw cluster rectangle
	drawBox(gl,x,y,(int)maxRadius);

	gl.glPointSize(PATH_POINT_SIZE);

	ArrayList<ClusterPathPoint> points = getPath();
	for ( Point2D.Float p:points ){
		gl.glBegin(GL.GL_POINTS);
		gl.glVertex2f(p.x,p.y);
		gl.glEnd();
	}

	// now draw velocityPPT vector
	if ( showClusterVelocity ){
		gl.glLineWidth(VEL_LINE_WIDTH);
		gl.glBegin(GL.GL_LINES);
		{
			gl.glVertex2i(x,y);
			gl.glVertex2f(x + (getVelocityPPT().x * VELOCITY_VECTOR_SCALING * velocityVectorScaling),y + (getVelocityPPT().y * VELOCITY_VECTOR_SCALING * velocityVectorScaling));
		}
		gl.glEnd();
	}
	// text annoations on clusters, setup
	final int font = GLUT.BITMAP_HELVETICA_18;
	if(validForOSC){
		gl.glColor3f(0,1,0);
	}else{
		gl.glColor3f(1,1,1);
	}
	gl.glRasterPos3f(location.x,location.y,0);

	// annotate the cluster with hash ID
	if ( showClusterNumber ){
		chip.getCanvas().getGlut().glutBitmapString(font,String.format("#%d",hashCode()));
	}

	//annotate the cluster with the velocityPPT in pps
	if ( showClusterVelocity ){
		Point2D.Float velpps = getVelocityPPS();
		chip.getCanvas().getGlut().glutBitmapString(font,String.format("%.0f,%.0f pps",velpps.x,velpps.y));
	}

	//show superPos
	gl.glColor3f(1,0,0);
	gl.glPointSize(SUPER_POINT_SIZE);
	gl.glBegin(GL.GL_POINTS);
	gl.glVertex2f(superPos.x,superPos.y);
	gl.glEnd();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:68,代码来源:BlurringTunnelTracker.java

示例14: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
synchronized public void annotate (GLAutoDrawable drawable){
	final float BOX_LINE_WIDTH = 5f; // in pixels
	final float PATH_LINE_WIDTH = 3f;
	float[] rgb;
	int sx, sy;

	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 ClassTracker.annotate");
		return;
	}
	gl.glPushMatrix();
	splitClusters();
	for ( Cluster c:clusters ){
		rgb = c.color.getRGBComponents(null);
		if ( c.mass > clusterMinMass4Display ){
			sx = 14;
			sy = 14;
			if ( c.em ){
				gl.glLineWidth(2);
			} else{
				gl.glLineWidth(1);
			}
			gl.glColor3fv(rgb,0);
			//gl.glColor3f(.5f,.7f,.1f);
		} else{
			sx = (int)( (14.0 * c.mass) / clusterMinMass4Display );
			sy = (int)( (14.0 * c.mass) / clusterMinMass4Display );
			gl.glLineWidth((float).2);
			//gl.glColor3fv(rgb,0);
			gl.glColor3f(.1f,.2f,.1f);
		}
		drawBox(gl,(int)c.location.x,(int)c.location.y,sx,sy);
		gl.glBegin(GL.GL_LINES);
		{
			gl.glVertex2i((int)c.location.x,(int)c.location.y);
			gl.glVertex2f((int)( c.location.x + (c.velocity.x * displayVelocityScaling) ),(int)( c.location.y + (c.velocity.y * displayVelocityScaling) ));
		}
		gl.glEnd();
	}
	gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:47,代码来源:ParticleTracker.java

示例15: drawStats

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

         renderer.begin3DRendering();
//            renderer.beginRendering(drawable.getWidth(), drawable.getHeight());
         // optionally set the color
         renderer.setColor(1, 1, 1, 1f);
         if (rateEnabled) {
             renderer.draw3D(toString(), -1 ,chip.getSizeY(), 0, .2f); // TODO fix string n lines
         }
         // ... more draw commands, color changes, etc.
         renderer.end3DRendering();

         // draw hist
         if (isiHistEnabled) {
             renderer.draw3D(String.format("%d", isiMinUs), -1, -5, 0, .2f);
             renderer.draw3D(String.format("%d", isiMaxUs), chip.getSizeX()- (int) Math.floor(Math.log10(isiMaxUs)) -1, -5, 0, .2f); 
             renderer.draw3D(logISIEnabled ? "log" : "linear", -1, -7, 0, .2f);

             if (individualISIsEnabled) {
                 if (showAverageISIHistogram) {
                     gl.glPushMatrix();
                     globalHist.draw(gl, lineWidth, GLOBAL_HIST_COLOR);
                     gl.glPopMatrix();
                 }
                 if (showIndividualISIHistograms) {
                     int n = histMap.size();
                     gl.glPushMatrix();
                     int k = 0;
                     gl.glLineWidth(lineWidth);
                     gl.glColor4fv(INDIV_HIST_COLOR, 0);
                     for (ISIHist h : histMap.values()) {
                         gl.glPushMatrix();
                         gl.glScalef(1, 1f / n, 1); // if n=10 and sy=128 then scale=1/10 scale so that all n fit in viewpoort of chip, each one is scaled to chip size y
                         boolean sel = false;
                         for (int a : currentAddress) {
                             if (a == h.address) {
                                 sel = true;
                             }
                         }
                         if (!sel) {
                             h.draw(gl);
                         } else {
                             h.draw(gl, lineWidth, SELECT_COLOR);
                         }
                         gl.glPopMatrix();
                         gl.glTranslatef(0, (float) chip.getSizeY() / n, 0);
                     }
                     gl.glPopMatrix();
                 }
             } else {
                 globalHist.draw(gl, lineWidth, GLOBAL_HIST_COLOR);
             }
             if (currentMousePoint != null) {
                 if (currentMousePoint.y <= 0) {

                     if (!logISIEnabled) {
                         binTime = (((float) currentMousePoint.x / chip.getSizeX()) * (stats.isiMaxUs - stats.isiMinUs)) + stats.isiMinUs;
                     } else {
                         binTime = (float) Math.exp((((float) currentMousePoint.x / chip.getSizeX()) * (stats.logIsiMax - stats.logIsiMin)) + stats.logIsiMin);
                     }
                     gl.glColor3fv(SELECT_COLOR, 0);
                     renderer.draw3D(String.format("%.0f us", binTime), currentMousePoint.x - .5f, -9, 0, .2f);
                     gl.glLineWidth(lineWidth);
                     gl.glColor3fv(SELECT_COLOR, 0);
                     gl.glBegin(GL2.GL_LINES);
                     gl.glVertex2f((currentMousePoint.x - .5f), -9);
                     gl.glVertex2f((currentMousePoint.x - .5f), chip.getSizeY());
                     gl.glEnd();
                 }
             }
         }
     }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:74,代码来源:CellStatsProber_cochlea.java


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