Patched kmx's patch from here http://rt.cpan.org/Ticket/Display.html?id=49000
[sdlgit/SDL_perl.git] / src / OpenGL.xs
index ad8dee2..807c997 100644 (file)
 #include <glu.h>
 #else
 #include <GL/gl.h>
+
+#if defined(__WIN32__) && defined(__MINGW32__)
+/* 
+this is a sort of dirty hack - MS Windows supports just OpenGL 1.1 and all 1.2+
+related stuff was moved from GL/gl.h to GL/glext.h; however this separation
+was done not properly and even if we are OK with OpenGL 1.1 there are some
+constants missing in GL/gl.h thus we need also GL/glext.h
+*/
+#include <GL/glext.h>
+#undef GL_VERSION_1_3
+#undef GL_VERSION_1_2
+#endif
+
 #include <GL/glu.h>
 #endif
 
@@ -54,7 +67,7 @@
 #define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFF
 #endif /* GL_ALL_CLIENT_BITS */  
 
-#include "../src/defines.h"
+#include "../../src/defines.h"
 
 SV* sdl_perl_nurbs_error_hook;
 void
@@ -875,6 +888,8 @@ glDrawElements ( mode, count, type, indices )
        CODE:
                glDrawElements( mode, count, type, indices);
 
+#ifdef GL_VERSION_1_2
+
 void
 glDrawRangeElements ( mode, start, end, count, type, indices )
        GLenum mode
@@ -886,6 +901,8 @@ glDrawRangeElements ( mode, start, end, count, type, indices )
        CODE:
                glDrawRangeElements(mode,start,end,count,type,indices);
 
+#endif // GL_VERSION_1_2
+
 void
 glDrawArrays ( mode, first, count )
        GLenum mode
@@ -2424,8 +2441,10 @@ gluNurbsCallback ( obj, which, cb )
                                gluNurbsCallback(obj,GLU_ERROR,(GLvoid*)sdl_perl_nurbs_error_callback);
                                break;
 #ifdef GLU_NURBS_BEGIN
+#ifdef GLU_VERSION_1_3
                        case GLU_NURBS_BEGIN:
                        case GLU_NURBS_BEGIN_DATA:
+
                                gluNurbsCallbackData(obj,(void*)cb);
                                gluNurbsCallback(obj,GLU_NURBS_BEGIN_DATA,
                                        (GLvoid*)sdl_perl_nurbs_being_callback);        
@@ -2460,11 +2479,14 @@ gluNurbsCallback ( obj, which, cb )
                                gluNurbsCallback(obj,GLU_NURBS_END_DATA,
                                        (GLvoid*)sdl_perl_nurbs_end_callback);  
                                break;
-#endif
+#endif // GLU_VERSION_1_3
+#endif // GLU_NURBS_BEGIN
                        default:
                                Perl_croak(aTHX_ "SDL::OpenGL::NurbsCallback - invalid type");
                }
 
+#ifdef GLU_VERSION_1_3
+
 void
 gluNurbsCallbackData ( obj, cb )
        GLUnurbsObj *obj
@@ -2472,6 +2494,8 @@ gluNurbsCallbackData ( obj, cb )
        CODE:
                gluNurbsCallbackData(obj,(void*)cb);
 
+#endif
+
 void
 gluBeginSurface ( obj )
        GLUnurbsObj *obj