本文整理汇总了Java中com.jogamp.opengl.GL2.glColor4fv方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glColor4fv方法的具体用法?Java GL2.glColor4fv怎么用?Java GL2.glColor4fv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glColor4fv方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: drawHistogram
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public static void drawHistogram(GL2 gl, float[] activations, int width, int height, float lineWidth, Color color) {
if (activations == null) {
return;
}
float[] ca = color.getColorComponents(null);
gl.glPushAttrib(GL2ES3.GL_COLOR | GL.GL_LINE_WIDTH);
gl.glLineWidth(lineWidth);
gl.glColor4fv(ca, 0);
float dx = (float) (width) / (activations.length);
float sy = (float) HISTOGRAM_HEIGHT_FRACTION * (height);
gl.glBegin(GL.GL_LINE_STRIP);
for (int i = 0; i < activations.length; i++) {
float y = 1 + (sy * activations[i]); // TODO debug hack
float x1 = 1 + (dx * i), x2 = x1 + dx;
gl.glVertex2f(x1, 1);
gl.glVertex2f(x1, y);
gl.glVertex2f(x2, y);
gl.glVertex2f(x2, 1);
}
gl.glEnd();
gl.glPopAttrib();
}
示例3: renderVelocity
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Renders the linear and angular velocity.
*
* @param gl the OpenGL files
*/
public void renderVelocity(GL2 gl) {
// set the color
gl.glColor4fv(Preferences.getBodyVelocityColor(), 0);
// draw the velocities
Vector2 c = this.getWorldCenter();
Vector2 v = this.getLinearVelocity();
double av = this.getAngularVelocity();
// draw the linear velocity for each body
gl.glBegin(GL.GL_LINES);
gl.glVertex2d(c.x, c.y);
gl.glVertex2d(c.x + v.x, c.y + v.y);
gl.glEnd();
// draw an arc
RenderUtilities.drawArc(gl, c.x, c.y, 0.125, 0, av);
}
示例4: annotateHistogram
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void annotateHistogram(GL2 gl, int width, int height, float lineWidth, Color color) {
gl.glPushAttrib(GL2ES3.GL_COLOR | GL.GL_LINE_WIDTH);
gl.glLineWidth(lineWidth);
float[] ca = color.getColorComponents(null);
gl.glColor4fv(ca, 0);
OutputOrInnerProductFullyConnectedLayer.this.annotateHistogram(gl, width, height);
gl.glPopAttrib();
}
示例5: annotateHistogram
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void annotateHistogram(GL2 gl, int width, int height, float lineWidth, Color color) {
gl.glPushAttrib(GL2ES3.GL_COLOR | GL.GL_LINE_WIDTH);
gl.glLineWidth(lineWidth);
float[] ca = color.getColorComponents(null);
gl.glColor4fv(ca, 0);
outputHistogram(gl, width, height);
gl.glPopAttrib();
}
示例6: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void draw(GL2 gl) {
if (rgba == null) {
return;
}
float maxActivation = 0;
int maxActivatedUnit = -1;
for (int i = 0; i < rgba.length; i++) {
if (rgba[i] > maxActivation) {
maxActivation = rgba[i];
maxActivatedUnit = i;
}
}
if (maxActivation < decisionThreshold) {
return;
}
final int dt = lastTimestampUs - lastDecisionTimestampUs;
if (dt < 0 || (dt) >>> 10 >= getDecisionLifetimeMs()) {
return;
}
try {
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_CONSTANT_ALPHA);
gl.glBlendEquation(GL2.GL_FUNC_ADD); // use additive color here to just brighten the pixels already there
gl.glBlendColor(1, 1, 1, 1);
} catch (final GLException e) {
e.printStackTrace();
}
gl.glColor4fv(rgba, 0);
gl.glRectf(xLeft, yBot, xRight < chip.getSizeX() ? xRight : chip.getSizeX(), yTop < chip.getSizeY() ? yTop : chip.getSizeY());
if (roiLastUpdated == this) {
// mark it
gl.glColor4f(1, 1, 1, 0.25f);
gl.glPushMatrix();
DrawGL.drawBox(gl, xCenter, yCenter, getWidth() << scale, getHeight() << scale, 0);
gl.glPopMatrix();
}
}
示例7: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void draw(GL2 gl, float lineWidth, float[] color) {
gl.glPushAttrib(GL2ES3.GL_COLOR | GL.GL_LINE_WIDTH);
gl.glLineWidth(lineWidth);
gl.glColor4fv(color, 0);
draw(gl);
gl.glPopAttrib();
}
示例8: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void draw(GL2 gl, float lineWidth, float[] color) {
gl.glPushAttrib(GL2GL3.GL_COLOR | GL2.GL_LINE_WIDTH);
gl.glLineWidth(lineWidth);
gl.glColor4fv(color, 0);
draw(gl);
gl.glPopAttrib();
}
示例9: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void draw(GL2 gl, float lineWidth, float[] color) {
gl.glPushAttrib(GL2.GL_COLOR | GL.GL_LINE_WIDTH);
gl.glLineWidth(lineWidth);
gl.glColor4fv(color, 0);
draw(gl);
gl.glPopAttrib();
}
示例10: renderCenter
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Renders the center of mass of this body.
*
* @param gl the OpenGL files
*/
public void renderCenter(GL2 gl) {
// getProperty the center of mass
Vector2 c = this.mass.getCenter();
// set the color
gl.glColor4fv(Preferences.getBodyCenterColor(), 0);
RenderUtilities.drawPoint(gl, c);
}
示例11: renderNormals
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Renders the edge normals of any Wound Shapes on this Body.
*
* @param gl the OpenGL graphics files
*/
public void renderNormals(GL2 gl) {
gl.glColor4fv(Preferences.getBodyNormalColor(), 0);
int fSize = this.getFixtureCount();
for (int i = 0; i < fSize; i++) {
// getProperty the fixture
BodyFixture bf = this.getFixture(i);
// getProperty the shape
Convex convex = bf.getShape();
// check the type
if (convex instanceof Wound) {
Wound w = (Wound) convex;
// getProperty the data
Vector2[] vertices = w.getVertices();
Vector2[] normals = w.getNormals();
int size = normals.length;
// declare some place holders
Vector2 p1, p2, n;
Vector2 mid = new Vector2();
// render all the normals
for (int j = 0; j < size; j++) {
// getProperty the points and the normal
p1 = vertices[j];
p2 = vertices[(j + 1 == size) ? 0 : j + 1];
n = normals[j];
// find the mid point between p1 and p2
mid.set(p2).subtract(p1).multiply(0.5).add(p1);
gl.glBegin(GL.GL_LINES);
gl.glVertex2d(mid.x, mid.y);
gl.glVertex2d(mid.x + n.x * 0.1, mid.y + n.y * 0.1);
gl.glEnd();
}
}
}
}
示例12: renderRotationDisc
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Renders the rotation disc.
*
* @param gl the OpenGL files
*/
public void renderRotationDisc(GL2 gl) {
// check if we should draw the rotation disc
Vector2 c = this.mass.getCenter();
// set the color
gl.glColor4fv(Preferences.getBodyRotationDiscColor(), 0);
// getProperty the radius
double r = this.getRotationDiscRadius();
// draw the circle
RenderUtilities.drawCircleFromCenter(gl, r, c.x, c.y, false, false);
}
示例13: 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();
}
}
}
}
示例14: outlineShape
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Outlines the given shape using the given line width.
*
* @param gl the OpenGL files
* @param s the shape to outline
* @param w the line width
* @param color the line color
*/
public static final void outlineShape(GL2 gl, Shape s, float w, float[] color) {
float lw = RenderUtilities.getLineWidth(gl);
RenderUtilities.setLineWidth(gl, w);
if (color != null) gl.glColor4fv(color, 0);
RenderUtilities.drawShape(gl, s, true);
RenderUtilities.setLineWidth(gl, lw);
}