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


Java IntBuffer.flip方法代码示例

本文整理汇总了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);
      }
  }
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:21,代码来源:TextureImpl.java

示例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;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:19,代码来源:LWJGLCursorFactory.java

示例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);
}
 
开发者ID:MarcPopescu-Pfeiffer,项目名称:2DGame,代码行数:24,代码来源:Model.java

示例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;
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:21,代码来源:Program.java

示例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;
}
 
开发者ID:ComunityEngine,项目名称:CommunityEngine-Java,代码行数:8,代码来源:Util.java

示例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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:Shaders.java

示例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;
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:34,代码来源:WorldLoader.java

示例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;
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:14,代码来源:FBOGraphics.java

示例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);
    }


}
 
开发者ID:sean417,项目名称:LearningOfThinkInJava,代码行数:16,代码来源:IntBufferDemo.java

示例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;
   }
 
开发者ID:camilne,项目名称:open-world,代码行数:20,代码来源:Util.java

示例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;
}
 
开发者ID:oreonengine,项目名称:Lwjgl3-Game-Engine-Programming-Series,代码行数:9,代码来源:BufferUtil.java

示例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;
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:12,代码来源:Loader.java

示例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;
}
 
开发者ID:asiermarzo,项目名称:Ultraino,代码行数:30,代码来源:Shader.java

示例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;
}
 
开发者ID:marcioz98,项目名称:MRCEngine,代码行数:7,代码来源:Loader.java

示例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);
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:7,代码来源:VaoLoader.java


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