Bonjour,
Je souhaiterais rendre un programme OpenGL qui fonctionne sous Linux portable pour Windows.
Si j'en crois le lien ci-dessous il faut utiliser wglGetProcAddress()
http://www.opengl.org/resources/code...s/node396.html
J'ai donc codé quelque chose comme ça :
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 #ifdef _WIN32 #define DECLARE_FUNC(func, f_type) \ static f_type func = NULL; \ static unsigned int func##_is_loaded = 0; #define LOAD_FUNC(func, f_type) \ func = (f_type) wglGetProcAddress(#func); \ if (func != NULL) func##_is_loaded = 1; #define IS_FUNC_LOADED(func) \ if (!func##_is_loaded) raise_exception("Unable to load " #func); // list of all the functions that windows has to load DECLARE_FUNC(glCreateShader, PFNGLCREATESHADERPROC) /* etc ... */ void windows_init() { // list of the functions that windows has to load: LOAD_FUNC(glCreateShader, PFNGLCREATESHADERPROC) /* etc ... */ } #else #define IS_FUNC_LOADED(func) void windows_init() { return; } #endif /* utilisation */ IS_FUNC_LOADED(glCreateShader) GLuint s = glCreateShader(GL_VERTEX_SHADER);
J'ai uniquement accès à des machines sous Linux ou MacOS X, donc j'aurais quelques questions pour Windows que je ne vais pas pouvoir tester :
1) Est-ce la manière correcte de procéder ?
2) Où puis-je trouver la liste exhaustive des fonctions que je dois loader de cette manière ?
3) dois-je conseiller aux utilisateurs Windows d'utiliser mon application avec cygwin ? MinGW ? quelque chose d'autre ? rien du tout ?
merci d'avance

