本文整理汇总了Java中com.jogamp.opengl.GL2.glPushMatrix方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glPushMatrix方法的具体用法?Java GL2.glPushMatrix怎么用?Java GL2.glPushMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glPushMatrix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.jogamp.opengl.GL2; //导入方法依赖的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();
}
示例2: render
import com.jogamp.opengl.GL2; //导入方法依赖的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();
}
示例3: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate (GLAutoDrawable drawable){
if ( !isAnnotationEnabled() ){
return;
}
GL2 gl = drawable.getGL().getGL2();
gl.glColor3f(0,0,1);
gl.glLineWidth(.2f);
int n = 1 << surroundScale;
int sy = chip.getSizeY();
gl.glPushMatrix();
gl.glBegin(GL.GL_LINES);
for ( int i = 1 ; i < surSizeX ;
i++ ){
gl.glVertex2i(i * n,0);
gl.glVertex2i(i * n,sy);
}
int sx = chip.getSizeX();
for ( int i = 1 ; i < surSizeY ;
i++ ){
gl.glVertex2i(0,i * n);
gl.glVertex2i(sx,i * n);
}
gl.glEnd();
gl.glPopMatrix();
}
示例4: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void draw(GL2 gl) {
GLUT cGLUT = chip.getCanvas().getGlut();
final int font = GLUT.BITMAP_HELVETICA_12;
gl.glColor3f(1, 1, 1);
cGLUT.glutBitmapString(font, toString()); // annotate
gl.glRasterPos3f(location.x, location.y, 0);
float amplitude = 1000 * getAmplitude();
float phase = getPhase(0);
gl.glPushMatrix();
gl.glTranslatef(location.x, location.y, 0);
gl.glLineWidth(3);
gl.glBegin(GL.GL_LINES);
gl.glVertex2f(0, 0);
gl.glVertex2d(amplitude * Math.cos(phase), amplitude * Math.sin(phase));
gl.glEnd();
gl.glPopMatrix();
}
示例5: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void draw(GL2 gl) {
gl.glPushMatrix();
gl.glTranslatef(chip.getSizeX() / 2, chip.getSizeY() / 2, 0);
float w = oscillator.maxx - oscillator.minx;
float h = oscillator.maxy - oscillator.miny;
gl.glScalef(chip.getSizeX() / w, chip.getSizeY() / h, 1);
if (isNearZeroCrossing()) {
gl.glColor3f(1, 0, 0);
} else {
gl.glColor3f(0, 1, 0);
}
final float r = .01f;
gl.glRectf(oscillator.x - (r * w), oscillator.y - (r * h), oscillator.x + (r * w), oscillator.y + (r * h));
gl.glPopMatrix();
}
示例6: drawPolygon
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawPolygon(final GL2 gl, final int xLowerLeft, final int yLowerLeft, final int width, final int height) {
gl.glPushMatrix();
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL.GL_BLEND);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
final double xRatio = (double) chip.getSizeX() / (double) width;
final double yRatio = (double) chip.getSizeY() / (double) height;
gl.glBegin(GL2.GL_POLYGON);
gl.glTexCoord2d(0, 0);
gl.glVertex2d(xLowerLeft, yLowerLeft);
gl.glTexCoord2d(xRatio, 0);
gl.glVertex2d(xRatio * width + xLowerLeft, yLowerLeft);
gl.glTexCoord2d(xRatio, yRatio);
gl.glVertex2d(xRatio * width + xLowerLeft, yRatio * height + yLowerLeft);
gl.glTexCoord2d(0, yRatio);
gl.glVertex2d(+xLowerLeft, yRatio * height + yLowerLeft);
gl.glEnd();
gl.glPopMatrix();
}
示例7: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
if(!isFilterEnabled()) {
return;
}
GL2 gl=drawable.getGL().getGL2();
gl.glPushMatrix();
final GLUT glut=new GLUT();
gl.glColor3f(1,1,1); // must set color before raster position (raster position is like glVertex)
gl.glRasterPos3f(0,0,0);
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format("ITD(us)=%s",fmt.format(lpFilterITD.getValue())));
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format(" ILD=%s",fmt.format(lpFilterILD.getValue())));
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format(" azm=%s",azm));
gl.glPopMatrix();
}
示例8: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
checkBlend(gl);
gl.glPushMatrix();
gl.glTranslatef(chip.getSizeX() / 2, chip.getSizeY() / 2, 10);
if (showOutputCell && (verticalObjectMotionCellModel.nSpikes > getIntegrateAndFireThreshold())) {
gl.glColor4f(1, 1, 1, .2f);
glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL);
float radius = (chip.getMaxSize() * verticalObjectMotionCellModel.spikeRateHz) / maxSpikeRateHz / 2;
glu.gluDisk(quad, 0, radius, 32, 1);
verticalObjectMotionCellModel.resetSpikeCount();
}
gl.glPopMatrix();
if (showSubunits) {
gl.glColor4f(0, 1, 0, .3f);
gl.glRectf(-10, 0, -5, inhibition);
gl.glColor4f(1, 0, 0, .3f);
gl.glRectf(-20, 0, -15, centerExcition);
renderer.begin3DRendering();
renderer.setColor(0, 1, 0, .3f);
renderer.draw3D("sur", -10, -3, 0, .4f);
renderer.setColor(1, 0, 0, .3f);
renderer.draw3D("cen", -20, -3, 0, .4f);
renderer.end3DRendering();
// render all the subunits now
subunits.render(gl);
}
}
示例9: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
if(!isFilterEnabled()) {
return;
}
GL2 gl=drawable.getGL().getGL2();
gl.glPushMatrix();
final GLUT glut=new GLUT();
gl.glColor3f(1,1,1);
gl.glRasterPos3f(0,0,0);
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format("ITD(us)=%s",fmt.format(ITD)));
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18,String.format(" Angle=%s",ANG));
gl.glPopMatrix();
}
示例10: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void draw(GLAutoDrawable drawable, GL2 gl, float linewidth) {
// if (getTargetLocation() != null && getTargetLocation().location == null) {
// textRenderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
// textRenderer.draw("Target not visible", chip.getSizeX() / 2, chip.getSizeY() / 2);
// textRenderer.endRendering();
// return;
// }
gl.glPushMatrix();
gl.glTranslatef(location.x, location.y, 0f);
float[] compArray = new float[4];
gl.glColor3fv(targetTypeColors[targetClassID % targetTypeColors.length].getColorComponents(compArray), 0);
// gl.glColor4f(0, 1, 0, .5f);
gl.glLineWidth(linewidth);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex2f(-width / 2, -height / 2);
gl.glVertex2f(+width / 2, -height / 2);
gl.glVertex2f(+width / 2, +height / 2);
gl.glVertex2f(-width / 2, +height / 2);
gl.glEnd();
// if (mouseQuad == null) {
// mouseQuad = glu.gluNewQuadric();
// }
// glu.gluQuadricDrawStyle(mouseQuad, GLU.GLU_LINE);
// //glu.gluDisk(mouseQuad, getTargetRadius(), getTargetRadius(), 32, 1);
// int maxDim = Math.max(width, height);
// glu.gluDisk(mouseQuad, maxDim / 2, (maxDim / 2) + 0.1, 32, 1);
//getTargetRadius(), getTargetRadius() + 1, 32, 1);
gl.glPopMatrix();
}
示例11: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
checkBlend(gl);
gl.glPushMatrix();
gl.glTranslatef(chip.getSizeX() / 2, chip.getSizeY() / 2, 10);
if (showOutputCell && (frequencyDetectionCellModel.nSpikes > getIntegrateAndFireThreshold())) {
gl.glColor4f(1, 1, 1, .2f);
glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL);
float radius = (chip.getMaxSize() * frequencyDetectionCellModel.spikeRateHz) / maxSpikeRateHz / 2;
glu.gluDisk(quad, 0, radius, 32, 1);
frequencyDetectionCellModel.resetSpikeCount();
}
gl.glPopMatrix();
if (showSubunits) {
gl.glColor4f(1, 0, 0, .3f);
gl.glRectf(-10, 0, -5, inhibition);
gl.glColor4f(0, 1, 0, .3f);
gl.glRectf(-20, 0, -15, centerExcitation);
renderer.begin3DRendering();
renderer.setColor(1, 0, 0, .3f);
renderer.draw3D("ini", -10, -3, 0, .4f);
renderer.setColor(0, 1, 0, .3f);
renderer.draw3D("exc", -20, -3, 0, .4f);
renderer.end3DRendering();
// render all the subunits now
subunits.render(gl);
}
}
示例12: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
if (!isFilterEnabled()) {
return;
}
GL2 gl = drawable.getGL().getGL2();
gl.glPushMatrix();
final GLUT glut = new GLUT();
gl.glColor3f(1, 1, 1); // must set color before raster position (raster position is like glVertex)
gl.glRasterPos3f(0, 0, 0);
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12, String.format("Low passed event rate=%s Hz, state=%s", fmt.format(rateEstimator.getFilteredEventRate()), state.toString()));
gl.glPopMatrix();
}
示例13: paintCovarianceEllipse
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected static void paintCovarianceEllipse( double[] pos, double[][] cov, final double nsigmas, float[] color, GL2 gl )
{
final int no_points_ellipse = 12;
final double a = cov[0][0];
final double b = cov[1][0];
final double c = cov[1][1];
final double d = Math.sqrt( (((a*a) + (4*b*b)) - (2*a*c)) + (c*c) );
final double scale1 = Math.sqrt( 0.5 * ( a+c+d ) ) * nsigmas;
final double scale2 = Math.sqrt( 0.5 * ( (a+c)-d ) ) * nsigmas;
final double theta = (0.5 * Math.atan2( (2*b), (a-c) ) * 180.0) / Math.PI;
gl.glPushMatrix();
gl.glTranslated(pos[0], pos[1], 0);
gl.glRotated(theta, 0, 0, 1);
gl.glScaled(scale1, scale2, 1);
gl.glColor3f( color[0], color[1], color[2] );
gl.glLineWidth(2);
gl.glBegin(GL.GL_LINE_LOOP);
final double angle = (2*Math.PI) / no_points_ellipse;
for (int i = 0;i<no_points_ellipse;i++) {
gl.glVertex2d( Math.cos( i*angle ), Math.sin( i*angle ) );
}
gl.glEnd();
gl.glPopMatrix();
}
示例14: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void draw(GL2 gl) {
if (!displayMotionField || velocities == null) {
return;
}
try {
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glBlendEquation(GL.GL_FUNC_ADD);
} catch (GLException e) {
e.printStackTrace();
}
float shift = ((1 << motionFieldSubsamplingShift) * .5f);
final float saturationSpeedScaleInversePixels = ppsScale * 0.1f; // this length of vector in pixels makes full brightness
for (int ix = 0; ix < sx; ix++) {
float x = (ix << motionFieldSubsamplingShift) + shift;
for (int iy = 0; iy < sy; iy++) {
final float y = (iy << motionFieldSubsamplingShift) + shift;
final int dt = ts - lastTs[ix][iy]; // use last timestamp of any event that is processed by extractEventInfo
gl.glColor4f(0, 0, 1, 1f);
final float dotRadius = .75f;
gl.glRectf(x - dotRadius, y - dotRadius, x + dotRadius, y + dotRadius);
if (dt > maxAgeUs || dt < 0) {
continue;
}
final float speed = velocities[ix][iy].getValue3D().z;
if (speed < minSpeedPpsToDrawMotionField) {
continue;
}
final Point3D p = velocities[ix][iy].getValue3D();
final float vx = p.x, vy = p.y;
float brightness = p.z * saturationSpeedScaleInversePixels;
if (brightness > 1) {
brightness = 1;
}
// TODO use motionColor()
float[] rgb;
if (displayMotionFieldUsingColor) {
rgb = motionColor(vx, vy, 1, 1);
} else {
rgb = new float[]{0, 0, 1};
}
gl.glColor4f(rgb[0], rgb[1], rgb[2], 1f);
gl.glLineWidth(motionVectorLineWidthPixels);
// gl.glColor4f(angle, 1 - angle, 1 / (1 + 10 * angle), .5f);
gl.glPushMatrix();
DrawGL.drawVector(gl, x, y, vx * ppsScale, vy * ppsScale, motionVectorLineWidthPixels, 1);
gl.glPopMatrix();
if (displayMotionFieldColorBlobs) {
gl.glColor4f(rgb[0], rgb[1], rgb[2], .01f);
final float s = shift / 4;
// draw a blurred square showing motion field direction
// TODO add brightness to show magnitude somehow
for (float dxx = -shift; dxx < shift; dxx += s) {
for (float dyy = -shift; dyy < shift; dyy += s) {
gl.glRectf(x - shift + dxx, y - shift + dyy, x + shift + dxx, y + shift + dyy);
}
}
}
}
}
}
示例15: display
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void display(Graphics3D graphics) {
AWTGraphics3D g = (AWTGraphics3D) graphics;
updateControls(0);
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);
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);
}
colide = NONE;
for (int i = 0; i < cubes.size(); i++) {
OrientedBoundingBox cube = cubes.get(i);
if (Intersector.intersectRayBounds(ray, cube) > 0) {
colide = i;
if (!click) {
g.setColor(Color.YELLOW);
} else {
selected = i;
g.setColor(Color.BLUE);
}
} else {
g.setColor(Color.GREEN);
}
if (selected == i) {
g.setColor(Color.BLUE);
}
gl.glPushMatrix();
gl.glMultMatrixf(cube.transform.val, 0);
g.drawBoundingBox(cube);
gl.glPopMatrix();
}
gl.glFlush();
}