FLTK logo

[master] acf7254 - macOS+OpenGL3: remove "warning: gl.h and gl3.h are both included"

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] acf7254 - macOS+OpenGL3: remove "warning: gl.h and gl3.h are both included" "ManoloFLTK" Nov 26, 2022  
 
commit acf7254fe8337e8b06462555d09d6521723c2024
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Sun Nov 27 08:06:33 2022 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Sun Nov 27 08:06:33 2022 +0100

    macOS+OpenGL3: remove "warning: gl.h and gl3.h are both included"

 FL/gl.h                      | 10 ++++------
 documentation/src/opengl.dox |  2 +-
 src/gl_draw.cxx              |  8 ++++++++
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git FL/gl.h FL/gl.h
index a30d2ea..10eb05e 100644
--- FL/gl.h
+++ FL/gl.h
@@ -55,7 +55,9 @@
 #  endif
 
 #  ifdef __APPLE__ // PORTME: OpenGL path abstraction
-#    include <OpenGL/gl.h>
+#    if !defined(__gl3_h_) // make sure OpenGL/gl3.h was not included before
+#      include <OpenGL/gl.h>
+#    endif
 #  else
 #    include <GL/gl.h>
 #  endif  // __APPLE__ // PORTME: OpenGL Path abstraction
@@ -68,11 +70,7 @@ FL_EXPORT void gl_color(Fl_Color i);
 inline void gl_color(int c) {gl_color((Fl_Color)c);}
 
 FL_EXPORT void gl_rect(int x,int y,int w,int h);
-/**
-  Fills the given rectangle with the current color.
-  \see gl_rect(int x, int y, int w, int h)
-  */
-inline void gl_rectf(int x,int y,int w,int h) {glRecti(x,y,x+w,y+h);}
+FL_EXPORT void gl_rectf(int x,int y,int w,int h);
 
 FL_EXPORT void gl_font(int fontid, int size);
 FL_EXPORT int  gl_height();
diff --git documentation/src/opengl.dox documentation/src/opengl.dox
index 7b544d2..6ab4dc2 100644
--- documentation/src/opengl.dox
+++ documentation/src/opengl.dox
@@ -588,7 +588,7 @@ pacman -S mingw-w64-x86_64-glew
 </ul>
 
 \par  Source-level changes for OpenGL 3:
-\li Put this in all OpenGL-using source files (instead of \#include <FL/gl.h>,
+\li Put this in all OpenGL-using source files (instead of, or before if needed, \#include <FL/gl.h>,
 and before \#include <FL/glut.h> if you use GLUT):
 \code
 #if defined(__APPLE__)
diff --git src/gl_draw.cxx src/gl_draw.cxx
index 16a70a0..35b2007 100644
--- src/gl_draw.cxx
+++ src/gl_draw.cxx
@@ -225,6 +225,14 @@ void gl_rect(int x, int y, int w, int h) {
   glEnd();
 }
 
+/**
+  Fills the given rectangle with the current color.
+  \see gl_rect(int x, int y, int w, int h)
+  */
+void gl_rectf(int x,int y,int w,int h) {
+  glRecti(x,y,x+w,y+h);
+}
+
 void gl_draw_image(const uchar* b, int x, int y, int w, int h, int d, int ld) {
   if (!ld) ld = w*d;
   GLint row_length;
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.