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


Java IntBuffer类代码示例

本文整理汇总了Java中java.nio.IntBuffer的典型用法代码示例。如果您正苦于以下问题:Java IntBuffer类的具体用法?Java IntBuffer怎么用?Java IntBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IntBuffer类属于java.nio包,在下文中一共展示了IntBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printShaderLogInfo

import java.nio.IntBuffer; //导入依赖的package包/类
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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:Shaders.java

示例2: loadTexture

import java.nio.IntBuffer; //导入依赖的package包/类
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];
}
 
开发者ID:lzmlsfe,项目名称:19porn,代码行数:24,代码来源:OpenGlUtils.java

示例3: Model

import java.nio.IntBuffer; //导入依赖的package包/类
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);
}
 
开发者ID:nitrodragon,项目名称:lwjgl3_stuff,代码行数:26,代码来源:Model.java

示例4: getLt

import java.nio.IntBuffer; //导入依赖的package包/类
@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;
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:22,代码来源:BufferDirectSequentialNumberCellIndex.java

示例5: visitPackageLocation

import java.nio.IntBuffer; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:ImageReader.java

示例6: getGt

import java.nio.IntBuffer; //导入依赖的package包/类
@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;
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:22,代码来源:BufferDirectSequentialNumberCellIndex.java

示例7: T_float_filter_8

import java.nio.IntBuffer; //导入依赖的package包/类
@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] ) );
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:18,代码来源:TestBufferDirectSequentialNumberCellIndexFloat.java

示例8: grayscaleImageToBitmap

import java.nio.IntBuffer; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:BioID-GmbH,项目名称:BWS-Android,代码行数:24,代码来源:ImageFormatConverter.java

示例9: T_short_filter_4

import java.nio.IntBuffer; //导入依赖的package包/类
@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 );
  }
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:23,代码来源:TestBufferDirectSequentialNumberCellIndexShort.java

示例10: cleanUpSource

import java.nio.IntBuffer; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:StreamSound.java

示例11: densePlusSparse

import java.nio.IntBuffer; //导入依赖的package包/类
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();
}
 
开发者ID:Tencent,项目名称:angel,代码行数:17,代码来源:ServerArbitraryIntRow.java

示例12: byteArray2IntArray

import java.nio.IntBuffer; //导入依赖的package包/类
@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;
}
 
开发者ID:huazhouwang,项目名称:Synapse,代码行数:21,代码来源:DbHelper.java

示例13: T_byte_filter_3

import java.nio.IntBuffer; //导入依赖的package包/类
@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 );
  }
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:22,代码来源:TestBufferDirectSequentialNumberCellIndexByte.java

示例14: T_byte_filter_8

import java.nio.IntBuffer; //导入依赖的package包/类
@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] ) );
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:18,代码来源:TestBufferDirectSequentialNumberCellIndexByte.java

示例15: uploadTextureSub

import java.nio.IntBuffer; //导入依赖的package包/类
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);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:TextureUtil.java


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