本文整理汇总了Java中org.lwjgl.PointerBuffer.remaining方法的典型用法代码示例。如果您正苦于以下问题:Java PointerBuffer.remaining方法的具体用法?Java PointerBuffer.remaining怎么用?Java PointerBuffer.remaining使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.PointerBuffer
的用法示例。
在下文中一共展示了PointerBuffer.remaining方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: paramGlfwMonitor
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
public static MethodCall paramGlfwMonitor(MethodCall mc, long monitor) {
PointerBuffer monitors = org.lwjgl.glfw.GLFW.glfwGetMonitors();
for (int i = 0; i < monitors.remaining(); i++) {
long m = monitors.get(i);
if (m == monitor) {
mc.paramEnum("monitor[" + i + "]");
return mc;
}
}
mc.param(monitor);
return mc;
}
示例4: returnValueGlfwMonitor
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
public static long returnValueGlfwMonitor(long monitor, MethodCall mc) {
PointerBuffer monitors = org.lwjgl.glfw.GLFW.glfwGetMonitors();
for (int i = 0; i < monitors.remaining(); i++) {
long m = monitors.get(i);
if (m == monitor) {
mc.returnValueEnum("monitor[" + i + "]");
return monitor;
}
}
mc.returnValue(monitor);
return monitor;
}
示例5: checkGlfwMonitor
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
public static void checkGlfwMonitor(long monitor) {
if (monitor == 0L)
return;
PointerBuffer pb = org.lwjgl.glfw.GLFW.glfwGetMonitors();
for (int i = 0; i < pb.remaining(); i++) {
if (pb.get(i) == monitor)
return;
}
throwIAEOrLogError("Provided 'monitor' argument is not a valid GLFW monitor handle: " + monitor);
}
示例6: createInstance
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
/**
* Create a Vulkan instance using LWJGL 3.
*
* @return the VkInstance handle
*/
private static VkInstance createInstance() {
VkApplicationInfo appInfo = VkApplicationInfo.calloc()
.sType(VK_STRUCTURE_TYPE_APPLICATION_INFO)
.pApplicationName(memUTF8("AWT Vulkan Demo"))
.pEngineName(memUTF8(""))
.apiVersion(VK_MAKE_VERSION(1, 0, 2));
ByteBuffer VK_KHR_SURFACE_EXTENSION = memUTF8(VK_KHR_SURFACE_EXTENSION_NAME);
ByteBuffer VK_KHR_OS_SURFACE_EXTENSION;
if (Platform.get() == Platform.WINDOWS)
VK_KHR_OS_SURFACE_EXTENSION = memUTF8(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
else
VK_KHR_OS_SURFACE_EXTENSION = memUTF8(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
PointerBuffer ppEnabledExtensionNames = memAllocPointer(2);
ppEnabledExtensionNames.put(VK_KHR_SURFACE_EXTENSION);
ppEnabledExtensionNames.put(VK_KHR_OS_SURFACE_EXTENSION);
ppEnabledExtensionNames.flip();
VkInstanceCreateInfo pCreateInfo = VkInstanceCreateInfo.calloc()
.sType(VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
.pNext(0L)
.pApplicationInfo(appInfo);
if (ppEnabledExtensionNames.remaining() > 0) {
pCreateInfo.ppEnabledExtensionNames(ppEnabledExtensionNames);
}
PointerBuffer pInstance = MemoryUtil.memAllocPointer(1);
int err = vkCreateInstance(pCreateInfo, null, pInstance);
if (err != VK_SUCCESS) {
throw new RuntimeException("Failed to create VkInstance: " + translateVulkanResult(err));
}
long instance = pInstance.get(0);
memFree(pInstance);
VkInstance ret = new VkInstance(instance, pCreateInfo);
memFree(ppEnabledExtensionNames);
memFree(VK_KHR_OS_SURFACE_EXTENSION);
memFree(VK_KHR_SURFACE_EXTENSION);
appInfo.free();
return ret;
}
示例7: initVulkan
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
@Override
public VkInstance initVulkan()
{
// We need to say which extensions to enable at the time of creating the instance. We should also add in the
// extensions required by GLFW to create the surface. Note that this should not be freed manually.
PointerBuffer glfwExtensions = glfwGetRequiredInstanceExtensions();
// Create a PointerBuffer with memory enough to hold pointers for all the extension names.
PointerBuffer enabledExtensionNames = memAllocPointer(glfwExtensions.remaining() + 1);
// Encode the surface extension names into a ByteBuffer so we can put it in the PointerBuffer.
ByteBuffer KHR_SURFACE_EXTENSION = memASCII(VK_KHR_SURFACE_EXTENSION_NAME);
// Add the extensions to the PointerBuffer and flip the buffer. In order to present something
// we must request the KHR_SURFACE_EXTENSION, without which, the instance will act like an offscreen context.
enabledExtensionNames.put(KHR_SURFACE_EXTENSION);
// Also put in the GLFW extensions into the enabledExtensionNames list so they get enabled too.
while (glfwExtensions.remaining() > 0)
enabledExtensionNames.put(glfwExtensions.get());
// Flip the buffer so that the system can read from the buffer.
enabledExtensionNames.flip();
// The VkApplicationInfo struct contains information about the application that we are going to create.
VkApplicationInfo appInfo = VkApplicationInfo.calloc()
.sType(VK_STRUCTURE_TYPE_APPLICATION_INFO)
.pApplicationName(memASCII("Vulkan Instance Example"))
.pEngineName(memASCII(""))
.apiVersion(VK_MAKE_VERSION(1, 0, 4));
// The VkInstanceCreateInfo struct contains information about the Vulkan instance, and refers to the appInfo.
VkInstanceCreateInfo instInfo = VkInstanceCreateInfo.calloc()
.sType(VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
.pNext(NULL)
.pApplicationInfo(appInfo)
.ppEnabledExtensionNames(enabledExtensionNames);
// The PointerBuffer enough to hold one pointer, the PointerBuffer is not a pointer, but it's contents are.
PointerBuffer pInstance = memAllocPointer(1);
// Create the instance. The instance handle is stored in the PointerBuffer which we can use now.
vkCreateInstance(instInfo, null, pInstance);
// Get the VkInstance handle from the pointer
instance = new VkInstance(pInstance.get(), instInfo);
// Free the pointer buffer, not the VkInstance struct
memFree(pInstance);
// Free the VkApplicationInfo and VkInstanceCreateInfo structs, we no longer need them in our application.
appInfo.free();
instInfo.free();
// Free the extension names, we don't need them now.
memFree(enabledExtensionNames);
memFree(KHR_SURFACE_EXTENSION);
// Print out the instance capabilities
VKCapabilities capabilities = instance.getCapabilities();
System.out.println("Vulkan10: " + capabilities.Vulkan10);
System.out.println("VK_KHR_display: " + capabilities.VK_KHR_display);
System.out.println("VK_KHR_surface: " + capabilities.VK_KHR_surface);
System.out.println("VK_KHR_swapchain: " + capabilities.VK_KHR_swapchain);
System.out.println("VK_EXT_debug_report: " + capabilities.VK_EXT_debug_report);
System.out.println("VK_KHR_xlib_surface: " + capabilities.VK_KHR_xlib_surface);
System.out.println("VK_KHR_win32_surface: " + capabilities.VK_KHR_win32_surface);
System.out.println("VK_KHR_display_swapchain: " + capabilities.VK_KHR_display_swapchain);
System.out.println("VK_KHR_sampler_mirror_clamp_to_edge: " + capabilities.VK_KHR_sampler_mirror_clamp_to_edge);
// Return instance to attach to the display so rendering can be done.
return instance;
}