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


Java GLMatrixFunc类代码示例

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


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

示例1: reshape

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
public void reshape(GLAutoDrawable canvas, int left, int top, int width, int height) {
    GL2 gl = canvas.getGL().getGL2();

    // Selecting the viewport -- the display area -- to be the entire widget.
    gl.glViewport(0, 0, width, height);

    // Determining the width to height ratio of the widget.
    double ratio = (double) width / (double) height;

    // Selecting the projection matrix.
    gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);

    gl.glLoadIdentity();

    // Selecting the view volume to be x from 0 to 1, y from 0 to 1, z from -1 to 1.
    // But we are careful to keep the aspect ratio and enlarging the width or the height.
    if (ratio < 1)
        gl.glOrtho(-v_size, v_size, -v_size, v_size / ratio, -1, 1);
    else
        gl.glOrtho(-v_size, v_size * ratio, -v_size, v_size, -1, 1);

    // Selecting the modelview matrix.
    gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);

}
 
开发者ID:claudiu-ancau-rm,项目名称:GUI,代码行数:26,代码来源:MainFrame.java

示例2: reshape

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
@Override
public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height ) {

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

	if( height <= 0 ) {
		height = 1;
	}

	final float h = ( float ) width / ( float ) height;
	gl.glViewport( 0, 0, width, height );
	gl.glMatrixMode( GLMatrixFunc.GL_PROJECTION );
	gl.glLoadIdentity();

	glu.gluPerspective( 45.0f, h, 1.0, 20.0 );
	gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW );
	gl.glLoadIdentity();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:19,代码来源:Triangulation3DViewer.java

示例3: setCamera

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的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

示例4: display

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的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: reshape

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
	GL2 gl = drawable.getGL().getGL2();
	gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
	gl.glLoadIdentity();
	glu.gluOrtho2D(0, width, 0, height); // left, right, bottom, top
	/* layout components */
	Insets insets = getInsets();
	bodyArea = new Rectangle(insets.left, insets.bottom, width - insets.left - insets.right, height - insets.bottom - insets.top);
	// layout title
	titleArea.x = (width - titleArea.width) / 2;
	titleArea.y = height - (insets.top / 2) - titleArea.height;
	bodyArea.height -= titleArea.height;

	layoutComponents(gl, x, y, width, height);

	/* set cliping area for body: left, right, bottom, top. */
	gl.glClipPlane(GL2ES1.GL_CLIP_PLANE0, new double[]{1.0, 0.0, 0.0, -bodyArea.x}, 0);
	gl.glClipPlane(GL2ES1.GL_CLIP_PLANE1, new double[]{-1.0, 0.0, 0.0, bodyArea.x + bodyArea.width}, 0);
	gl.glClipPlane(GL2ES1.GL_CLIP_PLANE2, new double[]{0.0, 1.0, 0.0, -bodyArea.y}, 0);
	gl.glClipPlane(GL2ES1.GL_CLIP_PLANE3, new double[]{0.0, -1.0, 0.0, bodyArea.x + bodyArea.height}, 0);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:Chart.java

示例6: reshape

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
@Override
public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
	disp.size[0] = (StaticVars.debugOn & StaticVars.debugWindow2x) ? width / 2 : width;
	disp.size[1] = (StaticVars.debugOn & StaticVars.debugWindow2x) ? height / 2 : height;
	final GL2ES1 gl = glad.getGL().getGL2ES1();
	if (width == 0) {
		width = 1;
	}
	if (height == 0) {
		height = 1;
	}

	gl.glViewport(0, 0, width, height);

	gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
	gl.glLoadIdentity();

	gl.glOrtho(0.0, (StaticVars.debugOn & StaticVars.debugWindow2x) ? width / 2 : width, (StaticVars.debugOn & StaticVars.debugWindow2x) ? height / 2 : height, 0.0, -1, 1);

	gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:XDrake99,项目名称:WarpPI,代码行数:23,代码来源:NEWTWindow.java

示例7: render

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
/**
 *
 */
@Override
public void render() {
    /* Clear context. */
    gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    /* Switch matrix mode to modelview. */
    gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
    gl.glEnable(GL_DEPTH_TEST);
    gl.glDepthFunc(GL_LESS);
    gl.glLoadIdentity();
    gl.glPolygonMode(GL_FRONT_AND_BACK, this.polygonmode);

    /* Call list. */
    for (Integer handle : this.objects) {
        gl.glCallList(handle);
    }
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:21,代码来源:JOGLOffscreenRenderer.java

示例8: positionCamera

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
/**
 * Changes the positionCamera of the camera.
 *
 * @param ex x Position of the Camera
 * @param ey y Position of the Camera
 * @param ez z Position of the Camera
 * @param cx x Position of the object of interest (i.e. the point at which the camera looks).
 * @param cy y Position of the object of interest (i.e. the point at which the camera looks).
 * @param cz z Position of the object of interest (i.e. the point at which the camera looks).
 * @param upx x-direction of the camera's UP position.
 * @param upy y-direction of the camera's UP position.
 * @param upz z-direction of the camera's UP position.
 */
@Override
public final void positionCamera(double ex, double ey, double ez, double cx, double cy, double cz, double upx, double upy, double upz) {
    /* Check context. */
    if (!this.checkContext()) {
      return;
    }

    /* Switch matrix mode to projection. */
    gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
    gl.glLoadIdentity();

    /* Set default perspective. */
    glu.gluPerspective(45.0f, this.aspect, 0.01f, 100.0f);

    /* Update camera position. */
    glu.gluLookAt(ex,ey,ez,cx,cy,cz,upx,upy,upz);
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:31,代码来源:JOGLOffscreenRenderer.java

示例9: reshape

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
{
  GL2 gl;
  System.out.println("reshape "+x+","+y+" "+width+","+height);
  gl = drawable.getGL().getGL2();
  newosdwidth=width;
  newosdheight=height;
  gl.glViewport(0, 0, newosdwidth, newosdheight);
  gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
  gl.glLoadIdentity();
  gl.glOrtho(0,newosdwidth,newosdheight,0,-1.0,1.0);
  gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
  gl.glLoadIdentity();
  gl.glClearColor( 0.0f, 0.0f, 0.0f, 0.0f);
  gl.glClear( gl.GL_COLOR_BUFFER_BIT);
  synchronized(newpbufferlock)
  {
    newpbuffer=true;
  }
  myConn.postResizeEvent(new java.awt.Dimension(c.getWidth(), c.getHeight()));
}
 
开发者ID:google,项目名称:sagetv,代码行数:22,代码来源:OpenGLGFXCMD.java

示例10: drawString

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
void drawString(String text, int x, int y, java.awt.Color color, GL2 gl, com.jogamp.opengl.util.awt.TextRenderer tr)
{
  //System.out.println("drawString "+ text + " x: "+x+" y: "+y);
  gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  //System.out.println("glOrtho(0,"+ c.getWidth() + ","+c.getHeight()+",0,-1.0,1.0)");
  gl.glOrtho(0,c.getWidth(),0,c.getHeight(),-1.0,1.0);
  tr.begin3DRendering();

  tr.setColor(color);
  tr.draw3D(text, x, c.getHeight()-y, 0, 1);
  tr.end3DRendering();
  gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
  gl.glPopMatrix();
  gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
}
 
开发者ID:google,项目名称:sagetv,代码行数:18,代码来源:OpenGLGFXCMD.java

示例11: setup

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的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

示例12: display

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
public void display(final GLAutoDrawable drawable) {
    final GL2ES2 gl = drawable.getGL().getGL2ES2();

    gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

    final RegionRenderer regionRenderer = getRenderer();
    final PMVMatrix pmv = regionRenderer.getMatrix();
    pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
    pmv.glLoadIdentity();
    pmv.glTranslatef(getXTran(), getYTran(), getZTran());
    pmv.glRotatef(getAngle(), 0, 1, 0);
    if( weight != regionRenderer.getRenderState().getWeight() ) {
        regionRenderer.getRenderState().setWeight(weight);
    }
    region.draw(gl, regionRenderer, getSampleCount());
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:18,代码来源:GPURegionGLListener01.java

示例13: display

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
public void display(final GLAutoDrawable drawable) {
    final GL2ES2 gl = drawable.getGL().getGL2ES2();

    gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

    final RegionRenderer regionRenderer = getRenderer();

    final PMVMatrix pmv = regionRenderer.getMatrix();
    pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
    pmv.glLoadIdentity();
    pmv.glTranslatef(getXTran(), getYTran(), getZTran());
    pmv.glRotatef(getAngle(), 0, 1, 0);
    if( weight != regionRenderer.getRenderState().getWeight() ) {
        regionRenderer.getRenderState().setWeight(weight);
    }
    region.draw(gl, regionRenderer, getSampleCount());

}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:20,代码来源:GPURegionGLListener02.java

示例14: windowToShapeCoordsImpl

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
private boolean windowToShapeCoordsImpl(final UIShape activeShape, final int glWinX, final int glWinY, final float[] objPos) {
    final PMVMatrix pmv = renderer.getMatrix();
    pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);

    pmv.glPushMatrix();
    transformShape(pmv, activeShape);
    boolean res = false;
    final float[] ctr = activeShape.getBounds().getCenter();
    if( pmv.gluProject(ctr[0], ctr[1], ctr[2], viewport, 0, dpyTmp1V3, 0) ) {
        // System.err.printf("winToShapeCoords.0: shape %d: obj [%f, %f, %f] -> win [%f, %f, %f]%n", shapeId, ctr[0], ctr[1], ctr[2], dpyTmp1V3[0], dpyTmp1V3[1], dpyTmp1V3[2]);
        if( pmv.gluUnProject(glWinX, glWinY, dpyTmp1V3[2], viewport, 0, objPos, 0) ) {
            // System.err.printf("winToShapeCoords.1: shape %d: win [%d, %d, %f] -> obj [%f, %f, %f]%n", shapeId, glWinX, glWinY, dpyTmp1V3[2], objPos[0], objPos[1], objPos[2]);
            res = true;
        }
    }
    pmv.glPopMatrix();
    return res;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:19,代码来源:SceneUIController.java

示例15: display

import com.jogamp.opengl.fixedfunc.GLMatrixFunc; //导入依赖的package包/类
@Override
public void display(final GLAutoDrawable drawable) {
    final GL2ES2 gl = drawable.getGL().getGL2ES2();

    gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

    final int[] sampleCount = { 4 };
    final float[] translate = button.getTranslate();

    final RegionRenderer regionRenderer = getRegionRenderer();
    final PMVMatrix pmv = regionRenderer.getMatrix();
    pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
    pmv.glLoadIdentity();
    pmv.glTranslatef(getXTran(), getYTran(), getZoom());
    pmv.glRotatef(getAngle(), 0, 1, 0);
    pmv.glTranslatef(translate[0], translate[1], 0);
    button.drawShape(gl, regionRenderer, sampleCount);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:20,代码来源:UIGLListener01.java


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