|
32 | 32 | extern "C" { |
33 | 33 | #endif |
34 | 34 |
|
| 35 | +/** |
| 36 | + * @brief Callback function for resolving function pointers. |
| 37 | + * |
| 38 | + * This callback functions is used to resolve platform-dependent GL function pointers. |
| 39 | + * |
| 40 | + * @param name The name of the function to resolve. |
| 41 | + * @param user_data A user-defined data pointer that is passed along with the load proc call, |
| 42 | + * e.g. context information. |
| 43 | + * @since 4.2.0 |
| 44 | + */ |
| 45 | +typedef void* (*projectm_load_proc)(const char* name, void* user_data); |
| 46 | + |
35 | 47 | /** |
36 | 48 | * @brief Creates a new projectM instance. |
37 | 49 | * |
38 | 50 | * If this function returns NULL, in most cases the OpenGL context is not initialized, not made |
39 | 51 | * current or insufficient to render projectM visuals. |
40 | 52 | * |
| 53 | + * The OpenGL resolver is initialized on the first call to either projectm_create() or projectm_create_with_opengl_load_proc(). |
| 54 | + * All projectM instances share the same resolver. |
| 55 | + * |
41 | 56 | * @return A projectM handle for the newly created instance that must be used in subsequent API calls. |
42 | 57 | * NULL if the instance could not be created successfully. |
43 | 58 | * @since 4.0.0 |
44 | 59 | */ |
45 | 60 | PROJECTM_EXPORT projectm_handle projectm_create(); |
46 | 61 |
|
| 62 | +/** |
| 63 | + * @brief Creates a new projectM instance using the given function to resolve GL api functions. |
| 64 | + * |
| 65 | + * The load_proc function accepts a function name and a user data pointer. |
| 66 | + * If this function returns NULL, in most cases the OpenGL context is not initialized, not made |
| 67 | + * current or insufficient to render projectM visuals. |
| 68 | + * |
| 69 | + * The OpenGL resolver is initialized on the first call to either projectm_create() or projectm_create_with_opengl_load_proc(). |
| 70 | + * All projectM instances share the same resolver, and subsequent calls ignore the provided load_proc. |
| 71 | + * |
| 72 | + * @param load_proc Callback function used to resolve OpenGL function pointers. Optional, may be NULL. |
| 73 | + * @param user_data Custom user data pointer to pass along to the load_proc call, e.g. context information. Optional, may be NULL. |
| 74 | + * @return A projectM handle for the newly created instance that must be used in subsequent API calls. |
| 75 | + * NULL if the instance could not be created successfully. |
| 76 | + * @since 4.2.0 |
| 77 | + */ |
| 78 | +PROJECTM_EXPORT projectm_handle projectm_create_with_opengl_load_proc(projectm_load_proc load_proc, void* user_data); |
| 79 | + |
47 | 80 | /** |
48 | 81 | * @brief Destroys the given instance and frees the resources. |
49 | 82 | * |
|
0 commit comments