本文整理汇总了Java中com.jogamp.opengl.util.texture.Texture.disable方法的典型用法代码示例。如果您正苦于以下问题:Java Texture.disable方法的具体用法?Java Texture.disable怎么用?Java Texture.disable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.util.texture.Texture
的用法示例。
在下文中一共展示了Texture.disable方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
@Override
public void render(Object glC) {
OpenGLContext context=(OpenGLContext)glC;//SumoPlatform.getApplication().getGeoContext();
GL gl = context.getGL();
gl.getGL2().glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE);
BufferedImage temp=new BufferedImage(overview.getWidth(), overview.getHeight(), overview.getType());
this.overview.copyData(temp.getRaster());
BufferedImage buffer=rescale.filter(temp, temp);
Texture texture = AWTTextureIO.newTexture(((GLBase)gl).getGLProfile(), buffer, true);
//Texture texture = TextureIO.newTexture(rescale.filter(temp, temp), false);
float tempscale=this.scale*context.getHeight()/context.getWidth();
if(tempscale<1){
bindTexture(gl, texture, 0, tempscale, 0, 1);
}
else{
bindTexture(gl, texture, 0, 1, 0, tempscale);
}
texture.disable(gl);
context.setX(0);
context.setY(0);
context.setZoom(Math.max(thumbReader.getWidth() / context.getWidth(),thumbReader.getHeight() / context.getHeight()));
SumoPlatform.getApplication().getLayerManager().render(context);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
示例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-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);
}
示例8: 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);
}
示例9: 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();
}
示例10: ThingWeAreSeeking
import com.jogamp.opengl.util.texture.Texture; //导入方法依赖的package包/类
ThingWeAreSeeking(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);
this.random = new Random();
GL2 gl = drawable.getGL().getGL2();
off_obj = new off_file_object("epcot.off", false); // This off file specifies vertices in CW
off_obj.load_off_file();
gl.glNewList(my_display_list, GL2.GL_COMPILE);
// 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);
texture.enable(gl);
texture.bind(gl);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_REPEAT);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_REPEAT);
gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_DECAL);
for (int i = 0; i < off_obj.num_faces; i++) // For each face
{
gl.glColor3f(1.0f, 1.0f, 1.0f);
gl.glBegin(GL2.GL_POLYGON);
for (int j = 0; j < off_obj.num_verts_in_face[i]; j++) // Go through
// verts in
// that face
{
gl.glNormal3fv(off_obj.normal_to_face[i], 0); // Normals same
// for all verts
// in face
int n = off_obj.verts_in_face[i][j];
gl.glVertex3d(off_obj.vertices[n][0], off_obj.vertices[n][1], off_obj.vertices[n][2]);
gl.glTexCoord2f((float)i/off_obj.num_faces, (float)j/off_obj.num_verts_in_face[i]);
}
gl.glEnd();
}
texture.disable(gl);
gl.glPopMatrix();
gl.glEndList();
}