• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TextureCoords类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: draw

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
@Override
public void draw(GL2 gl, float height) {
	// Update and fetch texture.
	if (adapter.toDraw()) {
		adapter.bindTexture(gl);
		Texture tex = adapter.getTexture();
		
		if (tex != null) {
			gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
			tex.bind(gl);
			
			TextureCoords texCoords = tex.getImageTexCoords();
			
			
			FloatBoundingBox box = adapter.getDrawBox();
			FloatVector3D upperLeft = box.getUpperLeft();
			FloatVector3D upperRight = box.getUpperRight();
			FloatVector3D lowerLeft = box.getLowerLeft();
			FloatVector3D lowerRight = box.getLowerRight();
			
			gl.glMatrixMode(GL2.GL_PROJECTION);
			gl.glLoadIdentity();
			gl.glOrthof(-1, 1, 
						-1, 1, 
						-10000, 10000);
			
			gl.glDisable(GL2.GL_DEPTH_TEST);
			
			gl.glMatrixMode(GL2.GL_MODELVIEW);
			
			// Lift the x-y-pane up:
			gl.glTranslatef(0, 0, height);
			
			// Draw texture.
			gl.glBegin(GL2.GL_QUADS);
			gl.glTexCoord2f(texCoords.left(), texCoords.top());
			gl.glVertex3f(upperLeft.getX(), upperLeft.getY(), 0.0f);
			gl.glTexCoord2f(texCoords.left(), texCoords.bottom());
			gl.glVertex3f(lowerLeft.getX(), lowerLeft.getY(), 0.0f);
			gl.glTexCoord2f(texCoords.right(), texCoords.bottom());
			gl.glVertex3f(lowerRight.getX(), lowerRight.getY(), 0.0f);
			gl.glTexCoord2f(texCoords.right(), texCoords.top());
			gl.glVertex3f(upperRight.getX(), upperRight.getY(), 0.0f);
			gl.glEnd();
		}
	}
	
	// Draw next layer if available.
	if (this.hasNextLayer()) {
		this.getNextLayer().draw(gl, height + HEIGHT_GAP);			
	}
}
 
开发者ID:johb,项目名称:GAIA,代码行数:53,代码来源:WeatherLayer.java


示例17: draw

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
/**
 * Draws all tiles available for the current view. Also all OpenGL-specific
 * work in the adapter must be performed here. To accomplish this
 * <code>performGLCalls()</code> is called.
 */
@Override
public void draw(GL2 gl, float height) {
	if (adapter != null) {

		// Create outstanding textures.
		adapter.performGLCalls(gl);

		Collection<GLResource> toDraw = adapter.getGLResources();
		for (GLResource current : toDraw) {
			// Get texture.
			Texture tex = adapter.getTexture(current.getKey());

			// Bind texture.
			if (tex != null) {
				tex.bind(gl);
				
				// Vertices to draw.
				FloatBoundingBox box = current.getBox();
				FloatVector3D[] vertices = box.getCornersCounterClockwise();
				// Tex coords.
				TextureCoords texCoords = tex.getImageTexCoords();
				
				// Backup the current Model-View-Matrix:
				gl.glPushMatrix();
				// Lift the x-y-pane up:
				gl.glTranslatef(0, 0, height);
				
				// Draw vertices and pass tex coords.
				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();
				
				// Restore the old matrix:
				gl.glPopMatrix();
			}
		}
	}
	
	// Draw next layer.
	if (this.hasNextLayer()) {
		this.getNextLayer().draw(gl, height + HEIGHT_GAP);
	}

}
 
开发者ID:johb,项目名称:GAIA,代码行数:57,代码来源:TileLayer.java


示例18: draw

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
@Override
public void draw(GL2 gl, float height) {
	
	// If not done yet, invoke the adapters initialization:
	if(!adapterInitialized) {
		adapter.performGLInit(gl);
		adapterInitialized = true;
	}
	
	// Perform all the necessary OpenGL-stuff:
	adapter.performGLCalls(gl);
	
	// Update and fetch texture.
	Texture tex = adapter.getTexture(CopyrightAdapter.COPYRIGHT_TEXTURE_KEY);
	if (tex != null) {
		gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
		tex.bind(gl);
		
		TextureCoords texCoords = tex.getImageTexCoords();
		
		FloatBoundingBox box = adapter.getDrawBox();
		if(box != null) {
			FloatVector3D upperLeft = box.getUpperLeft();
			FloatVector3D upperRight = box.getUpperRight();
			FloatVector3D lowerLeft = box.getLowerLeft();
			FloatVector3D lowerRight = box.getLowerRight();
			
			gl.glMatrixMode(GL2.GL_PROJECTION);
			gl.glLoadIdentity();
			gl.glOrthof(-1, 1, 
						-1, 1, 
						-10000, 10000);
			
			gl.glDisable(GL2.GL_DEPTH_TEST);
			
			gl.glMatrixMode(GL2.GL_MODELVIEW);
			
			// Lift the x-y-pane up:
			gl.glTranslatef(0, 0, height);
			
			// Draw texture.
			gl.glBegin(GL2.GL_QUADS);
			gl.glTexCoord2f(texCoords.left(), texCoords.top());
			gl.glVertex3f(upperLeft.getX(), upperLeft.getY(), 0.0f);
			gl.glTexCoord2f(texCoords.left(), texCoords.bottom());
			gl.glVertex3f(lowerLeft.getX(), lowerLeft.getY(), 0.0f);
			gl.glTexCoord2f(texCoords.right(), texCoords.bottom());
			gl.glVertex3f(lowerRight.getX(), lowerRight.getY(), 0.0f);
			gl.glTexCoord2f(texCoords.right(), texCoords.top());
			gl.glVertex3f(upperRight.getX(), upperRight.getY(), 0.0f);
			gl.glEnd();
		}
	}
	
	// Draw next layer.
	if (this.hasNextLayer()) {
		this.getNextLayer().draw(gl, height + HEIGHT_GAP);
	}
}
 
开发者ID:johb,项目名称:GAIA,代码行数:60,代码来源:CopyrightLayer.java


示例19: draw

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
/**
 * Draws all Wikipedia-POIs available for the current view. Also all
 * OpenGL-specific work in the adapter must be performed here.
 */
@Override
public void draw(GL2 gl, float height) {
	WikipediaManager wikiManager = (WikipediaManager) ResourceMaster.getInstance().getResourceManager("Wikipedia");
	
	if (wikiManager.isEnabled() && adapter != null && gl != null) {
		// Check if the adapter was already initialized.
		// This must be done from the OpenGl-thread:
		if (!adapterInitialized) {
			adapter.performGLInit(gl);
		}

		// Do further processing in the OpenGL-context:
		adapter.performGLCalls(gl);

		// Get the texture querying with the default key:
		Texture texture = adapter
				.getTexture(WikipediaAdapter.WIKIPEDIA_TEXTURE_KEY);

		if (texture != null) {

			// The textures 2D-coordinates:
			TextureCoords texCoords = texture.getImageTexCoords();

			gl.glEnable(GL2.GL_BLEND);
			gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
			// Bind the texture for use with every marker to draw:
			texture.bind(gl);

			// Iterate all markers already converted into GL-coordinates:
			Collection<GLResource> glResources = adapter.getGLResources();
			for (GLResource current : glResources) {

				// Vertices to draw:
				FloatBoundingBox box = current.getBox();
				FloatVector3D[] vertices = box.getCornersCounterClockwise();

				// Backup the current Model-View-Matrix:
				gl.glPushMatrix();
				// Lift the x-y-pane up:
				gl.glTranslatef(0, 0, height);
				
				// Draw vertices and pass uv-coords.
				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();
				
				// Restore the old matrix:
				gl.glPopMatrix();
			}
		}
	}

	// Draw next layer.
	if (this.hasNextLayer()) {
		this.getNextLayer().draw(gl, height + HEIGHT_GAP);
	}
}
 
开发者ID:johb,项目名称:GAIA,代码行数:69,代码来源:WikipediaLayer.java


示例20: draw

import com.jogamp.opengl.util.texture.TextureCoords; //导入依赖的package包/类
/**
 * Draws all POIs available for the current view. Also all OpenGL-specific
 * work in the adapter must be performed here.
 */
@Override
public void draw(GL2 gl, float height) {
	if (adapter != null && gl != null) {
		// Check if the adapter was already initialized.
		// This must be done from the OpenGl-thread:
		if (!adapterInitialized) {
			adapter.performGLInit(gl);
		}

		// Do further processing in the OpenGL-context:
		adapter.performGLCalls(gl);

		// Get the texture querying with the default key:
		Texture texture = adapter
				.getTexture(MarkerAdapter.MARKER_TEXTURE_KEY);

		if (texture != null) {

			// The textures 2D-coordinates:
			TextureCoords texCoords = texture.getImageTexCoords();

			gl.glEnable(GL2.GL_BLEND);
			gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
			// Bind the texture for use with every marker to draw:
			texture.bind(gl);

			// Iterate all markers already converted into GL-coordinates:
			Collection<GLResource> glResources = adapter.getGLResources();
			for (GLResource current : glResources) {

				// Vertices to draw:
				FloatBoundingBox box = current.getBox();
				FloatVector3D[] vertices = box.getCornersCounterClockwise();

				// Backup the current Model-View-Matrix:
				gl.glPushMatrix();
				// Lift the x-y-pane up:
				gl.glTranslatef(0, 0, height);
				
				// Draw vertices and pass uv-coords.
				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();
				
				// Restore the old matrix:
				gl.glPopMatrix();
			}
		}
	}

	// Draw next layer.
	if (this.hasNextLayer()) {
		this.getNextLayer().draw(gl, height + HEIGHT_GAP);
	}
}
 
开发者ID:johb,项目名称:GAIA,代码行数:67,代码来源:MarkerLayer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RMContainer类代码示例发布时间:2022-05-22
下一篇:
Java DecompilerSettings类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap