本文整理汇总了Java中java.nio.IntBuffer.flip方法的典型用法代码示例。如果您正苦于以下问题:Java IntBuffer.flip方法的具体用法?Java IntBuffer.flip怎么用?Java IntBuffer.flip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.nio.IntBuffer
的用法示例。
在下文中一共展示了IntBuffer.flip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: release
import java.nio.IntBuffer; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.opengl.Texture#release()
*/
public void release() {
IntBuffer texBuf = createIntBuffer(1);
texBuf.put(textureID);
texBuf.flip();
GL.glDeleteTextures(texBuf);
if (lastBind == this) {
bindNone();
}
if (cacheName != null) {
InternalTextureLoader.get().clear(cacheName);
} else {
InternalTextureLoader.get().clear(ref);
}
}
示例2: convertMask
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static IntBuffer convertMask(int[][] cursorMask)
{
ByteBuffer bb = ByteBuffer.allocateDirect(cursorMask.length*cursorMask[0].length*4);
bb.order(ByteOrder.nativeOrder());
IntBuffer ib = bb.asIntBuffer();
for(int y = cursorMask.length - 1; y >= 0; y--)
{
for(int x = 0; x < cursorMask[0].length; x++)
{
ib.put(cursorMask[y][x]);
}
}
ib.flip();
return ib;
}
示例3: Model
import java.nio.IntBuffer; //导入方法依赖的package包/类
public Model(float[] vertices, float[] tex_coords, int[] indices) {
drawCount = indices.length;
vertexObject = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, vertexObject);
glBufferData(GL_ARRAY_BUFFER, createBuffer(vertices), GL_STATIC_DRAW);
textureCoordObject = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, textureCoordObject);
glBufferData(GL_ARRAY_BUFFER, createBuffer(tex_coords), GL_STATIC_DRAW);
indexObject = glGenBuffers();
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexObject);
IntBuffer buffer = BufferUtils.createIntBuffer(indices.length);
buffer.put(indices);
buffer.flip();
glBufferData(GL_ELEMENT_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
示例4: fetchUniforms
import java.nio.IntBuffer; //导入方法依赖的package包/类
private Uniform[] fetchUniforms()
{
int len = GL20.glGetProgrami(this.handle, GL20.GL_ACTIVE_UNIFORMS);
int strlen = GL20.glGetProgrami(this.handle, GL20.GL_ACTIVE_UNIFORM_MAX_LENGTH);
Uniform[] uniforms = new Uniform[len];
IntBuffer sizeBuffer = BufferUtils.createIntBuffer(1);
IntBuffer typeBuffer = BufferUtils.createIntBuffer(1);
for(int i = 0; i < uniforms.length; ++i)
{
String name = GL20.glGetActiveUniform(this.handle, i, strlen, sizeBuffer, typeBuffer);
int location = GL20.glGetUniformLocation(this.handle, name);
uniforms[i] = new Uniform(this, name, typeBuffer.get(), location);
typeBuffer.flip();
}
return uniforms;
}
示例5: flip
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static IntBuffer flip(int[] data) {
IntBuffer buffer = BufferUtils.createIntBuffer(data.length);
buffer.put(data);
buffer.flip();
return buffer;
}
示例6: printLogInfo
import java.nio.IntBuffer; //导入方法依赖的package包/类
private static boolean printLogInfo(int obj, String name)
{
IntBuffer intbuffer = BufferUtils.createIntBuffer(1);
ARBShaderObjects.glGetObjectParameterARB(obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, (IntBuffer)intbuffer);
int i = intbuffer.get();
if (i > 1)
{
ByteBuffer bytebuffer = BufferUtils.createByteBuffer(i);
intbuffer.flip();
ARBShaderObjects.glGetInfoLogARB(obj, intbuffer, bytebuffer);
byte[] abyte = new byte[i];
bytebuffer.get(abyte);
if (abyte[i - 1] == 0)
{
abyte[i - 1] = 10;
}
String s = new String(abyte);
SMCLog.info("Info log: " + name + "\n" + s);
return false;
}
else
{
return true;
}
}
示例7: loadMetadata
import java.nio.IntBuffer; //导入方法依赖的package包/类
/**
*
* @param id
* @param shader
* @param storage
* @return true if the id was used, false if there was nothing to upload
*/
private boolean loadMetadata(int id, Shader shader, ExtendedBlockStorage storage) {
int[] data = new int[chunkSize];
boolean containsValues = false;
for (int y = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) {
int metadata = storage.get(x, y, z).getBlock().getMetaFromState(storage.get(x, y, z));
data[(y<<8) + (z<<4) + x] = metadata;
if (metadata != 0) {
containsValues = true;
}
}
}
}
if (containsValues) {
IntBuffer buffer = BufferUtils.createIntBuffer(chunkSize);
buffer.put(data);
buffer.flip();
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getMetadataSsbo());
GL15.glBufferSubData(GL43.GL_SHADER_STORAGE_BUFFER, (id-1)*chunkSize*4, buffer);
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
}
return containsValues;
}
示例8: destroy
import java.nio.IntBuffer; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.Graphics#destroy()
*/
public void destroy() {
super.destroy();
IntBuffer buffer = BufferUtils.createIntBuffer(1);
buffer.put(FBO);
buffer.flip();
EXTFramebufferObject.glDeleteFramebuffersEXT(buffer);
valid = false;
}
示例9: main
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static void main(String[] args) {
ByteBuffer bb=ByteBuffer.allocate(BSIZE);
IntBuffer ib=bb.asIntBuffer();
ib.put(new int[]{11,42,47,99,143,811,1016});
System.out.println(ib.getClass().getName());
System.out.println(ib.get(3));
ib.put(3,1811);
ib.flip();
while (ib.hasRemaining()){
int i=ib.get();
System.out.println(i);
}
}
示例10: toBuffer
import java.nio.IntBuffer; //导入方法依赖的package包/类
/**
* Stores the specified data into a IntBuffer
* @param data The array of integer data
* @return The generated IntBuffer
*/
public static IntBuffer toBuffer(int[] data) {
// Create an empty FloatBuffer with the correct size
IntBuffer buffer = BufferUtils.createIntBuffer(data.length);
// Store all the data in the buffer
for(int i = 0; i < data.length; i++) {
buffer.put(data[i]);
}
// Prepares the buffer for get() operations
buffer.flip();
return buffer;
}
示例11: createFlippedBuffer
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static IntBuffer createFlippedBuffer(int... values)
{
IntBuffer buffer = createIntBuffer(values.length);
buffer.put(values);
buffer.flip();
return buffer;
}
示例12: storeDataInIntBuffer
import java.nio.IntBuffer; //导入方法依赖的package包/类
/**
* Stores given data to a int buffer for use
* @param data - Data to store into buffer.
* @return - Returns buffer with data in it.
*/
private IntBuffer storeDataInIntBuffer(int[] data) {
IntBuffer buffer = BufferUtils.createIntBuffer(data.length);
buffer.put(data);
buffer.flip();
return buffer;
}
示例13: initShader
import java.nio.IntBuffer; //导入方法依赖的package包/类
int initShader(GL2 gl, int nShaderType, String source) {
int shader = gl.glCreateShader(nShaderType);
if (shader != 0) {
String[] sources = new String[]{ source };
gl.glShaderSource(shader, 1, sources, null);
gl.glCompileShader(shader);
IntBuffer compiled = BufferUtils.createIntBuffer(1);
gl.glGetShaderiv(shader, GL2.GL_COMPILE_STATUS, compiled);
if (compiled.get() == 0) {
IntBuffer infoLen = BufferUtils.createIntBuffer(1);
gl.glGetShaderiv(shader, GL2.GL_INFO_LOG_LENGTH, infoLen);
int length = infoLen.get();
if (length > 0) {
ByteBuffer buf = BufferUtils.createByteBuffer(length);
infoLen.flip();
gl.glGetShaderInfoLog(shader, length, infoLen, buf);
byte[] b = new byte[infoLen.get()];
buf.get(b);
System.out.println("Prgram : " + fProgram);
System.out.println(source);
System.err.println("Error compiling shader " + vProgram + " " + fProgram + " -> " + new String(b));
}
}
}
return shader;
}
示例14: storeDataInIntBuffer
import java.nio.IntBuffer; //导入方法依赖的package包/类
private IntBuffer storeDataInIntBuffer(int[] data) {
IntBuffer buffer = BufferUtils.createIntBuffer(data.length);
buffer.put(data);
buffer.flip();
return buffer;
}
示例15: storeIndicesInVao
import java.nio.IntBuffer; //导入方法依赖的package包/类
private static void storeIndicesInVao(Vao vao, int[] indices) {
IntBuffer intBuffer = BufferUtils.createIntBuffer(indices.length);
intBuffer.put(indices);
intBuffer.flip();
vao.createIndexBuffer(intBuffer);
}