本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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 ) );
}
}
示例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 ) );
}
}
示例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;
}
示例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));
}
}
示例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));
}
}
示例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);
}
示例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);
}
示例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;
}
示例15: Framebuffer
import com.badlogic.gdx.utils.BufferUtils; //导入方法依赖的package包/类
public Framebuffer() {
IntBuffer buf = BufferUtils.newIntBuffer(1);
Gdx.gl.glGenBuffers( 1, buf );
id = buf.get();
}