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


Java TextureCoords类代码示例

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


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

示例1: bindTexture

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
private void bindTexture(GL gl, Texture texture, float xmin, float xmax, float ymin, float ymax) {
    texture.enable(gl);
    texture.bind(gl);
    TextureCoords coords = texture.getImageTexCoords();
    gl.getGL2().glBegin(GL2.GL_QUADS);
    gl.getGL2().glTexCoord2f(coords.left(), coords.top());
    gl.getGL2().glVertex2f(xmin, 1 - ymin);
    gl.getGL2().glTexCoord2f(coords.right(), coords.top());
    gl.getGL2().glVertex2f(xmax, 1 - ymin);
    gl.getGL2().glTexCoord2f(coords.right(), coords.bottom());
    gl.getGL2().glVertex2f(xmax, 1 - ymax);
    gl.getGL2().glTexCoord2f(coords.left(), coords.bottom());
    gl.getGL2().glVertex2f(xmin, 1 - ymax);
    gl.getGL2().glEnd();
    texture.disable(gl);

}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:18,代码来源:ThumbnailsLayer.java

示例2: bindTexture

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
/**
 *
 * @param gl
 * @param texture
 * @param xmin
 * @param xmax
 * @param ymin
 * @param ymax
 */
private void bindTexture(GL gl, Texture texture, float xmin, float xmax, float ymin, float ymax) {
    texture.enable(gl);
    texture.bind(gl);
    TextureCoords coords = texture.getImageTexCoords();
    gl.getGL2().glBegin(GL2.GL_QUADS);
    gl.getGL2().glTexCoord2f(coords.left(), coords.top());
    gl.getGL2().glVertex2f(xmin, 1 - ymin);
    gl.getGL2().glTexCoord2f(coords.right(), coords.top());
    gl.getGL2().glVertex2f(xmax, 1 - ymin);
    gl.getGL2().glTexCoord2f(coords.right(), coords.bottom());
    gl.getGL2().glVertex2f(xmax, 1 - ymax);
    gl.getGL2().glTexCoord2f(coords.left(), coords.bottom());
    gl.getGL2().glVertex2f(xmin, 1 - ymax);
    gl.getGL2().glEnd();
    texture.disable(gl);
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:26,代码来源:ImageLayer.java

示例3: FloorModel

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
FloorModel(Texture t, Point3d p, DynamicsWorld world) {
    super(p,1);

    mkStaticGroundPlane(world);

    if(floorInt == 0){
        this.gl = gl;

        this.t = t;

        TextureCoords textureCoords = t.getImageTexCoords();
        textureTop = textureCoords.top();
        textureBottom = textureCoords.bottom();
        textureLeft = textureCoords.left();
        textureRight = textureCoords.right();
        floorInt = genCibeList(world);

    }
}
 
开发者ID:seemywingz,项目名称:Kengine,代码行数:20,代码来源:FloorModel.java

示例4: Wall

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
Wall(Point3d p, DynamicsWorld world) {
    super(p, 1);

    if(obj == 0){
        try {
            texture = Textures.wall;
            TextureCoords textureCoords = texture.getImageTexCoords();
            textureTop = textureCoords.top();
            textureBottom = textureCoords.bottom();
            textureLeft = textureCoords.left();
            textureRight = textureCoords.right();
        }catch (Exception e){
            e.printStackTrace();
            System.out.println("Error loading wall texture");
        }
        obj = genCube();
    }

    initializePhysics(world);
}
 
开发者ID:seemywingz,项目名称:Kengine,代码行数:21,代码来源:Wall.java

示例5: draw3D

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
/**
 * Draws text at a location in 3D space.
 *
 * <p>
 * Uses the renderer's current color. The baseline of the leftmost character
 * is placed at position (x, y, z) in the current coordinate system.
 *
 * @param text
 *            Text to draw
 * @param x
 *            Position to draw on X axis
 * @param y
 *            Position to draw on Y axis
 * @param z
 *            Position to draw on Z axis
 * @param scale
 *            Uniform scale applied to width and height of text
 * @throws GLException
 *             if no OpenGL context is current, or is unexpected version
 * @throws NullPointerException
 *             if text is null
 */
public void draw3D(/*@Nonnull*/ final String text,
		/*@CheckForSigned*/ float x,
		/*@CheckForSigned*/ final float y,
		/*@CheckForSigned*/ final float z,
		/*@CheckForSigned*/ final float scale) {

	Check.notNull(text, "Text cannot be null");

	// Get the current OpenGL context
	final GL gl = GLContext.getCurrentGL();

	// Get all the glyphs for the string
	final List<Glyph> glyphs = glyphProducer.createGlyphs(text);

	// Render each glyph
	for (final Glyph glyph : glyphs) {
		if (glyph.location == null) {
			glyphCache.upload(glyph);
		}
		final TextureCoords coords = glyphCache.find(glyph);
		final float advance = glyphRenderer.drawGlyph(gl, glyph, x, y, z, scale, coords);
		x += advance * scale;
	}
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:47,代码来源:TextRenderer.java

示例6: drawGlyph

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
@Override
public float drawGlyph(/*@Nonnull*/ final GL gl,
		/*@Nonnull*/ final Glyph glyph,
		/*@CheckForSigned*/ final float x,
		/*@CheckForSigned*/ final float y,
		/*@CheckForSigned*/ final float z,
		/*@CheckForSigned*/ final float scale,
		/*@Nonnull*/ final TextureCoords coords) {

	Check.notNull(gl, "GL cannot be null");
	Check.notNull(glyph, "Glyph cannot be null");
	Check.notNull(coords, "Texture coordinates cannot be null");

	if (delegate == null) {
		throw new IllegalStateException("Must be in render cycle!");
	} else {
		return delegate.drawGlyph(gl, glyph, x, y, z, scale, coords);
	}
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:20,代码来源:TextRenderer.java

示例7: computeCoordinates

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
/**
 * Computes the normalized coordinates of a glyph's location.
 *
 * @param glyph Glyph being uploaded, assumed not null
 */
private void computeCoordinates(/*@Nonnull*/ final Glyph glyph) {

    // Determine dimensions in pixels
    final int cacheWidth = getWidth();
    final int cacheHeight = getHeight();
    final float left = getLeftBorderLocation(glyph);
    final float bottom = getBottomBorderLocation(glyph);

    // Convert to normalized texture coordinates
    final float l = left / cacheWidth;
    final float b = bottom / cacheHeight;
    final float r = (left + glyph.width) / cacheWidth;
    final float t = (bottom - glyph.height) / cacheHeight;

    // Store in glyph
    glyph.coordinates = new TextureCoords(l, b, r, t);
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:23,代码来源:GlyphCache.java

示例8: drawCorners

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
private void drawCorners(GL2 gl, Map<String, Vertex> map) {
  Vertex rightBottom = map.get("rightBottom");
  Vertex leftBottom = map.get("leftBottom");
  Vertex rightTop = map.get("rightTop");
  Vertex leftTop = map.get("leftTop");
  TextureCoords textureCoords = texture.getImageTexCoords();

  float leftTex = textureCoords.left();
  float rightTex = textureCoords.right();
  float topTex = textureCoords.top();
  float bottomTex = textureCoords.bottom();

  gl.glPushMatrix();
  gl.glBegin(GL_TRIANGLE_STRIP);
  gl.glTexCoord2d(rightTex, bottomTex);
  gl.glVertex3f(rightBottom.getPositionX(), rightBottom.getPositionY(),
      rightBottom.getPositionZ());

  gl.glTexCoord2d(rightTex, topTex);
  gl.glVertex3f(rightTop.getPositionX(), rightTop.getPositionY(), rightTop.getPositionZ());

  gl.glTexCoord2d(leftTex, bottomTex);
  gl.glVertex3f(leftBottom.getPositionX(), leftBottom.getPositionY(), leftBottom.getPositionZ());

  gl.glTexCoord2d(leftTex, topTex);
  gl.glVertex3f(leftTop.getPositionX(), leftTop.getPositionY(), leftTop.getPositionZ());
  gl.glEnd();
  gl.glPopMatrix();
}
 
开发者ID:StefanoaicaLucian,项目名称:ParticleEffectsAPI,代码行数:30,代码来源:Particle.java

示例9: draw

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
@Override
public void draw(GL2 gl, float height) {
	if(blendTexture == null) {
		Environment environment = Environment.getInstance();
		String texPath = environment.getString(EnvVariable.SCREENSHOT_BLEND_TEXTURE);
		try {
			blendTexture = TextureIO.newTexture(new File(texPath), false);
		} catch (GLException | IOException e) {
			Logger.getInstance().warning("Texture " + texPath + " not found!");
		}
	}
	
	if(active && state != null && blendTexture != null) {
		
		TextureCoords texCoords = blendTexture.getImageTexCoords();
		FloatVector3D[] vertices = state.getBoundingBox().getCornersCounterClockwise();
		
		blendTexture.bind(gl);
		
		gl.glBegin(GL2.GL_QUADS);
		gl.glTexCoord2f(texCoords.right(), texCoords.top());
		gl.glVertex3f(vertices[0].getX(), vertices[0].getY(), 0);
		gl.glTexCoord2f(texCoords.left(), texCoords.top());
		gl.glVertex3f(vertices[1].getX(), vertices[1].getY(), 0);
		gl.glTexCoord2f(texCoords.left(), texCoords.bottom());
		gl.glVertex3f(vertices[2].getX(), vertices[2].getY(), 0);
		gl.glTexCoord2f(texCoords.right(), texCoords.bottom());
		gl.glVertex3f(vertices[3].getX(), vertices[3].getY(), 0);
		gl.glEnd();
	}
	
	// Draw next layer.
	if (this.hasNextLayer()) {
		this.getNextLayer().draw(gl, height + HEIGHT_GAP);
	}
}
 
开发者ID:johb,项目名称:GAIA,代码行数:37,代码来源:ScreenshotLayer.java

示例10: drawTexture

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
private void drawTexture(GL gl, AxeBox axe, Texture texture, TextureCoords coords) {
    callWithAlphaFactor(gl, filter, 1);
    before(gl);
    if (horizontal) {
        mapTextureHorizontal(gl, coords, computeTextureVertex(axe, texture, horizontal, pos));
    } else {
        mapTextureVertical(gl, coords, computeTextureVertex(axe, texture, horizontal, pos));
    }
    after(gl);
}
 
开发者ID:jzy3d,项目名称:bigpicture,代码行数:11,代码来源:AxeTextAnnotation.java

示例11: mapTextureHorizontal

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
protected void mapTextureHorizontal(GL gl, TextureCoords coords, Mapping mapping) {
    if (gl.isGL2()) {
        gl.getGL2().glBegin(GL2GL3.GL_QUADS);
        gl.getGL2().glTexCoord2f(coords.left(), coords.bottom()); // left
        gl.getGL2().glVertex3d(mapping.leftBottom.x, mapping.leftBottom.y, mapping.leftBottom.z);
        gl.getGL2().glTexCoord2f(coords.right(), coords.bottom());
        gl.getGL2().glVertex3d(mapping.rightBottom.x, mapping.rightBottom.y, mapping.rightBottom.z);
        gl.getGL2().glTexCoord2f(coords.right(), coords.top());
        gl.getGL2().glVertex3d(mapping.rightTop.x, mapping.rightTop.y, mapping.rightTop.z);
        gl.getGL2().glTexCoord2f(coords.left(), coords.top());
        gl.getGL2().glVertex3d(mapping.leftTop.x, mapping.leftTop.y, mapping.leftTop.z);
        gl.getGL2().glEnd();
    }
}
 
开发者ID:jzy3d,项目名称:bigpicture,代码行数:15,代码来源:AxeTextAnnotation.java

示例12: mapTextureVertical

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
protected void mapTextureVertical(GL gl, TextureCoords coords, Mapping mapping) {
    if (gl.isGL2()) {
        gl.getGL2().glBegin(GL2GL3.GL_QUADS);
        gl.getGL2().glTexCoord2f(coords.right(), coords.top());
        gl.getGL2().glVertex3d(mapping.leftTop.x, mapping.leftTop.y, mapping.leftTop.z);
        gl.getGL2().glTexCoord2f(coords.right(), coords.bottom());
        gl.getGL2().glVertex3d(mapping.rightTop.x, mapping.rightTop.y, mapping.rightTop.z);
        gl.getGL2().glTexCoord2f(coords.left(), coords.bottom());
        gl.getGL2().glVertex3d(mapping.rightBottom.x, mapping.rightBottom.y, mapping.rightBottom.z);
        gl.getGL2().glTexCoord2f(coords.left(), coords.top());
        gl.getGL2().glVertex3d(mapping.leftBottom.x, mapping.leftBottom.y, mapping.leftBottom.z);
        gl.getGL2().glEnd();
    }
}
 
开发者ID:jzy3d,项目名称:bigpicture,代码行数:15,代码来源:AxeTextAnnotation.java

示例13: renderTexture

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
/**
 * Render a texture to the given position.
 *
 * @param texture Texture to draw
 * @param centerX X coordinate for the center of the texture
 * @param centerY Y coordinate for the center of the texture
 */
private void renderTexture(Texture texture, double centerX, double centerY) {
  TextureCoords tc = texture.getImageTexCoords();
  float tx1 = tc.left();
  float ty1 = tc.top();
  float tx2 = tc.right();
  float ty2 = tc.bottom();
  float halfWidth = quarterValue(texture.getWidth());
  float halfHeight = quarterValue(texture.getHeight());

  GL2 gl = scene.gl;
  texture.bind(gl);
  texture.enable(gl);

  Color foreground = scene.getForegroundColor();
  gl.glColor4f(foreground.getRed() / 255f,
      foreground.getGreen() / 255f,
      foreground.getBlue() / 255f,
      foreground.getAlpha() / 255f);

  gl.glPushMatrix();
  float[] translate = GLScene.P((float) centerX, (float) centerY);
  gl.glTranslatef(translate[0], translate[1], translate[2]);
  gl.glBegin(GL2.GL_QUADS);
  // divided by 2 to get nicer textures
  // divided by 4 when we center it : 1/2 on each side of x axis for instance.
  gl.glTexCoord2f(tx1, ty1);
  GLScene.V(gl, -halfWidth, halfHeight);
  gl.glTexCoord2f(tx2, ty1);
  GLScene.V(gl, halfWidth,  halfHeight);
  gl.glTexCoord2f(tx2, ty2);
  GLScene.V(gl, halfWidth, -halfHeight);
  gl.glTexCoord2f(tx1, ty2);
  GLScene.V(gl, -halfWidth, -halfHeight);
  gl.glEnd();
  gl.glPopMatrix();

  texture.disable(gl);
}
 
开发者ID:google,项目名称:depan,代码行数:46,代码来源:DrawingPlugin.java

示例14: drawGlyph

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
@Override
public final float drawGlyph(/*@Nonnull*/ final GL gl,
                             /*@Nonnull*/ final Glyph glyph,
                             /*@CheckForSigned*/ final float x,
                             /*@CheckForSigned*/ final float y,
                             /*@CheckForSigned*/ final float z,
                             /*@CheckForSigned*/ final float scale,
                             /*@Nonnull*/ final TextureCoords coords) {

    Check.notNull(gl, "GL cannot be null");
    Check.notNull(glyph, "Glyph cannot be null");
    Check.notNull(coords, "Texture coordinates cannot be null");

    // Compute position and size
    quad.xl = x + (scale * glyph.kerning);
    quad.xr = quad.xl + (scale * glyph.width);
    quad.yb = y - (scale * glyph.descent);
    quad.yt = quad.yb + (scale * glyph.height);
    quad.z = z;
    quad.sl = coords.left();
    quad.sr = coords.right();
    quad.tb = coords.bottom();
    quad.tt = coords.top();

    // Draw quad
    pipeline.addQuad(gl, quad);

    // Return distance to next character
    return glyph.advance;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:31,代码来源:AbstractGlyphRenderer.java

示例15: render

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
public void render(GL2 gl) {
	
	// Create the credits texture if not done yet:
	if(creditsTexture == null) {
		createTexture();
	}
	
	if(creditsTexture != null) {
		// Activate alpha:
		gl.glEnable(GL2.GL_BLEND);
		gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
		
		// Bind the texture for use:
		creditsTexture.bind(gl);
		
		// The textures 2D-coordinates:
		TextureCoords texCoords = creditsTexture.getImageTexCoords();
		
		// Backup current matrix:
		gl.glPushMatrix();
		gl.glLoadIdentity();
		
		// Apply transformation:
		gl.glRotatef(rotation, 1, 0, 0);
		gl.glTranslatef(0, -2, position);
		gl.glRotatef(-90, 1, 0, 0);
		
		// Draw vertices and pass uv-coords.
		gl.glBegin(GL2.GL_QUADS);
		gl.glTexCoord2f(texCoords.right(), texCoords.top());
		gl.glVertex3f(CREDITS_PANE_WIDTH/2, CREDITS_PANE_HEIGHT/2, 0);
		gl.glTexCoord2f(texCoords.left(), texCoords.top());
		gl.glVertex3f(-CREDITS_PANE_WIDTH/2, CREDITS_PANE_HEIGHT/2, 0);
		gl.glTexCoord2f(texCoords.left(), texCoords.bottom());
		gl.glVertex3f(-CREDITS_PANE_WIDTH/2, -CREDITS_PANE_HEIGHT/2, 0);
		gl.glTexCoord2f(texCoords.right(), texCoords.bottom());
		gl.glVertex3f(CREDITS_PANE_WIDTH/2, -CREDITS_PANE_HEIGHT/2, 0);
		gl.glEnd();
		
		// Restore matrix:
		gl.glPopMatrix();
	}
}
 
开发者ID:johb,项目名称:GAIA,代码行数:44,代码来源:Credits.java


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