Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

40,038 questions

52,003 answers

573 users

How to get the graphics card model name using OpenGL in C

1 Answer

0 votes
#include <GL/glew.h>
#include <GLFW/glfw3.h>

#include <stdio.h>

const GLint WIDTH = 800, HEIGHT = 600;

int main(void)
{
    if (!glfwInit()) {
        printf("glfwInit() Error");
        return 1;
    }

    GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "window title", NULL, NULL);
    if (!window) {
        printf("glfwCreateWindow() Error");
        glfwTerminate();
        return 1;
    }

    glfwMakeContextCurrent(window);

    glewExperimental = GL_TRUE;

    if (glewInit() != GLEW_OK) {
        printf("glewInit() Error");
        glfwDestroyWindow(window);
        glfwTerminate();
    }

    const GLubyte* vendor = glGetString(GL_VENDOR); // get the vendor
    printf("Vendor: %s\n", vendor);
    const GLubyte* renderer = glGetString(GL_RENDERER); // get the graphic card model
    printf("Renderer: %s", renderer);

    
    while (!glfwWindowShouldClose(window)) {
        glfwPollEvents();
    }

    glfwDestroyWindow(window);
    glfwTerminate();

    return 0;
}




/*
run:

Vendor: NVIDIA Corporation
Renderer: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2

*/

 



answered Mar 19, 2022 by avibootz

Related questions

1 answer 216 views
1 answer 175 views
175 views asked Mar 19, 2022 by avibootz
1 answer 283 views
1 answer 199 views
...