本文整理汇总了Java中com.jogamp.opengl.glu.GLU类的典型用法代码示例。如果您正苦于以下问题:Java GLU类的具体用法?Java GLU怎么用?Java GLU使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLU类属于com.jogamp.opengl.glu包,在下文中一共展示了GLU类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setCamera
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
private void setCamera(GL2 gl, GLU glu)
{
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(75, 1, 0.01, 1000);
//look at the player from 1.5 units directly above the player
glu.gluLookAt(
inst.player.pos.x, inst.player.pos.y, 1.5,
inst.player.pos.x, inst.player.pos.y, 0,
0, 1, 0);
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
}
开发者ID:ben-j-c,项目名称:TopDownGame,代码行数:17,代码来源:Display.java
示例2: setCameraMapping
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
private void setCameraMapping(GL2 gl, GLU glu)
{
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-1, 1, -1, 1, 0.01, 1000);
//look at the player from 2.5 units directly above the player
glu.gluLookAt(
inst.player.pos.x + inst.offset.x, inst.player.pos.y + inst.offset.y, 1.5,
inst.player.pos.x + inst.offset.x, inst.player.pos.y + inst.offset.y, 0,
0, 1, 0);
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
}
开发者ID:ben-j-c,项目名称:TopDownGame,代码行数:17,代码来源:Display.java
示例3: render
import com.jogamp.opengl.glu.GLU; //导入依赖的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
示例4: render
import com.jogamp.opengl.glu.GLU; //导入依赖的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
示例5: render
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
private void render(GL2 gl) {
final float alpha = .2f;
glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL);
int off = (1 << (subunitSubsamplingBits)) / 2;
for (int x = excludedEdgeSubunits; x < (nx-excludedEdgeSubunits); x++) {
for (int y = excludedEdgeSubunits; y < (ny-excludedEdgeSubunits); y++) {
gl.glPushMatrix();
gl.glTranslatef((x << subunitSubsamplingBits) + off, (y << subunitSubsamplingBits) + off, 5);
if (((x == (nx / 2)) && (y == (ny / 2))) || ((x == ((nx / 2) - 1)) && (y == (ny / 2))) || ((x == ((nx / 2) - 1)) && (y == ((ny / 2) - 1))) || ((x == (nx / 2)) && (y == ((ny / 2) - 1)))) {
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,代码行数:27,代码来源:ObjectMotionCell.java
示例6: render
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
private void render(GL2 gl) {//fix graphic
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 == excitedColumnNumber) {
gl.glColor4f(0, 1, 0, alpha);
} else {
gl.glColor4f(1, 0, 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("Inhibition", 0, chip.getSizeY(), 0, .5f);
renderer.setColor(1, 0, 0, 1);
renderer.draw3D("Active Scan", chip.getSizeX() / 2, chip.getSizeY(), 0, .5f);
renderer.end3DRendering();
}
开发者ID:SensorsINI,项目名称:jaer,代码行数:27,代码来源:FrequencyDetectionCell.java
示例7: draw
import com.jogamp.opengl.glu.GLU; //导入依赖的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
示例8: setCamera
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
private void setCamera(GLAutoDrawable drawable, GLU glu, float distance) {
GL2 gl = drawable.getGL().getGL2();
// Change to projection matrix.
gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity();
//gl.glEnable(GL.GL_DEPTH_TEST);
//gl.glTranslatef( 0f, 0f, 800);
//gl.glTranslatef( chip.getSizeX()/2, chip.getSizeX()/2, chip.getSizeX()/2 );
//gl.glRotatef(45, 0, 1, 0);
// Perspective.
float widthHeightRatio = getWidth() / getHeight();
//glu.gluPerspective(60, widthHeightRatio, 200, 1200);
glu.gluPerspective(60, widthHeightRatio, 50, 2000);
glu.gluLookAt(xeye, yeye, distance, 0, 0, 0, 0, 1, 0);
// Change back to model view matrix.
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glLoadIdentity();
}
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:Triangulation3DViewer.java
示例9: checkGLError
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
/**
* Utility method to check for GL errors. Prints stacked up errors up to a
* limit.
*
* @param g the GL context
* @param glu the GLU used to obtain the error strings
* @param msg an error message to log to e.g., show the context
*/
public void checkGLError(final GL2 g, final GLU glu, final String msg) {
int error = g.glGetError();
int nerrors = 3;
while ((error != GL.GL_NO_ERROR) && (nerrors-- != 0)) {
final StackTraceElement[] trace = Thread.currentThread().getStackTrace();
if (trace.length > 1) {
final String className = trace[2].getClassName();
final String methodName = trace[2].getMethodName();
final int lineNumber = trace[2].getLineNumber();
log.warning("GL error number " + error + " " + glu.gluErrorString(error) + " : " + msg + " at "
+ className + "." + methodName + " (line " + lineNumber + ")");
} else {
log.warning("GL error number " + error + " " + glu.gluErrorString(error) + " : " + msg);
}
// Thread.dumpStack();
error = g.glGetError();
}
}
开发者ID:SensorsINI,项目名称:jaer,代码行数:27,代码来源:ChipCanvas.java
示例10: checkGLError
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
/** Utility method to check for GL errors. Prints stacked up errors up to a limit.
@param g the GL context
@param glu the GLU used to obtain the error strings
@param msg an error message to log to e.g., show the context
*/
public void checkGLError(GL2 g, GLU glu, String msg) {
if (g == null) {
log.warning("null GL");
return;
}
int error = g.glGetError();
int nerrors = 3;
while ((error != GL.GL_NO_ERROR) && (nerrors-- != 0)) {
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
if (trace.length > 1) {
String className = trace[2].getClassName();
String methodName = trace[2].getMethodName();
int lineNumber = trace[2].getLineNumber();
log.warning("GL error number " + error + " " + glu.gluErrorString(error) + " : " + msg + " at " + className + "." + methodName + " (line " + lineNumber + ")");
} else {
log.warning("GL error number " + error + " " + glu.gluErrorString(error) + " : " + msg);
}
// Thread.dumpStack();
error = g.glGetError();
}
}
开发者ID:SensorsINI,项目名称:jaer,代码行数:27,代码来源:Series.java
示例11: reshape
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
GLU glu = g.getGLU();
if (height == 0) height = 1; // prevent divide by zero
float aspect = (float) width / height;
// Set the view port (display area) to cover the entire window
gl.glViewport(0, 0, width, height);
// Setup perspective projection, with aspect ratio matches viewport
gl.glMatrixMode(GL2.GL_PROJECTION); // choose projection matrix
gl.glLoadIdentity(); // reset projection matrix
glu.gluPerspective(45.0, aspect, 0.1, 100.0); // fovy, aspect, zNear, zFar
// Enable the model-view transform
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity(); // reset
}
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:AnimationApplication.java
示例12: reshape
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
GLU glu = g.getGLU();
if (height == 0) height = 1; // prevent divide by zero
float aspect = (float)width / height;
// Set the view port (display area) to cover the entire window
gl.glViewport(0, 0, width, height);
// Setup perspective projection, with aspect ratio matches viewport
gl.glMatrixMode(GL2.GL_PROJECTION); // choose projection matrix
gl.glLoadIdentity(); // reset projection matrix
glu.gluPerspective(45.0, aspect, 0.1, 100.0); // fovy, aspect, zNear, zFar
// Enable the model-view transform
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity(); // reset
}
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:SimpleMeshExample.java
示例13: reshape
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2(); // get the OpenGL graphics context
GLU glu = g.getGLU();
if (height == 0) height = 1; // prevent divide by zero
float aspect = (float) width / height;
// Set the view port (display area) to cover the entire window
gl.glViewport(0, 0, width, height);
// Setup perspective projection, with aspect ratio matches viewport
gl.glMatrixMode(GL2.GL_PROJECTION); // choose projection matrix
gl.glLoadIdentity(); // reset projection matrix
glu.gluPerspective(45.0, aspect, 0.1, 1000.0); // fovy, aspect, zNear, zFar
// Enable the model-view transform
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity(); // reset
}
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:LogoShowApplication.java
示例14: standardScene
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
public static void standardScene(Graphics3D graphics, int x, int y, int w, int h) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
GL2 gl = g.getGL2();
GLU glu = g.getGLU();
gl.glViewport(x, y, w, h);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
double aspect = (double)w/(double)h;
glu.gluPerspective(60.0, aspect, 0.1, 500.0);
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
}
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:18,代码来源:StandardExample.java
示例15: JOGLOffscreenRenderer
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
/**
* Default constructor. Defines the width and the height of this JOGLOffscreenRenderer and
* initializes all the required OpenGL bindings.
*
* @param width Width in pixels.
* @param height Height in pixels.
*/
public JOGLOffscreenRenderer(int width, int height) {
/* Assign width and height. */
this.width = width;
this.height = height;
this.aspect = (float) width / (float) height;
/* Initialize GLOffscreenAutoDrawable. */
GLDrawableFactory factory = GLDrawableFactory.getFactory(GL_PROFILE);
this.drawable = factory.createOffscreenAutoDrawable(null, GL_CAPABILITIES,null,width,height);
this.drawable.display();
/* Initialize GLU and GL2. */
this.glu = new GLU();
this.gl = drawable.getGL().getGL2();
/* Set default color. */
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}
开发者ID:vitrivr,项目名称:cineast,代码行数:26,代码来源:JOGLOffscreenRenderer.java
示例16: setup
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
protected static void setup(GL pGL, int width, int height)
{
pGL.getGL2().glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pGL.getGL2().glLoadIdentity();
// coordinate system origin at lower left with width and height same as
// the
// window
final GLU glu = new GLU();
glu.gluOrtho2D(0.0f, width, 0.0f, height);
pGL.getGL2().glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pGL.getGL2().glLoadIdentity();
pGL.glViewport(0, 0, width, height);
}
开发者ID:ClearVolume,项目名称:ClearVolume,代码行数:17,代码来源:OneTriangle.java
示例17: render
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
@Override
void render(GL2 gl, GLU glu) {
if (conf.objectRenderMode == Rendermodus.RENDER_GLU)
if (quadric == null)
quadric = glu.gluNewQuadric();
if (associatedCam.istDrahtgittermodell())
gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);
else
gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, conf.displayMode.getMode());
loadMaterial(gl);
gl.glPushMatrix();
renderDelegate(gl, glu);
gl.glPopMatrix();
}
开发者ID:trent2,项目名称:bGLOOP,代码行数:17,代码来源:GLObjekt.java
示例18: generateDisplayList_GLU
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
@Override
void generateDisplayList_GLU(GL2 gl, GLU glu) {
// gl.glColor3f(1, 1, 1);
gl.glNewList(bufferName, GL2.GL_COMPILE);
gl.glEnable(GL2.GL_CULL_FACE);
glu.gluQuadricNormals(quadric, GLU.GLU_SMOOTH);
glu.gluQuadricTexture(quadric, true);
gl.glTranslated(0, 0, aHoehe/2);
glu.gluDisk(quadric, 0, aRad1, aEcken, 1);
gl.glPushMatrix();
gl.glRotated(180, 0, 1, 0);
gl.glTranslated(0, 0, aHoehe);
glu.gluDisk(quadric, 0, aRad2, aEcken, 1);
gl.glPopMatrix();
gl.glTranslated(0, 0, -aHoehe);
glu.gluCylinder(quadric, aRad2, aRad1, aHoehe, aEcken, aKonzentrischeKreise);
// glu.gluDeleteQuadric(quadric);
gl.glEndList();
}
开发者ID:trent2,项目名称:bGLOOP,代码行数:20,代码来源:GLPrismoid.java
示例19: getRealWorldPointFromWindowPoint
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
@Override
public GamaPoint getRealWorldPointFromWindowPoint(final Point windowPoint) {
int realy = 0;// GL y coord pos
final double[] wcoord = new double[4];
final int x = (int) windowPoint.getX(), y = (int) windowPoint.getY();
final GLU glu = GLU.createGLU(gl);
realy = viewport[3] - y;
glu.gluUnProject(x, realy, 0.1, mvmatrix, 0, projmatrix, 0, viewport, 0, wcoord, 0);
final GamaPoint v1 = new GamaPoint(wcoord[0], wcoord[1], wcoord[2]);
glu.gluUnProject(x, realy, 0.9, mvmatrix, 0, projmatrix, 0, viewport, 0, wcoord, 0);
final GamaPoint v2 = new GamaPoint(wcoord[0], wcoord[1], wcoord[2]);
final GamaPoint v3 = v2.minus(v1).normalized();
final float distance =
(float) (camera.getPosition().getZ() / GamaPoint.dotProduct(new GamaPoint(0.0, 0.0, -1.0), v3));
final GamaPoint worldCoordinates = camera.getPosition().plus(v3.times(distance));
return new GamaPoint(worldCoordinates.x, worldCoordinates.y);
}
开发者ID:gama-platform,项目名称:gama,代码行数:19,代码来源:JOGLRenderer.java
示例20: resizeArea
import com.jogamp.opengl.glu.GLU; //导入依赖的package包/类
/**
* Resizes the area.
*
* @param gl2
* The GL object
* @param x
* unused
* @param y
* unused
* @param width
* The width
* @param height
* The hieght
*/
protected void resizeArea(GL2 gl2, int x, int y, int width, int height) {
gl2.glMatrixMode(GL2.GL_PROJECTION);
gl2.glLoadIdentity();
// coordinate system origin at lower left with width and height same as
// the window
GLU glu = new GLU();
glu.gluOrtho2D(0.0f, width, 0.0f, height);
gl2.glMatrixMode(GL2.GL_MODELVIEW);
gl2.glLoadIdentity();
gl2.glViewport(0, 0, width, height);
area.setWidth(width);
area.setHeight(height);
}
开发者ID:jsettlers,项目名称:settlers-remake,代码行数:32,代码来源:AreaContainer.java
注:本文中的com.jogamp.opengl.glu.GLU类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论