當前位置: 首頁>>代碼示例>>Java>>正文


Java IntBuffer.position方法代碼示例

本文整理匯總了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;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:17,代碼來源:BufferUtils.java

示例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());
    }
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:19,代碼來源:GL20.java

示例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();
                }
            }
        }
    }
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:18,代碼來源:GL11.java

示例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);
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:19,代碼來源:ARBShaderObjects.java

示例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;
}
 
開發者ID:yahoojapan,項目名稱:multiple-dimension-spread,代碼行數:12,代碼來源:OptimizeLongColumnBinaryMaker.java

示例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();
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:8,代碼來源:MatrixTrackingGL.java

示例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;
}
 
開發者ID:yahoojapan,項目名稱:multiple-dimension-spread,代碼行數:10,代碼來源:OptimizeStringColumnBinaryMaker.java

示例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();
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:8,代碼來源:MatrixTrackingGL.java

示例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);
        }
    }
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:12,代碼來源:ARBVertexArrayObject.java

示例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();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:GlStateManager.java

示例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);
        }
    }
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:13,代碼來源:EXTFramebufferObject.java

示例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;
}
 
開發者ID:Jim00000,項目名稱:Big-Number-Calculation,代碼行數:10,代碼來源:Add.java

示例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;
}
 
開發者ID:uestccokey,項目名稱:EZFilter,代碼行數:8,代碼來源:BitmapOutput.java

示例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);
        }
    }
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:13,代碼來源:ARBFramebufferObject.java

示例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;
}
 
開發者ID:FacePlusPlus,項目名稱:MegviiFacepp-Android-SDK,代碼行數:11,代碼來源:CameraMatrix.java


注:本文中的java.nio.IntBuffer.position方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。