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

Java MipMapGenerator类代码示例

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

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



MipMapGenerator类属于com.badlogic.gdx.graphics.glutils包,在下文中一共展示了MipMapGenerator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: uploadImageData

import com.badlogic.gdx.graphics.glutils.MipMapGenerator; //导入依赖的package包/类
public static void uploadImageData (int target, TextureData data, int miplevel) {
	if (data == null) {
		// FIXME: remove texture on target?
		return;
	}

	if (!data.isPrepared()) data.prepare();

	final TextureDataType type = data.getType();
	if (type == TextureDataType.Custom) {
		data.consumeCustomData(target);
		return;
	}

	Pixmap pixmap = data.consumePixmap();
	boolean disposePixmap = data.disposePixmap();
	if (data.getFormat() != pixmap.getFormat()) {
		Pixmap tmp = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), data.getFormat());
		Blending blend = Pixmap.getBlending();
		Pixmap.setBlending(Blending.None);
		tmp.drawPixmap(pixmap, 0, 0, 0, 0, pixmap.getWidth(), pixmap.getHeight());
		Pixmap.setBlending(blend);
		if (data.disposePixmap()) {
			pixmap.dispose();
		}
		pixmap = tmp;
		disposePixmap = true;
	}

	Gdx.gl.glPixelStorei(GL20.GL_UNPACK_ALIGNMENT, 1);
	if (data.useMipMaps()) {
		MipMapGenerator.generateMipMap(target, pixmap, pixmap.getWidth(), pixmap.getHeight());
	} else {
		Gdx.gl.glTexImage2D(target, miplevel, pixmap.getGLInternalFormat(), pixmap.getWidth(), pixmap.getHeight(), 0,
			pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels());
	}
	if (disposePixmap) pixmap.dispose();
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:39,代码来源:GLTexture.java


示例2: create

import com.badlogic.gdx.graphics.glutils.MipMapGenerator; //导入依赖的package包/类
@Override
public void create () {
	camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	camera.position.set(0, 1.5f, 1.5f);
	camera.lookAt(0, 0, 0);
	camera.update();
	controller = new PerspectiveCamController(camera);

	mesh = new Mesh(true, 4, 4, new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(
		Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE));
	mesh.setVertices(new float[] {-1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, -1, 1, 0, -1, 0, -1, 0, 0,});
	mesh.setIndices(new short[] {0, 1, 2, 3});

	shader = new ShaderProgram(Gdx.files.internal("data/shaders/flattex-vert.glsl").readString(), Gdx.files.internal(
		"data/shaders/flattex-frag.glsl").readString());
	if (!shader.isCompiled()) throw new GdxRuntimeException("shader error: " + shader.getLog());

	textureHW = new Texture(Gdx.files.internal("data/badlogic.jpg"), Format.RGB565, true);
	MipMapGenerator.setUseHardwareMipMap(false);
	textureSW = new Texture(Gdx.files.internal("data/badlogic.jpg"), Format.RGB565, true);
	currTexture = textureHW;

	createUI();

	multiplexer = new InputMultiplexer();
	Gdx.input.setInputProcessor(multiplexer);
	multiplexer.addProcessor(ui);
	multiplexer.addProcessor(controller);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:30,代码来源:MipMapTest.java


示例3: uploadImageData

import com.badlogic.gdx.graphics.glutils.MipMapGenerator; //导入依赖的package包/类
private void uploadImageData(Pixmap paramPixmap)
{
  if ((enforcePotImages) && (Gdx.gl20 == null) && ((!MathUtils.isPowerOfTwo(this.data.getWidth())) || (!MathUtils.isPowerOfTwo(this.data.getHeight()))))
    throw new GdxRuntimeException("Texture width and height must be powers of two: " + this.data.getWidth() + "x" + this.data.getHeight());
  boolean bool;
  if (this.data.getFormat() != paramPixmap.getFormat())
  {
    Pixmap localPixmap = new Pixmap(paramPixmap.getWidth(), paramPixmap.getHeight(), this.data.getFormat());
    Pixmap.Blending localBlending = Pixmap.getBlending();
    Pixmap.setBlending(Pixmap.Blending.None);
    int i = paramPixmap.getWidth();
    int j = paramPixmap.getHeight();
    localPixmap.drawPixmap(paramPixmap, 0, 0, 0, 0, i, j);
    Pixmap.setBlending(localBlending);
    bool = true;
    paramPixmap = localPixmap;
  }
  while (true)
  {
    Gdx.gl.glBindTexture(3553, this.glHandle);
    Gdx.gl.glPixelStorei(3317, 1);
    if (this.data.useMipMaps())
      MipMapGenerator.generateMipMap(paramPixmap, paramPixmap.getWidth(), paramPixmap.getHeight(), bool);
    do
    {
      return;
      Gdx.gl.glTexImage2D(3553, 0, paramPixmap.getGLInternalFormat(), paramPixmap.getWidth(), paramPixmap.getHeight(), 0, paramPixmap.getGLFormat(), paramPixmap.getGLType(), paramPixmap.getPixels());
    }
    while (!bool);
    paramPixmap.dispose();
    return;
    bool = false;
  }
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:35,代码来源:Texture.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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