本文整理汇总了Java中org.lwjgl.PointerBuffer类的典型用法代码示例。如果您正苦于以下问题:Java PointerBuffer类的具体用法?Java PointerBuffer怎么用?Java PointerBuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PointerBuffer类属于org.lwjgl包,在下文中一共展示了PointerBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
/**
* Loads one or more meshes at the specified resource path with
* the textures at the specified texture path with the specified flags.
*
* @param resourcePath - Path for the mesh resource to load.
* @param texturesDir - Path for the textures to use for the mesh.
* @param flags - Flags for the Assimp importer to use.
*
* @return Mesh array with the loaded meshes.
*
* @throws Exception
*/
public static Mesh[] load(String resourcePath, String texturesDir, int flags) throws Exception {
AIScene aiScene = Assimp.aiImportFile(resourcePath, flags);
if (aiScene == null) {
throw new Exception("Error loading model");
}
int numMaterials = aiScene.mNumMaterials();
PointerBuffer aiMaterials = aiScene.mMaterials();
List<Material> materials = new ArrayList<>();
for (int i = 0; i < numMaterials; i++) {
AIMaterial aiMaterial = AIMaterial.create(aiMaterials.get(i));
processMaterial(aiMaterial, materials, texturesDir);
}
int numMeshes = aiScene.mNumMeshes();
PointerBuffer aiMeshes = aiScene.mMeshes();
Mesh[] meshes = new Mesh[numMeshes];
for (int i = 0; i < numMeshes; i++) {
AIMesh aiMesh = AIMesh.create(aiMeshes.get(i));
Mesh mesh = processMesh(aiMesh, materials);
meshes[i] = mesh;
}
return meshes;
}
示例2: glCreateShaderProgramv
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
public static int glCreateShaderProgramv(int type, PointerBuffer strings) {
int shader = org.lwjgl.opengl.ARBSeparateShaderObjects.glCreateShaderProgramv(type, strings);
if (TRACE.enabled) {
/* Log the shader source */
StringBuilder sb = new StringBuilder();
if (strings != null) {
int stringsPos = strings.position();
for (int i = 0; i < strings.remaining(); i++) {
String source = org.lwjgl.system.MemoryUtil.memASCII(strings.get(stringsPos + i));
sb.append(source);
}
}
trace("Shader source for shader [" + shader + "]:\n" + sb.toString());
}
return shader;
}
示例3: glCreateShaderProgramv
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
public static int glCreateShaderProgramv(int type, PointerBuffer strings) {
int shader = org.lwjgl.opengl.GL41.glCreateShaderProgramv(type, strings);
if (TRACE.enabled) {
/* Log the shader source */
StringBuilder sb = new StringBuilder();
if (strings != null) {
int stringsPos = strings.position();
for (int i = 0; i < strings.remaining(); i++) {
String source = org.lwjgl.system.MemoryUtil.memASCII(strings.get(stringsPos + i));
sb.append(source);
}
}
trace("Shader source for shader [" + shader + "]:\n" + sb.toString());
}
return shader;
}
示例4: create
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
private long create(int depth, GLData attribs, GLData effective) throws AWTException {
int screen = X11.XDefaultScreen(display);
IntBuffer attrib_list = BufferUtils.createIntBuffer(16 * 2);
attrib_list.put(GLX_DRAWABLE_TYPE).put(GLX_WINDOW_BIT);
attrib_list.put(GLX_RENDER_TYPE).put(GLX_RGBA_BIT);
attrib_list.put(GLX_RED_SIZE).put(attribs.redSize);
attrib_list.put(GLX_GREEN_SIZE).put(attribs.greenSize);
attrib_list.put(GLX_BLUE_SIZE).put(attribs.blueSize);
attrib_list.put(GLX_DEPTH_SIZE).put(attribs.depthSize);
if (attribs.doubleBuffer)
attrib_list.put(GLX_DOUBLEBUFFER).put(1);
attrib_list.put(0);
attrib_list.flip();
PointerBuffer fbConfigs = glXChooseFBConfig(display, screen, attrib_list);
if (fbConfigs == null || fbConfigs.capacity() == 0) {
// No framebuffer configurations supported!
throw new AWTException("No supported framebuffer configurations found");
}
long context = glXCreateNewContext(display, fbConfigs.get(0), GLX_RGBA_TYPE, NULL, true);
return context;
}
示例5: calculateImageSize
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
/**
* Calculates the number of bytes in the specified cl_mem image region.
* This implementation assumes 1 byte per element, because we cannot the
* image type.
*
* @param region the image region
* @param row_pitch the row pitch
* @param slice_pitch the slice pitch
*
* @return the region size in bytes
*/
static int calculateImageSize(final PointerBuffer region, long row_pitch, long slice_pitch) {
if ( !LWJGLUtil.CHECKS )
return 0;
final long w = region.get(0);
final long h = region.get(1);
final long d = region.get(2);
if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) )
throw new IllegalArgumentException("Invalid cl_mem image region dimensions: " + w + " x " + h + " x " + d);
if ( row_pitch == 0 )
row_pitch = w;
else if ( LWJGLUtil.DEBUG && row_pitch < w )
throw new IllegalArgumentException("Invalid row pitch specified: " + row_pitch);
if ( slice_pitch == 0 )
slice_pitch = row_pitch * h;
else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) )
throw new IllegalArgumentException("Invalid slice pitch specified: " + slice_pitch);
return (int)(slice_pitch * d);
}
示例6: getPrimitiveKindFromBufferClass
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
public static PrimitiveType.Kind getPrimitiveKindFromBufferClass(Class c) {
if ( IntBuffer.class.equals(c) )
return PrimitiveType.Kind.INT;
else if ( DoubleBuffer.class.equals(c) )
return PrimitiveType.Kind.DOUBLE;
else if ( ShortBuffer.class.equals(c) )
return PrimitiveType.Kind.SHORT;
else if ( ByteBuffer.class.equals(c) || PointerBuffer.class.equals(c) )
return PrimitiveType.Kind.BYTE;
else if ( FloatBuffer.class.equals(c) )
return PrimitiveType.Kind.FLOAT;
else if ( LongBuffer.class.equals(c) )
return PrimitiveType.Kind.LONG;
else
throw new RuntimeException(c + " is not allowed");
}
示例7: visitClassType
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
public void visitClassType(ClassType t) {
is_indirect = true;
Class<?> c = getClassFromType(t);
if ( String.class.equals(c) ) {
native_types = new ArrayList<Class>();
native_types.add(type_map.getStringElementType());
} else if ( Buffer.class.equals(c) ) {
native_types = new ArrayList<Class>();
native_types.add(type_map.getVoidType());
} else if ( Buffer.class.isAssignableFrom(c) ) {
PrimitiveType.Kind kind = getPrimitiveKindFromBufferClass(c);
getNativeTypeFromAnnotatedPrimitiveType(kind);
} else if ( PointerBuffer.class.isAssignableFrom(c) ) {
native_types = new ArrayList<Class>();
native_types.add(PointerBuffer.class);
} else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) {
native_types = new ArrayList<Class>();
native_types.add(PointerWrapper.class);
is_indirect = false;
} else
throw new RuntimeException(t + " is not allowed");
}
示例8: getValidBufferTypes
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
private static Class[] getValidBufferTypes(Class type) {
if ( type.equals(IntBuffer.class) )
return new Class[] { cl_int.class, cl_uint.class };
else if ( type.equals(FloatBuffer.class) )
return new Class[] { cl_float.class };
else if ( type.equals(ByteBuffer.class) )
return new Class[] { cl_byte.class, cl_char.class, cl_uchar.class, cl_void.class };
else if ( type.equals(ShortBuffer.class) )
return new Class[] { cl_short.class };
else if ( type.equals(DoubleBuffer.class) )
return new Class[] { cl_double.class };
else if ( type.equals(LongBuffer.class) )
return new Class[] { cl_long.class };
else if ( type.equals(PointerBuffer.class) )
return new Class[] { size_t.class };
else
return new Class[] { };
}
示例9: getValidAnnotationTypes
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
public Class[] getValidAnnotationTypes(Class type) {
Class[] valid_types;
if ( Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) )
valid_types = getValidBufferTypes(type);
else if ( type.isPrimitive() )
valid_types = getValidPrimitiveTypes(type);
else if ( String.class.equals(type) )
valid_types = new Class[] { cl_byte.class };
else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) )
valid_types = new Class[] { PointerWrapper.class };
else if ( ByteBuffer[].class == type )
valid_types = new Class[] { cl_char.class, cl_uchar.class };
else if ( void.class.equals(type) )
valid_types = new Class[] { GLreturn.class };
else
valid_types = new Class[] { };
return valid_types;
}
示例10: visitClassType
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
public void visitClassType(ClassType t) {
Class type = NativeTypeTranslator.getClassFromType(t);
if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) || (Utils.isAddressableType(type) && !String.class.equals(type)) )
signature.append("J");
else {
String type_name;
if ( (CharSequence.class.isAssignableFrom(type) && !String.class.equals(type)) || CharSequence[].class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) )
type_name = ByteBuffer.class.getName();
else
type_name = t.getDeclaration().getQualifiedName();
signature.append("L");
signature.append(getNativeNameFromClassName(type_name));
signature.append(";");
}
}
示例11: clCreateContext
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
/** LWJGL requires CL_CONTEXT_PLATFORM to be present in the cl_context_properties buffer. */
@Alternate("clCreateContext")
@Code(
tryBlock = true,
// Create a GlobalRef to the callback object.
javaBeforeNative = "\t\tlong user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);",
// Associate context with the GlobalRef, so we can delete it later.
javaFinally = "\t\t\tif ( __result != null ) __result.setContextCallback(user_data);"
)
@Check(value = "errcode_ret", canBeNull = true)
@PointerWrapper(value = "cl_context", params = "APIUtil.getCLPlatform(properties)")
CLContext clCreateContext(@NullTerminated @Check("3") @Const @NativeType("cl_context_properties") PointerBuffer properties,
@Constant("1") @cl_uint int num_devices,
@Constant(value = "APIUtil.getPointer(device)", keepParam = true) CLDevice device,
@PointerWrapper(value = "cl_create_context_callback", canBeNull = true) CLContextCallback pfn_notify,
@Constant("user_data") @PointerWrapper("void *") long user_data,
@OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret);
示例12: clEnqueueReadBuffer
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
@Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);")
@cl_int
int clEnqueueReadBuffer(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
@PointerWrapper("cl_mem") CLMem buffer,
@cl_bool int blocking_read,
@size_t long offset,
@AutoSize("ptr") @size_t long size,
@OutParameter
@cl_byte
@cl_short
@cl_int
@cl_long
@cl_float
@cl_double Buffer ptr,
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
示例13: clEnqueueWriteBuffer
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
@Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);")
@cl_int
int clEnqueueWriteBuffer(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
@PointerWrapper("cl_mem") CLMem buffer,
@cl_bool int blocking_write,
@size_t long offset,
@AutoSize("ptr") @size_t long size,
@Const
@cl_byte
@cl_short
@cl_int
@cl_long
@cl_float
@cl_double Buffer ptr,
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
示例14: clEnqueueReadImage
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
@Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);")
@cl_int
int clEnqueueReadImage(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
@PointerWrapper("cl_mem") CLMem image,
@cl_bool int blocking_read,
@Check("3") @Const @NativeType("size_t") PointerBuffer origin,
@Check("3") @Const @NativeType("size_t") PointerBuffer region,
@size_t long row_pitch,
@size_t long slice_pitch,
@OutParameter @Check("CLChecks.calculateImageSize(region, row_pitch, slice_pitch)")
@cl_byte
@cl_short
@cl_int
@cl_float Buffer ptr,
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
示例15: clEnqueueWriteImage
import org.lwjgl.PointerBuffer; //导入依赖的package包/类
@Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);")
@cl_int
int clEnqueueWriteImage(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
@PointerWrapper("cl_mem") CLMem image,
@cl_bool int blocking_write,
@Check("3") @Const @NativeType("size_t") PointerBuffer origin,
@Check("3") @Const @NativeType("size_t") PointerBuffer region,
@size_t long input_row_pitch,
@size_t long input_slice_pitch,
@Check("CLChecks.calculateImageSize(region, input_row_pitch, input_slice_pitch)") @Const
@cl_byte
@cl_short
@cl_int
@cl_float Buffer ptr,
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);