Advertisement
maany

Lwjgl mem info

Mar 31st, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. public int getFreeMemory() {
  2.         if(glGetString(GL_VENDOR).equals("NVIDIA Technologies")){
  3.             return glGetInteger(NVXGpuMemoryInfo.GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX);
  4.         }
  5.         else if(glGetString(GL_VENDOR).equals("ATI Technologies")){
  6.             return glGetInteger(ATIMeminfo.GL_RENDERBUFFER_FREE_MEMORY_ATI) + glGetInteger(ATIMeminfo.GL_TEXTURE_FREE_MEMORY_ATI) + glGetInteger(ATIMeminfo.GL_VBO_FREE_MEMORY_ATI);
  7.         }
  8.         else{
  9.             throw new UnsupportedOperationException("Cannot retrieve GPU's memory info");
  10.         }
  11.     }
  12.  
  13. public int getMaxMemory() {
  14.        if(glGetString(GL_VENDOR).equals("NVIDIA Technologies")){
  15.             return glGetInteger(NVXGpuMemoryInfo.GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX);
  16.         }
  17.         else if(glGetString(GL_VENDOR).equals("ATI Technologies")){
  18.             return -1;
  19.         }
  20.         else{
  21.             throw new UnsupportedOperationException("Cannot retrieve GPU's memory info");
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement