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


Java GL2.glRectf方法代码示例

本文整理汇总了Java中com.jogamp.opengl.GL2.glRectf方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glRectf方法的具体用法?Java GL2.glRectf怎么用?Java GL2.glRectf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.opengl.GL2的用法示例。


在下文中一共展示了GL2.glRectf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
synchronized public void annotate(final GLAutoDrawable drawable) {
    if (!showAnnotation) {
        return;
    }
    final GL2 gl = drawable.getGL().getGL2();
    gl.glColor3f(0, 0, 1);
    final float x1 = (chip.getSizeX() * ((float) (eventsSinceLastShot >> 10))) / eventCountThresholdKEvents;
    gl.glRectf(0, 0, x1, 2);
    final float x2 = (chip.getSizeX() * ((eventRateEstimator.getFilteredEventRate()))) / eventRateThresholdHz;
    gl.glRectf(0, 4, x2, 6);

    textRenderer.setColor(1, 1, 1, 0.4f); // rgba
    textRenderer.begin3DRendering();
    final String s = String.format("kevents accum.: %4d, rate keps: %6.2f, snapshot triggered=%s", eventsSinceLastShot >> 10,
            eventRateEstimator.getFilteredEventRate() * 1e-3f, snapshotTriggered);
    textRenderer.draw3D(s, 0, 0, 0, .25f);
    textRenderer.end3DRendering();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:20,代码来源:DavisAutoShooter.java

示例2: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(final GLAutoDrawable drawable) {
	if (!showHotPixels) {
		return;
	}
	final GL2 gl = drawable.getGL().getGL2();
	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 (final GLException e) {
		e.printStackTrace();
		showHotPixels = false;
	}
	gl.glColor4f(.1f, .1f, 1f, .25f);
	gl.glLineWidth(1f);
	for (final HotPixel p : hotPixelSet) {
		gl.glRectf(p.x - 1, p.y - 1, p.x + 2, p.y + 2);
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:22,代码来源:HotPixelFilter.java

示例3: 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();

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:17,代码来源:HarmonicFilter.java

示例4: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Called by the drawable to initiate OpenGL rendering by the
    client. After all GLEventListeners have been notified of a
    display event, the drawable will swap its buffers if {@link
    GLAutoDrawable#setAutoSwapBufferMode setAutoSwapBufferMode} is
    enabled. */
@Override
public void display(GLAutoDrawable drawable){
	target.update();
	GL2 gl=drawable.getGL().getGL2();
	gl.glClearColor(0,0,0,0f);
	gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	gl.glPushMatrix();
	gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
	gl.glLoadIdentity(); // very important to load identity matrix here so this works after first resize!!!
	gl.glOrtho(0,drawable.getSurfaceWidth() ,0,drawable.getSurfaceHeight(),10000,-10000);
	gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
	gl.glPopMatrix();
	gl.glPushMatrix();
	gl.glColor3f(1,1,1);
	gl.glRectf(target.x()-SIZE, target.y()-SIZE, target.x()+SIZE, target.y()+SIZE);
	//        gl.glColor3f(1,1,1);
	//        gl.glTranslatef(target.x(),target.y(),0);
	//        if(eyeQuad==null) eyeQuad = glu.gluNewQuadric();
	//        glu.gluQuadricDrawStyle(eyeQuad,GLU.GLU_FILL);
	//        glu.gluDisk(eyeQuad,0,5,16,1);
	gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:28,代码来源:EyeTarget.java

示例5: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {         //shows the class in the jAER window
    if ((drawable == null) || (chip.getCanvas() == null) || !classifyEvents || model == null) {
        return;
    }
    titleRenderer = new TextRenderer(new Font("Helvetica", Font.PLAIN, 40));
    Rectangle2D bounds = titleRenderer.getBounds("Unkown");
    titleArea = new Rectangle((int) bounds.getWidth(), (int) bounds.getHeight());
    GL2 gl = drawable.getGL().getGL2();
    gl.glColor3f(1, 1, 1);
    gl.glRasterPos3f(10, 10, 0);
    titleRenderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
    titleRenderer.setColor(Color.WHITE);
    titleRenderer.draw(String.format("Class: %d", labeledClass), titleArea.x, titleArea.y);
    titleRenderer.endRendering();
    gl.glPushMatrix();
    gl.glLoadIdentity();
    gl.glTranslatef(drawable.getSurfaceWidth() / 2, drawable.getSurfaceHeight() / 2, 0);
    gl.glColor3f(1, 1, 1);
    float w = drawable.getSurfaceWidth() * lastdot * 5;
    gl.glRectf(0, -10, w, 10);
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:24,代码来源:CochleaSVMTwoEars.java

示例6: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
	GL2 gl = drawable.getGL().getGL2();
	float csx = chip.getSizeX(), csy = chip.getSizeY();
	final float sx = size * chip.getSizeX(), sy = size * chip.getSizeY();
	final float inx = inset * chip.getSizeX(), iny = inset * chip.getSizeY();
	gl.glColor3f(1, 1, 1);
	switch (getCorner()) {
		case 0:
			gl.glRectf(inx, iny, inx + sx, iny + sy);
			break;
		case 1:
			gl.glRectf(csx - inx, iny, csx - inx - sx, iny + sy);
			break;
			//            case 2:
				//                gl.glRectf(csx-inx, csy-iny, csx-inx - sx, csy-iny - sy);
				//                break;
				//            case 3:
			//                gl.glRectf(inx, csy-iny, inx + sx, csy-iny - sy);
			//                break;
		default:

	}
	delayCount++;
	if (delayCount > delayFrames) {
		delayCount=0;
		corner++;
		if (corner > 1) {
			corner = 0;
		}
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:33,代码来源:LatencyTest.java

示例7: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
    final GL2 gl = drawable.getGL().getGL2();
    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 (final GLException e) {
            e.printStackTrace();
    }        
    gl.glColor4f(1f, .1f, .1f, .25f);
    gl.glLineWidth(1f);
    
    if(displayParticles) {
        gl.glColor4f(.1f, 1f, .1f, .25f);

        for(int i = 0; i < filter.getParticleCount(); i ++) {            
            gl.glRectd(filter.get(i).getX() - 0.5, filter.get(i).getY() - 0.5, filter.get(i).getX() + 0.5, filter.get(i).getY() + 0.5);
        }            
    }
    
    gl.glColor4f(.1f, .1f, 1f, .25f);

    gl.glRectf((int)outputX - 10, (int)outputY - 10, (int)outputX + 12, (int)outputY + 12);

    // }    
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:29,代码来源:ParticleFilterTracking.java

示例8: draw

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Draws this event by some standardized method that will depend on
 * rendering method.
 *
 * @param drawable
 *            the OpenGL drawable.
 */
public void draw(final GLAutoDrawable drawable) {
	final GL2 gl = drawable.getGL().getGL2(); // when we get this we are already set up with scale 1=1 pixel, at LL
												// corner

	gl.glColor3f(1, 1, 1);
	gl.glRectf(x, y, x + 1, y + 1);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:15,代码来源:BasicEvent.java

示例9: 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);
    }

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:32,代码来源:VerticalObjectMotionCell.java

示例10: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {

	if (!isFilterEnabled()) {
		return;
	}
	if (!showMap) {
		return;
	}
	if (drawable == null) {
		return;
	}
	if (map == null) {
		return;
	}

	GL2 gl=drawable.getGL().getGL2();

	for (int x = 0; x < cameraX; x++) {
		for (int y = 0; y < cameraY; y++) {

			float green = (float)map[x][y]/(float)(learnMap ? maxMap : 1.0f);
			float red   = 1.0f - green;

			gl.glColor4f(red,green,0.0f,.9f);
			gl.glRectf(
				x-0.5f,
				y-0.5f,
				x+0.5f,
				y+0.5f);
		}
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:34,代码来源:DepressionMap.java

示例11: drawEventRateBars

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawEventRateBars(GLAutoDrawable drawable) {
    if (!isEventRate()) {
        return;
    }
    GL2 gl = drawable.getGL().getGL2();
    // positioning of rate bars depends on num types and display size
    ChipCanvas.Borders borders = chip.getCanvas().getBorders();

    // get screen width in screen pixels, subtract borders in screen pixels to find width of drawn chip area in screen pixels
    float /*h = drawable.getHeight(), */ w = drawable.getSurfaceWidth() - (2 * borders.leftRight * chip.getCanvas().getScale());
    int ntypes = eventRateFilter.getNumCellTypes();
    final int sx = chip.getSizeX(), sy = chip.getSizeY();
    final float yorig = .9f * sy, xpos = 0, ystep = Math.max(.03f * sy, 6), barh = .03f * sy;

    gl.glPushMatrix();
    //        gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
    //        gl.glLoadIdentity();
    gl.glColor3f(1, 1, 1);
    int font = GLUT.BITMAP_9_BY_15;
    GLUT glut = chip.getCanvas().getGlut();
    int nbars = eventRateFilter.isMeasureIndividualTypesEnabled() ? ntypes : 1;
    for (int i = 0; i < nbars; i++) {
        final float rate = eventRateFilter.getFilteredEventRate(i);
        float bary = yorig - (ystep * i);
        gl.glRasterPos3f(xpos, bary, 0);
        String s = null;
        if (eventRateFilter.isMeasureIndividualTypesEnabled()) {
            s = String.format("Type %d: %10s", i, engFmt.format(rate) + " Hz");
        } else {
            s = String.format("All %d types: %10s", ntypes, engFmt.format(rate) + " Hz");
        }
        // get the string length in screen pixels , divide by chip array in screen pixels,
        // and multiply by number of pixels to get string length in screen pixels.
        float sw = (glut.glutBitmapLength(font, s) / w) * sx;
        glut.glutBitmapString(font, s);
        gl.glRectf(xpos + sw, bary + barh, xpos + sw + ((rate * sx) / getEventRateScaleMax()), bary);
    }
    gl.glPopMatrix();

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:41,代码来源:Info.java

示例12: drawTimeScaling

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void drawTimeScaling(GLAutoDrawable drawable, float timeExpansion) {
    if (!isTimeScaling()) {
        return;
    }
    final int sx = chip.getSizeX(), sy = chip.getSizeY();
    final float yorig = .95f * sy, xpos = 0, barh = .03f * sy;
    int h = drawable.getSurfaceHeight(), w = drawable.getSurfaceWidth();
    GL2 gl = drawable.getGL().getGL2();

    gl.glPushMatrix();
    gl.glColor3f(1, 1, 1);
    GLUT glut = chip.getCanvas().getGlut();
    StringBuilder s = new StringBuilder();
    if ((timeExpansion < 1) && (timeExpansion != 0)) {
        s.append('/');
        timeExpansion = 1 / timeExpansion;
    } else {
        s.append('x');
    }
    int font = GLUT.BITMAP_9_BY_15;
    String s2 = String.format("Time factor: %10s", engFmt.format(timeExpansion) + s);

    float sw = (glut.glutBitmapLength(font, s2) / (float) w) * sx;
    gl.glRasterPos3f(0, yorig, 0);
    glut.glutBitmapString(font, s2);
    float x0 = xpos;
    float x1 = (float) (xpos + (x0 * Math.log10(timeExpansion)));
    float y0 = sy + barh;
    float y1 = y0;
    gl.glRectf(x0, y0, x1, y1);
    gl.glPopMatrix();

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:34,代码来源:Info.java

示例13: glDrawPixels

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * draws the buffered pixels onto GL canvas
 *
 * pixels still visible in the viewport but not part of the current frame
 * are buffered internally and can be drawn onto the viewport (after a
 * <code>glTransform</code> was performed) using this method. the value
 * is scaled according to
 *
 * <pre>
 *   value = (pixel_value - offset) * gain
 * </pre>
 *
 * @param gl drawable
 * @param offset
 * @param gain
 */
public synchronized void glDrawPixels(GL2 gl,float offset,float gain) {
	int dx= -currentX();
	int dy= -currentY();

	for(OpticalFlowIntegrator.Pixel px : buffer) {
		float v= gain*(px.getValue()-offset);

		gl.glColor3f(v,v,v);
		gl.glRectf(px.getX()+dx   ,px.getY()+dy,
			px.getX()+dx+1f,px.getY()+dy+1f);
	}

	gl.glColor3f(0f,1f,1f);
	if (clipping) {
		gl.glColor3f(1f,.5f,0f);
	}
	if (error) {
		gl.glColor3f(1f,1f,0f);
	}
	gl.glLineWidth(2f);
	gl.glBegin(GL.GL_LINE_LOOP);
	gl.glVertex3f(x1+dx,y1+dy,0f);
	gl.glVertex3f(x2+dx,y1+dy,0f);
	gl.glVertex3f(x2+dx,y2+dy,0f);
	gl.glVertex3f(x1+dx,y2+dy,0f);
	gl.glEnd();

	// draw graph traces
	glDrawTraces(gl);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:47,代码来源:OpticalFlowIntegrator.java

示例14: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
    if ((!showHistogram && !showBitmap) || histogram == null || histmax == 0) {
        return;
    }
    GL2 gl = drawable.getGL().getGL2();
    checkBlend(gl);
    int numX = chip.getSizeX(), numY = chip.getSizeY();
    final float bmbrightness=.4f;
    for (int y = 0; y < numY; y++) {
        for (int x = 0; x < numX; x++) {
            float v1 = (float) histogram[x][y];
            float v2 = v1 / threshold;
            if(showHistogram){
                if (v1 > threshold) {
                    gl.glColor4f(v2, v2, 0, 0.25f);
                    gl.glRectf(x, y, x + 1, y + 1);
                } else if (v1 > 0) {
                    gl.glColor4f(0, v2, v2, .25f);
                    gl.glRectf(x, y, x + 1, y + 1);
                }
            }
           
            if(showBitmap && bitmap!=null && bitmap[x][y]){
                gl.glColor4f(bmbrightness,bmbrightness,bmbrightness, 0.5f);
                gl.glRectf(x, y, x + 1, y + 1);
            }
        }
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:31,代码来源:Histogram2DFilter.java

示例15: annotate

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
    public void annotate(GLAutoDrawable drawable) { // TODO make this a displaylist
        GL2 gl = drawable.getGL().getGL2();
        final int xp = -20, yp = 10; // where to draw it
        final int sz = 1; // how big each one, 1 for actual size
        // draw negative part as big rectangle
        gl.glColor4f(-negativeWeight, 0, 0, 1);
        gl.glRectf(xp + ((-negativeKernelRadius - .5f) * sz),
                yp + ((-negativeKernelRadius - .5f) * sz),
                xp + ((negativeKernelRadius + .5f) * sz),
                yp + ((negativeKernelRadius + .5f) * sz));
        gl.glColor4f(0, 0, 1, .5f);
        gl.glBegin(GL.GL_LINE_LOOP);
        gl.glVertex2f(xp + ((-negativeKernelRadius - .5f) * sz), yp + ((-negativeKernelRadius - .5f) * sz));
        gl.glVertex2f(xp + ((negativeKernelRadius - .5f) * sz), yp + ((-negativeKernelRadius - .5f) * sz));
        gl.glVertex2f(xp + ((negativeKernelRadius - .5f) * sz), yp + ((negativeKernelRadius - .5f) * sz));
        gl.glVertex2f(xp + ((-negativeKernelRadius - .5f) * sz), yp + ((negativeKernelRadius - .5f) * sz));
        gl.glEnd();

        // draw each positive kernel pixel on top
        for (Splatt s : splatts) {
            if (s.weight > 0) {
                gl.glColor4f(0, s.weight, 0, 1);
                gl.glRectf(xp + ((s.x - .5f) * sz), yp + ((s.y - .5f) * sz), xp + ((s.x + .5f) * sz), yp + ((s.y + .5f) * sz));
            } else {
//                gl.glColor4f(-s.weight, 0, 0,.5f);
            }
        }
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:30,代码来源:CircularConvolutionFilter.java


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