Allowing "freeglut" to compile without errors under *nix. Before this, there were...
[freeglut] / src / freeglut_internal.h
index 572600e..f7155d5 100644 (file)
 #    ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
 #        include <X11/extensions/xf86vmode.h>
 #    endif
+/* If GLX is too old, we will fail during runtime when multisampling
+   is requested, but at least freeglut compiles. */
+#    ifndef GLX_SAMPLE_BUFFERS
+#        define GLX_SAMPLE_BUFFERS 0x80A8
+#    endif
+#    ifndef GLX_SAMPLES
+#        define GLX_SAMPLES 0x80A9
+#    endif
 
 #endif
 
 /* These files should be available on every platform. */
-#include <GL/gl.h>
-#include <GL/glu.h>
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
@@ -246,18 +252,6 @@ struct tagSFG_XYUse
     GLboolean       Use;                /* ...and a single boolean.          */
 };
 
-/* A helper structure holding a timeval and a boolean */
-typedef struct tagSFG_Time SFG_Time;
-struct tagSFG_Time
-{
-#if TARGET_HOST_MS_WINDOWS
-    DWORD Value;
-#else
-    struct timeval  Value;
-#endif
-    GLboolean       Set;
-};
-
 /*
  * An enumeration containing the state of the GLUT execution:
  * initializing, running, or stopping
@@ -294,7 +288,7 @@ struct tagSFG_State
     GLuint           SwapCount;            /* Count of glutSwapBuffer calls  */
     GLuint           SwapTime;             /* Time of last SwapBuffers       */
 
-    SFG_Time         Time;                 /* Time that glutInit was called  */
+    unsigned long    Time;                 /* Time that glutInit was called  */
     SFG_List         Timers;               /* The freeglut timer hooks       */
     SFG_List         FreeTimers;           /* The unused timer hooks         */
 
@@ -314,6 +308,13 @@ struct tagSFG_State
     char            *ProgramName;         /* Name of the invoking program    */
     GLboolean        JoysticksInitialised;  /* Only initialize if application calls for them */
     GLboolean        InputDevsInitialised;  /* Only initialize if application calls for them */
+
+    int              AuxiliaryBufferNumber;  /* Number of auxiliary buffers */
+    int              SampleNumber;         /*  Number of samples per pixel  */
+
+    int              MajorVersion;         /* Major OpenGL context version  */
+    int              MinorVersion;         /* Minor OpenGL context version  */
+    int              ContextFlags;         /* OpenGL context flags          */
 };
 
 /* The structure used by display initialization in freeglut_init.c */
@@ -326,6 +327,8 @@ struct tagSFG_Display
     Window          RootWindow;         /* The screen's root window.         */
     int             Connection;         /* The display's connection number   */
     Atom            DeleteWindow;       /* The window deletion atom          */
+    Atom            State;              /* The state atom                    */
+    Atom            StateFullScreen;    /* The full screen atom              */
 
 #ifdef X_XF86VidModeGetModeLine
     /*
@@ -392,7 +395,7 @@ struct tagSFG_Context
     SFG_WindowContextType Context;   /* The window's OpenGL/WGL context     */
 
 #if TARGET_HOST_POSIX_X11
-    XVisualInfo*    VisualInfo;      /* The window's visual information     */
+    GLXFBConfig*    FBConfig;        /* The window's FBConfig               */
 #elif TARGET_HOST_MS_WINDOWS
     HDC             Device;          /* The window's device context         */
 #endif
@@ -422,7 +425,6 @@ struct tagSFG_WindowState
     GLboolean       IgnoreKeyRepeat;    /* Whether to ignore key repeat.     */
     GLboolean       KeyRepeating;       /* Currently in repeat mode          */
 
-    GLboolean       IsGameMode;         /* Is this the game mode window?     */
     GLboolean       NeedToResize;       /* Do we need to resize the window?  */
 };
 
@@ -569,10 +571,6 @@ enum
 typedef struct tagSFG_MenuContext SFG_MenuContext;
 struct tagSFG_MenuContext
 {
-#if TARGET_HOST_POSIX_X11
-    XVisualInfo*        MVisualInfo;      /* The window's visual information */
-#endif
-
     SFG_WindowContextType MContext;       /* The menu window's WGL context   */
 };
 
@@ -689,6 +687,18 @@ struct tagSFG_Font
     float           xorig, yorig; /* Relative origin of the character */
 };
 
+#if TARGET_HOST_POSIX_X11
+
+struct freeglutBitmapFont
+{
+  const char *name ;
+  const int num_chars ;
+  const int first ;
+  const void *ch ;
+};
+
+#endif
+
 /* The stroke font structures */
 
 typedef struct tagSFG_StrokeVertex SFG_StrokeVertex;
@@ -799,7 +809,7 @@ void fgDestroyStructure( void );
 
 /* A helper function to check if a display mode is possible to use */
 #if TARGET_HOST_POSIX_X11
-XVisualInfo* fgChooseVisual( void );
+GLXFBConfig* fgChooseFBConfig( void );
 #endif
 
 /* The window procedure for Win32 events handling */
@@ -816,12 +826,14 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
  * Defined in freeglut_structure.c, freeglut_window.c.
  */
 SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
-                            int x, int y, int w, int h,
+                            GLboolean positionUse, int x, int y,
+                            GLboolean sizeUse, int w, int h,
                             GLboolean gameMode, GLboolean isMenu );
 void        fgSetWindow ( SFG_Window *window );
 void        fgOpenWindow( SFG_Window* window, const char* title,
-                          int x, int y, int w, int h, GLboolean gameMode,
-                          GLboolean isSubWindow );
+                          GLboolean positionUse, int x, int y,
+                          GLboolean sizeUse, int w, int h,
+                          GLboolean gameMode, GLboolean isSubWindow );
 void        fgCloseWindow( SFG_Window* window );
 void        fgAddToWindowDestroyList ( SFG_Window* window );
 void        fgCloseWindows ();
@@ -900,6 +912,9 @@ void fgDisplayMenu( void );
 /* Elapsed time as per glutGet(GLUT_ELAPSED_TIME). */
 long fgElapsedTime( void );
 
+/* System time in milliseconds */
+long unsigned fgSystemTime(void);
+
 /* List functions */
 void fgListInit(SFG_List *list);
 void fgListAppend(SFG_List *list, SFG_Node *node);
@@ -911,6 +926,15 @@ void fgListInsert(SFG_List *list, SFG_Node *next, SFG_Node *node);
 void fgError( const char *fmt, ... );
 void fgWarning( const char *fmt, ... );
 
+/*
+ * Check if "hint" is present in "property" for "window".  See freeglut_init.c
+ */
+#if TARGET_HOST_POSIX_X11
+int fgHintPresent(Window window, Atom property, Atom hint);
+#endif
+
+SFG_Proc fghGetProcAddress( const char *procName );
+
 #endif /* FREEGLUT_INTERNAL_H */
 
 /*** END OF FILE ***/