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


Java GL2.glColor4f方法代码示例

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


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

示例1: draw

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
synchronized void draw(GL2 gl) {
                gl.glPushAttrib(GL2.GL_ENABLE_BIT);
                gl.glLineStipple(1, (short) 0x7777);
                gl.glLineWidth(9);
                gl.glColor4f(0, 1, 1, .9f);
//                textRenderer.begin3DRendering();
//                textRenderer.draw3D("laser line", 5, 5, 0, textScale);
//                textRenderer.end3DRendering();
                gl.glEnable(GL2.GL_LINE_STIPPLE);
                gl.glBegin(GL.GL_LINE_STRIP);
                for (int i = 0; i < mapSizeX; i++) {
                    if (!ys[i].isNaN()) { // skip over columns without valid score
                        gl.glVertex2f(i, ys[i]);
                    } else { // interrupt lines at NaN
                        gl.glEnd();
                        gl.glBegin(GL.GL_LINE_STRIP);
                    }
                }
                gl.glEnd();
                gl.glPopAttrib();
            }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:22,代码来源:FilterLaserline.java

示例2: render

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void render(GL2 gl) {
    final float alpha = .2f;
    final float scaleRadius = .0001f;
    glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL);
    for (int x = 0; x < nx; x++) {
        for (int y = 0; y < ny; y++) {
            gl.glPushMatrix();
            final int shift = 1 << (subunitSubsamplingBits - 1);
            gl.glTranslatef(shift + (x << subunitSubsamplingBits), shift + (y << subunitSubsamplingBits), 5);
            gl.glColor4f(0, 1, 0, alpha);
            //glu.gluDisk(quad, 0, (float)Math.log10((double)scaleRadius *synapticWeight* offSubunits[x][y].computeInputToApproachCell()), 16, 1);
            glu.gluDisk(quad, 0, scaleRadius *synapticWeight*  onSubunits[x][y].computeInputToApproachCell(), 16, 1);
            gl.glColor4f(1, 0, 0, alpha);
            glu.gluDisk(quad, 0, scaleRadius *synapticWeight*  offSubunits[x][y].computeInputToApproachCell(), 16, 1);
            //glu.gluDisk(quad, 0, (float)Math.log10((double)scaleRadius *synapticWeight* onSubunits[x][y].computeInputToApproachCell()), 16, 1);
            gl.glPopMatrix();
        }
    }
    renderer.begin3DRendering();
    renderer.setColor(0, 1, 0, 1);
    renderer.draw3D("Inhibitory ON subunits", 0, chip.getSizeY(), 0, .5f);
    renderer.setColor(1, 0, 0, 1);
    renderer.draw3D("Excitatory OFF subunits", chip.getSizeX() / 2, chip.getSizeY(), 0, .5f);
    renderer.end3DRendering(); // annotation on top

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

示例3: typeColor

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Sets the gl color depending on cochlea cell type
   @param gl the GL context
   @param type the cell type 0-3
 */
public static void typeColor(GL2 gl, int type) {
	final float alpha = 0.5f;
	switch (type) {
		case 0:
			gl.glColor4f(1, 0, 0, alpha);
			break;
		case 2:
			gl.glColor4f(0, 1, 0, alpha);
			break;
		case 1:
			gl.glColor4f(1, 1, 0, alpha);
			break;
		case 3:
			gl.glColor4f(0, 0, 1, alpha);
		default:
			gl.glColor4f(.5f, .5f, .5f, alpha);
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:CochleaGramDisplayMethod.java

示例4: drawMouseJoint

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Renders a MouseJoint to the given graphics object.
 *
 * @param gl    the OpenGL graphics files
 * @param joint the joint
 * @param invdt the inverse of the delta time of the last world step
 */
public static final void drawMouseJoint(GL2 gl, PinJoint joint, double invdt) {
    // set the color
    gl.glColor4f(0.0f, 0.0f, 0.0f, 0.8f);
    // draw the anchor point
    Vector2 anchor = joint.getAnchor2();
    RenderUtilities.fillRectangleFromCenter(gl, anchor.x, anchor.y, 0.05, 0.05);
    // draw the target point
    Vector2 target = joint.getTarget();
    RenderUtilities.fillRectangleFromCenter(gl, target.x, target.y, 0.05, 0.05);
    // draw a line connecting them
    // make the line color a function of stress (black to red)
    // getProperty the inverse delta time
    double maxForce = joint.getMaximumForce();
    double force = joint.getReactionForce(invdt).getMagnitude();
    double red = force / maxForce;
    red *= 1.10;
    red = Interval.clamp(red, 0.0, 1.0);
    // set the color
    gl.glColor4f((float) red, 0.0f, 0.0f, 0.8f);
    gl.glBegin(GL.GL_LINES);
    gl.glVertex2d(anchor.x, anchor.y);
    gl.glVertex2d(target.x, target.y);
    gl.glEnd();
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:32,代码来源:RenderUtilities.java

示例5: drawRopeJoint

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Renders a RopeJoint to the given graphics object.
 *
 * @param gl    the OpenGL graphics files
 * @param joint the joint
 */
public static final void drawRopeJoint(GL2 gl, RopeJoint joint) {
    Vector2 v1 = joint.getAnchor1();
    Vector2 v2 = joint.getAnchor2();
    // set the color to be mostly transparent
    gl.glColor4f(0.0f, 0.0f, 0.0f, 0.3f);

    // emulate a line stroke of arbitrary width without cap/join
    // getProperty the tangent vector
    Vector2 t = v1.to(v2);
    t.normalize();
    t.left();
    t.multiply(0.05);

    // save the original stroke
    gl.glBegin(GL2.GL_QUADS);
    gl.glVertex2d(v1.x - t.x, v1.y - t.y);
    gl.glVertex2d(v1.x + t.x, v1.y + t.y);
    gl.glVertex2d(v2.x + t.x, v2.y + t.y);
    gl.glVertex2d(v2.x - t.x, v2.y - t.y);
    gl.glEnd();
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:28,代码来源:RenderUtilities.java

示例6: render

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void render(GL2 gl) {
    final float alpha = .2f;
    glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL);
    int off = (1 << (subunitSubsamplingBits)) / 2;
    for (int x = 0; x < nx; x++) {
        for (int y = 0; y < ny; y++) {
            gl.glPushMatrix();
            gl.glTranslatef((x << subunitSubsamplingBits) + off, (y << subunitSubsamplingBits) + off, 5);
            if ((x == (nx / 2)) || (x == ((nx / 2) - 1))) {
            gl.glColor4f(1, 0, 0, alpha);
            } else {
                gl.glColor4f(0, 1, 0, alpha);
            }
            glu.gluDisk(quad, 0, subunitActivityBlobRadiusScale *synapticWeight* subunits[x][y].computeInputToCell(), 16, 1);
            gl.glPopMatrix();
        }
    }
    renderer.begin3DRendering();
    renderer.setColor(0, 1, 0, 1);
    renderer.draw3D("Center", 0, chip.getSizeY(), 0, .5f);
    renderer.setColor(1, 0, 0, 1);
    renderer.draw3D("Surround", chip.getSizeX() / 2, chip.getSizeY(), 0, .5f);
    renderer.end3DRendering();


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

示例7: drawPulleyJoint

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Renders a PulleyJoint to the given graphics object.
 *
 * @param gl    the OpenGL graphics files
 * @param joint the joint
 * @since 2.2.0
 */
public static final void drawPulleyJoint(GL2 gl, PulleyJoint joint) {
    // set the color to be mostly transparent
    gl.glColor4f(0.0f, 0.0f, 0.0f, 0.3f);

    Vector2 p1 = joint.getAnchor1();
    Vector2 p2 = joint.getPulleyAnchor1();
    Vector2 p3 = joint.getPulleyAnchor2();
    Vector2 p4 = joint.getAnchor2();

    gl.glBegin(GL.GL_LINE_STRIP);
    gl.glVertex2d(p1.x, p1.y);
    gl.glVertex2d(p2.x, p2.y);
    gl.glVertex2d(p3.x, p3.y);
    gl.glVertex2d(p4.x, p4.y);
    gl.glEnd();
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:24,代码来源:RenderUtilities.java

示例8: drawCursor

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawCursor(GL2 gl, Point p, float[] color) {
    if (p == null) {
        return;
    }
    checkBlend(gl);
    gl.glColor4fv(color, 0);
    gl.glLineWidth(3f);
    gl.glPushMatrix();
    gl.glTranslatef(p.x, p.y, 0);
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex2f(0, -CURSOR_SIZE_CHIP_PIXELS / 2);
    gl.glVertex2f(0, +CURSOR_SIZE_CHIP_PIXELS / 2);
    gl.glVertex2f(-CURSOR_SIZE_CHIP_PIXELS / 2, 0);
    gl.glVertex2f(+CURSOR_SIZE_CHIP_PIXELS / 2, 0);
    gl.glEnd();
    gl.glTranslatef(.5f, -.5f, 0);
    gl.glColor4f(0, 0, 0, 1);
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex2f(0, -CURSOR_SIZE_CHIP_PIXELS / 2);
    gl.glVertex2f(0, +CURSOR_SIZE_CHIP_PIXELS / 2);
    gl.glVertex2f(-CURSOR_SIZE_CHIP_PIXELS / 2, 0);
    gl.glVertex2f(+CURSOR_SIZE_CHIP_PIXELS / 2, 0);
    gl.glEnd();
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:26,代码来源:Speedometer.java

示例9: draw

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void draw(GL2 gl) {
    if ((maxvalue <= 0) || Float.isNaN(ballX) || Float.isNaN(ballY)) {
        return;
    }
    gl.glColor4f(0, .4f, 0, .2f);
    if (quad == null) {
        quad = glu.gluNewQuadric();
    }

    gl.glPushMatrix();
    gl.glTranslatef(ballX, ballY, 0);
    glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL);
    gl.glLineWidth(2f);
    glu.gluDisk(quad, 0, ballRadiusPixels, 16, 1);
    gl.glPopMatrix();

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

示例10: render

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void render(GL2 gl) {
	gl.glPushMatrix();
	gl.glColor4f(1f, 1f, 1f, .25f);
	//            gl.glLightf(chip.getSizeX()/2, chip.getSizeY()/2, chip.getMaxSize()*4);
	//            gl.glEnable(GL.GL_LIGHT0);
	gl.glTranslatef(posPixels.x, posPixels.y, radiusPixels);
	if (sphereQuad == null) {
		sphereQuad = glu.gluNewQuadric();
	}
	if (sphereQuad != null) {
		glu.gluSphere(sphereQuad, 6, 16, 16);
	}
	gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:15,代码来源:LabyrinthVirtualBall.java

示例11: drawThrottlePainter

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Displays the extracted track points
 */
private void drawThrottlePainter(GLAutoDrawable drawable) {
    if (isSelected() && (getTrack() != null) && (getTrack().getPointList() != null) && (currentProfile != null)) {
        Point mp = glCanvas.getMousePosition();
        Point p = canvas.getPixelFromPoint(mp);
        if (p == null) {
            return;
        }
        GL2 gl = drawable.getGL().getGL2();
        checkBlend(gl);
        switch (editState) {
            case None:
                gl.glColor4f(.25f, .25f, 0, .3f);
                break;
            case Increae:
                gl.glColor4f(0, .45f, 0, .5f);
                break;
            case Decrease:
                gl.glColor4f(.45f, .0f, 0, .5f);

        }
        gl.glPushMatrix();
        gl.glTranslatef(p.x, p.y, 0);
        if (quad == null) {
            quad = glu.gluNewQuadric();
        }
        glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL);
        glu.gluDisk(quad, 0, 5, 32, 1);
        gl.glPopMatrix();

        chip.getCanvas().checkGLError(gl, glu, "in drawThrottlePainterk");

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

示例12: render

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void render(GL2 gl) {
    if (showSubunits && showSpecificOMCoutput && !showAllOMCoutputs) {
        final float alpha = .2f;
        glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL);
        int off = (1 << (subsample)) / 2;
        for (int x = 0; x < (nxmax); x++) {
            for (int y = 0; y < (nymax); y++) {
                gl.glPushMatrix();
                gl.glTranslatef((x << subsample) + off, (y << subsample) + off, 5);
                if (((x == getShowXcoord()) && (y == getShowYcoord())) || ((x == (getShowXcoord() + 1)) && (y == (getShowYcoord() + 1)))
                        || ((x == getShowXcoord()) && (y == (getShowYcoord() + 1))) || ((x == (getShowXcoord() + 1)) && (y == getShowYcoord()))) {
                    gl.glColor4f(1, 0, 0, alpha);
                } else {
                    gl.glColor4f(0, 1, 0, alpha);
                }
                glu.gluDisk(quad, 0, subunitActivityBlobRadiusScale * subunits[x][y].computeInputToCell(), 16, 1);
                gl.glPopMatrix();
            }
        }
        renderer.begin3DRendering();
        renderer.setColor(1, 0, 0, 1);
        renderer.draw3D("Center", 0, chip.getSizeY(), 0, .5f);
        renderer.setColor(0, 1, 0, 1);
        renderer.draw3D("Surround", chip.getSizeX() / 2, chip.getSizeY(), 0, .5f);
        renderer.end3DRendering();
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:28,代码来源:OmcodFpga.java

示例13: drawRevoluteJoint

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Renders a RevoluteJoint to the given graphics object.
 *
 * @param gl    the OpenGL graphics files
 * @param joint the joint
 */
public static final void drawRevoluteJoint(GL2 gl, RevoluteJoint joint) {
    Vector2 anchor = joint.getAnchor1();
    gl.glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
    RenderUtilities.fillCircleFromCenter(gl, 0.025, anchor.x, anchor.y);
    gl.glColor4f(0.3f, 0.3f, 0.3f, 1.0f);
    RenderUtilities.drawCircleFromCenter(gl, 0.025, anchor.x, anchor.y, false, false);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:14,代码来源:RenderUtilities.java

示例14: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
    GL2 gl = drawable.getGL().getGL2();
    checkBlend(gl);
    gl.glPushMatrix();
    gl.glTranslatef(chip.getSizeX() / 2, chip.getSizeY() / 2, 10);
    if (showOutputCell && (frequencyDetectionCellModel.nSpikes > getIntegrateAndFireThreshold())) {
        gl.glColor4f(1, 1, 1, .2f);
        glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL);
        float radius = (chip.getMaxSize() * frequencyDetectionCellModel.spikeRateHz) / maxSpikeRateHz / 2;
        glu.gluDisk(quad, 0, radius, 32, 1);
        frequencyDetectionCellModel.resetSpikeCount();
    }
    gl.glPopMatrix();

    if (showSubunits) {
        gl.glColor4f(1, 0, 0, .3f);
        gl.glRectf(-10, 0, -5, inhibition);
        gl.glColor4f(0, 1, 0, .3f);
        gl.glRectf(-20, 0, -15, centerExcitation);
        renderer.begin3DRendering();
        renderer.setColor(1, 0, 0, .3f);
        renderer.draw3D("ini", -10, -3, 0, .4f);
        renderer.setColor(0, 1, 0, .3f);
        renderer.draw3D("exc", -20, -3, 0, .4f);
        renderer.end3DRendering();
        // render all the subunits now
        subunits.render(gl);
    }

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

示例15: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
    if ((!showHistogram && !showBitmap) || histogram == null || histmax == 0) {
        return;
    }
    GL2 gl = drawable.getGL().getGL2();
    checkBlend(gl);
    int numX = chip.getSizeX(), numY = chip.getSizeY();
    final float bmbrightness=.4f;
    for (int y = 0; y < numY; y++) {
        for (int x = 0; x < numX; x++) {
            float v1 = (float) histogram[x][y];
            float v2 = v1 / threshold;
            if(showHistogram){
                if (v1 > threshold) {
                    gl.glColor4f(v2, v2, 0, 0.25f);
                    gl.glRectf(x, y, x + 1, y + 1);
                } else if (v1 > 0) {
                    gl.glColor4f(0, v2, v2, .25f);
                    gl.glRectf(x, y, x + 1, y + 1);
                }
            }
           
            if(showBitmap && bitmap!=null && bitmap[x][y]){
                gl.glColor4f(bmbrightness,bmbrightness,bmbrightness, 0.5f);
                gl.glRectf(x, y, x + 1, y + 1);
            }
        }
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:31,代码来源:Histogram2DFilter.java


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