All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.daxie.joglf.gl.tool.BufferFunctions Maven / Gradle / Ivy

There is a newer version: 11.7.0
Show newest version
package com.daxie.joglf.gl.tool;

import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

import com.daxie.basis.coloru8.ColorU8;
import com.daxie.basis.matrix.Matrix;
import com.daxie.basis.vector.Vector;
import com.jogamp.common.nio.Buffers;

/**
 * Provides methods to handle buffers.
 * @author Daba
 *
 */
public class BufferFunctions {
	public static String GetStringFromByteBuffer(ByteBuffer b) {
		byte[] byte_array=new byte[b.remaining()];
		b.get(byte_array);
		
		((Buffer)b).flip();
		
		return new String(byte_array,0,byte_array.length-1);
	}
	
	public static IntBuffer CopyIntBuffer(IntBuffer b) {
		IntBuffer copied=Buffers.newDirectIntBuffer(b.capacity());
		
		int cap=b.capacity();
		for(int i=0;i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy