⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smallglut.java

📁 Android从入门到精通
💻 JAVA
字号:
package com.androidbook.opengl;

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

public abstract class SmallGLUT {

    public static final float PI = 3.14159265358979323846f;
    
    
    ByteBuffer getByteBufferFromByteArray( byte array[]) {
	ByteBuffer buffer = ByteBuffer.allocateDirect(array.length);
	buffer.put(array);
	buffer.position(0);
	return buffer;
    }
    
    FloatBuffer getFloatBufferFromFloatArray(float array[]) {
        ByteBuffer tempBuffer = ByteBuffer.allocateDirect(array.length * 4);
        tempBuffer.order(ByteOrder.nativeOrder());
        FloatBuffer buffer = tempBuffer.asFloatBuffer();
        buffer.put(array);
        buffer.position(0);
        return buffer;
    }
    
    IntBuffer getIntBufferFromIntArray( int array[]) {
	ByteBuffer tempBuffer = ByteBuffer.allocateDirect(array.length * 4);
	tempBuffer.order(ByteOrder.nativeOrder());
	IntBuffer buffer = tempBuffer.asIntBuffer();
	buffer.put(array);
	buffer.position(0);
	return buffer;
    }
    
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -