本文整理汇总了Java中com.jogamp.opengl.GL2.glColor3d方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glColor3d方法的具体用法?Java GL2.glColor3d怎么用?Java GL2.glColor3d使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glColor3d方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawAxis
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawAxis(GL2 gl) {
//Draw Axis
gl.glLineWidth(axisWidth);
//Draw X Axis
gl.glColor3d(1.0, 0.0, 0.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(axisSize, 0, 0);
gl.glEnd();
//Draw Y Axis
gl.glColor3d(0.0, 1.0, 0.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(0, axisSize, 0);
gl.glEnd();
//Draw Z Axis
gl.glColor3d(0.0, 0.0, 1.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(0, 0, axisSize);
gl.glEnd();
}
示例2: drawRay
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawRay(GL2 gl, Ray ray) {
float axisSize = 50;
Vector3 v = new Vector3(ray.direction);
v.scl(axisSize);
//Draw Camera Axis
if (colide >= 0) {
gl.glColor3d(1.0, 0.0, 0.0);
} else {
gl.glColor3d(0.0, 0.0, 1.0);
}
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(view.getX(), 1, view.getZ());
gl.glVertex3d(view.getX() + v.x, view.getY() + v.y, view.getZ() + v.z);
gl.glEnd();
}
示例3: drawRay
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawRay(GL2 gl, Ray ray) {
float axisSize = 50;
Vector3 v = new Vector3(ray.direction);
v.scl(axisSize);
//Draw Camera Axis
gl.glColor3d(0.0, 0.0, 1.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(view.getX(), 1, view.getZ());
gl.glVertex3d(view.getX()+v.x, view.getY()+v.y, view.getZ()+v.z);
gl.glEnd();
}
示例4: drawEnts
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void drawEnts(GL2 gl)
{
if(inst.GAME_STARTED)
{
//gl.glColor3d(1, 0, 0);
for(Entity e : inst.entityWrapper.ents)
{
e.render(gl);
if((e.TYPE & Entity.PROJECTILE) != 0)
{
gl.glColor3d(Math.random()*0.5 +0.5, Math.random()*0.5, 0);
drawCube(gl, 0.005, e.pos.x, e.pos.y, 0.01);
}
if((e.TYPE & Entity.BODY) != 0)
{
gl.glColor3d(e.r,e.g,e.b);
drawCube(gl, 0.005, e.pos.x, e.pos.y, 0.01);
}
}
gl.glColor3d(0, 1, 0);
gl.glVertex2d(inst.player.pos.x, inst.player.pos.y);
drawCube(gl, 0.005, inst.player.pos.x, inst.player.pos.y, 0.01);
for(Projectile p : inst.entityWrapper.projectiles)
{
p.render(gl);
}
}
}
示例5: render
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void render(GL2 gl)
{
if(pos == null || v == null)
return;
gl.glColor3d(Shoot.r.nextDouble(), Shoot.r.nextDouble(), Shoot.r.nextDouble());
gl.glBegin(GL2.GL_LINES);
gl.glVertex3d(pos.x, pos.y, 0);
Vector pos2 = pos.add(v);
gl.glVertex3d(pos2.x, pos2.y, 0);
gl.glEnd();
}
示例6: drawOriginalAxis
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawOriginalAxis(GL2 gl) {
//Draw Axis
gl.glLineWidth(axisWidth*3);
gl.glBegin(GL.GL_LINES);
//Draw Rotation Axis
gl.glColor3d(0.8, 0.2, 0.8);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(axis.x*axisSize, axis.y*axisSize, axis.z*axisSize);
gl.glEnd();
}
示例7: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
if(!isFilterEnabled()) {
return;
// if(isRelaxed) return;
}
GL2 gl=drawable.getGL().getGL2();
// draw bar for speechiness signal, part in grey and part above threshold in red
gl.glPushMatrix();
float f=((speechinessFilter.getValue()/(2*responseModulationThreshold))); // 1/2 for threshold
int sx=chip.getSizeX();
if(f<=.5f) {
gl.glColor3d(0.7, 0.7, 0.7);
gl.glRectf(2, 2, 2+(f*sx), 3);
} else {
gl.glColor3d(0.7, 0.7, 0.7);
gl.glRectf(2, 2, sx/2, 3);
gl.glColor3d(1, 0, 0); // red
gl.glRectf(sx/2, 2, f*sx, 3);
}
gl.glPopMatrix();
// show state of Goalie (arm shows its own state)
// gl.glColor3d(1, 1, 1);
// gl.glPushMatrix();
// int font=GLUT.BITMAP_HELVETICA_12;
// gl.glRasterPos3f(1, 1, 0);
// annotate the cluster with the arm state, e.g. relaxed or learning
// String stats=String.format("%s rateFilter=%.2f speechinessFilter=%.2f isSomeoneThere=%s responseFraction=%.1f",
// overallState.toString(),rateModulationFilter.getValue(),speechinessFilter.getValue(),isSomeoneThere(),getResponseFraction());
// chip.getCanvas().getGlut().glutBitmapString(font, stats);
// gl.glPopMatrix();
}
示例8: drawAxis
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawAxis(GL2 gl) {
double axisSize = 100;
//Draw Axis
gl.glLineWidth(2.5f);
//Draw X Axis
gl.glColor3d(1.0, 0.0, 0.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(axisSize, 0, 0);
gl.glEnd();
//Draw Y Axis
gl.glColor3d(0.0, 1.0, 0.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(0, axisSize, 0);
gl.glEnd();
//Draw Z Axis
gl.glColor3d(0.0, 0.0, 1.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(0, 0, axisSize);
gl.glEnd();
}
示例9: drawAxis
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawAxis(GL2 gl) {
double axisSize = 100;
//Draw Axis
gl.glLineWidth(2.5f);
//Draw X Axis
gl.glColor3d(1.0, 0.0, 0.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(axisSize, 0, 0);
gl.glEnd();
//Draw Y Axis
gl.glColor3d(0.0, 1.0, 0.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(0, axisSize, 0);
gl.glEnd();
//Draw Z Axis
gl.glColor3d(0.0, 0.0, 1.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(0, 0, axisSize);
gl.glEnd();
}
示例10: drawAxis
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawAxis(GL2 gl){
double axisSize = 100;
//Draw Axis
gl.glLineWidth(2.5f);
//Draw X Axis
gl.glColor3d(1.0, 0.0, 0.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(axisSize, 0, 0);
gl.glEnd();
//Draw Y Axis
gl.glColor3d(0.0, 1.0, 0.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(0, axisSize, 0);
gl.glEnd();
//Draw Z Axis
gl.glColor3d(0.0, 0.0, 1.0);
gl.glBegin(GL.GL_LINES);
gl.glVertex3d(0.0, 0.0, 0.0);
gl.glVertex3d(0, 0, axisSize);
gl.glEnd();
}
示例11: drawFloor
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected void drawFloor(GL2 gl) {
gl.glColor3d(1,1,1);
gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
drawGrid(gl,200,120);
}
示例12: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
updateControls(0);
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glClearColor(1f, 1f, 1f, 1);
//Transform by Aim
g.aimCamera(view.getAim());
//Draw Scene
g.setColor(Color.BLACK);
g.drawGrid(1, 150, 150);
gl.glPushMatrix();
gl.glMultMatrixf(transform.val, 0);
drawOriginalAxis(gl);
drawAxis(gl);
if (selected == AXIS_H || collisionAxis == vAxis) {
gl.glColor3d(1.0, 1.0, 0.0);
} else {
gl.glColor3d(1.0, 0.0, 0.0);
}
g.drawBoundingBox(vAxis);
if (selected == AXIS_V || collisionAxis == hAxis) {
gl.glColor3d(1.0, 1.0, 0.0);
} else {
gl.glColor3d(0.0, 1.0, 0.0);
}
g.drawBoundingBox(hAxis);
gl.glPopMatrix();
Ray ray = g.getCameraRay(mx, my);
if(drawRay) {
drawRay(gl, ray);
}
if (Intersector.intersectRayBoundsFast(ray, vAxis, transform)) {
collisionAxis = vAxis;
} else if (Intersector.intersectRayBoundsFast(ray, hAxis, transform)) {
collisionAxis = hAxis;
} else if(selected == NONE) {
collisionAxis = NO_AXIS;
}
gl.glFlush();
}
示例13: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
updateControls(0);
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glClearColor(1f, 1f, 1f, 1);
//Transform by Aim
g.aimCamera(view.getAim());
//Draw Scene
g.setColor(Color.BLACK);
g.drawGrid(1, 150, 150);
gl.glTranslatef(position.x, position.y, position.z);
drawAxis(gl);
if (selected == X || collisionAxis == xAxis) {
gl.glColor3d(1.0, 1.0, 0.0);
} else {
gl.glColor3d(1.0, 0.0, 0.0);
}
g.drawBoundingBox(xAxis);
if (selected == Y || collisionAxis == yAxis) {
gl.glColor3d(1.0, 1.0, 0.0);
} else {
gl.glColor3d(0.0, 1.0, 0.0);
}
g.drawBoundingBox(yAxis);
if (selected == Z || collisionAxis == zAxis) {
gl.glColor3d(1.0, 1.0, 0.0);
} else {
gl.glColor3d(0.0, 0.0, 1.0);
}
g.drawBoundingBox(zAxis);
Ray ray = g.getCameraRay(mx, my);
if(drawRay) {
drawRay(gl, ray);
}
if (Intersector.intersectRayBoundsFast(ray, xAxis)) {
collisionAxis = xAxis;
} else if (Intersector.intersectRayBoundsFast(ray, yAxis)) {
collisionAxis = yAxis;
} else if (Intersector.intersectRayBoundsFast(ray, zAxis)) {
collisionAxis = zAxis;
} else if(selected == NONE) {
collisionAxis = NO_AXIS;
}
gl.glFlush();
}
示例14: render
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected void render(GL2 gl, int canvaswidth, int canvasheight) {
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glLoadIdentity();
// Draw a quad textured with the map image.
float textureHeight = mapTexture.getHeight();
float textureWidth = mapTexture.getWidth();
float aspect = textureHeight / textureWidth;
float height = canvasheight;
float width = height / aspect;
gl.glBindTexture(GL_TEXTURE_2D, textureName.get(0));
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glColor3f(1, 1, 1);
gl.glBegin(GL2.GL_POLYGON);
gl.glTexCoord2f(0, 0);
gl.glVertex2f(0, 0);
gl.glTexCoord2f(1, 0);
gl.glVertex2f(width, 0);
gl.glTexCoord2f(1, 1);
gl.glVertex2f(width, height);
gl.glTexCoord2f(0, 1);
gl.glVertex2f(0, height);
gl.glEnd();
gl.glBindTexture(GL_TEXTURE_2D, 0);
// Draw river
double elapsed = System.currentTimeMillis() - start_time;
int current_frame_index = Math.min(data_points.length - 1,
(int) (elapsed / ms_per_day));
// We're going to interpolate in time between samples
double tween = (elapsed - current_frame_index * ms_per_day) / ms_per_day;
double depths[] = data_points[current_frame_index];
double next_depths[] = data_points[Math.min(current_frame_index + 1, data_points.length - 1)];
// The river's course
int course[][] = {{298, 2}, {291, 7}, {284, 10}, {281, 17}, {278, 24}, {277, 33}, {275, 40}, {273, 48}, {270, 56}, {264, 62}, {258, 66}, {252, 70}, {246, 74}, {237, 75}, {228, 76}, {222, 81}, {217, 87}, {213, 93}, {209, 100}, {204, 105}, {198, 109}, {193, 114}, {189, 120}, {183, 127}, {178, 133}, {172, 137}, {165, 140}, {159, 145}, {154, 150}, {150, 157}, {148, 165}, {145, 173}, {141, 180}, {138, 188}, {134, 196}, {129, 202}, {125, 209}, {120, 216}, {114, 222}, {109, 227}, {102, 230}, {94, 233}, {87, 236}, {81, 240}, {74, 243}, {68, 247}, {61, 250}, {56, 255}, {52, 261}, {47, 267}, {41, 271}, {35, 276}, {28, 279}, {23, 284}, {19, 290}, {17, 299}, {16, 308}, {14, 317}, {8, 322}, {4, 328}, {5, 337}, {9, 343}, {9, 344}, {9, 345}, {9, 346}, {9, 347}, {9, 348}, {9, 349}, {9, 350}};
gl.glLineWidth(20);
gl.glBegin(GL2.GL_LINE_STRIP);
for (int i = 0; i < course.length; ++i) {
int station = (int) Math.floor(3 * (double) i / course.length);
double shade = ((1 - tween) * depths[station] + tween * next_depths[station]) / 30;
double redgreen = Math.max(0, 1.75 * shade - 1);
double blue = shade * 2;
gl.glColor3d(redgreen, redgreen, blue);
gl.glVertex2d(width * (course[i][0]) / textureWidth,
height * (course[i][1]) / textureHeight);
}
gl.glEnd();
}
示例15: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
view.update(0);
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glClearColor(1f, 1f, 1f, 1);
//Transform by Aim
g.aimCamera(view.getAim());
//Draw Scene
StandardExample.drawAxis(gl, 100);
//Draw Grid
g.setColor(Color.BLACK);
g.drawGrid(1, 150, 150);
Ray ray = g.getCameraRay(mx, my);
if (colide >= 0) {
gl.glColor3d(1.0, 0.0, 0.0);
} else {
gl.glColor3d(0.0, 0.0, 1.0);
}
if (drawRay) {
float raySize = 500;
StandardExample.drawRay(gl, ray, view, raySize);
}
g.setColor(Color.BLUE);
cone.draw(g);
if (Intersector.intersectRayCylinderFast(ray, cylinder)) {
g.setColor(Color.YELLOW);
} else {
g.setColor(Color.GREEN);
}
cylinder.draw(g);
gl.glFlush();
}