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


Java BufferUtils.newIntBuffer方法代码示例

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


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

示例1: loadShader

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
private int loadShader (int type, String source) {
		GL20 gl = Gdx.gl20;
		IntBuffer intbuf = BufferUtils.newIntBuffer(1);

		int shader = gl.glCreateShader(type);
		if (shader == 0) return -1;

		gl.glShaderSource(shader, source);
		gl.glCompileShader(shader);
		gl.glGetShaderiv(shader, GL20.GL_COMPILE_STATUS, intbuf);

		int compiled = intbuf.get(0);
		if (compiled == 0) {
// gl.glGetShaderiv(shader, GL20.GL_INFO_LOG_LENGTH, intbuf);
// int infoLogLength = intbuf.get(0);
// if (infoLogLength > 1) {
			String infoLog = gl.glGetShaderInfoLog(shader);
			log += infoLog;
// }
			return -1;
		}

		return shader;
	}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:25,代码来源:ShaderProgram.java

示例2: dispose

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
/** Releases all resources associated with the FrameBuffer. */
public void dispose () {
	GL20 gl = Gdx.gl20;

	IntBuffer handle = BufferUtils.newIntBuffer(1);

	colorTexture.dispose();
	if (hasDepth)
		gl.glDeleteRenderbuffer(depthbufferHandle);

	if (hasStencil)
		gl.glDeleteRenderbuffer(stencilbufferHandle);

	gl.glDeleteFramebuffer(framebufferHandle);

	if (buffers.get(Gdx.app) != null) buffers.get(Gdx.app).removeValue(this, true);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:18,代码来源:FrameBuffer.java

示例3: create

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
private void create (int width, int height, Format format2) {
	this.width = width;
	this.height = height;
	this.format = Format.RGBA8888;
	canvas = Canvas.createIfSupported();
	canvas.getCanvasElement().setWidth(width);
	canvas.getCanvasElement().setHeight(height);
	context = canvas.getContext2d();
	context.setGlobalCompositeOperation(getComposite());
	buffer = BufferUtils.newIntBuffer(1);
	id = nextId++;
	buffer.put(0, id);
	pixmaps.put(id, this);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:15,代码来源:Pixmap.java

示例4: create

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
private void create (int width, int height, Format format2) {
    this.width = width;
    this.height = height;
    this.format = Format.RGBA8888;
    canvas = Canvas.createIfSupported();
    canvas.getCanvasElement().setWidth(width);
    canvas.getCanvasElement().setHeight(height);
    context = canvas.getContext2d();
    context.setGlobalCompositeOperation(getComposite());
    buffer = BufferUtils.newIntBuffer(1);
    id = nextId++;
    buffer.put(0, id);
    pixmaps.put(id, this);
}
 
开发者ID:neuroradiology,项目名称:TinyVoxel,代码行数:15,代码来源:Pixmap.java

示例5: loadShader

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
private int loadShader(int paramInt, String paramString)
{
  GL20 localGL20 = Gdx.graphics.getGL20();
  IntBuffer localIntBuffer = BufferUtils.newIntBuffer(1);
  int i = localGL20.glCreateShader(paramInt);
  if (i == 0)
    return -1;
  localGL20.glShaderSource(i, paramString);
  localGL20.glCompileShader(i);
  localGL20.glGetShaderiv(i, 35713, localIntBuffer);
  if (localIntBuffer.get(0) == 0)
  {
    String str = localGL20.glGetShaderInfoLog(i);
    this.log += str;
    return -1;
  }
  return i;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:19,代码来源:ShaderProgram.java

示例6: dispose

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
public void dispose()
{
  GL20 localGL20 = Gdx.graphics.getGL20();
  IntBuffer localIntBuffer = BufferUtils.newIntBuffer(1);
  this.colorTexture.dispose();
  if (this.hasDepth)
  {
    localIntBuffer.put(this.depthbufferHandle);
    localIntBuffer.flip();
    localGL20.glDeleteRenderbuffers(1, localIntBuffer);
  }
  localIntBuffer.clear();
  localIntBuffer.put(this.framebufferHandle);
  localIntBuffer.flip();
  localGL20.glDeleteFramebuffers(1, localIntBuffer);
  if (buffers.get(Gdx.app) != null)
    ((List)buffers.get(Gdx.app)).remove(this);
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:19,代码来源:FrameBuffer.java

示例7: link

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
public void link() {
	Gdx.gl.glLinkProgram( handle );
	
	IntBuffer status = BufferUtils.newIntBuffer(1);
	Gdx.gl.glGetProgramiv( handle, GL20.GL_LINK_STATUS, status );
	if (status.get() == GL20.GL_FALSE) {
		throw new Error( Gdx.gl.glGetProgramInfoLog( handle ) );
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:10,代码来源:Program.java

示例8: compile

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
public void compile() {
	Gdx.gl.glCompileShader( handle );

	IntBuffer status = BufferUtils.newIntBuffer(1);
	Gdx.gl.glGetShaderiv( handle, GL20.GL_COMPILE_STATUS, status);
	if (status.get() == GL20.GL_FALSE) {
		throw new Error( Gdx.gl.glGetShaderInfoLog( handle ) );
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:10,代码来源:Shader.java

示例9: loadShader

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
protected int loadShader(int type, String source) throws Exception {
    IntBuffer intbuf = BufferUtils.newIntBuffer(1);
    int shader = Gdx.gl.glCreateShader(type);
    if(shader == 0) return -1;
    Gdx.gl.glShaderSource(shader, source);
    Gdx.gl.glCompileShader(shader);
    Gdx.gl.glGetShaderiv(shader, GL20.GL_COMPILE_STATUS, intbuf);

    int compiled = intbuf.get(0);
    if(compiled == 0) {
        $setValue_log($getValue__log() + Gdx.gl.glGetShaderInfoLog(shader));
        return -1;
    }
    return shader;
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:16,代码来源:GeometryShaderProgram.java

示例10: link

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
public void link() {
    Gdx.gl.glLinkProgram(handle);

    IntBuffer status = BufferUtils.newIntBuffer(1);
    Gdx.gl.glGetProgramiv(handle, GL20.GL_LINK_STATUS, status);
    if (status.get() == GL20.GL_FALSE) {
        throw new Error(Gdx.gl.glGetProgramInfoLog(handle));
    }
}
 
开发者ID:skynet67,项目名称:pixel-dungeon-rebirth,代码行数:10,代码来源:Program.java

示例11: compile

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
public void compile() {
    Gdx.gl.glCompileShader(handle);

    IntBuffer status = BufferUtils.newIntBuffer(1);
    Gdx.gl.glGetShaderiv(handle, GL20.GL_COMPILE_STATUS, status);
    if (status.get() == GL20.GL_FALSE) {
        throw new Error(Gdx.gl.glGetShaderInfoLog(handle));
    }
}
 
开发者ID:skynet67,项目名称:pixel-dungeon-rebirth,代码行数:10,代码来源:Shader.java

示例12: benchInt

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
private void benchInt () {
	IntBuffer ib = BufferUtils.newIntBuffer(1024 * 1024 / 4);
	int[] ints = new int[1024 * 1024 / 4];
	int len = ints.length;

	// relative put
	long start = TimeUtils.nanoTime();
	for (int j = 0; j < NUM_MB; j++) {
		ib.clear();
		for (int i = 0; i < len; i++)
			ib.put(ints[i]);
	}
	Gdx.app.log("BufferUtilsTest", "IntBuffer relative put: " + (TimeUtils.nanoTime() - start) / 1000000000.0f);

	// absolute put
	start = TimeUtils.nanoTime();
	for (int j = 0; j < NUM_MB; j++) {
		ib.clear();
		for (int i = 0; i < len; i++)
			ib.put(i, ints[i]);
	}
	Gdx.app.log("BufferUtilsTest", "IntBuffer absolute put: " + (TimeUtils.nanoTime() - start) / 1000000000.0f);

	// bulk put
	start = TimeUtils.nanoTime();
	for (int j = 0; j < NUM_MB; j++) {
		ib.clear();
		ib.put(ints);
	}
	Gdx.app.log("BufferUtilsTest", "IntBuffer bulk put: " + (TimeUtils.nanoTime() - start) / 1000000000.0f);

	// JNI put
	start = TimeUtils.nanoTime();
	for (int j = 0; j < NUM_MB; j++) {
		ib.clear();
		BufferUtils.copy(ints, 0, ib, len);
	}
	Gdx.app.log("BufferUtilsTest", "IntBuffer native bulk put: " + (TimeUtils.nanoTime() - start) / 1000000000.0f);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:40,代码来源:BufferUtilsTest.java

示例13: DDirectionalShadowLight

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
public DDirectionalShadowLight(int shadowQuality, float shadowViewportWidth, float shadowViewportHeight, float shadowNear, float shadowFar) {
	super(Gdx.graphics.getWidth(), Gdx.graphics.getWidth(), shadowViewportWidth, shadowViewportHeight, shadowNear, shadowFar);
	
	IntBuffer ib = BufferUtils.newIntBuffer(16);
	Gdx.gl.glGetIntegerv(GL20.GL_MAX_VIEWPORT_DIMS, ib);
	maxSize = ib.get(0);
	
	setShadowQuality(shadowQuality);
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:10,代码来源:DDirectionalShadowLight.java

示例14: maxSize

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
private int maxSize() {
	if (maxSize == -1) {
		IntBuffer intBuffer = BufferUtils.newIntBuffer(16);
		Gdx.gl.glGetIntegerv(GL20.GL_MAX_TEXTURE_SIZE, intBuffer);
		maxSize = Math
				.min(intBuffer.get(0),
						Math.max(Gdx.graphics.getHeight(),
								Gdx.graphics.getWidth()));
	}
	return maxSize;
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:12,代码来源:AndroidImageUtils.java

示例15: Framebuffer

import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
public Framebuffer() {
	IntBuffer buf = BufferUtils.newIntBuffer(1);
	Gdx.gl.glGenBuffers( 1, buf );
	id = buf.get();
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:6,代码来源:Framebuffer.java


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