Java 类java.nio.IntBuffer 实例源码

项目:Backmemed    文件:Shaders.java   
private static boolean printShaderLogInfo(int shader, String name, List<String> listFiles)
{
    IntBuffer intbuffer = BufferUtils.createIntBuffer(1);
    int i = GL20.glGetShaderi(shader, 35716);

    if (i <= 1)
    {
        return true;
    }
    else
    {
        for (int j = 0; j < listFiles.size(); ++j)
        {
            String s = (String)listFiles.get(j);
            SMCLog.info("File: " + (j + 1) + " = " + s);
        }

        String s1 = GL20.glGetShaderInfoLog(shader, i);
        SMCLog.info("Shader info log: " + name + "\n" + s1);
        return false;
    }
}
项目:19porn    文件:OpenGlUtils.java   
public static int loadTexture(final IntBuffer data, final Size size, final int usedTexId) {
    int textures[] = new int[1];
    if (usedTexId == NO_TEXTURE) {
        GLES20.glGenTextures(1, textures, 0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, size.width, size.height,
                0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);
    } else {
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
        GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, size.width,
                size.height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);
        textures[0] = usedTexId;
    }
    return textures[0];
}
项目:lwjgl3_stuff    文件:Model.java   
public Model(float[] vertices, float[] tex_coords, int[] indices) {
    draw_count = indices.length;

    v_id = glGenBuffers();
    glBindBuffer(GL_ARRAY_BUFFER, v_id);
    glBufferData(GL_ARRAY_BUFFER, createBuffer(vertices), GL_STATIC_DRAW);

    t_id = glGenBuffers();
    glBindBuffer(GL_ARRAY_BUFFER, t_id);
    glBufferData(GL_ARRAY_BUFFER, createBuffer(tex_coords), GL_STATIC_DRAW);

    i_id = glGenBuffers();

    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, i_id);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}
项目:multiple-dimension-spread    文件:BufferDirectSequentialNumberCellIndex.java   
@Override
public Set<Integer> getLt( final IDicManager dicManager , final IntBuffer dicIndexIntBuffer , final NumberFilter numberFilter ) throws IOException{
  long target;
  try{
    target = numberFilter.getNumberObject().getLong();
  }catch( NumberFormatException e ){
    return null;
  }
  Set<Integer> matchDicList = new HashSet<Integer>();
  for( int i = 0 ; i < dicManager.getDicSize() ; i++ ){
    PrimitiveObject numObj = dicManager.get( i );
    if( numObj == null ){
      continue;
    }
    if( numObj.getLong() < target ){
      matchDicList.add( Integer.valueOf( i ) );
    }
  }

  return matchDicList;
}
项目:openjdk-jdk10    文件:ImageReader.java   
void visitPackageLocation(ImageLocation loc) {
    // Retrieve package name
    String pkgName = getBaseExt(loc);
    // Content is array of offsets in Strings table
    byte[] stringsOffsets = getResource(loc);
    ByteBuffer buffer = ByteBuffer.wrap(stringsOffsets);
    buffer.order(getByteOrder());
    IntBuffer intBuffer = buffer.asIntBuffer();
    // For each module, create a link node.
    for (int i = 0; i < stringsOffsets.length / SIZE_OF_OFFSET; i++) {
        // skip empty state, useless.
        intBuffer.get(i);
        i++;
        int offset = intBuffer.get(i);
        String moduleName = getString(offset);
        Node targetNode = findNode("/modules/" + moduleName);
        if (targetNode != null) {
            String pkgDirName = packagesDir.getName() + "/" + pkgName;
            Directory pkgDir = (Directory) nodes.get(pkgDirName);
            newLinkNode(pkgDir, pkgDir.getName() + "/" + moduleName, targetNode);
        }
    }
}
项目:multiple-dimension-spread    文件:BufferDirectSequentialNumberCellIndex.java   
@Override
public Set<Integer> getGt( final IDicManager dicManager , final IntBuffer dicIndexIntBuffer , final NumberFilter numberFilter ) throws IOException{
  long target;
  try{
    target = numberFilter.getNumberObject().getLong();
  }catch( NumberFormatException e ){
    return null;
  }
  Set<Integer> matchDicList = new HashSet<Integer>();
  for( int i = 0 ; i < dicManager.getDicSize() ; i++ ){
    PrimitiveObject numObj = dicManager.get( i );
    if( numObj == null ){
      continue;
    }
    if( target < numObj.getLong() ){
      matchDicList.add( Integer.valueOf( i ) );
    }
  }

  return matchDicList;
}
项目:multiple-dimension-spread    文件:TestBufferDirectSequentialNumberCellIndexFloat.java   
@Test
public void T_float_filter_8() throws IOException{
  List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
  dic.add( new FloatObj( (float) 1.00001 ) );
  dic.add( new FloatObj( (float) 2.00001 ) );
  dic.add( new FloatObj( (float) 3.00001 ) );
  dic.add( new FloatObj( (float) 4.00001 ) );
  dic.add( new FloatObj( (float) 5.00001 ) );
  IntBuffer buffer = IntBuffer.allocate( 100 );
  for( int i = 0 ; i < 100 ; i++ ){
    buffer.put( i % 5 );
  }
  ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.FLOAT , new TestDicManager( dic ) , buffer );
  IFilter filter = new NumberFilter( NumberFilterType.GE , new DoubleObj( Double.valueOf( Float.MIN_VALUE ) / (double)10 ) );

  assertEquals( null , index.filter( filter , new boolean[100] ) );
}
项目:BWS-Android    文件:ImageFormatConverter.java   
/**
 * Converts a GrayscaleImage to a Bitmap.
 */
@NonNull
public Bitmap grayscaleImageToBitmap(@NonNull GrayscaleImage img) {
    String stopwatchSessionId = log.startStopwatch(getStopwatchSessionId("grayscaleImageToBitmap"));

    int size = img.width * img.height;
    int[] buffer = new int[size];

    for (int index = 0; index < size; index++) {
        // "AND 0xff" for the signed byte issue
        int luminance = img.data[index] & 0xff;
        // normal encoding for bitmap
        buffer[index] = (0xff000000 | luminance << 16 | luminance << 8 | luminance);
    }

    Bitmap bitmap = Bitmap.createBitmap(img.width, img.height, Bitmap.Config.ARGB_8888);
    bitmap.copyPixelsFromBuffer(IntBuffer.wrap(buffer));

    log.stopStopwatch(stopwatchSessionId);
    return bitmap;
}
项目:multiple-dimension-spread    文件:TestBufferDirectSequentialNumberCellIndexShort.java   
@Test
public void T_short_filter_4() throws IOException{
  List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
  dic.add( new ShortObj( (short) 1000 ) );
  dic.add( new ShortObj( (short) 2000 ) );
  dic.add( new ShortObj( (short) 3000 ) );
  dic.add( new ShortObj( (short) 4000 ) );
  dic.add( new ShortObj( (short) 5000 ) );
  IntBuffer buffer = IntBuffer.allocate( 100 );
  for( int i = 0 ; i < 100 ; i++ ){
    buffer.put( i % 5 );
  }
  ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.SHORT , new TestDicManager( dic ) , buffer );
  IFilter filter = new NumberFilter( NumberFilterType.LE , new ShortObj( (short) 2000 ) );

  FilterdExpressionIndex result = new FilterdExpressionIndex( index.filter( filter , new boolean[100] ) );
  assertEquals( result.size() , 40 );
  for( int i = 0,n=0 ; n < 100 ; i+=2,n+=5 ){
    assertEquals( result.get(i) , n );
    assertEquals( result.get(i+1) , n+1 );
  }
}
项目:multiple-dimension-spread    文件:BufferDirectSequentialNumberCellIndex.java   
@Override
public Set<Integer> getGt( final IDicManager dicManager , final IntBuffer dicIndexIntBuffer , final NumberFilter numberFilter ) throws IOException{
  byte target;
  try{
    target = numberFilter.getNumberObject().getByte();
  }catch( NumberFormatException e ){
    return null;
  }
  Set<Integer> matchDicList = new HashSet<Integer>();
  for( int i = 0 ; i < dicManager.getDicSize() ; i++ ){
    PrimitiveObject numObj = dicManager.get( i );
    if( numObj == null ){
      continue;
    }
    if( target < numObj.getByte() ){
      matchDicList.add( Integer.valueOf( i ) );
    }
  }

  return matchDicList;
}
项目:trashjam2017    文件:StreamSound.java   
/**
 * Clean up the buffers applied to the sound source
 */
private void cleanUpSource() {
    SoundStore store = SoundStore.get();

    AL10.alSourceStop(store.getSource(0));
    IntBuffer buffer = BufferUtils.createIntBuffer(1);
    int queued = AL10.alGetSourcei(store.getSource(0), AL10.AL_BUFFERS_QUEUED);

    while (queued > 0)
    {
        AL10.alSourceUnqueueBuffers(store.getSource(0), buffer);
        queued--;
    }

    AL10.alSourcei(store.getSource(0), AL10.AL_BUFFER, 0);
}
项目:multiple-dimension-spread    文件:BufferDirectSequentialNumberCellIndex.java   
@Override
public Set<Integer> getGt( final IDicManager dicManager , final IntBuffer dicIndexIntBuffer , final NumberFilter numberFilter ) throws IOException{
  Float target;
  try{
    target = Float.valueOf( numberFilter.getNumberObject().getFloat() );
  }catch( NumberFormatException e ){
    return null;
  }
  Set<Integer> matchDicList = new HashSet<Integer>();
  for( int i = 0 ; i < dicManager.getDicSize() ; i++ ){
    PrimitiveObject numObj = dicManager.get( i );
    if( numObj == null ){
      continue;
    }
    if( target.compareTo( numObj.getFloat() ) < 0 ){
      matchDicList.add( Integer.valueOf( i ) );
    }
  }

  return matchDicList;
}
项目:multiple-dimension-spread    文件:BufferDirectSequentialNumberCellIndex.java   
@Override
public Set<Integer> getGt( final IDicManager dicManager , final IntBuffer dicIndexIntBuffer , final NumberFilter numberFilter ) throws IOException{
  Double target;
  try{
    target = Double.valueOf( numberFilter.getNumberObject().getDouble() );
  }catch( NumberFormatException e ){
    return null;
  }
  Set<Integer> matchDicList = new HashSet<Integer>();
  for( int i = 0 ; i < dicManager.getDicSize() ; i++ ){
    PrimitiveObject numObj = dicManager.get( i );
    if( numObj == null ){
      continue;
    }
    if( target.compareTo( numObj.getDouble() ) < 0 ){
      matchDicList.add( Integer.valueOf( i ) );
    }
  }

  return matchDicList;
}
项目:angel    文件:ServerArbitraryIntRow.java   
private void densePlusSparse(IntBuffer keys, IntBuffer values) {
  int length = keys.capacity();
  int ov, value, key;
  for (int i = 0; i < length; i++) {
    key = keys.get(i);
    ov = denseRep.get(key);
    value = ov + values.get(i);
    if (ov != 0 && value == 0)
      nnz--;
    denseRep.put(key, value);
  }

  int size = (int)(endCol - startCol);
  if (nnz < threshold * size)
    denseToSparse();
}
项目:Synapse    文件:DbHelper.java   
@Nullable
private static int[] byteArray2IntArray(byte... array) {
    if (array == null) {
        return null;
    }

    final int[] res = new int[array.length >> 2];

    try {
        final IntBuffer buffer = ByteBuffer.wrap(array).asIntBuffer();

        for (int i = 0, iLen = res.length; i < iLen; ++i) {
            res[i] = buffer.get();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    return res;
}
项目:multiple-dimension-spread    文件:TestBufferDirectSequentialNumberCellIndexByte.java   
@Test
public void T_byte_filter_3() throws IOException{
  List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
  dic.add( new ByteObj( (byte) 10 ) );
  dic.add( new ByteObj( (byte) 20 ) );
  dic.add( new ByteObj( (byte) 30 ) );
  dic.add( new ByteObj( (byte) 40 ) );
  dic.add( new ByteObj( (byte) 50 ) );
  IntBuffer buffer = IntBuffer.allocate( 100 );
  for( int i = 0 ; i < 100 ; i++ ){
    buffer.put( i % 5 );
  }
  ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.BYTE , new TestDicManager( dic ) , buffer );
  IFilter filter = new NumberFilter( NumberFilterType.LT , new ByteObj( (byte) 20 ) );

  FilterdExpressionIndex result = new FilterdExpressionIndex( index.filter( filter , new boolean[100] ) );
  assertEquals( result.size() , 20 );
  for( int i = 0,n=0 ; n < 100 ; i++,n+=5 ){
    assertEquals( result.get(i) , n );
  }
}
项目:multiple-dimension-spread    文件:TestBufferDirectSequentialNumberCellIndexByte.java   
@Test
public void T_byte_filter_8() throws IOException{
  List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
  dic.add( new ByteObj( (byte) 10 ) );
  dic.add( new ByteObj( (byte) 20 ) );
  dic.add( new ByteObj( (byte) 30 ) );
  dic.add( new ByteObj( (byte) 40 ) );
  dic.add( new ByteObj( (byte) 50 ) );
  IntBuffer buffer = IntBuffer.allocate( 100 );
  for( int i = 0 ; i < 100 ; i++ ){
    buffer.put( i % 5 );
  }
  ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.BYTE , new TestDicManager( dic ) , buffer );
  IFilter filter = new NumberFilter( NumberFilterType.GE , new LongObj( Long.valueOf( Byte.MIN_VALUE ) - (long)1 ) );

  assertEquals( null , index.filter( filter , new boolean[100] ) );
}
项目:DecompiledMinecraft    文件:TextureUtil.java   
private static void uploadTextureSub(int p_147947_0_, int[] p_147947_1_, int p_147947_2_, int p_147947_3_, int p_147947_4_, int p_147947_5_, boolean p_147947_6_, boolean p_147947_7_, boolean p_147947_8_)
{
    int i = 4194304 / p_147947_2_;
    setTextureBlurMipmap(p_147947_6_, p_147947_8_);
    setTextureClamped(p_147947_7_);
    int l;

    for (int j = 0; j < p_147947_2_ * p_147947_3_; j += p_147947_2_ * l)
    {
        int k = j / p_147947_2_;
        l = Math.min(i, p_147947_3_ - k);
        int i1 = p_147947_2_ * l;
        copyToBufferPos(p_147947_1_, j, i1);
        GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, p_147947_0_, p_147947_4_, p_147947_5_ + k, p_147947_2_, l, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)dataBuffer);
    }
}
项目:multiple-dimension-spread    文件:OptimizeLongColumnBinaryMaker.java   
@Override
public IntBuffer getIndexIntBuffer( final byte[] buffer , final int start , final int length ) throws IOException{
  int size = length / Short.BYTES;
  ByteBuffer wrapBuffer = ByteBuffer.wrap( buffer , start , length );
  IntBuffer result = IntBuffer.allocate( size );
  for( int i = 0 ; i < size ; i++ ){
    result.put( (int)( wrapBuffer.getShort() ) );
  }
  result.position( 0 );
  return result;
}
项目:Ultraino    文件:Shader.java   
int createProgramFromBuffer(GL2 gl, String vProgram, String fProgram, HashMap<String,String> templates){
    int program = 0;
    vertexShader = initShader(gl, GL2.GL_VERTEX_SHADER, preProcessVertex( getSourceCode(vProgram), templates ));
    fragmentShader = initShader(gl, GL2.GL_FRAGMENT_SHADER, preProcessFragment( getSourceCode(fProgram), templates ));

    if (vertexShader != 0 && fragmentShader != 0) {
        program = gl.glCreateProgram();

        if (program != 0) {
            gl.glAttachShader(program, vertexShader);                
            gl.glAttachShader(program, fragmentShader);
            gl.glLinkProgram(program);
            IntBuffer linkStatus = BufferUtils.createIntBuffer(1);
            gl.glGetProgramiv(program, GL2.GL_LINK_STATUS, linkStatus);

            if (linkStatus.get(0) != GL2.GL_TRUE) {
                IntBuffer infoLen = BufferUtils.createIntBuffer(1);
                gl.glGetProgramiv(program, GL2.GL_INFO_LOG_LENGTH, infoLen);
                int length = infoLen.get();
                if (length != 0) {
                    ByteBuffer buf = BufferUtils.createByteBuffer(length);
                    infoLen.flip();
                    gl.glGetProgramInfoLog(program, length, infoLen, buf);
                    byte[] b = new byte[length];
                    buf.get(b);
                    System.err.println("Could not link program: " + new String(b));
                }
            }
        }
    }

    return program;
}
项目:debug    文件:ARBDirectStateAccess.java   
public static void glCreateVertexArrays(IntBuffer arrays) {
    org.lwjgl.opengl.ARBDirectStateAccess.glCreateVertexArrays(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);
            CURRENT_CONTEXT.get().vaos.put(arrays.get(position + i), vao);
        }
    }
}
项目:DecompiledMinecraft    文件:OpenGlHelper.java   
public static void glUniform3(int location, IntBuffer values)
{
    if (arbShaders)
    {
        ARBShaderObjects.glUniform3ARB(location, values);
    }
    else
    {
        GL20.glUniform3(location, values);
    }
}
项目:Backmemed    文件:ShadersTex.java   
public static void setupTexture(MultiTexID multiTex, int[] src, int width, int height, boolean linear, boolean clamp)
{
    int i = linear ? 9729 : 9728;
    int j = clamp ? 10496 : 10497;
    int k = width * height;
    IntBuffer intbuffer = getIntBuffer(k);
    intbuffer.clear();
    intbuffer.put(src, 0, k).position(0).limit(k);
    GlStateManager.bindTexture(multiTex.base);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, i);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, i);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, j);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, j);
    intbuffer.put(src, k, k).position(0).limit(k);
    GlStateManager.bindTexture(multiTex.norm);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, i);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, i);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, j);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, j);
    intbuffer.put(src, k * 2, k).position(0).limit(k);
    GlStateManager.bindTexture(multiTex.spec);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, i);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, i);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, j);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, j);
    GlStateManager.bindTexture(multiTex.base);
}
项目:Towan    文件:InternalTextureLoader.java   
/**
 * Create a new texture ID 
 *
 * @return A new texture ID
 */
public static int createTextureID() 
{ 
   IntBuffer tmp = createIntBuffer(1); 
   GL.glGenTextures(tmp); 
   return tmp.get(0);
}
项目:Backmemed    文件:GlStateManager.java   
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();
}
项目:Backmemed    文件:Shaders.java   
private static IntBuffer fillIntBufferZero(IntBuffer buf)
{
    int i = buf.limit();

    for (int j = buf.position(); j < i; ++j)
    {
        buf.put(j, 0);
    }

    return buf;
}
项目:Progetto-C    文件:OpenALStreamPlayer.java   
/**
 * Clean up the buffers applied to the sound source
 */
private void removeBuffers() {
    IntBuffer buffer = BufferUtils.createIntBuffer(1);
    int queued = AL10.alGetSourcei(source, AL10.AL_BUFFERS_QUEUED);

    while (queued > 0)
    {
        AL10.alSourceUnqueueBuffers(source, buffer);
        queued--;
    }
}
项目:BaseClient    文件:InternalTextureLoader.java   
/**
 * Create a new texture ID 
 *
 * @return A new texture ID
 */
public static int createTextureID() 
{ 
   IntBuffer tmp = createIntBuffer(1); 
   GL.glGenTextures(tmp); 
   return tmp.get(0);
}
项目:MC-Ray-Tracer    文件:WorldLoader.java   
/**
 * 
 * @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;
}
项目:Backmemed    文件:Mipmaps.java   
public static void allocateMipmapTextures(int p_allocateMipmapTextures_0_, int p_allocateMipmapTextures_1_, String p_allocateMipmapTextures_2_)
{
    Dimension[] adimension = makeMipmapDimensions(p_allocateMipmapTextures_0_, p_allocateMipmapTextures_1_, p_allocateMipmapTextures_2_);

    for (int i = 0; i < adimension.length; ++i)
    {
        Dimension dimension = adimension[i];
        int j = dimension.width;
        int k = dimension.height;
        int l = i + 1;
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, l, GL11.GL_RGBA, j, k, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)((IntBuffer)null));
    }
}
项目:debug    文件:Context.java   
public static void deleteVertexArrays(IntBuffer indices) {
    Context context = CURRENT_CONTEXT.get();
    int pos = indices.position();
    for (int i = 0; i < indices.remaining(); i++) {
        int index = indices.get(pos + i);
        if (index == 0)
            continue;
        VAO vao = context.vaos.get(index);
        if (vao != null && vao == context.currentVao) {
            context.currentVao = context.defaultVao;
        }
        context.vaos.remove(index);
    }
}
项目:debug    文件:ARBDrawElementsBaseVertex.java   
public static void glDrawElementsBaseVertex(int mode, IntBuffer indices, int basevertex) {
    if (Properties.VALIDATE.enabled) {
        checkBeforeDrawCall();
    }
    if (Properties.PROFILE.enabled) {
        RT.beforeDraw();
    }
    org.lwjgl.opengl.ARBDrawElementsBaseVertex.glDrawElementsBaseVertex(mode, indices, basevertex);
    if (Properties.PROFILE.enabled) {
        RT.draw(indices.remaining());
    }
}
项目:angel    文件:PeriodHATest.java   
private long sum(IntBuffer buffer, int size) {
  long ret = 0L;
  for(int i = 0; i < size; i++) {
    ret += buffer.get(i);
  }

  return ret;
}
项目:DecompiledMinecraft    文件:OpenGlHelper.java   
public static void glUniform1(int location, IntBuffer values)
{
    if (arbShaders)
    {
        ARBShaderObjects.glUniform1ARB(location, values);
    }
    else
    {
        GL20.glUniform1(location, values);
    }
}
项目:G2Dj    文件:Texture.java   
@Override
protected void finalize() throws Throwable
{
    GL.glDeleteTextures(1, IntBuffer.wrap(new int[]{m_TextureHandle}));

    super.finalize();

}
项目:debug    文件:GL11.java   
public static void glGetIntegerv(int pname, IntBuffer params) {
    if (Properties.PROFILE.enabled && pname == org.lwjgl.opengl.GL30.GL_NUM_EXTENSIONS) {
        int numExtensions = org.lwjgl.opengl.GL11.glGetInteger(pname);
        params.put(params.position(), numExtensions + 2); // <- for GREMEDY_string_marker and GREMEDY_frame_terminator
        return;
    }
    org.lwjgl.opengl.GL11.glGetIntegerv(pname, params);
}
项目:debug    文件:GL31.java   
public static void glDrawElementsInstanced(int mode, IntBuffer indices, int primcount) {
    if (Properties.VALIDATE.enabled) {
        checkBeforeDrawCall();
    }
    if (Properties.PROFILE.enabled) {
        RT.beforeDraw();
    }
    org.lwjgl.opengl.GL31.glDrawElementsInstanced(mode, indices, primcount);
    if (Properties.PROFILE.enabled) {
        RT.draw(indices.remaining() * primcount);
    }
}
项目:mao-android    文件:CameraView.java   
public void capture(final ICaptureCallback callback) {
    mLog.i("capture");
    runOnDrawEnd(new Runnable() {
        @Override
        public void run() {
            IntBuffer ib = IntBuffer.allocate(mSurfaceWidth * mSurfaceHeight);
            GLES20.glReadPixels(0, 0, mSurfaceWidth, mSurfaceHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, ib);
            Bitmap result = Bitmap.createBitmap(mSurfaceWidth, mSurfaceHeight, Bitmap.Config.ARGB_8888);
            result.copyPixelsFromBuffer(ib);

            callback.onCapture(result);
        }
    });
}
项目:Progetto-C    文件:InternalTextureLoader.java   
/**
 * Create a new texture ID 
 *
 * @return A new texture ID
 */
public static int createTextureID() 
{ 
   IntBuffer tmp = createIntBuffer(1); 
   GL.glGenTextures(tmp); 
   return tmp.get(0);
}
项目:Mass    文件:StaticMeshLoader.java   
/**
 * Proceses the indices of a mesh.
 * 
 * @param aiMesh - AIMesh to process indices for.
 * @param indices - List of indices to add processed indices to.
 */
private static void processIndices(AIMesh aiMesh, List<Integer> indices) {
    int numFaces = aiMesh.mNumFaces();
    AIFace.Buffer aiFaces = aiMesh.mFaces();

    for (int i = 0; i < numFaces; i++) {
        AIFace aiFace = aiFaces.get();
        IntBuffer buffer = aiFace.mIndices();
        while (buffer.remaining() > 0) {
            indices.add(buffer.get());
        }
    }
}