Commits

Lenard Lindstrom committed e731721

opengl save segfault: moved __stdcall again

Comments (0)

Files changed (3)

  */
 #include "pygame.h"
 #include "pygamedocs.h"
+#include "pgopengl.h"
 
 static int is_extended = 0;
 static int SaveTGA (SDL_Surface *surface, char *file, int rle);
     Uint32 rmask, gmask, bmask;
     int i;
     unsigned char *pixels;
-#ifdef _WIN32
-    typedef void __stdcall (*GL_glReadPixels_Func)(int, int, int, int, unsigned int, unsigned int, void*);
-#else
-    typedef void (*GL_glReadPixels_Func)(int, int, int, int, unsigned int, unsigned int, void*);
-#endif
 
     GL_glReadPixels_Func p_glReadPixels= NULL;
     pixels = NULL;
 #include <jpeglib.h>
 #include "pygame.h"
 #include "pygamedocs.h"
+#include "pgopengl.h"
 #include <SDL_image.h>
 
 static char*
     Uint32 rmask, gmask, bmask;
     int i;
     unsigned char *pixels;
-#ifdef _WIN32
-    typedef void __stdcall (*GL_glReadPixels_Func)(int, int, int, int, unsigned int, unsigned int, void*);
-#else
-    typedef void (*GL_glReadPixels_Func)(int, int, int, int, unsigned int, unsigned int, void*);
-#endif
 
     GL_glReadPixels_Func p_glReadPixels= NULL;
     pixels = NULL;
+#if !defined(PGOPENGL_H)
+#define PGOPENGL_H
+
+/** This header includes definitions of Opengl functions as pointer types for
+ ** use with the SDL function SDL_GL_GetProcAddress.
+ **/
+
+#if defined(_WIN32)
+#define GL_APIENTRY __stdcall
+#else
+#define GL_APIENTRY
+#endif
+
+typedef void (GL_APIENTRY *GL_glReadPixels_Func)(int, int, int, int, unsigned int, unsigned int, void*);
+
+#endif