本文整理汇总了Java中com.jogamp.opengl.util.texture.awt.AWTTextureIO.newTexture方法的典型用法代码示例。如果您正苦于以下问题:Java AWTTextureIO.newTexture方法的具体用法?Java AWTTextureIO.newTexture怎么用?Java AWTTextureIO.newTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.util.texture.awt.AWTTextureIO
的用法示例。
在下文中一共展示了AWTTextureIO.newTexture方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入方法依赖的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: init
import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入方法依赖的package包/类
public void init()
{
GL2 gl = Unknown.getGL();
AffineTransform at = AffineTransform.getScaleInstance(1, -1);
at.translate(0, -backend.getHeight());
AffineTransformOp op = new AffineTransformOp(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
this.backend = op.filter(backend, null);
text = AWTTextureIO.newTexture(Unknown.getGLProfile(), backend, false);
text.bind(gl);
bounds = new BoundingBox(0, 0, text.getImageWidth() * scale, text.getImageHeight() * scale);
hasInit = true;
}
示例3: createBlankTexture
import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入方法依赖的package包/类
/**
* Creates a clear white 1x1 texture for rendering objects without textures
* @param gl
*/
private void createBlankTexture(GL3 gl) {
BufferedImage image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
WritableRaster raster = image.getRaster();
float[] white = new float[] {255, 255, 255};
for (int i=0; i<image.getWidth(); i++) {
for (int j=0; j<image.getHeight(); j++) {
raster.setPixel(i, j, white);
}
}
blank = AWTTextureIO.newTexture(gl.getGLProfile(), image, false);
blank.setTexParameteri(gl, GL3.GL_TEXTURE_MAG_FILTER, GL3.GL_NEAREST);
}
示例4: createPlaceholderTexture
import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入方法依赖的package包/类
/**
* Creates an 8x8 magenta and black checkerboard pattern to use as a texture if
* the correct texture is missing
* @param gl
*/
private void createPlaceholderTexture(GL3 gl) {
BufferedImage image = new BufferedImage(8, 8, BufferedImage.TYPE_INT_RGB);
WritableRaster raster = image.getRaster();
float[] black = new float[] {0, 0, 0};
float[] magenta = new float[] {255, 0, 255};
for (int i=0; i<image.getWidth(); i++) {
for (int j=0; j<image.getHeight(); j++) {
raster.setPixel(i, j, (i+j)%2==0 ? magenta : black);
}
}
placeholder = AWTTextureIO.newTexture(gl.getGLProfile(), image, false);
placeholder.setTexParameteri(gl, GL3.GL_TEXTURE_MAG_FILTER, GL3.GL_NEAREST);
}
示例5: getTexture
import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入方法依赖的package包/类
public Texture getTexture(GL2 gl, String resourceName) throws IOException {
URL url = TextureLoader.class.getClassLoader().getResource(resourceName);
if (url == null) {
throw new IOException("Cannot find: "+resourceName);
}
BufferedImage bufferedImage = ImageIO.read(new BufferedInputStream(getClass().getClassLoader().getResourceAsStream(resourceName)));
// ImageUtil.flipImageVertically(bufferedImage);
Texture result = AWTTextureIO.newTexture(GLProfile.getDefault(), bufferedImage, true);
result.enable(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);
return result;
}
示例6: create
import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入方法依赖的package包/类
public void create(DrawContext dc){
GL gl = dc.getGL();
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for(int i=0;i<width;i++){
for(int j=0;j<height;j++){
image.setRGB(i, j, (int)(Math.random()*Integer.MAX_VALUE));
}
}
texture = AWTTextureIO.newTexture(GLProfile.getDefault(), image, false);
}
示例7: finishSprite
import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入方法依赖的package包/类
public static void finishSprite() {
GLProfile gp = GLProfile.getGL2ES2();
Texture texture = AWTTextureIO.newTexture(gp, currentSprite.getImage(), true);
currentSprite.dispose();
for (String key : currentSpriteList.keySet()) {
list.put(key, texture);
}
currentSpriteList.clear();
}
示例8: load
import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入方法依赖的package包/类
@Override
public Texture load(String c) throws Exception {
return AWTTextureIO.newTexture(gl.getGLProfile(), getTexture(c, FONT_SIZE), true);
}