Code example for ShortBuffer

Methods: positionput

0
     
    public void setIndices(short[] indices) {
        ByteBuffer ibb = ByteBuffer.allocateDirect(indices.length * 2);
        ibb.order(ByteOrder.nativeOrder());
        mIndicesBuffer = ibb.asShortBuffer();
        mIndicesBuffer.put(indices);
        mIndicesBuffer.position(0);
        mNumIndices = indices.length;
    } 
     
    public void setTextureCoords(float[] coords) {
        ByteBuffer tbb = ByteBuffer.allocateDirect(coords.length * 4);
        tbb.order(ByteOrder.nativeOrder());
        mTextureBuffer = tbb.asFloatBuffer();
        mTextureBuffer.put(coords);
        mTextureBuffer.position(0);
    } 
     
     
    protected void setColor(float red, float green, float blue, float alpha) {
Experience pair programming with AI  Get Codota for Java