本文整理汇总了Java中java.nio.IntBuffer.position方法的典型用法代码示例。如果您正苦于以下问题:Java IntBuffer.position方法的具体用法?Java IntBuffer.position怎么用?Java IntBuffer.position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.nio.IntBuffer
的用法示例。
在下文中一共展示了IntBuffer.position方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ensureLargeEnough
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static IntBuffer ensureLargeEnough(IntBuffer buffer, int required) {
if (buffer != null) {
buffer.limit(buffer.capacity());
}
if (buffer == null || (buffer.remaining() < required)) {
int position = (buffer != null ? buffer.position() : 0);
IntBuffer newVerts = createIntBuffer(position + required);
if (buffer != null) {
buffer.flip();
newVerts.put(buffer);
newVerts.position(position);
}
buffer = newVerts;
}
return buffer;
}
示例2: glShaderSource
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static void glShaderSource(int shader, org.lwjgl.PointerBuffer strings, IntBuffer length) {
org.lwjgl.opengl.GL20.glShaderSource(shader, strings, length);
if (TRACE.enabled) {
/* Log the shader source */
StringBuilder sb = new StringBuilder();
if (strings != null && length != null) {
int stringsPos = strings.position();
int lengthPos = length.position();
for (int i = 0; i < strings.remaining(); i++) {
int len = length.get(lengthPos + i);
ByteBuffer string = org.lwjgl.system.MemoryUtil.memByteBuffer(strings.get(stringsPos + i), len);
String source = org.lwjgl.system.MemoryUtil.memASCII(string, len);
sb.append(source);
}
}
trace("Shader source for shader [" + shader + "]:\n" + sb.toString());
}
}
示例3: glDeleteTextures
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static void glDeleteTextures(IntBuffer textures) {
org.lwjgl.opengl.GL11.glDeleteTextures(textures);
if (Properties.PROFILE.enabled) {
Context ctx = CURRENT_CONTEXT.get();
int pos = textures.position();
for (int i = 0; i < textures.remaining(); i++) {
int buffer = textures.get(pos + i);
TextureObject to = ctx.textureObjects.remove(buffer);
Iterator<Map.Entry<Integer, TextureObject>> it = ctx.textureObjectBindings.entrySet().iterator();
while (it.hasNext()) {
if (it.next().getValue() == to) {
it.remove();
}
}
}
}
}
示例4: glShaderSource
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static void glShaderSource(int shader, org.lwjgl.PointerBuffer strings, IntBuffer length) {
if (TRACE.enabled) {
/* Log the shader source */
StringBuilder sb = new StringBuilder();
if (strings != null && length != null) {
int stringsPos = strings.position();
int lengthPos = length.position();
for (int i = 0; i < strings.remaining(); i++) {
int len = length.get(lengthPos + i);
ByteBuffer string = org.lwjgl.system.MemoryUtil.memByteBuffer(strings.get(stringsPos + i), len);
String source = org.lwjgl.system.MemoryUtil.memASCII(string, len);
sb.append(source);
}
}
trace("Shader source for shader [" + shader + "]:\n" + sb.toString());
}
org.lwjgl.opengl.ARBShaderObjects.glShaderSourceARB(shader, strings, length);
}
示例5: getIndexIntBuffer
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Override
public IntBuffer getIndexIntBuffer( final byte[] buffer , final int start , final int length ) throws IOException{
int size = length / Byte.BYTES;
ByteBuffer wrapBuffer = ByteBuffer.wrap( buffer , start , length );
IntBuffer result = IntBuffer.allocate( size );
for( int i = 0 ; i < size ; i++ ){
result.put( (int)( wrapBuffer.get() ) );
}
result.position( 0 );
return result;
}
示例6: glLoadMatrixx
import java.nio.IntBuffer; //导入方法依赖的package包/类
public void glLoadMatrixx(IntBuffer m) {
int position = m.position();
mCurrent.glLoadMatrixx(m);
m.position(position);
mgl.glLoadMatrixx(m);
if ( _check) check();
}
示例7: getIndexIntBuffer
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Override
public IntBuffer getIndexIntBuffer( final int size , final ByteBuffer wrapBuffer ) throws IOException{
IntBuffer result = IntBuffer.allocate( size );
for( int i = 0 ; i < size ; i++ ){
result.put( (int)( wrapBuffer.getShort() ) );
}
result.position( 0 );
return result;
}
示例8: glMultMatrixx
import java.nio.IntBuffer; //导入方法依赖的package包/类
public void glMultMatrixx(IntBuffer m) {
int position = m.position();
mCurrent.glMultMatrixx(m);
m.position(position);
mgl.glMultMatrixx(m);
if ( _check) check();
}
示例9: glGenVertexArrays
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static void glGenVertexArrays(IntBuffer arrays) {
org.lwjgl.opengl.ARBVertexArrayObject.glGenVertexArrays(arrays);
if (Properties.VALIDATE.enabled) {
Context context = CURRENT_CONTEXT.get();
int position = arrays.position();
for (int i = 0; i < arrays.remaining(); i++) {
VAO vao = new VAO(context.GL_MAX_VERTEX_ATTRIBS);
context.vaos.put(arrays.get(position + i), vao);
}
}
}
示例10: deleteTextures
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static void deleteTextures(IntBuffer p_deleteTextures_0_)
{
p_deleteTextures_0_.rewind();
while (p_deleteTextures_0_.position() < p_deleteTextures_0_.limit())
{
int i = p_deleteTextures_0_.get();
deleteTexture(i);
}
p_deleteTextures_0_.rewind();
}
示例11: glGenFramebuffersEXT
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static void glGenFramebuffersEXT(IntBuffer framebuffers) {
org.lwjgl.opengl.EXTFramebufferObject.glGenFramebuffersEXT(framebuffers);
if (Properties.VALIDATE.enabled) {
Context ctx = CURRENT_CONTEXT.get();
int pos = framebuffers.position();
for (int i = 0; i < framebuffers.remaining(); i++) {
int handle = framebuffers.get(pos + i);
FBO fbo = new FBO(handle);
ctx.fbos.put(handle, fbo);
}
}
}
示例12: initBuf
import java.nio.IntBuffer; //导入方法依赖的package包/类
protected IntBuffer initBuf(int[] num, int buflen) {
IntBuffer intBuf = IntBuffer.allocate(buflen);
intBuf.position(buflen - num.length);
for (int i = 0; i < buflen; i++)
intBuf.put(i, 0);
intBuf.put(num);
intBuf.rewind();
return intBuf;
}
示例13: initBuffer
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Override
public IntBuffer initBuffer(int width, int height) {
int[] pixels = new int[width * height];
IntBuffer intBuffer = IntBuffer.wrap(pixels);
intBuffer.position(0);
return intBuffer;
}
示例14: glGenFramebuffers
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static void glGenFramebuffers(IntBuffer framebuffers) {
org.lwjgl.opengl.ARBFramebufferObject.glGenFramebuffers(framebuffers);
if (Properties.VALIDATE.enabled) {
Context ctx = CURRENT_CONTEXT.get();
int pos = framebuffers.position();
for (int i = 0; i < framebuffers.remaining(); i++) {
int handle = framebuffers.get(pos + i);
FBO fbo = new FBO(handle);
ctx.fbos.put(handle, fbo);
}
}
}
示例15: intBufferUtil
import java.nio.IntBuffer; //导入方法依赖的package包/类
private IntBuffer intBufferUtil(int[] arr) {
// 初始化ByteBuffer,长度为arr数组的长度*4,因为一个int占4个字节
ByteBuffer qbb = ByteBuffer.allocateDirect(arr.length * 4);
// 数组排列用nativeOrder
qbb.order(ByteOrder.nativeOrder());
IntBuffer mBuffer = qbb.asIntBuffer();
mBuffer.put(arr);
mBuffer.position(0);
return mBuffer;
}