List of usage examples for org.lwjgl.opengl NVXGPUMemoryInfo GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
int GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
To view the source code for org.lwjgl.opengl NVXGPUMemoryInfo GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX.
Click Source Link
From source file:net.guerra24.infinity.client.graphics.opengl.Display.java
License:Open Source License
@Override public void create(int width, int height, String title, boolean vsync, boolean visible, boolean resizable, ContextFormat format, String[] icons) { Logger.log("Creating Window"); super.displayWidth = width; super.displayHeight = height; if (glfwInit() != GL_TRUE) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints();//from w w w. j av a2 s .com glfwWindowHint(GLFW_VISIBLE, visible ? 1 : 0); super.displayResizable = resizable; glfwWindowHint(GLFW_RESIZABLE, resizable ? 1 : 0); format.create(); super.window = glfwCreateWindow(displayWidth, displayHeight, title, NULL, NULL); if (super.window == NULL) { throw new RuntimeException("Failed to create the GLFW window"); } super.createCallbacks(); super.setCallbacks(); vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(super.window, (vidmode.width() - super.displayWidth) / 2, (vidmode.height() - super.displayHeight) / 2); glfwMakeContextCurrent(super.window); glfwSwapInterval(vsync ? 1 : 0); try { ByteBuffer[] icon_array = new ByteBuffer[icons.length]; for (int i = 0; i < icons.length; i++) { icon_array[i] = ByteBuffer.allocateDirect(1); String path = icons[i]; icon_array[i] = displayUtils.loadIcon(path); } } catch (IOException e) { Logger.error("Failed to load icons"); e.printStackTrace(); } createCapabilities(); super.vg = nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG); if (vg == NULL) throw new RuntimeException("Fail to create NanoVG"); lastLoopTime = getTime(); ByteBuffer w = BufferUtils.createByteBuffer(4); ByteBuffer h = BufferUtils.createByteBuffer(4); glfwGetFramebufferSize(window, w, h); super.displayFramebufferWidth = w.getInt(0); super.displayFramebufferHeight = h.getInt(0); glfwGetWindowSize(super.window, w, h); super.displayWidth = w.getInt(0); super.displayHeight = h.getInt(0); super.pixelRatio = (float) displayFramebufferWidth / (float) displayWidth; glViewport(0, 0, (int) (displayWidth * pixelRatio), (int) (displayHeight * pixelRatio)); if (glGetString(GL_VENDOR).contains("NVIDIA")) nvidia = true; else if (glGetString(GL_VENDOR).contains("AMD")) amd = true; if (nvidia) glGetIntegerv(NVXGPUMemoryInfo.GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, maxVram); else if (amd) glGetIntegerv(WGLAMDGPUAssociation.WGL_GPU_RAM_AMD, maxVram); if (nvidia) Logger.log("Max VRam: " + maxVram.get(0) + "KB"); else if (amd) Logger.log("Max VRam: " + maxVram.get(0) + "MB"); super.displayCreated = true; }