Getting maximum possible texture size and GPU memory available

Getting maximum possible texture size

Material is based on OpenGL Wiki page: https://www.khronos.org/opengl/wiki/Textures_-_more

    int max_tex_size;
    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size);  
    cout << "GPU maximal 2D texture size: " << max_tex_size << endl;

For 3D texture: GL_MAX_3D_TEXTURE_SIZE
For cubemap texture:GL_MAX_CUBE_MAP_TEXTURE_SIZE

Getting total and available GPU memory for NVidia cards

Material is based on the article How to Know the Graphics Memory Size and Usage In OpenGL by JEGX:
https://www.geeks3d.com/20100531/programming-tips-how-to-know-the-graphics-memory-size-and-usage-in-opengl/

    #define GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX 0x9048    #define GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX 0x9049

    GLint total_mem_kb = 0;
    glGetIntegerv(GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX, &total_mem_kb);
    cout << "Nvidia GPU total memory: " << total_mem_kb / 1024 << " Mb" << endl;

    GLint cur_avail_mem_kb = 0;
    glGetIntegerv(GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX, &cur_avail_mem_kb);
    cout << "Nvidia GPU available memory: " << cur_avail_mem_kb / 1024 << " Mb" << endl;


Comments

Popular posts from this blog

Computing ray origin and direction from Model View Projection matrices for raymarching

Forward and backward alpha blending for raymarching

Forward, Deferred and Raytracing rendering in openFrameworks and web