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


Java AWTTextureIO类代码示例

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


AWTTextureIO类属于com.jogamp.opengl.util.texture.awt包,在下文中一共展示了AWTTextureIO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:26,代码来源:ThumbnailsLayer.java

示例2: updateFutures

import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入依赖的package包/类
/**
 *
 * @param gl
 */
private void updateFutures(GL gl) {
    List<Future<Object[]>> remove1 = new ArrayList<Future<Object[]>>();
    for (Future<Object[]> f : futures) {
        if (f.isDone() || f.isCancelled()) {
            remove1.add(f);
            try {
                Object[] o = f.get();
                submitedTiles.remove(o[1]);
                if (o.length>2&&o[2] != null) {
                    tcm.add((String) o[0], AWTTextureIO.newTexture(gl.getGLProfile(),(BufferedImage) o[2], false));
                }
            } catch (Exception ex) {
            	logger.error(ex.getMessage(),ex);
            }
        }
    }
    futures.removeAll(remove1);
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:23,代码来源:ImageLayer.java

示例3: 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;
}
 
开发者ID:CUB3D,项目名称:Unknown-3,代码行数:18,代码来源:Image.java

示例4: updateBitmap

import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入依赖的package包/类
private void updateBitmap() {
    try {
       
        BufferedImage img = ImageIO.read(imageInputStream);
        data = AWTTextureIO.newTextureData(GLContext.getCurrentGL().getGLProfile(), img, false);
        
        if (data.getMustFlipVertically()) {
            ImageUtil.flipImageVertically(img);
            data = AWTTextureIO.newTextureData(GLContext.getCurrentGL().getGLProfile(), img, false);
        }
    } catch (IOException ex) {
        //TODO this is a very, very bad practice...
        throw new RuntimeException(ex.getMessage());
    }

    updateTextureFlag = false;
}
 
开发者ID:jchai3d,项目名称:jchai3d,代码行数:18,代码来源:JTexture2D.java

示例5: updateBitmap

import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入依赖的package包/类
private void updateBitmap() {
    try {

        BufferedImage img = ImageIO.read(imageInputStream);
        data = AWTTextureIO.newTextureData(GLContext.getCurrentGL().getGLProfile(), img, false);
        
        if (data.getMustFlipVertically()) {
            ImageUtil.flipImageVertically(img);
            data = AWTTextureIO.newTextureData(GLContext.getCurrentGL().getGLProfile(), img, false);
        }
    } catch (IOException ex) {
        //TODO this is a very, very bad practice...
        throw new RuntimeException(ex.getMessage());
    }

    markForUpdate = false;
}
 
开发者ID:jchai3d,项目名称:jchai3d,代码行数:18,代码来源:JBitmap.java

示例6: newTextureData

import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入依赖的package包/类
/**
 * Method newTextureData()
 * 
 * @see com.jogamp.opengl.util.texture.spi.TextureProvider#newTextureData(com.jogamp.opengl.GLProfile, java.io.File,
 *      int, int, boolean, java.lang.String)
 */
@Override
public TextureData newTextureData(final GLProfile glp, final File file, final int internalFormat,
		final int pixelFormat, final boolean mipmap, final String fileSuffix) throws IOException {
	final IScope scope = GAMA.getRuntimeScope();
	final GamaImageFile f = new GamaImageFile(scope, file.getAbsolutePath());
	if (f.getExtension(scope).equals("pgm")) {
		final BufferedImage image = f.getImage(scope, true);
		return AWTTextureIO.newTextureData(glp, image, internalFormat, pixelFormat, mipmap);
	} else {
		return null;
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:19,代码来源:PGMTextureProvider.java

示例7: buildTexture

import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入依赖的package包/类
public static Texture buildTexture(final GL gl, final BufferedImage image) {
	try {
		final TextureData data = AWTTextureIO.newTextureData(gl.getGLProfile(),
				correctImage(image, !Abstract3DRenderer.isNonPowerOf2TexturesAvailable), false);
		final Texture texture = new Texture(gl, data);
		data.flush();
		return texture;
	} catch (final GLException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:13,代码来源:OpenGL.java

示例8: 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);
}
 
开发者ID:patowen,项目名称:hyperbolic-space,代码行数:18,代码来源:TextureBank.java

示例9: 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);
}
 
开发者ID:patowen,项目名称:hyperbolic-space,代码行数:20,代码来源:TextureBank.java

示例10: 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;
}
 
开发者ID:WhiteHexagon,项目名称:example-jovr-jogl-rift,代码行数:15,代码来源:TextureLoader.java

示例11: 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);
}
 
开发者ID:vcucek,项目名称:WildPlot,代码行数:12,代码来源:RandomTexture.java

示例12: addTexture

import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入依赖的package包/类
public void addTexture(BufferedImage img, int index) {
 try {
	 TextureData data = AWTTextureIO.newTextureData(GLProfile.getDefault(), img, false);
	 texturePool[index] = TextureIO.newTexture(data);
 } catch(Exception e) {
	 System.err.println("Error while setting a texture from an BufferedImage("+img.toString()+") Exception: "+e);
	 System.exit(1);
 }
}
 
开发者ID:xtreme8000,项目名称:aos_remake,代码行数:10,代码来源:TextureHelper.java

示例13: 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();
}
 
开发者ID:olamedia,项目名称:assets,代码行数:10,代码来源:TextureManager.java

示例14: afterValueChange

import com.jogamp.opengl.util.texture.awt.AWTTextureIO; //导入依赖的package包/类
@Override
public void afterValueChange(final Boolean newValue) {
	AWTTextureIO.setTexRectEnabled(newValue);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:5,代码来源:OpenGL.java

示例15: 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);
}
 
开发者ID:mitoma,项目名称:kashiki,代码行数:5,代码来源:TextureProvider.java


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