本文整理汇总了Java中com.jme3.util.BufferUtils.destroyDirectBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java BufferUtils.destroyDirectBuffer方法的具体用法?Java BufferUtils.destroyDirectBuffer怎么用?Java BufferUtils.destroyDirectBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.util.BufferUtils
的用法示例。
在下文中一共展示了BufferUtils.destroyDirectBuffer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startChange
import com.jme3.util.BufferUtils; //导入方法依赖的package包/类
/**
* Start making changes.
*/
private void startChange() {
final Array<ColorPoint> colorPoints = getColorPoints();
colorPoints.clear();
final Texture alphaTexture = notNull(getAlphaTexture());
final Image image = alphaTexture.getImage();
final ByteBuffer data = image.getData(0);
if (prevBuffer == null) {
prevBuffer = BufferUtils.createByteBuffer(data.capacity());
} else if (prevBuffer.capacity() < data.capacity()) {
BufferUtils.destroyDirectBuffer(prevBuffer);
prevBuffer = BufferUtils.createByteBuffer(data.capacity());
}
final int position = data.position();
data.position(0);
prevBuffer.clear();
prevBuffer.put(data);
prevBuffer.flip();
data.position(position);
}
示例2: lwjglBody
import com.jme3.util.BufferUtils; //导入方法依赖的package包/类
public void lwjglBody(int gl_format, Texture tx, Texel ir, int mipmap, int slice, Map<String,String> options, DDS_HEADER header, DDS_BODY body) throws Exception {
IntBuffer intBuf1=BufferUtils.createIntBuffer(1);
glGenTextures(intBuf1);
int id=intBuf1.get(0);
glBindTexture(GL_TEXTURE_2D,id);
Vector4f pixels[][]=ir.getPixels(PixelFormat.FLOAT_NORMALIZED_RGBA);
FloatBuffer bbf=BufferUtils.createFloatBuffer(pixels.length*pixels[0].length*4);
for(int y=0;y<pixels[0].length;y++){
for(int x=0;x<pixels.length;x++){
bbf.put(pixels[x][y].x);
bbf.put(pixels[x][y].y);
bbf.put(pixels[x][y].z);
bbf.put(pixels[x][y].w);
}
}
bbf.rewind();
glTexImage2D(GL_TEXTURE_2D,0,gl_format,pixels.length,pixels[0].length,0,GL_RGBA,GL_FLOAT,bbf);
int out_size=glGetTexLevelParameteri(GL_TEXTURE_2D,0,GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB);
ByteBuffer out=BufferUtils.createByteBuffer(out_size);
// glGetCompressedTexImageARB(GL_TEXTURE_2D,0,out);
glGetCompressedTexImage(GL_TEXTURE_2D,0,out);
byte bytes[]=new byte[out_size];
out.rewind();
out.get(bytes);
body.write(bytes);
BufferUtils.destroyDirectBuffer(out);
BufferUtils.destroyDirectBuffer(bbf);
glBindTexture(GL_TEXTURE_2D,0);
glDeleteTextures(id);
}
示例3: deleteNativeBuffers
import com.jme3.util.BufferUtils; //导入方法依赖的package包/类
@Override
protected void deleteNativeBuffers() {
for (ByteBuffer buf : data) {
BufferUtils.destroyDirectBuffer(buf);
}
}
示例4: deallocateBuffers
import com.jme3.util.BufferUtils; //导入方法依赖的package包/类
protected void deallocateBuffers() {
BufferUtils.destroyDirectBuffer(vb);
BufferUtils.destroyDirectBuffer(ib);
BufferUtils.destroyDirectBuffer(tcb);
BufferUtils.destroyDirectBuffer(cb);
}