本文整理汇总了Java中javax.media.opengl.glu.GLUquadric类的典型用法代码示例。如果您正苦于以下问题:Java GLUquadric类的具体用法?Java GLUquadric怎么用?Java GLUquadric使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLUquadric类属于javax.media.opengl.glu包,在下文中一共展示了GLUquadric类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gegGLCalList
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
protected void gegGLCalList(){
GLU glu = new GLU();
GLUquadric sQuad= glu.gluNewQuadric();
callist = gl.glGenLists(1);
gl.glNewList(callist, gl.GL_COMPILE);
texture.enable(gl);
texture.bind(gl);
glu.gluQuadricTexture(sQuad, true);
glu.gluQuadricOrientation(sQuad, glu.GLU_INSIDE);
glu.gluSphere(sQuad, radius, 36, 72);
gl.glEndList();
}
示例2: OConnorHangingLight
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
public OConnorHangingLight(float x, float yCeiling, float z, float size, float length, GL2 gl, GLU glu) {
GLUquadric quadric = glu.gluNewQuadric();
glu.gluQuadricDrawStyle(quadric, GLU.GLU_FILL);
glu.gluQuadricNormals(quadric, GLU.GLU_FLAT);
glu.gluQuadricTexture (quadric, false);
this.quadric = quadric;
this.x = x;
this.y = yCeiling;
this.z = z;
this.length = length;
this.size = size;
this.colorChange = (int)(Math.random()*100);
this.bobChange = (float)(Math.random()*100);
this.r = (float)Math.random();
this.g = (float)Math.random();
this.b = (float)Math.random();
}
示例3: OConnorFloatingLight
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
public OConnorFloatingLight(float x, float y, float z, float size, float speed, float radX, float radY, float radZ, GL2 gl, GLU glu) {
GLUquadric quadric = glu.gluNewQuadric();
glu.gluQuadricDrawStyle(quadric, GLU.GLU_FILL);
glu.gluQuadricNormals(quadric, GLU.GLU_FLAT);
glu.gluQuadricTexture (quadric, false);
this.quadric = quadric;
this.x = x;
this.y = y;
this.z = z;
this.size = size;
this.flightRadiusX = radX;
this.flightRadiusY = radY;
this.flightRadiusZ = radZ;
this.speed = speed;
this.colorChange = (int)(Math.random()*100);
this.posChange = (float)(Math.random()*100);
this.r = (float)Math.random();
this.g = (float)Math.random();
this.b = (float)Math.random();
}
示例4: plotObject
import javax.media.opengl.glu.GLUquadric; //导入依赖的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();
}
示例5: mkGLCallList
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
protected int mkGLCallList(){
GLU glu = new GLU();
int callList;
GLUquadric quad = glu.gluNewQuadric();
// material properties
float[] no_mat = {0.0f, 0.0f, 0.0f, 1.0f};
float[] mat_ambient = {1f, 1f, 1f, 1.0f};
float[] mat_diffuse = {1, 1, 1, 1.0f};
float[] mat_specular = {1.0f, 1.0f, 1.0f, 1.0f};
float no_shininess = 0.0f;
float low_shininess = 5.0f;
float high_shininess = 100.0f;
float[] mat_emission = {0.3f, 0.2f, 0.2f, 0.0f};
callList = gl.glGenLists(1);
gl.glNewList(callList, gl.GL_COMPILE);
gl.glMaterialfv(gl.GL_FRONT, gl.GL_AMBIENT, Utils.mkFloatBuffer(no_mat));
gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, Utils.mkFloatBuffer(mat_diffuse));
gl.glMaterialfv(gl.GL_FRONT, gl.GL_SPECULAR, Utils.mkFloatBuffer(mat_specular));
gl.glMaterialf(gl.GL_FRONT, gl.GL_SHININESS, high_shininess);
gl.glMaterialfv(gl.GL_FRONT, gl.GL_EMISSION, Utils.mkFloatBuffer(no_mat));
glu.gluQuadricTexture(quad, true);
glu.gluQuadricOrientation(quad, glu.GLU_OUTSIDE);
texture.enable(gl);
texture.bind(gl);
glu.gluSphere(quad, 1, 36, 72);
texture.disable(gl);
gl.glEndList();
return callList;
}
示例6: drawSphere
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
public static void drawSphere(GL2 gl2, double radius, boolean texture) {
GLU glu = new GLU();
GLUquadric quadric = glu.gluNewQuadric();
glu.gluQuadricTexture(quadric, texture);
if (texture == false) {
glu.gluQuadricDrawStyle(quadric, GLU.GLU_FILL);
}
glu.gluQuadricNormals(quadric, GLU.GLU_FLAT);
glu.gluQuadricOrientation(quadric, GLU.GLU_OUTSIDE);
glu.gluSphere(quadric, radius, 64, 64);
glu.gluDeleteQuadric(quadric);
}
示例7: render
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
public void render(RendererState rendererState) {
GL gl = rendererState.getGL();
GLU glu = new GLU();
gl.glRotated(90, 1, 0, 0);
gl.glColor4d(
material.getColor().getRed(),
material.getColor().getGreen(),
material.getColor().getBlue(),
material.getColor().getAlpha());
Texture texture = null;
if(material.getTexture() != null) {
texture =
rendererState.
getTextureLoader().
getTexture(
material.getTexture());
}
if(texture != null)
texture.enable();
GLUquadric sphere = glu.gluNewQuadric();
glu.gluQuadricTexture(sphere, true);
glu.gluQuadricDrawStyle(sphere, GLU.GLU_FILL);
glu.gluQuadricNormals(sphere, GLU.GLU_FLAT);
glu.gluQuadricOrientation(sphere, GLU.GLU_OUTSIDE);
glu.gluSphere(
sphere,
rendererState.getScale().getMagnitude(),
slices,
stacks);
glu.gluDeleteQuadric(sphere);
if(texture != null)
texture.disable();
gl.glColor4d(1, 1, 1, 1);
gl.glRotated(90, -1, 0, 0);
}
示例8: drawEarth
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
private void drawEarth(GL2 gl) {
// set material properties
float[] rgba = { 1f, 1f, 1f }; // neutral white surface
gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT, rgba, 0);
gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_SPECULAR, rgba, 0);
gl.glMaterialf(GL2.GL_FRONT, GL2.GL_SHININESS, 0.5f);
if (!texturesCreated) {
earth.scheduleAvailableTextures(gl.getGLProfile());
earth.createScheduledTextures(gl);
List<String> textureNames = earth.getAvailableTextureNames();
if (!textureNames.isEmpty()) {
earth.setCurrentTexture(earth.getDefaultTexture());
}
texturesCreated = true;
}
if(skydomeTexture == null) {
loadSkydomeTexture();
} else {
skydomeTexture.enable(gl);
skydomeTexture.bind(gl);
// create the earth ball
GLUquadric skydome = glu.gluNewQuadric();
glu.gluQuadricTexture(skydome, true); // apply texture to the sphere
glu.gluQuadricDrawStyle(skydome, GLU.GLU_FILL);
glu.gluQuadricNormals(skydome, GLU.GLU_FLAT);
glu.gluQuadricOrientation(skydome, GLU.GLU_INSIDE);
glu.gluSphere(skydome, this.currentRadius()*5, SKYDOME_RESOLUTION, SKYDOME_RESOLUTION);
glu.gluDeleteQuadric(skydome);
}
if(credits != null && !wasLastFrame2D()) {
credits.render(gl);
} else {
// apply the texture
Texture texture = earth.getCurrentTexture();
if (texture != null) {
texture.enable(gl);
texture.bind(gl);
}
// create the earth ball
GLUquadric earthQuad = glu.gluNewQuadric();
glu.gluQuadricTexture(earthQuad, true); // apply texture to the sphere
glu.gluQuadricDrawStyle(earthQuad, GLU.GLU_FILL);
glu.gluQuadricNormals(earthQuad, GLU.GLU_FLAT);
glu.gluQuadricOrientation(earthQuad, GLU.GLU_OUTSIDE);
// size of sphere depends on zoom
glu.gluSphere(earthQuad, this.currentRadius(), EARTH_RESOLUTION, EARTH_RESOLUTION);
glu.gluDeleteQuadric(earthQuad);
}
}
示例9: draw
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
/**
* Draw all locations
* @param gl
* @param glu
* @param shearX
* @param shearY
*/
public void draw(GL gl1, GLU glu, double shearX, double shearY) {
//System.out.println("\ndrawing spheres");
GL2 gl = (GL2)gl1;
gl.glInitNames();
gl.glPushName(0);
GLUquadric quadric = glu.gluNewQuadric();
glu.gluQuadricNormals(quadric, GLU.GLU_SMOOTH);
// store initial drawing color
gl.glPushAttrib(GL2.GL_CURRENT_BIT);
for (int i = 0; i < locs.size(); i++) {
Location loc = locs.get(i);
gl.glLoadName(i);
gl.glColor4f(loc.r, loc.g, loc.b, 1.0f);
gl.glPushMatrix();
try {
double x = loc.x;
double y = loc.y;
double z = grid.z(x, y);
x += shearX * z;
y += shearY * z;
//System.out.println("ID " + i + "\t" + x + "\t" + y + "\t" + z);
gl.glTranslated(x, y, z);
glu.gluSphere(quadric, R, LONGITUDE_SLICES, LATITUDE_SLICES);
} catch (Exception exc) {
// FIXME
System.out.println("Could not draw sphere");
}
gl.glPopMatrix();
}
// restore initial drawing color
gl.glPopAttrib();
glu.gluDeleteQuadric(quadric);
}
示例10: display
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
@Override
public void display(GLAutoDrawable glAutoDrawable) {
// System.out.println("MER.display " + time + " " + this.mapEvent.getMessage());
GL gl = glAutoDrawable.getGL();
gl.glPushMatrix();
gl.glTranslated(location.x, location.y, location.z + 60 * 1.1);
// display small
// gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA);
GlColor color = new GlColor(entity.getColor(), 0.5);
gl.glColor4d(color.r, color.g, color.b, color.a);
GLUquadric quadratic = glu.gluNewQuadric();
glu.gluSphere(quadratic, SPHERE_RADIUS, SPHERE_SLICES, SPHERE_STACKS);
gl.glPopMatrix();
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glColor3d(1,1,1);
gl.glRasterPos3d(location.x, location.y, location.z);
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12, this.mapEvent.getMessage());
gl.glEnable(GL.GL_DEPTH_TEST);
// gl.glDisable(GL.GL_BLEND);
}
示例11: drawGForceWinLoop
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
public void drawGForceWinLoop(GL gl,GLU glu ){
// Clear the screen
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
if (InputHandler.MPOrientationMatrix != null)
{
//gl.glMatrixMode(gl.GL_PROJECTION);
//glu.gluLookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
//gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(gl.GL_MODELVIEW);
Matrix4f m = new Matrix4f(InputHandler.MPOrientationMatrix);
System.out.println("matrix: "+m);
//m.invert();
gl.glLoadIdentity();
gl.glTranslatef(0.3f, 0.3f, -5);
gl.glMultMatrixf(m.transposeLocal().getMatrix(), 0);
// ein mal ganz richtig
Vector3f x = new Vector3f(0.7f,0.f,0.f);
Vector3f y = new Vector3f(0.f,0.7f,0.f);
Vector3f z = new Vector3f(0.f,0.f,0.7f);
gl.glPushMatrix();
gl.glBegin(GL.GL_LINES);
gl.glColor3f(0.0f, 0.0f, 0.0f);
gl.glVertex3f(0,0,0);
gl.glColor3f(1.0f, 0.0f, 0.0f);
gl.glVertex3f(x.x,x.y,x.z);
gl.glColor3f(0.0f, 0.0f, 0.0f);
gl.glVertex3f(0,0,0);
gl.glColor3f(0.0f, 1.0f, 0.0f);
gl.glVertex3f(y.x,y.y,y.z);
gl.glColor3f(0.0f, 0.0f, 0.0f);
gl.glVertex3f(0,0,0);
gl.glColor3f(0.0f, 0.0f, 1.0f);
gl.glVertex3f(z.x,z.y,z.z);
gl.glColor3f(1.0f, 1.0f, 1.0f);
GLUquadric qobj0 = glu.gluNewQuadric();
if(Math.sin(aswitch/10)>0)
gl.glColor3f(1.0f, 1.0f, 1.0f);
else
gl.glColor3f(0.7f, 0.7f, 0.7f);
glu.gluSphere( qobj0, 0.2f, 12, 12);
gl.glEnd();
gl.glPopMatrix();
return;
}
}
示例12: drawSphere
import javax.media.opengl.glu.GLUquadric; //导入依赖的package包/类
protected void drawSphere(GLUquadric quadric,float r,GLU glu){glu.gluSphere(quadric, r, 10, 10);}