G
G
Grigory Dikiy2016-09-29 11:05:09
C++ / C#
Grigory Dikiy, 2016-09-29 11:05:09

Create an OpenGL extension library?

Good day. The university set the task of creating a dynamic or static library of extensions and connecting it to the project with OpenGL in order to take functions from there to work with them.
This is how the task sounds:
b6f8d7d4b9494820932b7ea2e6041035.png
Actually the links that were given:
www.opengl.org/registry/doc/glspec33.core.20100311.pdf
https://www.opengl.org/sdk/docs/man/
Actually the question:
What does the author of the task have in view of the creation of extensions? Does he really want me to write the work of the functions included in the opengl 3.3 standard and then make my own dynamic library? Or did he mean something else?
Actually, the example that was given in the manual:

if (SDL_GL_LoadLibrary("libGL.so") == -1) {
        SDL_LogCritical(SDL_LOG_PRIORITY_CRITICAL, "Unable to load OpenGL library: %s", SDL_GetError());
    }

    typedef void ( * PFNGLCLEARCOLORPROC)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
    typedef void ( * PFNGLCLEARPROC)(GLbitfield );

    PFNGLCLEARPROC glClear;
    PFNGLCLEARCOLORPROC glClearColor;

    // Получаем адреса функций
    glClear = (PFNGLCLEARPROC)SDL_GL_GetProcAddress("glClear");
    glClearColor = (PFNGLCLEARCOLORPROC)SDL_GL_GetProcAddress("glClearColor");

The author says "make a library for this piece of code", but not for 2 functions, but for 400. The second question is, is it possible to do this? How can I create a library that, as you can see from the example, will require SDL_GL_LoadLibrary("libGL.so") and load another library and what is the benefit of using it, because it turns out "recursion" to use one library to load the functions of another library is not better then just copy libGL.so rename and create a header with these addresses?
PS Maybe I'm still stupid and don't understand anything in life and programming

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Tsilyurik, 2016-09-29
@frilix

Maybe I'm still stupid and don't understand anything in life and programming

Most likely, that's exactly what it is...
Since this is a training task for pYanErs, the author most likely meant to simply create a wrapper for OpenGL 3.3 ...
... in order to make original calls to OpenGL through its own transit library. And not all 400 pieces, but only those 2 or 3 calls that your calling application makes.
With the goal, just to show that you understand what libraries are in general and know how to create them.
If you master this business in Linux, then here is a fairly detailed description of the library technique for you - Developing software projects in Linux .
If you prefer Windows... read Jeffrey Richter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question