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


Java GL2.glPixelZoom方法代码示例

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


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

示例1: displayPixmap

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Displays the pixmap of pixel values.
 *
 * @param drawable
 */
synchronized private void displayPixmap(GLAutoDrawable drawable) {
	GL2 gl = drawable.getGL().getGL2();
	if (gl == null) {
		return;
	}

	checkGLError(gl, "before pixmap");
	final int wi = drawable.getSurfaceWidth(), hi = drawable.getSurfaceHeight();
	float scale = 1;
	if (fillsVertically) {// tall chip, use chip height
		scale = ((float) hi - (2 * borderPixels)) / getSizeY();
	} else if (fillsHorizontally) {
		scale = ((float) wi - (2 * borderPixels)) / getSizeX();
	}

	gl.glPixelZoom(scale, scale);
	gl.glRasterPos2f(-.5f, -.5f); // to LL corner of chip, but must be inside viewport or else it is ignored, breaks on zoom     if (zoom.isZoomEnabled() == false) {

	checkPixmapAllocation();
	{
		try {
			pixmap.rewind();
			gl.glDrawPixels(sizeX, sizeY, GL.GL_RGB, GL.GL_FLOAT, pixmap);
		} catch (IndexOutOfBoundsException e) {
			log.warning(e.toString());
		}
	}
	//        FloatBuffer minMax=FloatBuffer.allocate(6);
	//        gl.glGetMinmax(GL.GL_MINMAX, true, GL.GL_RGB, GL.GL_FLOAT, minMax);
	//        gl.glDisable(GL.GL_MINMAX);
	checkGLError(gl, "after rendering image");


	// outline frame
	gl.glColor4f(0, 0, 1f, 0f);
	gl.glLineWidth(1f);
	{
		gl.glBegin(GL.GL_LINE_LOOP);
		final float o = .5f;
		final float w = sizeX - 1;
		final float h = sizeY - 1;
		gl.glVertex2f(-o, -o);
		gl.glVertex2f(w + o, -o);
		gl.glVertex2f(w + o, h + o);
		gl.glVertex2f(-o, h + o);
		gl.glEnd();
	}
	checkGLError(gl, "after rendering frame");
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:54,代码来源:ImageDisplay.java

示例2: displayPixmap

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Displays the pixmap of pixel values.
 *
 * @param drawable
 */
synchronized private void displayPixmap(GLAutoDrawable drawable) {
    GL2 gl = drawable.getGL().getGL2();
    if (gl == null) {
        return;
    }

    checkGLError(gl, "before pixmap");
    final int wi = drawable.getSurfaceWidth(), hi = drawable.getSurfaceHeight();
    float scale = 1;
    if (fillsVertically) {// tall chip, use chip height
        scale = (hi - (2 * borderPixels)) / getSizeY();
    } else if (fillsHorizontally) {
        scale = (wi - (2 * borderPixels)) / getSizeX();
    }

    gl.glPixelZoom(scale, scale);
    //        gl.glRasterPos2f(-.5f, -.5f); // to LL corner of chip, but must be inside viewport or else it is ignored, breaks on zoom     if (zoom.isZoomEnabled() == false) {
    gl.glRasterPos2f(0, 0); // to LL corner of chip, but must be inside viewport or else it is ignored, breaks on zoom     if (zoom.isZoomEnabled() == false) {

    checkPixmapAllocation();
    {
        try {
            pixmap.rewind();
            gl.glDrawPixels(sizeX, sizeY, GL.GL_RGB, GL.GL_FLOAT, pixmap);
        } catch (IndexOutOfBoundsException e) {
            log.warning(e.toString());
        }
    }
    //        FloatBuffer minMax=FloatBuffer.allocate(6);
    //        gl.glGetMinmax(GL.GL_MINMAX, true, GL.GL_RGB, GL.GL_FLOAT, minMax);
    //        gl.glDisable(GL.GL_MINMAX);
    checkGLError(gl, "after rendering image");

    // outline frame
    gl.glColor4f(0, 0, 1f, 0f);
    gl.glLineWidth(2f);
    {
        gl.glBegin(GL.GL_LINE_LOOP);
        final float o = 0;
        final float w = sizeX;
        final float h = sizeY;
        gl.glVertex2f(-o, -o);
        gl.glVertex2f(w + o, -o);
        gl.glVertex2f(w + o, h + o);
        gl.glVertex2f(-o, h + o);
        gl.glEnd();
    }
    checkGLError(gl, "after rendering frame");
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:55,代码来源:ImageDisplay.java


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