本文整理匯總了Java中javax.media.opengl.GL2.glScaled方法的典型用法代碼示例。如果您正苦於以下問題:Java GL2.glScaled方法的具體用法?Java GL2.glScaled怎麽用?Java GL2.glScaled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glScaled方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: render
import javax.media.opengl.GL2; //導入方法依賴的package包/類
protected void render(DrawContext dc, Vec4 point, double radius)
{
dc.getView().pushReferenceCenter(dc, point);
//GL gl = dc.getGL();
GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
gl.glScaled(radius, radius, radius);
gl.glRotated(lon, 0, 1, 0);
gl.glRotated(lat, -1, 0, 0);
// drawFMS(dc, strike, dip, rake, strike2, dip2, rake2);
if (dc.isPickingMode())
{
Color color = dc.getUniquePickColor();
pickSupport.addPickableObject(color.getRGB(),
eq,
position,
false);
gl.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
} else
gl.glColor3f(1,1,1);
gl.glCallList(this.glListId);
gl.glCallList(this.glListId+1);
if (!dc.isPickingMode())
gl.glColor3f(0,0,0);
gl.glCallList(this.glListId+2);
gl.glCallList(this.glListId+3);
// GL gl = dc.getGL();
// gl.glBegin(GL.GL_LINES);
// gl.glVertex2f(0, 4);
// gl.glVertex2d(0, 0);
// gl.glEnd();
dc.getView().popReferenceCenter(dc);
}
示例2: display
import javax.media.opengl.GL2; //導入方法依賴的package包/類
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
this.drawable = drawable;
// Apply transformations
double transx = -origin.getX(), transy = -origin.getY();
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0, width, height, 0, -1, 1);
gl.glViewport(0, 0, width, height);
gl.glTranslated(transx + zoomPos.getX(), transy + zoomPos.getY(), 0);
gl.glScaled(scaleFactor, scaleFactor, 1);
gl.glTranslated(-zoomPos.getX(), -zoomPos.getY(), 0);
gl.glGetDoublev(GL2.GL_MODELVIEW_MATRIX, modelview);
gl.glGetDoublev(GL2.GL_PROJECTION_MATRIX, projection);
gl.glGetIntegerv(GL2.GL_VIEWPORT, viewport);
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
// Draw edges, arrows and vertices
edgeRenderer.transform(transx, transy, scaleFactor);
edgeRenderer.render();
if (animateLabels) {
labelRenderer.scale(scaleFactor);
labelRenderer.drawLabels();
}
vertexRenderer.transform(transx, transy, scaleFactor);
vertexRenderer.render();
}
示例3: drawSegment
import javax.media.opengl.GL2; //導入方法依賴的package包/類
public void drawSegment(GL2 gl, GLUT glut, boolean stickFigure) {
gl.glPushMatrix();
if (stickFigure) {
gl.glTranslated(0d, 0d, HEIGHT_OUTER_SEGMENT / 2f);
gl.glScaled(RobotBody.STICK_THICKNESS, RobotBody.STICK_THICKNESS, HEIGHT_OUTER_SEGMENT);
glut.glutSolidCube(1f);
} else {
outerSegmentBody.draw(gl);
final double heightDifference = HEIGHT_OUTER_SEGMENT - HEIGHT_INNER_SEGMENT;
gl.glTranslated(0d, 0d, heightDifference / 2f);
innerSegmentBody.draw(gl);
}
gl.glPopMatrix();
}
示例4: drawStickFigureBody
import javax.media.opengl.GL2; //導入方法依賴的package包/類
private void drawStickFigureBody(GL2 gl, GLUT glut, double bodyHeight) {
gl.glPushMatrix();
gl.glScaled(RobotBody.STICK_THICKNESS, RobotBody.STICK_THICKNESS, bodyHeight);
gl.glTranslated(0d, 0d, bodyHeight / 2f);
glut.glutSolidCube(1f);
gl.glPopMatrix();
}
示例5: drawStickFigurePelvis
import javax.media.opengl.GL2; //導入方法依賴的package包/類
private void drawStickFigurePelvis(GL2 gl, GLUT glut, double bodyHeight) {
final double pelvisWidth = LEG_OFFCENTER * 2f;
gl.glPushMatrix();
gl.glScaled(pelvisWidth, RobotBody.STICK_THICKNESS, RobotBody.STICK_THICKNESS);
glut.glutSolidCube(1f);
gl.glPopMatrix();
}
示例6: drawStickFigureShoulders
import javax.media.opengl.GL2; //導入方法依賴的package包/類
private void drawStickFigureShoulders(GL2 gl, GLUT glut) {
final double shoulderWidth = SHOULDER_OFFCENTER * 2f;
gl.glPushMatrix();
gl.glTranslated(0d, 0d, SHOULDER_HEIGHT);
gl.glScaled(shoulderWidth, RobotBody.STICK_THICKNESS, RobotBody.STICK_THICKNESS);
glut.glutSolidCube(1f);
gl.glPopMatrix();
}
示例7: draw
import javax.media.opengl.GL2; //導入方法依賴的package包/類
public void draw(GL2 gl, Lighting lighting, Foliage foliage, int requiredDetailLevel, int depth) {
gl.glPushMatrix();
gl.glTranslated(0d, 0d, zTranslation);
gl.glRotated(zRotation, 0d, 0d, 1d);
gl.glRotated(yRotation, 0d, 1d, 0d);
gl.glPushMatrix();
if (isLeaf) {
final float scaleMultiplier = (requiredDetailLevel == 0) ? (4f) : ((requiredDetailLevel == 1) ? (2f) : (1f));
gl.glScaled(scale.x() * scaleMultiplier, scale.y() * scaleMultiplier, scale.z() * scaleMultiplier);
gl.glTranslated(sidewaysTranslation, 0d, 0d);
gl.glRotated(zRotation, 0d, 0d, 1d);
foliage.drawLeaf(gl);
} else {
gl.glScaled(scale.x(), scale.y(), scale.z());
foliage.drawBranch(gl, calcRequiredDetailForBranch(requiredDetailLevel, (float) scale.x()));
}
gl.glPopMatrix();
final int maxNodes = (requiredDetailLevel == 0) ? (1)
: ((requiredDetailLevel == 1) ? (4)
: ((requiredDetailLevel == 2) ? (10)
: (Integer.MAX_VALUE)));
if (!childLeafs.isEmpty()) {
lighting.setMaterial(gl, Material.LEAF);
childLeafs.stream().limit(maxNodes).forEach((node) -> node.draw(gl, lighting, foliage, requiredDetailLevel, depth + 1));
lighting.setMaterial(gl, Material.BARK);
}
if (!keepGoing(requiredDetailLevel, depth)) {
gl.glPopMatrix();
return;
}
childBranches.stream().limit(maxNodes).forEach((child) -> child.draw(gl, lighting, foliage, requiredDetailLevel, depth + 1));
gl.glPopMatrix();
}
示例8: plotObject
import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override
public void plotObject( final GLAutoDrawable drawable,
final org.openimaj.vis.general.XYZVisualisation3D.LocatedObject3D<ColouredDot> object,
final AxesRenderer3D renderer )
{
final double[] p = renderer.calculatePosition( new double[]
{ object.x, object.y, object.z } );
final GL2 gl = drawable.getGL().getGL2();
gl.glPushMatrix();
// Translate to the position of the dot
gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW );
gl.glTranslated( p[0], p[1], p[2] );
final double[] s = renderer.scaleDimension(
new double[] {object.object.size, object.object.size, object.object.size} );
gl.glScaled( s[0], s[1], s[2] );
// Create a sphere
if( !this.isEnableLights() )
gl.glColor3f( object.object.colour[0], object.object.colour[1], object.object.colour[2] );
else
{
final float[] rgba = { object.object.colour[0], object.object.colour[1], object.object.colour[2] };
gl.glMaterialfv( GL.GL_FRONT, GLLightingFunc.GL_AMBIENT, rgba, 0);
gl.glMaterialfv( GL.GL_FRONT, GLLightingFunc.GL_SPECULAR, rgba, 0);
gl.glMaterialf( GL.GL_FRONT, GLLightingFunc.GL_SHININESS, 0.05f);
}
final GLUquadric qobj0 = this.glu.gluNewQuadric();
this.glu.gluQuadricDrawStyle( qobj0, GLU.GLU_FILL );
this.glu.gluQuadricNormals( qobj0, GLU.GLU_SMOOTH );
this.glu.gluSphere( qobj0, 1, 12, 12 );
this.glu.gluDeleteQuadric( qobj0 );
gl.glPopMatrix();
}