Fix compiler warnings
authorSylvain Beucler <beuc@beuc.net>
Sat, 21 Apr 2012 17:40:25 +0000 (17:40 +0000)
committerSylvain Beucler <beuc@beuc.net>
Sat, 21 Apr 2012 17:40:25 +0000 (17:40 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1256 7f0cb862-5218-0410-a997-914c9d46530a

26 files changed:
CMakeLists.txt
progs/test-shapes-gles1/CMakeLists.txt
src/android/fg_gamemode_android.c
src/android/fg_init_android.c
src/android/fg_input_devices_android.c
src/android/fg_internal_android.h
src/android/fg_joystick_android.c
src/android/fg_main_android.c
src/android/fg_main_android.h [new file with mode: 0644]
src/android/fg_runtime_android.c
src/android/fg_spaceball_android.c
src/android/fg_state_android.c
src/android/fg_window_android.c
src/android/native_app_glue/android_native_app_glue.h
src/egl/fg_ext_egl.c
src/egl/fg_init_egl.c
src/egl/fg_init_egl.h [new file with mode: 0644]
src/egl/fg_state_egl.c
src/egl/fg_state_egl.h [new file with mode: 0644]
src/egl/fg_window_egl.c
src/egl/fg_window_egl.h
src/fg_geometry.c
src/fg_gl2.c
src/fg_main.h [new file with mode: 0644]
src/gles_stubs.c
src/x11/fg_internal_x11.h

index 828b7b2..d3f083a 100644 (file)
@@ -50,6 +50,7 @@ SET(FREEGLUT_SRCS
     src/fg_input_devices.c
     src/fg_joystick.c
     src/fg_main.c
+    src/fg_main.h
     src/fg_misc.c
     src/fg_overlay.c
     src/fg_spaceball.c
@@ -103,15 +104,6 @@ IF(WIN32)
 
 ELSEIF(ANDROID)
     LIST(APPEND FREEGLUT_SRCS
-        src/egl/fg_internal_egl.h
-        src/egl/fg_display_egl.c
-        src/egl/fg_ext_egl.c
-        src/egl/fg_init_egl.c
-        src/egl/fg_state_egl.c
-        src/egl/fg_structure_egl.c
-        src/egl/fg_structure_egl.h
-        src/egl/fg_window_egl.c
-        src/egl/fg_window_egl.h
         src/android/native_app_glue/android_native_app_glue.c
         src/android/native_app_glue/android_native_app_glue.h
         src/android/fg_internal_android.h
@@ -122,6 +114,7 @@ ELSEIF(ANDROID)
         src/android/fg_input_devices_android.c
         src/android/fg_joystick_android.c
         src/android/fg_main_android.c
+        src/android/fg_main_android.h
         src/android/fg_runtime_android.c
         src/android/fg_spaceball_android.c
         src/android/fg_state_android.c
@@ -146,17 +139,7 @@ ELSE()
         src/x11/fg_window_x11.c
         src/x11/fg_xinput_x11.c
     )
-    IF(FREEGLUT_GLES2 OR FREEGLUT_GLES1)
-        LIST(APPEND FREEGLUT_SRCS
-            src/egl/fg_internal_egl.h
-            src/egl/fg_display_egl.c
-            src/egl/fg_ext_egl.c
-            src/egl/fg_init_egl.c
-            src/egl/fg_state_egl.c
-            src/egl/fg_structure_egl.c
-            src/egl/fg_window_egl.c
-        )
-    ELSE()
+    IF(!(FREEGLUT_GLES2 OR FREEGLUT_GLES1))
         LIST(APPEND FREEGLUT_SRCS
             src/x11/fg_internal_x11_glx.h
             src/x11/fg_display_x11_glx.c
@@ -166,6 +149,21 @@ ELSE()
         )
     ENDIF()
 ENDIF()
+IF(FREEGLUT_GLES2 OR FREEGLUT_GLES1)
+    LIST(APPEND FREEGLUT_SRCS
+        src/egl/fg_internal_egl.h
+        src/egl/fg_display_egl.c
+        src/egl/fg_ext_egl.c
+        src/egl/fg_init_egl.c
+        src/egl/fg_init_egl.h
+        src/egl/fg_state_egl.c
+        src/egl/fg_state_egl.h
+        src/egl/fg_structure_egl.c
+        src/egl/fg_structure_egl.h
+        src/egl/fg_window_egl.c
+        src/egl/fg_window_egl.h
+    )
+ENDIF()
 
 # For OpenGL ES (GLES):
 # - compile with -DFREEGLUT_GLES1 and -DFREEGLUT_GLES2 to cleanly
index 24e97d1..3c1f40a 100644 (file)
@@ -1,6 +1,14 @@
 cmake_minimum_required(VERSION 2.6)
 project(test-shapes-gles1)
 
+IF(CMAKE_COMPILER_IS_GNUCC)
+  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+  IF(!ANDROID)
+    # not setting -ansi as EGL/KHR headers doesn't support it
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi")
+  ENDIF()
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
 # FreeGLUT
 include(FindPkgConfig)
 pkg_check_modules(freeglut REQUIRED freeglut-gles1>=3.0.0)
index 8cd3034..14683ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_gamemode_x11.c
+ * fg_gamemode_x11.c
  *
  * The game mode handling code.
  *
index 70b276c..a07cedd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_init_android.c
+ * fg_init_android.c
  *
  * Various freeglut initialization functions.
  *
@@ -25,6 +25,7 @@
 
 #include <GL/freeglut.h>
 #include "fg_internal.h"
+#include "egl/fg_init_egl.h"
 
 void fgPlatformInitialize()
 {
index ac3aea5..89f412b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_input_devices_android.c
+ * fg_input_devices_android.c
  *
  * Handles miscellaneous input devices via direct serial-port access.
  *
index a0441b5..c072136 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_internal_android.h
+ * fg_internal_android.h
  *
  * The freeglut library private include file.
  *
@@ -104,6 +104,7 @@ struct tagSFG_PlatformJoystick
 typedef struct tagSFG_PlatformWindowState SFG_PlatformWindowState;
 struct tagSFG_PlatformWindowState
 {
+    int unused;
 };
 
 #endif  /* FREEGLUT_INTERNAL_ANDROID_H */
index 5328285..084978a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_joystick_android.c
+ * fg_joystick_android.c
  *
  * Joystick handling code
  *
index 3f973f2..9d5ebf6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_main_android.c
+ * fg_main_android.c
  *
  * The Android-specific windows message processing methods.
  *
@@ -28,6 +28,7 @@
 
 #include <GL/freeglut.h>
 #include "fg_internal.h"
+#include "fg_main.h"
 
 #include <android/log.h>
 #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "FreeGLUT", __VA_ARGS__))
@@ -217,13 +218,13 @@ int32_t handle_input(struct android_app* app, AInputEvent* event) {
     LOGI("motion %.01f,%.01f action=%d", x, y, AMotionEvent_getAction(event));
     
     /* Virtual arrows PAD */
-    // Don't interfere with existing mouse move event
+    /* Don't interfere with existing mouse move event */
     if (!touchscreen.in_mmotion) {
       struct vpad_state prev_vpad = touchscreen.vpad;
       touchscreen.vpad.left = touchscreen.vpad.right
        = touchscreen.vpad.up = touchscreen.vpad.down = false;
 
-      int32_t width = ANativeWindow_getWidth(window->Window.Handle);
+      /* int32_t width = ANativeWindow_getWidth(window->Window.Handle); */
       int32_t height = ANativeWindow_getHeight(window->Window.Handle);
       if (action == AMOTION_EVENT_ACTION_DOWN || action == AMOTION_EVENT_ACTION_MOVE) {
        if ((x > 0 && x < 100) && (y > (height - 100) && y < height))
@@ -273,7 +274,7 @@ int32_t handle_input(struct android_app* app, AInputEvent* event) {
     if (!touchscreen.vpad.on) {
       window->State.MouseX = x;
       window->State.MouseY = y;
-      LOGI("Changed mouse position: %d,%d", x, y);
+      LOGI("Changed mouse position: %f,%f", x, y);
       if (action == AMOTION_EVENT_ACTION_DOWN && FETCH_WCB(*window, Mouse)) {
        touchscreen.in_mmotion = true;
        INVOKE_WCB(*window, Mouse, (GLUT_LEFT_BUTTON, GLUT_DOWN, x, y));
diff --git a/src/android/fg_main_android.h b/src/android/fg_main_android.h
new file mode 100644 (file)
index 0000000..7a00986
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * fg_main_android.h
+ *
+ * The Android-specific windows message processing methods.
+ *
+ * Copyright (C) 2012  Sylvain Beucler
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __FG_MAIN_ANDROID_H__
+#define __FG_MAIN_ANDROID_H__
+
+extern void fgPlatformProcessSingleEvent(void);
+extern void fgPlatformReshapeWindow(SFG_Window *window, int width, int height);
+extern void fgPlatformDisplayWindow(SFG_Window *window);
+extern unsigned long fgPlatformSystemTime(void);
+extern void fgPlatformSleepForEvents(long msec);
+extern void fgPlatformMainLoopPreliminaryWork(void);
+extern void fgPlatformDeinitialiseInputDevices(void);
+
+#endif
index 13f2e86..1b92bf6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_runtime_android.c
+ * fg_runtime_android.c
  *
  * Android runtime
  *
@@ -78,7 +78,6 @@ static void onNativeWindowResized(ANativeActivity* activity, ANativeWindow* wind
 static void onNativeWindowRedrawNeeded(ANativeActivity* activity, ANativeWindow* window) {
   LOGI("onNativeWindowRedrawNeeded: %p\n", (void*)activity);
   struct android_app* app = (struct android_app*)activity->instance;
-  //if (fgDisplay.pDisplay.single_window->Window.pContext.eglSurface != EGL_NO_SURFACE)
   android_app_write_cmd(app, APP_CMD_WINDOW_RESIZED);
 }
 
@@ -138,7 +137,7 @@ static void extract_assets(struct android_app* app) {
 void android_main(struct android_app* app) {
   LOGI("android_main");
 
-  // Register window resize callback
+  /* Register window resize callback */
   app->activity->callbacks->onNativeWindowResized = onNativeWindowResized;
   app->activity->callbacks->onContentRectChanged = onContentRectChanged;
   app->activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded;
index 2f04d67..b06410b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_spaceball_android.c
+ * fg_spaceball_android.c
  *
  * Spaceball support for Windows
  *
index f229c95..6aed163 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_state_android.c
+ * fg_state_android.c
  *
  * Android-specific freeglut state query methods.
  *
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <android/native_window.h>
 #include "fg_internal.h"
+#include "egl/fg_state_egl.h"
 
 int fgPlatformGlutDeviceGet ( GLenum eWhat )
 {
index 58d612a..4c5d9d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_window_android.c
+ * fg_window_android.c
  *
  * Window management methods for Android
  *
@@ -30,6 +30,7 @@
 #include <GL/freeglut.h>
 #include "fg_internal.h"
 #include "egl/fg_window_egl.h"
+#include "android/fg_main_android.h"
 
 /*
  * Opens a window. Requires a SFG_Window object created and attached
@@ -40,14 +41,11 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
                            GLboolean sizeUse, int w, int h,
                            GLboolean gameMode, GLboolean isSubWindow )
 {
-  // printf("fgPlatformOpenWindow %p ID=%d\n", (void*)window, window->ID);
-
   /* TODO: only one full-screen window possible? */
   static int nb_windows = 0;
   if (nb_windows == 0) {
     nb_windows++;
     fgDisplay.pDisplay.single_window = window;
-    // printf("=> %p ID=%d\n", (void*)fgDisplay.pDisplay.single_window, fgDisplay.pDisplay.single_window->ID);
   } else {
     return;
   }
index e7faba3..0c59ec2 100644 (file)
@@ -342,6 +342,8 @@ void app_dummy();
  */
 extern void android_main(struct android_app* app);
 
+/* static  */void android_app_write_cmd(struct android_app* android_app, int8_t cmd);
+
 #ifdef __cplusplus
 }
 #endif
index c5dfc2b..417f6ed 100644 (file)
@@ -28,5 +28,5 @@
 
 SFG_Proc fgPlatformGetProcAddress( const char *procName )
 {
-    return (SFG_Proc)eglGetProcAddress( ( const GLubyte * )procName );
+    return (SFG_Proc)eglGetProcAddress(procName);
 }
index 54b510e..361c73c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_init_egl.c
+ * fg_init_egl.c
  *
  * Various freeglut initialization functions.
  *
@@ -48,10 +48,10 @@ void fghPlatformInitializeEGL()
   eglBindAPI(EGL_OPENGL_ES_API);
 # endif
 
-  // fgDisplay.ScreenWidth = ...;
-  // fgDisplay.ScreenHeight = ...;
-  // fgDisplay.ScreenWidthMM = ...;
-  // fgDisplay.ScreenHeightMM = ...;
+  /* fgDisplay.ScreenWidth = ...; */
+  /* fgDisplay.ScreenHeight = ...; */
+  /* fgDisplay.ScreenWidthMM = ...; */
+  /* fgDisplay.ScreenHeightMM = ...; */
 }
 
 void fghPlatformCloseDisplayEGL()
diff --git a/src/egl/fg_init_egl.h b/src/egl/fg_init_egl.h
new file mode 100644 (file)
index 0000000..592c522
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * fg_init_egl.h
+ *
+ * Various freeglut initialization functions.
+ *
+ * Copyright (C) 2012  Sylvain Beucler
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __FG_INIT_EGL_H__
+#define __FG_INIT_EGL_H__
+
+extern void fghPlatformInitializeEGL();
+extern void fghPlatformCloseDisplayEGL();
+extern void fgPlatformDestroyContext();
+
+#endif
index f3b922a..2890d00 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <GL/freeglut.h>
 #include "fg_internal.h"
+#include "egl/fg_window_egl.h"
 
 /*
  * Queries the GL context about some attributes
@@ -122,7 +123,6 @@ int* fgPlatformGlutGetModeValues(GLenum eWhat, int *size)
       attribute_name = EGL_SAMPLES;
 
       EGLConfig* configArray;
-      EGLConfig* config;
       EGLint configArraySize = 0;
  
       /* Get number of available configs */
@@ -139,21 +139,19 @@ int* fgPlatformGlutGetModeValues(GLenum eWhat, int *size)
       
       /* We get results in ascending order */
       {
-       int * temp_array;
-       int previous_value;
+       int previous_value = 0;
        int i;
        
        array = malloc(sizeof(int) * configArraySize);
-       previous_value = 0;
 
        for (i = 0; i < configArraySize; i++) {
-         int value;
+         int value = 0;
          eglGetConfigAttrib(fgDisplay.pDisplay.egl.Display,
                             configArray[i], attribute_name, &value);
          if (value > previous_value)
            {
              previous_value = value;
-             temp_array[*size] = value;
+             array[*size] = value;
              (*size)++;
            }
        }
diff --git a/src/egl/fg_state_egl.h b/src/egl/fg_state_egl.h
new file mode 100644 (file)
index 0000000..bdb93c5
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * fg_state_egl.c
+ *
+ * EGL-specific freeglut state query methods.
+ *
+ * Copyright (C) 2012  Sylvain Beucler
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __FG_STATE_EGL_H__
+#define __FG_STATE_EGL_H__
+
+#include <GL/freeglut.h>
+#include "fg_internal.h"
+int fghPlatformGlutGetEGL(GLenum eWhat);
+
+#endif
index e6b6a00..48eb748 100644 (file)
@@ -116,9 +116,9 @@ void fghPlatformOpenWindowEGL( SFG_Window* window )
 
   fgPlatformSetWindow(window);
 
-  //EGLint w, h;
-  //eglQuerySurface(display, surface, EGL_WIDTH, &w);
-  //eglQuerySurface(display, surface, EGL_HEIGHT, &h);
+  /* EGLint w, h; */
+  /* eglQuerySurface(display, surface, EGL_WIDTH, &w); */
+  /* eglQuerySurface(display, surface, EGL_HEIGHT, &h); */
 
 }
 
index 71dfd1a..8f5898d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * freeglut_display_android.c
+ * fg_window_egl.h
  *
  * Window management methods for EGL
  *
index 0ffffcb..c482a7f 100644 (file)
@@ -93,12 +93,12 @@ static void fghDrawGeometryWire20(GLfloat *vertices, GLfloat *normals, GLsizei n
         fghEnableVertexAttribArray(attribute_v_coord);
         fghBindBuffer(FGH_ARRAY_BUFFER, vbo_coords);
         fghVertexAttribPointer(
-            attribute_v_coord,  // attribute
-            3,                  // number of elements per vertex, here (x,y,z)
-            GL_FLOAT,           // the type of each element
-            GL_FALSE,           // take our values as-is
-            0,                  // no extra data between each position
-            0                   // offset of first element
+            attribute_v_coord,  /* attribute */
+            3,                  /* number of elements per vertex, here (x,y,z) */
+            GL_FLOAT,           /* the type of each element */
+            GL_FALSE,           /* take our values as-is */
+            0,                  /* no extra data between each position */
+            0                   /* offset of first element */
         );
     }
 
@@ -106,12 +106,12 @@ static void fghDrawGeometryWire20(GLfloat *vertices, GLfloat *normals, GLsizei n
         fghEnableVertexAttribArray(attribute_v_normal);
         fghBindBuffer(FGH_ARRAY_BUFFER, vbo_normals);
         fghVertexAttribPointer(
-            attribute_v_normal, // attribute
-            3,                  // number of elements per vertex, here (x,y,z)
-            GL_FLOAT,           // the type of each element
-            GL_FALSE,           // take our values as-is
-            0,                  // no extra data between each position
-            0                   // offset of first element
+            attribute_v_normal, /* attribute */
+            3,                  /* number of elements per vertex, here (x,y,z) */
+            GL_FLOAT,           /* the type of each element */
+            GL_FALSE,           /* take our values as-is */
+            0,                  /* no extra data between each position */
+            0                   /* offset of first element */
         );
     }
 
@@ -208,12 +208,12 @@ static void fghDrawGeometrySolid20(GLfloat *vertices, GLfloat *normals, GLubyte
         fghEnableVertexAttribArray(attribute_v_coord);
         fghBindBuffer(FGH_ARRAY_BUFFER, vbo_coords);
         fghVertexAttribPointer(
-            attribute_v_coord,  // attribute
-            3,                  // number of elements per vertex, here (x,y,z)
-            GL_FLOAT,           // the type of each element
-            GL_FALSE,           // take our values as-is
-            0,                  // no extra data between each position
-            0                   // offset of first element
+            attribute_v_coord,  /* attribute */
+            3,                  /* number of elements per vertex, here (x,y,z) */
+            GL_FLOAT,           /* the type of each element */
+            GL_FALSE,           /* take our values as-is */
+            0,                  /* no extra data between each position */
+            0                   /* offset of first element */
         );
     };
     
@@ -221,12 +221,12 @@ static void fghDrawGeometrySolid20(GLfloat *vertices, GLfloat *normals, GLubyte
         fghEnableVertexAttribArray(attribute_v_normal);
         fghBindBuffer(FGH_ARRAY_BUFFER, vbo_normals);
         fghVertexAttribPointer(
-            attribute_v_normal, // attribute
-            3,                  // number of elements per vertex, here (x,y,z)
-            GL_FLOAT,           // the type of each element
-            GL_FALSE,           // take our values as-is
-            0,                  // no extra data between each position
-            0                   // offset of first element
+            attribute_v_normal, /* attribute */
+            3,                  /* number of elements per vertex, here (x,y,z) */
+            GL_FLOAT,           /* the type of each element */
+            GL_FALSE,           /* take our values as-is */
+            0,                  /* no extra data between each position */
+            0                   /* offset of first element */
         );
     };
     
@@ -304,7 +304,7 @@ static void fghGenerateGeometryWithIndexArray(int numFaces, int numEdgePerFace,
     for (i=0; i<numFaces; i++)
     {
         int normIdx         = i*3;
-        int faceIdxVertIdx  = i*numEdgePerFace; // index to first element of "row" in vertex indices
+        int faceIdxVertIdx  = i*numEdgePerFace; /* index to first element of "row" in vertex indices */
         for (j=0; j<numEdgePerFace; j++)
         {
             int outIdx  = i*numEdgePerFace*3+j*3;
@@ -402,7 +402,7 @@ static GLubyte cube_vi[CUBE_VERT_PER_OBJ] =
     7,4,3,2,
     4,7,6,5
 };
-DECLARE_SHAPE_CACHE_DECOMPOSE_TO_TRIANGLE(cube,Cube,CUBE);
+DECLARE_SHAPE_CACHE_DECOMPOSE_TO_TRIANGLE(cube,Cube,CUBE)
 
 /* -- Dodecahedron -- */
 /* Magic Numbers:  It is possible to create a dodecahedron by attaching two
@@ -478,7 +478,7 @@ static GLubyte dodecahedron_vi[DODECAHEDRON_VERT_PER_OBJ] =
     18,  1,  0,  5,  9, 
     19, 14, 13, 10, 12
 };
-DECLARE_SHAPE_CACHE_DECOMPOSE_TO_TRIANGLE(dodecahedron,Dodecahedron,DODECAHEDRON);
+DECLARE_SHAPE_CACHE_DECOMPOSE_TO_TRIANGLE(dodecahedron,Dodecahedron,DODECAHEDRON)
 
 
 /* -- Icosahedron -- */
@@ -557,7 +557,7 @@ static GLubyte icosahedron_vi[ICOSAHEDRON_VERT_PER_OBJ] =
     11,  6,  7 ,
     11, 10,  6 
 };
-DECLARE_SHAPE_CACHE(icosahedron,Icosahedron,ICOSAHEDRON);
+DECLARE_SHAPE_CACHE(icosahedron,Icosahedron,ICOSAHEDRON)
 
 /* -- Octahedron -- */
 #define OCTAHEDRON_NUM_VERT           6
@@ -604,7 +604,7 @@ static GLubyte octahedron_vi[OCTAHEDRON_VERT_PER_OBJ] =
     3, 4, 2,
     3, 5, 4
 };
-DECLARE_SHAPE_CACHE(octahedron,Octahedron,OCTAHEDRON);
+DECLARE_SHAPE_CACHE(octahedron,Octahedron,OCTAHEDRON)
 
 /* -- RhombicDodecahedron -- */
 #define RHOMBICDODECAHEDRON_NUM_VERT            14
@@ -665,7 +665,7 @@ static GLubyte rhombicdodecahedron_vi[RHOMBICDODECAHEDRON_VERT_PER_OBJ] =
     7, 11, 13, 12,
     8, 12, 13,  9
 };
-DECLARE_SHAPE_CACHE_DECOMPOSE_TO_TRIANGLE(rhombicdodecahedron,RhombicDodecahedron,RHOMBICDODECAHEDRON);
+DECLARE_SHAPE_CACHE_DECOMPOSE_TO_TRIANGLE(rhombicdodecahedron,RhombicDodecahedron,RHOMBICDODECAHEDRON)
 
 /* -- Tetrahedron -- */
 /* Magic Numbers:  r0 = ( 1, 0, 0 )
@@ -709,7 +709,7 @@ static GLubyte tetrahedron_vi[TETRAHEDRON_VERT_PER_OBJ] =
     0, 3, 1,
     0, 1, 2
 };
-DECLARE_SHAPE_CACHE(tetrahedron,Tetrahedron,TETRAHEDRON);
+DECLARE_SHAPE_CACHE(tetrahedron,Tetrahedron,TETRAHEDRON)
 
 /* -- Sierpinski Sponge -- */
 static unsigned int ipow (int x, unsigned int y)
@@ -757,6 +757,7 @@ static void fghSierpinskiSpongeGenerate ( int numLevels, double offset[3], GLflo
     }
 }
 
+#ifndef GL_ES_VERSION_2_0
 /* -- Now the various shapes involving circles -- */
 /*
  * Compute lookup table of cos and sin values forming a circle
@@ -893,7 +894,7 @@ static void fghGenerateSphere(GLfloat radius, GLint slices, GLint stacks, GLfloa
     free(sint2);
     free(cost2);
 }
-
+#endif
 
 /* -- INTERNAL DRAWING functions --------------------------------------- */
 #define _DECLARE_INTERNAL_DRAW_DO_DECLARE(name,nameICaps,nameCaps,vertIdxs)\
@@ -961,11 +962,11 @@ static void fghCube( GLfloat dSize, GLboolean useWireMode )
         free(vertices);
 }
 
-DECLARE_INTERNAL_DRAW_DECOMPOSED_TO_TRIANGLE(dodecahedron,Dodecahedron,DODECAHEDRON);
-DECLARE_INTERNAL_DRAW(icosahedron,Icosahedron,ICOSAHEDRON);
-DECLARE_INTERNAL_DRAW(octahedron,Octahedron,OCTAHEDRON);
-DECLARE_INTERNAL_DRAW_DECOMPOSED_TO_TRIANGLE(rhombicdodecahedron,RhombicDodecahedron,RHOMBICDODECAHEDRON);
-DECLARE_INTERNAL_DRAW(tetrahedron,Tetrahedron,TETRAHEDRON);
+DECLARE_INTERNAL_DRAW_DECOMPOSED_TO_TRIANGLE(dodecahedron,Dodecahedron,DODECAHEDRON)
+DECLARE_INTERNAL_DRAW(icosahedron,Icosahedron,ICOSAHEDRON)
+DECLARE_INTERNAL_DRAW(octahedron,Octahedron,OCTAHEDRON)
+DECLARE_INTERNAL_DRAW_DECOMPOSED_TO_TRIANGLE(rhombicdodecahedron,RhombicDodecahedron,RHOMBICDODECAHEDRON)
+DECLARE_INTERNAL_DRAW(tetrahedron,Tetrahedron,TETRAHEDRON)
 
 static void fghSierpinskiSponge ( int numLevels, double offset[3], GLfloat scale, GLboolean useWireMode )
 {
@@ -1653,10 +1654,10 @@ void FGAPIENTRY glutSolidCube( double dSize )
     fghCube( (GLfloat)dSize, FALSE );
 }
 
-DECLARE_SHAPE_INTERFACE(Dodecahedron);
-DECLARE_SHAPE_INTERFACE(Icosahedron);
-DECLARE_SHAPE_INTERFACE(Octahedron);
-DECLARE_SHAPE_INTERFACE(RhombicDodecahedron);
+DECLARE_SHAPE_INTERFACE(Dodecahedron)
+DECLARE_SHAPE_INTERFACE(Icosahedron)
+DECLARE_SHAPE_INTERFACE(Octahedron)
+DECLARE_SHAPE_INTERFACE(RhombicDodecahedron)
 
 void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale )
 {
@@ -1669,7 +1670,7 @@ void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], do
     fghSierpinskiSponge ( num_levels, offset, (GLfloat)scale, FALSE );
 }
 
-DECLARE_SHAPE_INTERFACE(Tetrahedron);
+DECLARE_SHAPE_INTERFACE(Tetrahedron)
 
 
 /*** END OF FILE ***/
index b2f1822..deb4bb2 100644 (file)
@@ -40,8 +40,8 @@ void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib) {
 void fgInitGL2() {
 #ifndef GL_ES_VERSION_2_0
     fgState.HasOpenGL20 = 0;
-    // TODO: Mesa returns a valid stub function, rather than NULL,
-    // when we request a non-existent function
+    /* TODO: Mesa returns a valid stub function, rather than NULL,
+       when we request a non-existent function */
 #define CHECK(func, a) if ((a) == NULL) { fgWarning("fgInitGL2: " func " is NULL"); return; }
     CHECK("fghGenBuffers", fghGenBuffers = (FGH_PFNGLGENBUFFERSPROC)glutGetProcAddress("glGenBuffers"));
     CHECK("fghDeleteBuffers", fghDeleteBuffers = (FGH_PFNGLDELETEBUFFERSPROC)glutGetProcAddress("glDeleteBuffers"));
diff --git a/src/fg_main.h b/src/fg_main.h
new file mode 100644 (file)
index 0000000..175032c
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * fg_main.h
+ *
+ * The windows message processing methods.
+ *
+ * Copyright (C) 2012  Sylvain Beucler
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __FG_MAIN_H__
+#define __FG_MAIN_H__
+
+#include <GL/freeglut.h>
+#include "fg_internal.h"
+
+extern void fghRedrawWindow(SFG_Window *window);
+
+#endif
index 2a67174..63693cc 100644 (file)
@@ -18,7 +18,7 @@ GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed,
   return GL_FALSE;
 }
 
-int  glutCreateMenu( void (* callback)( int menu ) ) {}
+int  glutCreateMenu( void (* callback)( int menu ) ) { return 0; }
 void glutDestroyMenu( int menu ) {}
 int  glutGetMenu( void ) { return 0; }
 void glutSetMenu( int menu ) {}
@@ -37,7 +37,7 @@ int  glutStrokeWidth( void* font, int character ) { return 0; }
 int  glutBitmapLength( void* font, const unsigned char* string ) { return 0; }
 int  glutStrokeLength( void* font, const unsigned char* string ) { return 0; }
 
-void *glutGetMenuData( void ) {}
+void *glutGetMenuData( void ) { return NULL; }
 void  glutSetMenuData(void* data) {}
 
 int     glutBitmapHeight( void* font ) { return 0; }
index 0d969f4..9919ae5 100644 (file)
@@ -92,10 +92,8 @@ struct tagSFG_PlatformDisplay
  * Make "freeglut" window handle and context types so that we don't need so
  * much conditionally-compiled code later in the library.
  */
+#ifndef EGL_VERSION_1_0
 typedef Window     SFG_WindowHandleType ;
-#ifdef EGL_VERSION_1_0
-typedef EGLContext SFG_WindowContextType ;
-#else
 typedef GLXContext SFG_WindowContextType ;
 #endif
 typedef struct tagSFG_PlatformContext SFG_PlatformContext;