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


Java Texture.bind方法代码示例

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


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

示例1: bindTexture

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的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.Texture; //导入方法依赖的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: innerDraw

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
@Override
public void innerDraw(GL2 gl) {
  Texture texture = textureProvider.getTexture(gl, "◆");
  texture.enable(gl);
  texture.bind(gl);
  gl.glColor4d(0.4, 0.4, 1, 0.5);

  gl.glRotated((System.currentTimeMillis() / 5) % 360, 0, 1, 0);

  gl.glBegin(GL2.GL_POLYGON);
  gl.glTexCoord2f(0, 1);
  gl.glVertex2d(-0.5, -0.5);
  gl.glTexCoord2f(0, 0);
  gl.glVertex2d(-0.5, 0.5);
  gl.glTexCoord2f(1, 0);
  gl.glVertex2d(0.5, 0.5);
  gl.glTexCoord2f(1, 1);
  gl.glVertex2d(0.5, -0.5);
  gl.glEnd();
}
 
开发者ID:mitoma,项目名称:kashiki,代码行数:21,代码来源:CaretView.java

示例4: innerDraw

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
@Override
public void innerDraw(GL2 gl) {
  Texture texture = textureProvider.getTexture(gl, String.valueOf(bufferChar.getChar()));
  texture.enable(gl);
  texture.bind(gl);
  gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
  gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
  gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_ALPHA_TYPE, GL2.GL_LINEAR);
  gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);

  gl.glBegin(GL2.GL_POLYGON);
  gl.glTexCoord2f(0, 1);
  gl.glVertex2d(-0.5, -0.5);
  gl.glTexCoord2f(0, 0);
  gl.glVertex2d(-0.5, 0.5);
  gl.glTexCoord2f(1, 0);
  gl.glVertex2d(0.5, 0.5);
  gl.glTexCoord2f(1, 1);
  gl.glVertex2d(0.5, -0.5);
  gl.glEnd();
}
 
开发者ID:mitoma,项目名称:kashiki,代码行数:22,代码来源:CharView.java

示例5: drawTexture

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
public static void drawTexture(GL2 gl, Texture texture, int x, int y, int width, int height)
{
    texture.enable(gl);
    texture.bind(gl);

    gl.glBegin(GL2.GL_QUADS);
        gl.glTexCoord2d(0.0, 0.0);
        gl.glVertex2d(x, y);

        gl.glTexCoord2d(1.0, 0.0);
        gl.glVertex2d(x + width, y);

        gl.glTexCoord2d(1.0, 1.0);
        gl.glVertex2d(x + width, y + height);

        gl.glTexCoord2d(0.0, 1.0);
        gl.glVertex2d(x, y + height);
    gl.glEnd();

    texture.disable(gl);
}
 
开发者ID:vobject,项目名称:maru,代码行数:22,代码来源:GLUtils.java

示例6: TamburiniRoof

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
public TamburiniRoof(GL2 gl, float width, float height, Texture side, Texture roof){
	this.gl = gl;
	this.width = width;
	this.height = height;
	
           gl.glEnable(GL2.GL_TEXTURE_2D);
               side.bind(gl);
               triangles();
               
               gl.glPushMatrix();
               	gl.glTranslatef(0, 0, width);
               	triangles();
               gl.glPopMatrix();
               
               roof.bind(gl);
               rooftop();
               
               gl.glPushMatrix();
           		gl.glRotatef(180, 0, 1, 0);
           		gl.glTranslatef(-width, 0, -width);
           		rooftop();
           	gl.glPopMatrix();
               
           gl.glDisable(GL2.GL_TEXTURE_2D);
}
 
开发者ID:ProfAmesBC,项目名称:Game2013,代码行数:26,代码来源:TamburiniRoof.java

示例7: drawTile

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
private void drawTile(GL2 gl, double x, double y, double tileSize, Texture texture) {

        texture.enable(gl);
        texture.bind(gl);

        gl.glBegin(GL2.GL_QUADS);

        //(0,0)
        gl.glTexCoord2d(0, 0);
        gl.glVertex3d(x * tileSize, 0, y * tileSize);

        //(1,0)
        gl.glTexCoord2d(1, 0);
        gl.glVertex3d(x * tileSize + tileSize, 0, y * tileSize);

        //(1,1)
        gl.glTexCoord2d(1, 1);
        gl.glVertex3d(x * tileSize + tileSize, 0, y * tileSize + tileSize);

        //(0,1)
        gl.glTexCoord2d(0, 1);
        gl.glVertex3d(x * tileSize, 0, y * tileSize + tileSize);

        gl.glEnd();

        texture.disable(gl);
    }
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:28,代码来源:CollisionApplication.java

示例8: drawTile

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
private void drawTile(GL2 gl, double x, double y, double tileSize, Texture texture) {

		texture.enable(gl);
		texture.bind(gl);
		
		gl.glBegin(GL2.GL_QUADS);

		//(0,0)
		gl.glTexCoord2d(0, 0);
		gl.glVertex3d(x*tileSize, 0, y*tileSize);

		//(1,0)
		gl.glTexCoord2d(1, 0);
		gl.glVertex3d(x*tileSize+tileSize, 0, y*tileSize);

		//(1,1)
		gl.glTexCoord2d(1, 1);
		gl.glVertex3d(x*tileSize+tileSize, 0, y*tileSize+tileSize);

		//(0,1)
		gl.glTexCoord2d(0, 1);
		gl.glVertex3d(x*tileSize, 0, y*tileSize+tileSize);

		gl.glEnd();
		
		texture.disable(gl);
	}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:28,代码来源:GridMenuApplication.java

示例9: drawTile

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
private void drawTile(GL2 gl, double x, double y, double tileSize, Texture texture) {

		texture.enable(gl);
		texture.bind(gl);
		
		gl.glBegin(GL2.GL_QUADS);

		//(0,0)
		gl.glTexCoord2d(0, 0);
		gl.glVertex3d(x*tileSize-tileSize/2, 0, y*tileSize-tileSize/2);

		//(1,0)
		gl.glTexCoord2d(1, 0);
		gl.glVertex3d(x*tileSize-tileSize/2+tileSize, 0, y*tileSize-tileSize/2);

		//(1,1)
		gl.glTexCoord2d(1, 1);
		gl.glVertex3d(x*tileSize+tileSize-tileSize/2, 0, y*tileSize+tileSize-tileSize/2);

		//(0,1)
		gl.glTexCoord2d(0, 1);
		gl.glVertex3d(x*tileSize-tileSize/2, 0, y*tileSize+tileSize-tileSize/2);

		gl.glEnd();
		
		texture.disable(gl);
	}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:28,代码来源:RadialMarkerApplication.java

示例10: switchOnTex

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
private void switchOnTex(Texture tex, GL2 gl) // switch the lights off, and texturing on
{
    gl.glEnable(GL2.GL_LIGHTING);
    useWhiteMtl(gl);
    tex.enable(gl);
    tex.bind(gl);

}
 
开发者ID:Fidentis,项目名称:Analyst,代码行数:9,代码来源:Materials.java

示例11: draw

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
public void draw(GL gl, AxeBox axe) {
    if (resource == null) {
        resource = cellRenderer.getImage();
        resource.mount(gl);
    }
    Texture texture = resource.getTexture(gl);
    texture.bind(gl);

    // Draw
    drawTexture(gl, axe, texture, resource.getCoords());

    if (false)
        drawDebugPoint(gl);
}
 
开发者ID:jzy3d,项目名称:bigpicture,代码行数:15,代码来源:AxeTextAnnotation.java

示例12: renderTexture

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的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

示例13: setTexture

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
/**
 * Set the texture uniform.
 * @param gl the OpenGL interface
 * @param texture the texture to set
 */
public final void setTexture(@Nonnull GL2 gl, @Nonnull Texture texture) {
    gl.glActiveTexture(GL.GL_TEXTURE0);
    texture.enable(gl);
    texture.bind(gl);
    gl.glUniform1i(textureLocation, 0);
}
 
开发者ID:bensmith87,项目名称:ui,代码行数:12,代码来源:TextProgram.java

示例14: setTexture

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
/**
 * Set the texture uniform.
 * @param gl the OpenGL interface
 * @param texture the texture to set
 */
public final void setTexture(@Nonnull GL2 gl, @Nonnull Texture texture) {
    gl.glActiveTexture(GL.GL_TEXTURE0);
    texture.enable(gl);
    texture.bind(gl);
    gl.glUniform1i(texureLocation, 0);
}
 
开发者ID:bensmith87,项目名称:ui,代码行数:12,代码来源:TextureProgram.java

示例15: Villain

import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
Villain(double x, double y, double z, int degrees, double bounding_cir_rad,
		int display_list, the_game playing_field, GLAutoDrawable drawable, Texture texture) {
	super(x, y, z, degrees, bounding_cir_rad, display_list, playing_field,
			drawable);

	GL2 gl = drawable.getGL().getGL2();
	GLU glu = my_playing_field.glu;
	GLUquadric cyl = glu.gluNewQuadric();
	GLUquadric top = glu.gluNewQuadric();

	gl.glNewList(my_display_list, GL2.GL_COMPILE);

	texture.enable(gl);
	texture.bind(gl);

	// Set material properties.
	float[] rgba = {1f, 1f, 1f};
	gl.glMaterialfv(GL.GL_FRONT, GL2.GL_AMBIENT, rgba, 0);
	gl.glMaterialfv(GL.GL_FRONT, GL2.GL_SPECULAR, rgba, 0);
	gl.glMaterialf(GL.GL_FRONT, GL2.GL_SHININESS, 0.5f);
	glu.gluQuadricTexture(cyl, true);
	gl.glPushMatrix();

	gl.glRotated(-90.0,  1.0,0.0,0.0);
	glu.gluCylinder(cyl, bounding_cir_rad, bounding_cir_rad, 25.0, 15, 5);
	gl.glPopMatrix();

	gl.glPushMatrix();

	gl.glTranslated(0, 25.0, 0 );
	gl.glRotated(-90.0,  1.0,0.0,0.0);
	glu.gluDisk(top, 0.0, bounding_cir_rad, 15, 5);

	texture.disable(gl);
	gl.glPopMatrix();
	gl.glEndList();
}
 
开发者ID:thomaj46,项目名称:GraphicsGame,代码行数:38,代码来源:Villain.java


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