当前位置: 首页>>代码示例>>Java>>正文


Java GLU类代码示例

本文整理汇总了Java中com.jogamp.opengl.glu.GLU的典型用法代码示例。如果您正苦于以下问题:Java GLU类的具体用法?Java GLU怎么用?Java GLU使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GLU类属于com.jogamp.opengl.glu包,在下文中一共展示了GLU类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的com.jogamp.opengl.glu.GLU类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。