From cb1e59cf5e6ac8034ae91abfd320874004a44c88 Mon Sep 17 00:00:00 2001 From: Sylvain Beucler Date: Sat, 21 Apr 2012 17:40:25 +0000 Subject: [PATCH] Fix compiler warnings git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1256 7f0cb862-5218-0410-a997-914c9d46530a --- CMakeLists.txt | 38 +++++---- progs/test-shapes-gles1/CMakeLists.txt | 8 ++ src/android/fg_gamemode_android.c | 2 +- src/android/fg_init_android.c | 3 +- src/android/fg_input_devices_android.c | 2 +- src/android/fg_internal_android.h | 3 +- src/android/fg_joystick_android.c | 2 +- src/android/fg_main_android.c | 9 ++- src/android/fg_main_android.h | 37 +++++++++ src/android/fg_runtime_android.c | 5 +- src/android/fg_spaceball_android.c | 2 +- src/android/fg_state_android.c | 3 +- src/android/fg_window_android.c | 6 +- .../native_app_glue/android_native_app_glue.h | 2 + src/egl/fg_ext_egl.c | 2 +- src/egl/fg_init_egl.c | 10 +-- src/egl/fg_init_egl.h | 33 ++++++++ src/egl/fg_state_egl.c | 10 +-- src/egl/fg_state_egl.h | 33 ++++++++ src/egl/fg_window_egl.c | 6 +- src/egl/fg_window_egl.h | 2 +- src/fg_geometry.c | 85 ++++++++++---------- src/fg_gl2.c | 4 +- src/fg_main.h | 34 ++++++++ src/gles_stubs.c | 4 +- src/x11/fg_internal_x11.h | 4 +- 26 files changed, 246 insertions(+), 103 deletions(-) create mode 100644 src/android/fg_main_android.h create mode 100644 src/egl/fg_init_egl.h create mode 100644 src/egl/fg_state_egl.h create mode 100644 src/fg_main.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 828b7b2..d3f083a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/progs/test-shapes-gles1/CMakeLists.txt b/progs/test-shapes-gles1/CMakeLists.txt index 24e97d1..3c1f40a 100644 --- a/progs/test-shapes-gles1/CMakeLists.txt +++ b/progs/test-shapes-gles1/CMakeLists.txt @@ -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) diff --git a/src/android/fg_gamemode_android.c b/src/android/fg_gamemode_android.c index 8cd3034..14683ee 100644 --- a/src/android/fg_gamemode_android.c +++ b/src/android/fg_gamemode_android.c @@ -1,5 +1,5 @@ /* - * freeglut_gamemode_x11.c + * fg_gamemode_x11.c * * The game mode handling code. * diff --git a/src/android/fg_init_android.c b/src/android/fg_init_android.c index 70b276c..a07cedd 100644 --- a/src/android/fg_init_android.c +++ b/src/android/fg_init_android.c @@ -1,5 +1,5 @@ /* - * freeglut_init_android.c + * fg_init_android.c * * Various freeglut initialization functions. * @@ -25,6 +25,7 @@ #include #include "fg_internal.h" +#include "egl/fg_init_egl.h" void fgPlatformInitialize() { diff --git a/src/android/fg_input_devices_android.c b/src/android/fg_input_devices_android.c index ac3aea5..89f412b 100644 --- a/src/android/fg_input_devices_android.c +++ b/src/android/fg_input_devices_android.c @@ -1,5 +1,5 @@ /* - * freeglut_input_devices_android.c + * fg_input_devices_android.c * * Handles miscellaneous input devices via direct serial-port access. * diff --git a/src/android/fg_internal_android.h b/src/android/fg_internal_android.h index a0441b5..c072136 100644 --- a/src/android/fg_internal_android.h +++ b/src/android/fg_internal_android.h @@ -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 */ diff --git a/src/android/fg_joystick_android.c b/src/android/fg_joystick_android.c index 5328285..084978a 100644 --- a/src/android/fg_joystick_android.c +++ b/src/android/fg_joystick_android.c @@ -1,5 +1,5 @@ /* - * freeglut_joystick_android.c + * fg_joystick_android.c * * Joystick handling code * diff --git a/src/android/fg_main_android.c b/src/android/fg_main_android.c index 3f973f2..9d5ebf6 100644 --- a/src/android/fg_main_android.c +++ b/src/android/fg_main_android.c @@ -1,5 +1,5 @@ /* - * freeglut_main_android.c + * fg_main_android.c * * The Android-specific windows message processing methods. * @@ -28,6 +28,7 @@ #include #include "fg_internal.h" +#include "fg_main.h" #include #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 index 0000000..7a00986 --- /dev/null +++ b/src/android/fg_main_android.h @@ -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 diff --git a/src/android/fg_runtime_android.c b/src/android/fg_runtime_android.c index 13f2e86..1b92bf6 100644 --- a/src/android/fg_runtime_android.c +++ b/src/android/fg_runtime_android.c @@ -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; diff --git a/src/android/fg_spaceball_android.c b/src/android/fg_spaceball_android.c index 2f04d67..b06410b 100644 --- a/src/android/fg_spaceball_android.c +++ b/src/android/fg_spaceball_android.c @@ -1,5 +1,5 @@ /* - * freeglut_spaceball_android.c + * fg_spaceball_android.c * * Spaceball support for Windows * diff --git a/src/android/fg_state_android.c b/src/android/fg_state_android.c index f229c95..6aed163 100644 --- a/src/android/fg_state_android.c +++ b/src/android/fg_state_android.c @@ -1,5 +1,5 @@ /* - * freeglut_state_android.c + * fg_state_android.c * * Android-specific freeglut state query methods. * @@ -29,6 +29,7 @@ #include #include #include "fg_internal.h" +#include "egl/fg_state_egl.h" int fgPlatformGlutDeviceGet ( GLenum eWhat ) { diff --git a/src/android/fg_window_android.c b/src/android/fg_window_android.c index 58d612a..4c5d9d2 100644 --- a/src/android/fg_window_android.c +++ b/src/android/fg_window_android.c @@ -1,5 +1,5 @@ /* - * freeglut_window_android.c + * fg_window_android.c * * Window management methods for Android * @@ -30,6 +30,7 @@ #include #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; } diff --git a/src/android/native_app_glue/android_native_app_glue.h b/src/android/native_app_glue/android_native_app_glue.h index e7faba3..0c59ec2 100644 --- a/src/android/native_app_glue/android_native_app_glue.h +++ b/src/android/native_app_glue/android_native_app_glue.h @@ -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 diff --git a/src/egl/fg_ext_egl.c b/src/egl/fg_ext_egl.c index c5dfc2b..417f6ed 100644 --- a/src/egl/fg_ext_egl.c +++ b/src/egl/fg_ext_egl.c @@ -28,5 +28,5 @@ SFG_Proc fgPlatformGetProcAddress( const char *procName ) { - return (SFG_Proc)eglGetProcAddress( ( const GLubyte * )procName ); + return (SFG_Proc)eglGetProcAddress(procName); } diff --git a/src/egl/fg_init_egl.c b/src/egl/fg_init_egl.c index 54b510e..361c73c 100644 --- a/src/egl/fg_init_egl.c +++ b/src/egl/fg_init_egl.c @@ -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 index 0000000..592c522 --- /dev/null +++ b/src/egl/fg_init_egl.h @@ -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 diff --git a/src/egl/fg_state_egl.c b/src/egl/fg_state_egl.c index f3b922a..2890d00 100644 --- a/src/egl/fg_state_egl.c +++ b/src/egl/fg_state_egl.c @@ -25,6 +25,7 @@ #include #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 index 0000000..bdb93c5 --- /dev/null +++ b/src/egl/fg_state_egl.h @@ -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 +#include "fg_internal.h" +int fghPlatformGlutGetEGL(GLenum eWhat); + +#endif diff --git a/src/egl/fg_window_egl.c b/src/egl/fg_window_egl.c index e6b6a00..48eb748 100644 --- a/src/egl/fg_window_egl.c +++ b/src/egl/fg_window_egl.c @@ -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); */ } diff --git a/src/egl/fg_window_egl.h b/src/egl/fg_window_egl.h index 71dfd1a..8f5898d 100644 --- a/src/egl/fg_window_egl.h +++ b/src/egl/fg_window_egl.h @@ -1,5 +1,5 @@ /* - * freeglut_display_android.c + * fg_window_egl.h * * Window management methods for EGL * diff --git a/src/fg_geometry.c b/src/fg_geometry.c index 0ffffcb..c482a7f 100644 --- a/src/fg_geometry.c +++ b/src/fg_geometry.c @@ -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 +#include "fg_internal.h" + +extern void fghRedrawWindow(SFG_Window *window); + +#endif diff --git a/src/gles_stubs.c b/src/gles_stubs.c index 2a67174..63693cc 100644 --- a/src/gles_stubs.c +++ b/src/gles_stubs.c @@ -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; } diff --git a/src/x11/fg_internal_x11.h b/src/x11/fg_internal_x11.h index 0d969f4..9919ae5 100644 --- a/src/x11/fg_internal_x11.h +++ b/src/x11/fg_internal_x11.h @@ -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; -- 1.7.10.4