From: <be...@us...> - 2014-06-01 09:24:53
|
Revision: 1687 http://sourceforge.net/p/freeglut/code/1687 Author: beuc Date: 2014-06-01 09:24:47 +0000 (Sun, 01 Jun 2014) Log Message: ----------- Unify GLES1 and GLES2 (libraries are compatible and can be co-linked) Modified Paths: -------------- trunk/freeglut/freeglut/CMakeLists.txt trunk/freeglut/freeglut/include/GL/freeglut_std.h trunk/freeglut/freeglut/progs/test-shapes-gles1/CMakeLists.txt trunk/freeglut/freeglut/src/egl/fg_window_egl.c trunk/freeglut/freeglut/src/fg_geometry.c trunk/freeglut/freeglut/src/fg_gl2.c Added Paths: ----------- trunk/freeglut/freeglut/android/Android.mk Removed Paths: ------------- trunk/freeglut/freeglut/android/gles1/ trunk/freeglut/freeglut/android/gles2/Android.mk Modified: trunk/freeglut/freeglut/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/CMakeLists.txt 2014-06-01 03:50:51 UTC (rev 1686) +++ trunk/freeglut/freeglut/CMakeLists.txt 2014-06-01 09:24:47 UTC (rev 1687) @@ -40,11 +40,9 @@ ENDIF() # OpenGL ES support -OPTION(FREEGLUT_GLES1 "Use OpenGL ES 1.x (requires EGL)" OFF) -OPTION(FREEGLUT_GLES2 "Use OpenGL ES 2.x (requires EGL) (overrides BUILD_GLES1)" OFF) +OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" OFF) - SET(FREEGLUT_HEADERS include/GL/freeglut.h include/GL/freeglut_ext.h @@ -81,7 +79,7 @@ src/fg_window.c ) # TODO: OpenGL ES requires a compatible version of these files: -IF(NOT FREEGLUT_GLES2 AND NOT FREEGLUT_GLES1) +IF(NOT FREEGLUT_GLES) LIST(APPEND FREEGLUT_SRCS src/fg_font.c src/fg_menu.c @@ -172,7 +170,7 @@ src/x11/fg_window_x11.c src/x11/fg_xinput_x11.c ) - IF(NOT(FREEGLUT_GLES2 OR FREEGLUT_GLES1)) + IF(NOT(FREEGLUT_GLES)) LIST(APPEND FREEGLUT_SRCS src/x11/fg_internal_x11_glx.h src/x11/fg_display_x11_glx.c @@ -183,7 +181,7 @@ ) ENDIF() ENDIF() -IF(FREEGLUT_GLES2 OR FREEGLUT_GLES1) +IF(FREEGLUT_GLES) LIST(APPEND FREEGLUT_SRCS src/egl/fg_internal_egl.h src/egl/fg_display_egl.c @@ -199,18 +197,14 @@ ) ENDIF() -# For OpenGL ES (GLES): -# - compile with -DFREEGLUT_GLES1 and -DFREEGLUT_GLES2 to cleanly -# bootstrap headers inclusion in freeglut_std.h; these constants -# also need to be defined in client applications (e.g. through -# pkg-config), but use GLES constants directly for all other needs -# - define GLES version-specific library -IF(FREEGLUT_GLES2) - ADD_DEFINITIONS(-DFREEGLUT_GLES2) - LIST(APPEND LIBS GLESv2 EGL) -ELSEIF(FREEGLUT_GLES1) - ADD_DEFINITIONS(-DFREEGLUT_GLES1) - LIST(APPEND LIBS GLESv1_CM EGL) +# For OpenGL ES (GLES): compile with -DFREEGLUT_GLES to cleanly +# bootstrap headers inclusion in freeglut_std.h; this constant also +# need to be defined in client applications (e.g. through pkg-config), +# but do use GLES constants directly for all other needs +# GLES1 and GLES2 libraries are compatible and can be co-linked. +IF(FREEGLUT_GLES) + ADD_DEFINITIONS(-DFREEGLUT_GLES) + LIST(APPEND LIBS GLESv2 GLESv1_CM EGL) ELSE() FIND_PACKAGE(OpenGL REQUIRED) LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) @@ -369,10 +363,8 @@ # - the shared library should link to the dependency libraries so that the user # won't have to link them explicitly (they shouldn't have to know that we depend # on Xrandr or Xxf86vm) - IF(FREEGLUT_GLES2) - SET(LIBNAME freeglut-gles2) - ELSEIF(FREEGLUT_GLES1) - SET(LIBNAME freeglut-gles1) + IF(FREEGLUT_GLES) + SET(LIBNAME freeglut-gles) ELSE() SET(LIBNAME glut) ENDIF() @@ -489,30 +481,18 @@ # Define static build dependencies IF(WIN32) SET(PC_LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32 -lm") -ELSEIF(FREEGLUT_GLES2) +ELSEIF(FREEGLUT_GLES) IF(ANDROID) - SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lEGL -lm") + SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lGLESv1_CM -lEGL -lm") ELSEIF(BLACKBERRY) IF(PLAYBOOK) - SET(PC_LIBS_PRIVATE "-lbps -lscreen -lGLESv2 -lEGL -lm") + SET(PC_LIBS_PRIVATE "-lbps -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm") ELSE() - SET(PC_LIBS_PRIVATE "-lbps -lslog2 -lscreen -lGLESv2 -lEGL -lm") + SET(PC_LIBS_PRIVATE "-lbps -lslog2 -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm") ENDIF() ELSE() - SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lEGL -lm") + SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lGLESv1_CM -lEGL -lm") ENDIF() -ELSEIF(FREEGLUT_GLES1) - IF(ANDROID) - SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv1_CM -lEGL -lm") - ELSEIF(BLACKBERRY) - IF(PLAYBOOK) - SET(PC_LIBS_PRIVATE "-lbps -lscreen -lGLESv1_CM -lEGL -lm") - ELSE() - SET(PC_LIBS_PRIVATE "-lbps -lslog2 -lscreen -lGLESv1_CM -lEGL -lm") - ENDIF() - ELSE() - SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv1_CM -lEGL -lm") - ENDIF() ELSE() SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm") ENDIF() @@ -520,16 +500,12 @@ # bootstrap headers inclusion in freeglut_std.h: SET(PC_LIBNAME "glut") SET(PC_FILENAME "freeglut.pc") -IF(FREEGLUT_GLES2) - SET(PC_CFLAGS "-DFREEGLUT_GLES2") - SET(PC_LIBNAME "freeglut-gles2") - SET(PC_FILENAME "freeglut-gles2.pc") -ELSEIF(FREEGLUT_GLES1) - SET(PC_CFLAGS "-DFREEGLUT_GLES1") - SET(PC_LIBNAME "freeglut-gles1") - SET(PC_FILENAME "freeglut-gles1.pc") +IF(FREEGLUT_GLES) + SET(PC_CFLAGS "-DFREEGLUT_GLES") + SET(PC_LIBNAME "freeglut-gles") + SET(PC_FILENAME "freeglut-gles.pc") ENDIF() CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY) INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig/ RENAME ${PC_FILENAME}) # TODO: change the library and .pc name when building for GLES, -# e.g. -lglut-GLES2 +# e.g. -lglut-GLES Added: trunk/freeglut/freeglut/android/Android.mk =================================================================== --- trunk/freeglut/freeglut/android/Android.mk (rev 0) +++ trunk/freeglut/freeglut/android/Android.mk 2014-06-01 09:24:47 UTC (rev 1687) @@ -0,0 +1,9 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := freeglut-gles +LOCAL_SRC_FILES := lib/libfreeglut-gles.a +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include + +include $(PREBUILT_STATIC_LIBRARY) Deleted: trunk/freeglut/freeglut/android/gles2/Android.mk =================================================================== --- trunk/freeglut/freeglut/android/gles2/Android.mk 2014-06-01 03:50:51 UTC (rev 1686) +++ trunk/freeglut/freeglut/android/gles2/Android.mk 2014-06-01 09:24:47 UTC (rev 1687) @@ -1,9 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := freeglut-gles2 -LOCAL_SRC_FILES := lib/libfreeglut-gles2.a -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include - -include $(PREBUILT_STATIC_LIBRARY) Modified: trunk/freeglut/freeglut/include/GL/freeglut_std.h =================================================================== --- trunk/freeglut/freeglut/include/GL/freeglut_std.h 2014-06-01 03:50:51 UTC (rev 1686) +++ trunk/freeglut/freeglut/include/GL/freeglut_std.h 2014-06-01 09:24:47 UTC (rev 1687) @@ -129,15 +129,13 @@ /* * Always include OpenGL and GLU headers */ -/* Note: FREEGLUT_GLES1 and FREEGLUT_GLES2 are only used to cleanly - bootstrap headers inclusion here; use GLES constants directly +/* Note: FREEGLUT_GLES is only used to cleanly bootstrap headers + inclusion here; use GLES constants directly (e.g. GL_ES_VERSION_2_0) for all other needs */ -#ifdef FREEGLUT_GLES2 +#ifdef FREEGLUT_GLES # include <EGL/egl.h> +# include <GLES/gl.h> # include <GLES2/gl2.h> -#elif FREEGLUT_GLES1 -# include <EGL/egl.h> -# include <GLES/gl.h> #elif __APPLE__ # include <OpenGL/gl.h> # include <OpenGL/glu.h> Modified: trunk/freeglut/freeglut/progs/test-shapes-gles1/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/progs/test-shapes-gles1/CMakeLists.txt 2014-06-01 03:50:51 UTC (rev 1686) +++ trunk/freeglut/freeglut/progs/test-shapes-gles1/CMakeLists.txt 2014-06-01 09:24:47 UTC (rev 1687) @@ -11,7 +11,7 @@ # FreeGLUT include(FindPkgConfig) -pkg_check_modules(freeglut REQUIRED freeglut-gles1>=3.0.0) +pkg_check_modules(freeglut REQUIRED freeglut-gles>=3.0.0) if(freeglut_FOUND) include_directories(${freeglut_STATIC_INCLUDE_DIRS}) link_directories(${freeglut_STATIC_LIBRARY_DIRS}) Modified: trunk/freeglut/freeglut/src/egl/fg_window_egl.c =================================================================== --- trunk/freeglut/freeglut/src/egl/fg_window_egl.c 2014-06-01 03:50:51 UTC (rev 1686) +++ trunk/freeglut/freeglut/src/egl/fg_window_egl.c 2014-06-01 09:24:47 UTC (rev 1687) @@ -27,39 +27,49 @@ #include "fg_internal.h" int fghChooseConfig(EGLConfig* config) { - const EGLint attribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, -#ifdef GL_ES_VERSION_2_0 + EGLint attribs[32]; + int i = 0; + attribs[i++] = EGL_SURFACE_TYPE; + attribs[i++] = EGL_WINDOW_BIT; + if (fgState.MajorVersion >= 2) { /* * Khronos does not specify a EGL_OPENGL_ES3_BIT outside of the OpenGL extension "EGL_KHR_create_context". There are numerous references on the internet that * say to use EGL_OPENGL_ES3_BIT, followed by many saying they can't find it in any headers. In fact, the offical updated specification for EGL does not have * any references to OpenGL ES 3.0. Tests have shown that EGL_OPENGL_ES2_BIT will work with ES 3.0. */ - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, -#elif GL_VERSION_ES_CM_1_0 || GL_VERSION_ES_CL_1_0 || GL_VERSION_ES_CM_1_1 || GL_VERSION_ES_CL_1_1 - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, -#else - EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, -#endif + attribs[i++] = EGL_RENDERABLE_TYPE; + attribs[i++] = EGL_OPENGL_ES2_BIT; + } else { + attribs[i++] = EGL_RENDERABLE_TYPE; + attribs[i++] = EGL_OPENGL_ES_BIT; + } + /* Technically it's possible to request a standard OpenGL (non-ES) + context, but currently our build system assumes EGL => GLES */ + /* attribs[i++] = EGL_RENDERABLE_TYPE; */ + /* attribs[i++] = EGL_OPENGL_BIT; */ #ifdef TARGET_HOST_BLACKBERRY - /* Only 888 and 565 seem to work. Based on + /* Only 888 and 565 seem to work. Based on http://qt.gitorious.org/qt/qtbase/source/893deb1a93021cdfabe038cdf1869de33a60cbc9:src/plugins/platforms/qnx/qqnxglcontext.cpp and https://twitter.com/BlackBerryDev/status/380720927475912706 */ - EGL_BLUE_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_RED_SIZE, 8, + attribs[i++] = EGL_BLUE_SIZE; attribs[i++] = 8; + attribs[i++] = EGL_GREEN_SIZE; attribs[i++] = 8; + attribs[i++] = EGL_RED_SIZE; attribs[i++] = 8; #else - EGL_BLUE_SIZE, 1, - EGL_GREEN_SIZE, 1, - EGL_RED_SIZE, 1, + attribs[i++] = EGL_BLUE_SIZE; attribs[i++] = 1; + attribs[i++] = EGL_GREEN_SIZE; attribs[i++] = 1; + attribs[i++] = EGL_RED_SIZE; attribs[i++] = 1; #endif - EGL_ALPHA_SIZE, (fgState.DisplayMode & GLUT_ALPHA) ? 1 : 0, - EGL_DEPTH_SIZE, (fgState.DisplayMode & GLUT_DEPTH) ? 1 : 0, - EGL_STENCIL_SIZE, (fgState.DisplayMode & GLUT_STENCIL) ? 1 : 0, - EGL_SAMPLE_BUFFERS, (fgState.DisplayMode & GLUT_MULTISAMPLE) ? 1 : 0, - EGL_SAMPLES, (fgState.DisplayMode & GLUT_MULTISAMPLE) ? fgState.SampleNumber : 0, - EGL_NONE - }; + attribs[i++] = EGL_ALPHA_SIZE; + attribs[i++] = (fgState.DisplayMode & GLUT_ALPHA) ? 1 : 0; + attribs[i++] = EGL_DEPTH_SIZE; + attribs[i++] = (fgState.DisplayMode & GLUT_DEPTH) ? 1 : 0; + attribs[i++] = EGL_STENCIL_SIZE; + attribs[i++] = (fgState.DisplayMode & GLUT_STENCIL) ? 1 : 0; + attribs[i++] = EGL_SAMPLE_BUFFERS; + attribs[i++] = (fgState.DisplayMode & GLUT_MULTISAMPLE) ? 1 : 0; + attribs[i++] = EGL_SAMPLES; + attribs[i++] = (fgState.DisplayMode & GLUT_MULTISAMPLE) ? fgState.SampleNumber : 0; + attribs[i++] = EGL_NONE; EGLint num_config; if (!eglChooseConfig(fgDisplay.pDisplay.egl.Display, @@ -76,39 +86,26 @@ */ EGLContext fghCreateNewContextEGL( SFG_Window* window ) { EGLContext context; + EGLint ver = -1; EGLDisplay eglDisplay = fgDisplay.pDisplay.egl.Display; EGLConfig eglConfig = window->Window.pContext.egl.Config; - /* Ensure OpenGLES 2.0 context */ - static EGLint ctx_attribs[] = { -#ifdef GL_ES_VERSION_2_0 - EGL_CONTEXT_CLIENT_VERSION, 2, -#elif GL_VERSION_ES_CM_1_0 || GL_VERSION_ES_CL_1_0 || GL_VERSION_ES_CM_1_1 || GL_VERSION_ES_CL_1_1 - EGL_CONTEXT_CLIENT_VERSION, 1, -#endif - EGL_NONE - }; -#ifdef GL_ES_VERSION_2_0 - /* - * As GLES 3.0 is backwards compatible with GLES 2.0, we set 2.0 as default unless the user states a different version. - * This updates the context attributes and lets us check that the correct version was set when we query it after creation. - */ - int gles2Ver = fgState.MajorVersion <= 2 ? 2 : fgState.MajorVersion; - ctx_attribs[1] = gles2Ver; -#endif + /* On GLES, user specifies the target version with glutInitContextVersion */ + EGLint ctx_attribs[32]; + int i = 0; + ctx_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION; + ctx_attribs[i++] = fgState.MajorVersion; + ctx_attribs[i++] = EGL_NONE; + context = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, ctx_attribs); if (context == EGL_NO_CONTEXT) { fgWarning("Cannot initialize EGL context, err=%x\n", eglGetError()); fghContextCreationError(); } - EGLint ver = -1; + eglQueryContext(fgDisplay.pDisplay.egl.Display, context, EGL_CONTEXT_CLIENT_VERSION, &ver); -#ifdef GL_ES_VERSION_2_0 - if (ver != gles2Ver) -#else - if (ver != 1) -#endif + if (ver != fgState.MajorVersion) fgError("Wrong GLES major version: %d\n", ver); return context; Modified: trunk/freeglut/freeglut/src/fg_geometry.c =================================================================== --- trunk/freeglut/freeglut/src/fg_geometry.c 2014-06-01 03:50:51 UTC (rev 1686) +++ trunk/freeglut/freeglut/src/fg_geometry.c 2014-06-01 09:24:47 UTC (rev 1687) @@ -44,14 +44,12 @@ /* declare for drawing using the different OpenGL versions here so we can have a nice code order below */ -#ifndef GL_ES_VERSION_2_0 static void fghDrawGeometryWire11(GLfloat *vertices, GLfloat *normals, GLushort *vertIdxs, GLsizei numParts, GLsizei numVertPerPart, GLenum vertexMode, GLushort *vertIdxs2, GLsizei numParts2, GLsizei numVertPerPart2 ); static void fghDrawGeometrySolid11(GLfloat *vertices, GLfloat *normals, GLfloat *textcs, GLsizei numVertices, GLushort *vertIdxs, GLsizei numParts, GLsizei numVertIdxsPerPart); -#endif static void fghDrawGeometryWire20(GLfloat *vertices, GLfloat *normals, GLsizei numVertices, GLushort *vertIdxs, GLsizei numParts, GLsizei numVertPerPart, GLenum vertexMode, GLushort *vertIdxs2, GLsizei numParts2, GLsizei numVertPerPart2, @@ -62,9 +60,7 @@ GLint attribute_v_coord, GLint attribute_v_normal, GLint attribute_v_texture); /* declare function for generating visualization of normals */ static void fghGenerateNormalVisualization(GLfloat *vertices, GLfloat *normals, GLsizei numVertices); -#ifndef GL_ES_VERSION_2_0 static void fghDrawNormalVisualization11(); -#endif static void fghDrawNormalVisualization20(GLint attribute_v_coord); /* Drawing geometry: @@ -147,12 +143,10 @@ vertIdxs, numParts, numVertPerPart, vertexMode, vertIdxs2, numParts2, numVertPerPart2, attribute_v_coord, attribute_v_normal); -#ifndef GL_ES_VERSION_2_0 else fghDrawGeometryWire11(vertices, normals, vertIdxs, numParts, numVertPerPart, vertexMode, vertIdxs2, numParts2, numVertPerPart2); -#endif } /* Draw the geometric shape with filled triangles @@ -203,7 +197,6 @@ /* draw normals for each vertex as well */ fghDrawNormalVisualization20(attribute_v_coord); } -#ifndef GL_ES_VERSION_2_0 else { fghDrawGeometrySolid11(vertices, normals, textcs, numVertices, @@ -213,13 +206,11 @@ /* draw normals for each vertex as well */ fghDrawNormalVisualization11(); } -#endif } /* Version for OpenGL (ES) 1.1 */ -#ifndef GL_ES_VERSION_2_0 static void fghDrawGeometryWire11(GLfloat *vertices, GLfloat *normals, GLushort *vertIdxs, GLsizei numParts, GLsizei numVertPerPart, GLenum vertexMode, GLushort *vertIdxs2, GLsizei numParts2, GLsizei numVertPerPart2 @@ -282,7 +273,6 @@ if (textcs) glDisableClientState(GL_TEXTURE_COORD_ARRAY); } -#endif /* Version for OpenGL (ES) >= 2.0 */ static void fghDrawGeometryWire20(GLfloat *vertices, GLfloat *normals, GLsizei numVertices, @@ -540,7 +530,6 @@ } /* Version for OpenGL (ES) 1.1 */ -#ifndef GL_ES_VERSION_2_0 static void fghDrawNormalVisualization11() { GLfloat currentColor[4]; @@ -559,7 +548,6 @@ free(verticesForNormalVisualization); glColor4f(currentColor[0],currentColor[1],currentColor[2],currentColor[3]); } -#endif /* Version for OpenGL (ES) >= 2.0 */ static void fghDrawNormalVisualization20(GLint attribute_v_coord) Modified: trunk/freeglut/freeglut/src/fg_gl2.c =================================================================== --- trunk/freeglut/freeglut/src/fg_gl2.c 2014-06-01 03:50:51 UTC (rev 1686) +++ trunk/freeglut/freeglut/src/fg_gl2.c 2014-06-01 09:24:47 UTC (rev 1687) @@ -43,8 +43,9 @@ } void fgInitGL2() { -#ifndef GL_ES_VERSION_2_0 - fgState.HasOpenGL20 = 0; +#ifdef GL_ES_VERSION_2_0 + fgState.HasOpenGL20 = (fgState.MajorVersion >= 2); +#else /* 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; } @@ -56,6 +57,6 @@ CHECK("fghEnableVertexAttribArray", fghEnableVertexAttribArray = (FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC)glutGetProcAddress("glEnableVertexAttribArray")); CHECK("fghDisableVertexAttribArray", fghDisableVertexAttribArray = (FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC)glutGetProcAddress("glDisableVertexAttribArray")); #undef CHECK + fgState.HasOpenGL20 = 1; #endif - fgState.HasOpenGL20 = 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2014-06-24 07:03:20
|
Revision: 1694 http://sourceforge.net/p/freeglut/code/1694 Author: dcnieho Date: 2014-06-24 07:03:16 +0000 (Tue, 24 Jun 2014) Log Message: ----------- Updated BlackBerry references to make note of the change from FREEGLUT_GLES2/1 to FREEGLUT_GLES. Updated BlackBerry toolchain to support building with Dinkum and to support OS 10.3 and GCC 4.8.2 Updated BlackBerry fg_window_blackberry so that window usages aren't hardcoded based on compile information, since it is now controlled by glutInitContextVersion. EGL window setup now supports EGL 1.5, Renderable type for ES3, and using the minor version from glutInitContextVersion to have more exact control over which version of OpenGL ES is used (requires EGL 1.5) Modified Paths: -------------- trunk/freeglut/freeglut/README.blackberry trunk/freeglut/freeglut/blackberry.toolchain.cmake trunk/freeglut/freeglut/src/blackberry/fg_window_blackberry.c trunk/freeglut/freeglut/src/egl/fg_init_egl.c trunk/freeglut/freeglut/src/egl/fg_internal_egl.h trunk/freeglut/freeglut/src/egl/fg_window_egl.c Modified: trunk/freeglut/freeglut/README.blackberry =================================================================== --- trunk/freeglut/freeglut/README.blackberry 2014-06-02 13:25:25 UTC (rev 1693) +++ trunk/freeglut/freeglut/README.blackberry 2014-06-24 07:03:16 UTC (rev 1694) @@ -6,7 +6,7 @@ # $ source /absolute/path/to/the/bbndk/bbndk-env.sh # $ mkdir build # $ cd build -# $ cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES2=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles" +# $ cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles" # $ make -j8 # # Usage Mac: @@ -16,6 +16,8 @@ # > /absolute/path/to/the/bbndk/bbndk-env.bat # > mkdir build # > cd build -# > cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES2=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles" +# > cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles" # > make -j8 -# \ No newline at end of file +# + +To change which version of OpenGL to use, call glutInitContextVersion(1, 0) for OpenGL ES 1.x, glutInitContextVersion(2, 0) for OpenGL ES 2.0, or glutInitContextVersion(3, 0) for OpenGL ES 3.0. \ No newline at end of file Modified: trunk/freeglut/freeglut/blackberry.toolchain.cmake =================================================================== --- trunk/freeglut/freeglut/blackberry.toolchain.cmake 2014-06-02 13:25:25 UTC (rev 1693) +++ trunk/freeglut/freeglut/blackberry.toolchain.cmake 2014-06-24 07:03:16 UTC (rev 1694) @@ -6,7 +6,7 @@ # $ source /absolute/path/to/the/bbndk/bbndk-env.sh # $ mkdir build # $ cd build -# $ cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES2=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles" +# $ cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles" # $ make -j8 # # Usage Mac: @@ -16,7 +16,7 @@ # > /absolute/path/to/the/bbndk/bbndk-env.bat # > mkdir build # > cd build -# > cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES2=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles" +# > cmake .. -DCMAKE_TOOLCHAIN_FILE="../blackberry.toolchain.cmake" -DBLACKBERRY_ARCHITECTURE=arm -DFREEGLUT_GLES=ON -DFREEGLUT_BUILD_DEMOS=NO -DCMAKE_VERBOSE_MAKEFILE=TRUE -G "Eclipse CDT4 - Unix Makefiles" # > make -j8 # @@ -34,9 +34,14 @@ # Check for PlayBook if( EXISTS "${BLACKBERRY_TARGET_ROOT}/x86/lib/gcc/4.4.2" ) -set( PLAYBOOK True ) + set( PLAYBOOK True ) endif() +# Check for for GCC 4.8.2 +if( EXISTS "${BLACKBERRY_TARGET_ROOT}/x86/lib/gcc/4.8.2" ) + set( BB_GCC_482 True ) +endif() + # STL version: by default gnustl_static will be used set( BLACKBERRY_USE_STLPORT FALSE CACHE BOOL "Experimental: use stlport_static instead of gnustl_static") mark_as_advanced( BLACKBERRY_USE_STLPORT ) @@ -103,28 +108,52 @@ endif() # Flags and preprocessor definitions +set( BB_USING_GCC_482 False ) +if( PLAYBOOK ) + set( BLACKBERRY_COMP_DEF "-D__PLAYBOOK__" ) + set( BLACKBERRY_COMP_VERSION "4.4.2" ) +else() + set( BLACKBERRY_COMP_DEF "-D__QNX__" ) + if( BB_GCC_482 AND BLACKBERRY_USE_GCC_4_8 ) + set( BLACKBERRY_COMP_VERSION "4.8.2" ) + set( BB_USING_GCC_482 True ) + else() + set( BLACKBERRY_COMP_VERSION "4.6.3" ) + endif() +endif() if( BLACKBERRY_ARCHITECTURE STREQUAL "arm" ) - if( PLAYBOOK ) - set( BLACKBERRY_CC_FLAGS " -V4.4.2,gcc_ntoarmv7le -D__PLAYBOOK__" ) - set( BLACKBERRY_CXX_FLAGS " -V4.4.2,gcc_ntoarmv7le -Y_gpp -D__PLAYBOOK__" ) - else() - set( BLACKBERRY_CC_FLAGS " -V4.6.3,gcc_ntoarmv7le -D__QNX__" ) - set( BLACKBERRY_CXX_FLAGS " -V4.6.3,gcc_ntoarmv7le -Y_gpp -D__QNX__" ) - endif() + set( BLACKBERRY_COMP_TARGET "gcc_ntoarmv7le" ) else() - if( PLAYBOOK ) - set( BLACKBERRY_CC_FLAGS " -V4.4.2,gcc_ntox86 -D__PLAYBOOK__" ) - set( BLACKBERRY_CXX_FLAGS " -V4.4.2,gcc_ntox86 -Y_gpp -D__PLAYBOOK__" ) - else() - set( BLACKBERRY_CC_FLAGS " -V4.6.3,gcc_ntox86 -D__QNX__" ) - set( BLACKBERRY_CXX_FLAGS " -V4.6.3,gcc_ntox86 -Y_gpp -D__QNX__" ) - endif() + set( BLACKBERRY_COMP_TARGET "gcc_ntox86" ) endif() +set( BLACKBERRY_CXX_COMP_LIB "" ) +if( BLACKBERRY_DINKUM ) + set( DINKUM 1 ) + if( BB_USING_GCC_482 ) + set( BLACKBERRY_COMP_TARGET "${BLACKBERRY_COMP_TARGET}_cpp" ) + else() + set( BLACKBERRY_CXX_COMP_LIB "-Y_cpp" ) + endif() +else() + set( DINKUM 0 ) + if( BB_USING_GCC_482 ) + set( BLACKBERRY_COMP_TARGET "${BLACKBERRY_COMP_TARGET}_gpp" ) + else() + set( BLACKBERRY_CXX_COMP_LIB "-Y_gpp" ) + endif() +endif() +set( BLACKBERRY_CC_FLAGS " -V${BLACKBERRY_COMP_VERSION},${BLACKBERRY_COMP_TARGET} ${BLACKBERRY_COMP_DEF}" ) +set( BLACKBERRY_CXX_FLAGS " -V${BLACKBERRY_COMP_VERSION},${BLACKBERRY_COMP_TARGET} ${BLACKBERRY_CXX_COMP_LIB} ${BLACKBERRY_COMP_DEF}" ) set( BLACKBERRY 1 ) # NDK flags -set( CMAKE_CXX_FLAGS "${BLACKBERRY_CXX_FLAGS}" ) -set( CMAKE_C_FLAGS "${BLACKBERRY_CC_FLAGS}" ) +if( DINKUM ) + set( CMAKE_CXX_FLAGS "${BLACKBERRY_CXX_FLAGS} -DBLACKBERRY_DINKUM=1" ) + set( CMAKE_C_FLAGS "${BLACKBERRY_CC_FLAGS} -DBLACKBERRY_DINKUM=1" ) +else() + set( CMAKE_CXX_FLAGS "${BLACKBERRY_CXX_FLAGS}" ) + set( CMAKE_C_FLAGS "${BLACKBERRY_CC_FLAGS}" ) +endif() set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions" ) Modified: trunk/freeglut/freeglut/src/blackberry/fg_window_blackberry.c =================================================================== --- trunk/freeglut/freeglut/src/blackberry/fg_window_blackberry.c 2014-06-02 13:25:25 UTC (rev 1693) +++ trunk/freeglut/freeglut/src/blackberry/fg_window_blackberry.c 2014-06-24 07:03:16 UTC (rev 1694) @@ -61,7 +61,7 @@ int screenFormat = SCREEN_FORMAT_RGBA8888; //Only SCREEN_FORMAT_RGBA8888 and SCREEN_FORMAT_RGB565 are supported. See fg_window_egl for more info int configAttri; #define EGL_QUERY_COMP(att, comp) (eglGetConfigAttrib(fgDisplay.pDisplay.egl.Display, window->Window.pContext.egl.Config, att, &configAttri) == GL_TRUE && (configAttri comp)) - if(EGL_QUERY_COMP(EGL_ALPHA_SIZE, <= 0) && EGL_QUERY_COMP(EGL_RED_SIZE, <= 5) && + if (EGL_QUERY_COMP(EGL_ALPHA_SIZE, <= 0) && EGL_QUERY_COMP(EGL_RED_SIZE, <= 5) && EGL_QUERY_COMP(EGL_GREEN_SIZE, <= 6) && EGL_QUERY_COMP(EGL_BLUE_SIZE, <= 5)) { screenFormat = SCREEN_FORMAT_RGB565; } @@ -69,11 +69,17 @@ /* Set window properties */ int orientation = atoi(getenv("ORIENTATION")); -#ifdef GL_ES_VERSION_2_0 - int screenUsage = SCREEN_USAGE_OPENGL_ES2 | SCREEN_USAGE_ROTATION; -#elif GL_VERSION_ES_CM_1_0 || GL_VERSION_ES_CL_1_0 || GL_VERSION_ES_CM_1_1 || GL_VERSION_ES_CL_1_1 - int screenUsage = SCREEN_USAGE_OPENGL_ES1 | SCREEN_USAGE_ROTATION; + int screenUsage = SCREEN_USAGE_ROTATION; +#ifdef SCREEN_USAGE_OPENGL_ES3 + if (fgState.MajorVersion >= 3) { + screenUsage |= SCREEN_USAGE_OPENGL_ES3; + } else #endif + if (fgState.MajorVersion >= 2) { + screenUsage |= SCREEN_USAGE_OPENGL_ES2; + } else { + screenUsage |= SCREEN_USAGE_OPENGL_ES1; + } #if !defined(__X86__) && !defined(__PLAYBOOK__) screenUsage |= SCREEN_USAGE_DISPLAY; // Physical device copy directly into physical display #endif Modified: trunk/freeglut/freeglut/src/egl/fg_init_egl.c =================================================================== --- trunk/freeglut/freeglut/src/egl/fg_init_egl.c 2014-06-02 13:25:25 UTC (rev 1693) +++ trunk/freeglut/freeglut/src/egl/fg_init_egl.c 2014-06-24 07:03:16 UTC (rev 1694) @@ -39,7 +39,7 @@ FREEGLUT_INTERNAL_ERROR_EXIT(fgDisplay.pDisplay.egl.Display != EGL_NO_DISPLAY, "No display available", "fgPlatformInitialize"); - if (eglInitialize(fgDisplay.pDisplay.egl.Display, NULL, NULL) != EGL_TRUE) + if (eglInitialize(fgDisplay.pDisplay.egl.Display, &fgDisplay.pDisplay.egl.MajorVersion, &fgDisplay.pDisplay.egl.MinorVersion) != EGL_TRUE) fgError("eglInitialize: error %x\n", eglGetError()); # ifdef GL_VERSION_1_1 /* or later */ @@ -59,6 +59,8 @@ if (fgDisplay.pDisplay.egl.Display != EGL_NO_DISPLAY) { eglTerminate(fgDisplay.pDisplay.egl.Display); fgDisplay.pDisplay.egl.Display = EGL_NO_DISPLAY; + fgDisplay.pDisplay.egl.MajorVersion = 0; + fgDisplay.pDisplay.egl.MinorVersion = 0; } } Modified: trunk/freeglut/freeglut/src/egl/fg_internal_egl.h =================================================================== --- trunk/freeglut/freeglut/src/egl/fg_internal_egl.h 2014-06-02 13:25:25 UTC (rev 1693) +++ trunk/freeglut/freeglut/src/egl/fg_internal_egl.h 2014-06-24 07:03:16 UTC (rev 1694) @@ -35,6 +35,8 @@ { /* Used to initialize and deinitialize EGL */ EGLDisplay Display; + EGLint MajorVersion; + EGLint MinorVersion; }; Modified: trunk/freeglut/freeglut/src/egl/fg_window_egl.c =================================================================== --- trunk/freeglut/freeglut/src/egl/fg_window_egl.c 2014-06-02 13:25:25 UTC (rev 1693) +++ trunk/freeglut/freeglut/src/egl/fg_window_egl.c 2014-06-24 07:03:16 UTC (rev 1694) @@ -30,11 +30,16 @@ EGLint attributes[32]; int where = 0; ATTRIB_VAL(EGL_SURFACE_TYPE, EGL_WINDOW_BIT); +#ifdef EGL_OPENGL_ES3_BIT + if (fgDisplay.pDisplay.egl.MinorVersion >= 5 && fgState.MajorVersion >= 3) { + ATTRIB_VAL(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT); + } else +#endif if (fgState.MajorVersion >= 2) { /* - * Khronos does not specify a EGL_OPENGL_ES3_BIT outside of the OpenGL extension "EGL_KHR_create_context". There are numerous references on the internet that - * say to use EGL_OPENGL_ES3_BIT, followed by many saying they can't find it in any headers. In fact, the offical updated specification for EGL does not have - * any references to OpenGL ES 3.0. Tests have shown that EGL_OPENGL_ES2_BIT will work with ES 3.0. + * Khronos does not specify a EGL_OPENGL_ES3_BIT outside of the OpenGL extension "EGL_KHR_create_context" and EGL 1.5. There are numerous references on the internet + * that say to use EGL_OPENGL_ES3_BIT (pre-EGL 1.5), followed by many saying they can't find it in any headers. In fact, the offical updated specification for EGL + * does not have any references to OpenGL ES 3.x. Tests have shown that EGL_OPENGL_ES2_BIT will work with ES 3.x. */ ATTRIB_VAL(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT); } else { @@ -87,6 +92,12 @@ EGLint attributes[32]; int where = 0; ATTRIB_VAL(EGL_CONTEXT_CLIENT_VERSION, fgState.MajorVersion); +#ifdef EGL_CONTEXT_MINOR_VERSION + if (fgDisplay.pDisplay.egl.MinorVersion >= 5) { + // EGL_CONTEXT_CLIENT_VERSION == EGL_CONTEXT_MAJOR_VERSION + ATTRIB_VAL(EGL_CONTEXT_MINOR_VERSION, fgState.MinorVersion); + } +#endif ATTRIB(EGL_NONE); context = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, attributes); @@ -96,8 +107,17 @@ } eglQueryContext(fgDisplay.pDisplay.egl.Display, context, EGL_CONTEXT_CLIENT_VERSION, &ver); - if (ver != fgState.MajorVersion) + if (ver != fgState.MajorVersion) { fgError("Wrong GLES major version: %d\n", ver); + } +#ifdef EGL_CONTEXT_MINOR_VERSION + if (fgDisplay.pDisplay.egl.MinorVersion >= 5) { + eglQueryContext(fgDisplay.pDisplay.egl.Display, context, EGL_CONTEXT_MINOR_VERSION, &ver); + if (ver != fgState.MinorVersion) { + fgError("Wrong GLES minor version: %d\n", ver); + } + } +#endif return context; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2014-08-18 02:00:46
|
Revision: 1696 http://sourceforge.net/p/freeglut/code/1696 Author: dcnieho Date: 2014-08-18 02:00:40 +0000 (Mon, 18 Aug 2014) Log Message: ----------- For builds not using cmake, generate fg_version.h to match cmake-specified version number. Modified Paths: -------------- trunk/freeglut/freeglut/CMakeLists.txt trunk/freeglut/freeglut/config.h.in trunk/freeglut/freeglut/src/fg_internal.h Added Paths: ----------- trunk/freeglut/freeglut/src/fg_version.h trunk/freeglut/freeglut/src/fg_version.h.in Modified: trunk/freeglut/freeglut/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/CMakeLists.txt 2014-08-18 00:52:53 UTC (rev 1695) +++ trunk/freeglut/freeglut/CMakeLists.txt 2014-08-18 02:00:40 UTC (rev 1696) @@ -18,6 +18,8 @@ set(VERSION_MINOR 0) set(VERSION_PATCH 0) +# Update fg_version.h to match the versions number here in cmake +CONFIGURE_FILE(src/fg_version.h.in src/fg_version.h) # FREEGLUT_BUILD_SHARED_LIBS is already a standard CMake variable, but we need to # re-declare it here so it will show up in the GUI. Modified: trunk/freeglut/freeglut/config.h.in =================================================================== --- trunk/freeglut/freeglut/config.h.in 2014-08-18 00:52:53 UTC (rev 1695) +++ trunk/freeglut/freeglut/config.h.in 2014-08-18 02:00:40 UTC (rev 1696) @@ -19,11 +19,6 @@ #cmakedefine HAVE_ULONG_LONG #cmakedefine HAVE_U__INT64 -/* version numbers */ -#define VERSION_MAJOR @VERSION_MAJOR@ -#define VERSION_MINOR @VERSION_MINOR@ -#define VERSION_PATCH @VERSION_PATCH@ - /* warning and errors printed? */ #cmakedefine FREEGLUT_PRINT_WARNINGS #cmakedefine FREEGLUT_PRINT_ERRORS Modified: trunk/freeglut/freeglut/src/fg_internal.h =================================================================== --- trunk/freeglut/freeglut/src/fg_internal.h 2014-08-18 00:52:53 UTC (rev 1695) +++ trunk/freeglut/freeglut/src/fg_internal.h 2014-08-18 02:00:40 UTC (rev 1696) @@ -32,6 +32,8 @@ # include "config.h" #endif +#include "fg_version.h" + /* Freeglut is intended to function under all Unix/X11 and Win32 platforms. */ /* XXX: Don't all MS-Windows compilers (except Cygwin) have _WIN32 defined? * XXX: If so, remove the first set of defined()'s below. Added: trunk/freeglut/freeglut/src/fg_version.h =================================================================== --- trunk/freeglut/freeglut/src/fg_version.h (rev 0) +++ trunk/freeglut/freeglut/src/fg_version.h 2014-08-18 02:00:40 UTC (rev 1696) @@ -0,0 +1,47 @@ +/* + * fg_version.h + * + * The freeglut library private include file. + * + * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. + * Written by Pawel W. Olszta, <ol...@so...> + * Creation date: Thu Dec 2 1999 + * + * 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 FREEGLUT_VERSION_H +#define FREEGLUT_VERSION_H + +/* Ordinarily it's cmake's job to update fg_version.h, + * edit CMakeLists.txt rather than this file directly. + */ + +#ifndef VERSION_MAJOR +#define VERSION_MAJOR 3 +#endif + +#ifndef VERSION_MINOR +#define VERSION_MINOR 0 +#endif + +#ifndef VERSION_PATCH +#define VERSION_PATCH 0 +#endif + +#endif Property changes on: trunk/freeglut/freeglut/src/fg_version.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/freeglut/freeglut/src/fg_version.h.in =================================================================== --- trunk/freeglut/freeglut/src/fg_version.h.in (rev 0) +++ trunk/freeglut/freeglut/src/fg_version.h.in 2014-08-18 02:00:40 UTC (rev 1696) @@ -0,0 +1,47 @@ +/* + * fg_version.h + * + * The freeglut library private include file. + * + * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. + * Written by Pawel W. Olszta, <ol...@so...> + * Creation date: Thu Dec 2 1999 + * + * 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 FREEGLUT_VERSION_H +#define FREEGLUT_VERSION_H + +/* Ordinarily it's cmake's job to update fg_version.h, + * edit CMakeLists.txt rather than this file directly. + */ + +#ifndef VERSION_MAJOR +#define VERSION_MAJOR @VERSION_MAJOR@ +#endif + +#ifndef VERSION_MINOR +#define VERSION_MINOR @VERSION_MINOR@ +#endif + +#ifndef VERSION_PATCH +#define VERSION_PATCH @VERSION_PATCH@ +#endif + +#endif Property changes on: trunk/freeglut/freeglut/src/fg_version.h.in ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2014-08-27 10:14:47
|
Revision: 1700 http://sourceforge.net/p/freeglut/code/1700 Author: dcnieho Date: 2014-08-27 10:14:44 +0000 (Wed, 27 Aug 2014) Log Message: ----------- caption height should include the width of the border atop the window Modified Paths: -------------- trunk/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c Modified: trunk/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp =================================================================== --- trunk/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp 2014-08-27 05:47:05 UTC (rev 1699) +++ trunk/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp 2014-08-27 10:14:44 UTC (rev 1700) @@ -334,7 +334,7 @@ width, height, x ,y, x-border, - y-border-caption); + y-caption); else printf("child window %dx%d, top-left of client at: (%d,%d), relative to parent\n", width, height, Modified: trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c 2014-08-27 05:47:05 UTC (rev 1699) +++ trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c 2014-08-27 10:14:44 UTC (rev 1700) @@ -256,7 +256,7 @@ * all other extra pixels are assumed to be atop the window, forming the caption. */ borderWidth = ((winRect.right-winRect.left)-(clientRect.right-clientRect.left))/2; - captionHeight = (winRect.bottom-winRect.top)-(clientRect.bottom-clientRect.top)-borderWidth*2; + captionHeight = (winRect.bottom-winRect.top)-(clientRect.bottom-clientRect.top)-borderWidth; /* include top border in caption height */ switch( eWhat ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2014-08-27 16:02:08
|
Revision: 1703 http://sourceforge.net/p/freeglut/code/1703 Author: dcnieho Date: 2014-08-27 16:02:03 +0000 (Wed, 27 Aug 2014) Log Message: ----------- X11: implemented borderless and captionless window style using motif hints Modified Paths: -------------- trunk/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp trunk/freeglut/freeglut/src/x11/fg_window_x11.c Modified: trunk/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp =================================================================== --- trunk/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp 2014-08-27 13:42:59 UTC (rev 1702) +++ trunk/freeglut/freeglut/progs/demos/Resizer/Resizer.cpp 2014-08-27 16:02:03 UTC (rev 1703) @@ -380,4 +380,4 @@ printf("glutMainLoop returned\n"); return EXIT_SUCCESS; -} \ No newline at end of file +} Modified: trunk/freeglut/freeglut/src/x11/fg_window_x11.c =================================================================== --- trunk/freeglut/freeglut/src/x11/fg_window_x11.c 2014-08-27 13:42:59 UTC (rev 1702) +++ trunk/freeglut/freeglut/src/x11/fg_window_x11.c 2014-08-27 16:02:03 UTC (rev 1703) @@ -40,6 +40,18 @@ #include "x11/fg_window_x11_glx.h" #endif +/* Motif window hints, only define needed ones */ +typedef struct +{ + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long input_mode; + unsigned long status; +} MotifWmHints; +#define MWM_HINTS_DECORATIONS (1L << 1) +#define MWM_DECOR_BORDER (1L << 1) + static int fghResizeFullscrToggle(void) { XWindowAttributes attributes; @@ -340,7 +352,27 @@ XSetWMProtocols( fgDisplay.pDisplay.Display, window->Window.Handle, &fgDisplay.pDisplay.DeleteWindow, 1 ); + + if (!isSubWindow && !window->IsMenu && + ((fgState.DisplayMode & GLUT_BORDERLESS) || (fgState.DisplayMode & GLUT_CAPTIONLESS))) + { + /* _MOTIF_WM_HINTS is replaced by _NET_WM_WINDOW_TYPE, but that property does not allow precise + * control over the visual style of the window, which is what we are trying to achieve here. + * Stick with Motif and hope for the best... */ + MotifWmHints hints = {0}; + hints.flags = MWM_HINTS_DECORATIONS; + hints.decorations = (fgState.DisplayMode & GLUT_CAPTIONLESS) ? MWM_DECOR_BORDER:0; + printf("%i\n",hints.decorations); + XChangeProperty(fgDisplay.pDisplay.Display, window->Window.Handle, + XInternAtom( fgDisplay.pDisplay.Display, "_MOTIF_WM_HINTS", False ), + XInternAtom( fgDisplay.pDisplay.Display, "_MOTIF_WM_HINTS", False ), 32, + PropModeReplace, + (unsigned char*) &hints, + sizeof(MotifWmHints) / sizeof(long)); + } + + if (fgDisplay.pDisplay.NetWMSupported && fgDisplay.pDisplay.NetWMPid != None && fgDisplay.pDisplay.ClientMachine != None) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jt...@us...> - 2014-10-11 17:15:41
|
Revision: 1707 http://sourceforge.net/p/freeglut/code/1707 Author: jtsiomb Date: 2014-10-11 17:15:33 +0000 (Sat, 11 Oct 2014) Log Message: ----------- fixed build on MSVC6 Modified Paths: -------------- trunk/freeglut/freeglut/CMakeLists.txt trunk/freeglut/freeglut/progs/demos/shapes/glmatrix.c trunk/freeglut/freeglut/progs/demos/shapes/glmatrix.h trunk/freeglut/freeglut/progs/demos/shapes/shapes.c trunk/freeglut/freeglut/src/mswin/fg_main_mswin.c Modified: trunk/freeglut/freeglut/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/CMakeLists.txt 2014-10-06 16:32:46 UTC (rev 1706) +++ trunk/freeglut/freeglut/CMakeLists.txt 2014-10-11 17:15:33 UTC (rev 1707) @@ -228,6 +228,9 @@ SET( CMAKE_DEBUG_POSTFIX "d" ) ENDIF(MSVC) + # enable the use of Win2000 APIs (needed for really old compilers like MSVC6) + ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500) + ADD_DEFINITIONS(-DWINVER=0x0500) ENDIF() IF(CMAKE_COMPILER_IS_GNUCC) Modified: trunk/freeglut/freeglut/progs/demos/shapes/glmatrix.c =================================================================== --- trunk/freeglut/freeglut/progs/demos/shapes/glmatrix.c 2014-10-06 16:32:46 UTC (rev 1706) +++ trunk/freeglut/freeglut/progs/demos/shapes/glmatrix.c 2014-10-11 17:15:33 UTC (rev 1707) @@ -3,6 +3,10 @@ #include <math.h> #include "glmatrix.h" +#ifndef M_PI +#define M_PI 3.141592653589793 +#endif + #define MMODE_IDX(x) ((x) - GL_MODELVIEW) #define MAT_STACK_SIZE 32 #define MAT_IDENT {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1} @@ -114,17 +118,17 @@ gl_mult_matrixf(mat); } -void gl_ortho(float left, float right, float bottom, float top, float near, float far) +void gl_ortho(float left, float right, float bottom, float top, float znear, float zfar) { float mat[] = MAT_IDENT; float dx = right - left; float dy = top - bottom; - float dz = far - near; + float dz = zfar - znear; float tx = -(right + left) / dx; float ty = -(top + bottom) / dy; - float tz = -(far + near) / dz; + float tz = -(zfar + znear) / dz; float sx = 2.f / dx; float sy = 2.f / dy; @@ -140,21 +144,21 @@ gl_mult_matrixf(mat); } -void gl_frustum(float left, float right, float bottom, float top, float near, float far) +void gl_frustum(float left, float right, float bottom, float top, float znear, float zfar) { float mat[] = MAT_IDENT; float dx = right - left; float dy = top - bottom; - float dz = far - near; + float dz = zfar - znear; float a = (right + left) / dx; float b = (top + bottom) / dy; - float c = -(far + near) / dz; - float d = -2.f * far * near / dz; + float c = -(zfar + znear) / dz; + float d = -2.f * zfar * znear / dz; - mat[0] = 2.f * near / dx; - mat[5] = 2.f * near / dy; + mat[0] = 2.f * znear / dx; + mat[5] = 2.f * znear / dy; mat[8] = a; mat[9] = b; mat[10] = c; @@ -165,11 +169,11 @@ gl_mult_matrixf(mat); } -void glu_perspective(float vfov, float aspect, float near, float far) +void glu_perspective(float vfov, float aspect, float znear, float zfar) { float vfov_rad = (float)M_PI * vfov / 180.f; - float x = near * (float)tan(vfov_rad / 2.f); - gl_frustum(-aspect * x, aspect * x, -x, x, near, far); + float x = znear * (float)tan(vfov_rad / 2.f); + gl_frustum(-aspect * x, aspect * x, -x, x, znear, zfar); } /* return the matrix (16 elements, 4x4 matrix, row-major order */ Modified: trunk/freeglut/freeglut/progs/demos/shapes/glmatrix.h =================================================================== --- trunk/freeglut/freeglut/progs/demos/shapes/glmatrix.h 2014-10-06 16:32:46 UTC (rev 1706) +++ trunk/freeglut/freeglut/progs/demos/shapes/glmatrix.h 2014-10-11 17:15:33 UTC (rev 1707) @@ -20,9 +20,9 @@ void gl_translatef(float x, float y, float z); void gl_rotatef(float angle, float x, float y, float z); void gl_scalef(float x, float y, float z); -void gl_ortho(float left, float right, float bottom, float top, float near, float far); -void gl_frustum(float left, float right, float bottom, float top, float near, float far); -void glu_perspective(float vfov, float aspect, float near, float far); +void gl_ortho(float left, float right, float bottom, float top, float znear, float zfar); +void gl_frustum(float left, float right, float bottom, float top, float znear, float zfar); +void glu_perspective(float vfov, float aspect, float znear, float zfar); /* getters */ float* get_matrix(int mm); Modified: trunk/freeglut/freeglut/progs/demos/shapes/shapes.c =================================================================== --- trunk/freeglut/freeglut/progs/demos/shapes/shapes.c 2014-10-06 16:32:46 UTC (rev 1706) +++ trunk/freeglut/freeglut/progs/demos/shapes/shapes.c 2014-10-11 17:15:33 UTC (rev 1707) @@ -44,6 +44,7 @@ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include <stddef.h> #include "glmatrix.h" Modified: trunk/freeglut/freeglut/src/mswin/fg_main_mswin.c =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_main_mswin.c 2014-10-06 16:32:46 UTC (rev 1706) +++ trunk/freeglut/freeglut/src/mswin/fg_main_mswin.c 2014-10-11 17:15:33 UTC (rev 1707) @@ -184,7 +184,7 @@ -# if(_WIN32_WINNT >= 0x0500) +# if(_WIN32_WINNT >= 0x0500) && defined(WM_NCXBUTTONDOWN) DEFINE_MESSAGE(WM_NCXBUTTONDOWN), DEFINE_MESSAGE(WM_NCXBUTTONUP), DEFINE_MESSAGE(WM_NCXBUTTONDBLCLK), @@ -241,7 +241,7 @@ DEFINE_MESSAGE(WM_UNINITMENUPOPUP), DEFINE_MESSAGE(WM_MENUCOMMAND), -# if(_WIN32_WINNT >= 0x0500) +# if(_WIN32_WINNT >= 0x0500) && defined(WM_CHANGEUISTATE) DEFINE_MESSAGE(WM_CHANGEUISTATE), DEFINE_MESSAGE(WM_UPDATEUISTATE), DEFINE_MESSAGE(WM_QUERYUISTATE), @@ -272,7 +272,7 @@ # if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) DEFINE_MESSAGE(WM_MOUSEWHEEL), # endif -# if (_WIN32_WINNT >= 0x0500) +# if (_WIN32_WINNT >= 0x0500) && defined(WM_XBUTTONDOWN) DEFINE_MESSAGE(WM_XBUTTONDOWN), DEFINE_MESSAGE(WM_XBUTTONUP), DEFINE_MESSAGE(WM_XBUTTONDBLCLK), @@ -364,7 +364,7 @@ DEFINE_MESSAGE(WM_MOUSEHOVER), DEFINE_MESSAGE(WM_MOUSELEAVE), # endif -# if(WINVER >= 0x0500) +# if(WINVER >= 0x0500) && defined(WM_NCMOUSEHOVER) DEFINE_MESSAGE(WM_NCMOUSEHOVER), DEFINE_MESSAGE(WM_NCMOUSELEAVE), # endif /* WINVER >= 0x0500 */ @@ -398,7 +398,7 @@ DEFINE_MESSAGE(WM_PRINTCLIENT), # endif /* WINVER >= 0x0400 */ -# if(_WIN32_WINNT >= 0x0500) +# if(_WIN32_WINNT >= 0x0500) && defined(WM_APPCOMMAND) DEFINE_MESSAGE(WM_APPCOMMAND), # endif /* _WIN32_WINNT >= 0x0500 */ @@ -1283,7 +1283,7 @@ */ #else /* int modkeys = GET_KEYSTATE_WPARAM( wParam ); */ - short ticks = GET_WHEEL_DELTA_WPARAM( wParam ); + short ticks = HIWORD( wParam ); /* commented out as should not be needed here, mouse motion is processed in WM_MOUSEMOVE first: window->State.MouseX = GET_X_LPARAM( lParam ); window->State.MouseY = GET_Y_LPARAM( lParam ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2014-10-17 16:28:32
|
Revision: 1718 http://sourceforge.net/p/freeglut/code/1718 Author: dcnieho Date: 2014-10-17 16:28:24 +0000 (Fri, 17 Oct 2014) Log Message: ----------- adding glutStrokeWidthf and glutStrokeLengthf from GLUT 3.8 Modified Paths: -------------- trunk/freeglut/freeglut/include/GL/freeglut_ext.h trunk/freeglut/freeglut/include/GL/freeglut_std.h trunk/freeglut/freeglut/src/fg_ext.c trunk/freeglut/freeglut/src/fg_font.c Modified: trunk/freeglut/freeglut/include/GL/freeglut_ext.h =================================================================== --- trunk/freeglut/freeglut/include/GL/freeglut_ext.h 2014-10-17 16:09:00 UTC (rev 1717) +++ trunk/freeglut/freeglut/include/GL/freeglut_ext.h 2014-10-17 16:28:24 UTC (rev 1718) @@ -202,7 +202,7 @@ #define GLUT_HAS_MULTI 1 -/* TODO: add device_id paramater, +/* TODO: add device_id parameter, cf. http://sourceforge.net/mailarchive/forum.php?thread_name=20120518071314.GA28061%40perso.beuc.net&forum_name=freeglut-developer */ FGAPI void FGAPIENTRY glutMultiEntryFunc( void (* callback)( int, int ) ); FGAPI void FGAPIENTRY glutMultiButtonFunc( void (* callback)( int, int, int, int, int ) ); Modified: trunk/freeglut/freeglut/include/GL/freeglut_std.h =================================================================== --- trunk/freeglut/freeglut/include/GL/freeglut_std.h 2014-10-17 16:09:00 UTC (rev 1717) +++ trunk/freeglut/freeglut/include/GL/freeglut_std.h 2014-10-17 16:28:24 UTC (rev 1718) @@ -529,8 +529,10 @@ FGAPI int FGAPIENTRY glutBitmapWidth( void* font, int character ); FGAPI void FGAPIENTRY glutStrokeCharacter( void* font, int character ); FGAPI int FGAPIENTRY glutStrokeWidth( void* font, int character ); +FGAPI GLfloat FGAPIENTRY glutStrokeWidthf( void* font, int character ); /* GLUT 3.8 */ FGAPI int FGAPIENTRY glutBitmapLength( void* font, const unsigned char* string ); FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* string ); +FGAPI GLfloat FGAPIENTRY glutStrokeLengthf( void* font, const unsigned char *string ); /* GLUT 3.8 */ /* * Geometry functions, see fg_geometry.c Modified: trunk/freeglut/freeglut/src/fg_ext.c =================================================================== --- trunk/freeglut/freeglut/src/fg_ext.c 2014-10-17 16:09:00 UTC (rev 1717) +++ trunk/freeglut/freeglut/src/fg_ext.c 2014-10-17 16:28:24 UTC (rev 1718) @@ -125,8 +125,10 @@ CHECK_NAME(glutBitmapWidth); CHECK_NAME(glutStrokeCharacter); CHECK_NAME(glutStrokeWidth); + CHECK_NAME(glutStrokeWidthf); CHECK_NAME(glutBitmapLength); CHECK_NAME(glutStrokeLength); + CHECK_NAME(glutStrokeLengthf); CHECK_NAME(glutWireSphere); CHECK_NAME(glutSolidSphere); CHECK_NAME(glutWireCone); Modified: trunk/freeglut/freeglut/src/fg_font.c =================================================================== --- trunk/freeglut/freeglut/src/fg_font.c 2014-10-17 16:09:00 UTC (rev 1717) +++ trunk/freeglut/freeglut/src/fg_font.c 2014-10-17 16:28:24 UTC (rev 1718) @@ -346,7 +346,7 @@ /* * Return the width in pixels of a stroke character */ -int FGAPIENTRY glutStrokeWidth( void* fontID, int character ) +GLfloat FGAPIENTRY glutStrokeWidthf( void* fontID, int character ) { const SFG_StrokeChar *schar; SFG_StrokeFont* font; @@ -364,17 +364,21 @@ schar = font->Characters[ character ]; freeglut_return_val_if_fail( schar, 0 ); - return ( int )( schar->Right + 0.5 ); + return schar->Right; } +int FGAPIENTRY glutStrokeWidth(void* fontID, int character) +{ + return ( int )( glutStrokeWidthf(fontID,character) + 0.5f ); +} /* * Return the width of a string drawn using a stroke font */ -int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string ) +GLfloat FGAPIENTRY glutStrokeLengthf( void* fontID, const unsigned char* string ) { unsigned char c; - float length = 0.0; - float this_line_length = 0.0; + GLfloat length = 0.0; + GLfloat this_line_length = 0.0; SFG_StrokeFont* font; FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutStrokeLength" ); font = fghStrokeByID( fontID ); @@ -404,8 +408,12 @@ } if( length < this_line_length ) length = this_line_length; - return( int )( length + 0.5 ); + return length; } +int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string ) +{ + return( int )( glutStrokeLengthf(fontID,string) + 0.5f ); +} /* * Returns the height of a stroke font This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jt...@us...> - 2014-10-20 15:22:38
|
Revision: 1723 http://sourceforge.net/p/freeglut/code/1723 Author: jtsiomb Date: 2014-10-20 15:22:29 +0000 (Mon, 20 Oct 2014) Log Message: ----------- removed vfprintf and checking from CMakeLists.txt, and all the fallbacks from vfprintf to the obscure _doprnt function Modified Paths: -------------- trunk/freeglut/freeglut/CMakeLists.txt trunk/freeglut/freeglut/src/fg_main.c trunk/freeglut/freeglut/src/mswin/fg_internal_mswin.h trunk/freeglut/freeglut/src/x11/fg_main_x11.c Modified: trunk/freeglut/freeglut/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/CMakeLists.txt 2014-10-19 23:22:53 UTC (rev 1722) +++ trunk/freeglut/freeglut/CMakeLists.txt 2014-10-20 15:22:29 UTC (rev 1723) @@ -289,11 +289,8 @@ CHECK_INCLUDE_FILES(sys/param.h HAVE_SYS_PARAM_H) CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H) CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H) -CHECK_INCLUDE_FILES(errno.h HAVE_ERRNO_H) CHECK_INCLUDE_FILES(usbhid.h HAVE_USBHID_H) CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) -CHECK_FUNCTION_EXISTS(vfprintf HAVE_VFPRINTF) -CHECK_FUNCTION_EXISTS(_doprnt HAVE_DOPRNT) CHECK_FUNCTION_EXISTS(XParseGeometry HAVE_XPARSEGEOMETRY) IF (NOT HAVE_XPARSEGEOMETRY) LIST(APPEND FREEGLUT_SRCS Modified: trunk/freeglut/freeglut/src/fg_main.c =================================================================== --- trunk/freeglut/freeglut/src/fg_main.c 2014-10-19 23:22:53 UTC (rev 1722) +++ trunk/freeglut/freeglut/src/fg_main.c 2014-10-20 15:22:29 UTC (rev 1723) @@ -31,13 +31,6 @@ # include <errno.h> #endif #include <stdarg.h> -#ifdef HAVE_VFPRINTF -# define VFPRINTF(s,f,a) vfprintf((s),(f),(a)) -#elif defined(HAVE__DOPRNT) -# define VFPRINTF(s,f,a) _doprnt((f),(a),(s)) -#else -# define VFPRINTF(s,f,a) -#endif /* * Try to get the maximum value allowed for ints, falling back to the minimum @@ -289,7 +282,7 @@ fprintf( stderr, "freeglut "); if( fgState.ProgramName ) fprintf( stderr, "(%s): ", fgState.ProgramName ); - VFPRINTF( stderr, fmt, ap ); + vfprintf( stderr, fmt, ap ); fprintf( stderr, "\n" ); va_end( ap ); @@ -322,7 +315,7 @@ fprintf( stderr, "freeglut "); if( fgState.ProgramName ) fprintf( stderr, "(%s): ", fgState.ProgramName ); - VFPRINTF( stderr, fmt, ap ); + vfprintf( stderr, fmt, ap ); fprintf( stderr, "\n" ); va_end( ap ); Modified: trunk/freeglut/freeglut/src/mswin/fg_internal_mswin.h =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_internal_mswin.h 2014-10-19 23:22:53 UTC (rev 1722) +++ trunk/freeglut/freeglut/src/mswin/fg_internal_mswin.h 2014-10-20 15:22:29 UTC (rev 1723) @@ -48,10 +48,6 @@ #endif -#ifndef HAVE_VFPRINTF -#define HAVE_VFPRINTF 1 -#endif - /* MinGW may lack a prototype for ChangeDisplaySettingsEx() (depending on the version?) */ #if !defined(ChangeDisplaySettingsEx) LONG WINAPI ChangeDisplaySettingsExA(LPCSTR,LPDEVMODEA,HWND,DWORD,LPVOID); Modified: trunk/freeglut/freeglut/src/x11/fg_main_x11.c =================================================================== --- trunk/freeglut/freeglut/src/x11/fg_main_x11.c 2014-10-19 23:22:53 UTC (rev 1722) +++ trunk/freeglut/freeglut/src/x11/fg_main_x11.c 2014-10-20 15:22:29 UTC (rev 1723) @@ -32,13 +32,6 @@ # include <errno.h> #endif #include <stdarg.h> -#ifdef HAVE_VFPRINTF -# define VFPRINTF(s,f,a) vfprintf((s),(f),(a)) -#elif defined(HAVE__DOPRNT) -# define VFPRINTF(s,f,a) _doprnt((f),(a),(s)) -#else -# define VFPRINTF(s,f,a) -#endif /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2014-11-03 04:19:18
|
Revision: 1728 http://sourceforge.net/p/freeglut/code/1728 Author: dcnieho Date: 2014-11-03 04:19:10 +0000 (Mon, 03 Nov 2014) Log Message: ----------- Added support for minimizing window. Fixed issue where reshape callback would be called multiple times due to conflicting window size messages on keyboard closure. Fixed issue where changing orientation with the keyboard open would cause multiple reshape events. Modified Paths: -------------- trunk/freeglut/freeglut/CMakeLists.txt trunk/freeglut/freeglut/src/blackberry/fg_internal_blackberry.h trunk/freeglut/freeglut/src/blackberry/fg_main_blackberry.c trunk/freeglut/freeglut/src/blackberry/fg_window_blackberry.c Modified: trunk/freeglut/freeglut/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/CMakeLists.txt 2014-11-03 04:18:51 UTC (rev 1727) +++ trunk/freeglut/freeglut/CMakeLists.txt 2014-11-03 04:19:10 UTC (rev 1728) @@ -268,15 +268,14 @@ # -llog for native Android logging LIST(APPEND LIBS android log) ELSEIF(BLACKBERRY) - if(PLAYBOOK) - # -lbps for event loop - # -screen for native screen - LIST(APPEND LIBS bps screen) - ELSE() - # -lbps for event loop + # -lbps for event loop + # -screen for native screen + LIST(APPEND LIBS bps screen) + + if(NOT PLAYBOOK) # -lslog2 for logging - # -screen for native screen - LIST(APPEND LIBS bps slog2 screen) + # -pps for low-level screen manipulation + LIST(APPEND LIBS slog2 pps) ENDIF() ENDIF() Modified: trunk/freeglut/freeglut/src/blackberry/fg_internal_blackberry.h =================================================================== --- trunk/freeglut/freeglut/src/blackberry/fg_internal_blackberry.h 2014-11-03 04:18:51 UTC (rev 1727) +++ trunk/freeglut/freeglut/src/blackberry/fg_internal_blackberry.h 2014-11-03 04:19:10 UTC (rev 1728) @@ -119,10 +119,8 @@ int originalRotation; navigator_window_state_t windowState; GLboolean windowCovered; -#ifdef __PLAYBOOK__ int keyboardHeight; GLboolean keyboardOpen; -#endif }; /* Menu font and color definitions */ Modified: trunk/freeglut/freeglut/src/blackberry/fg_main_blackberry.c =================================================================== --- trunk/freeglut/freeglut/src/blackberry/fg_main_blackberry.c 2014-11-03 04:18:51 UTC (rev 1727) +++ trunk/freeglut/freeglut/src/blackberry/fg_main_blackberry.c 2014-11-03 04:19:10 UTC (rev 1728) @@ -353,12 +353,10 @@ do { SFG_Window* window = fgStructure.CurrentWindow; -#ifdef __PLAYBOOK__ /* Get the keyboard height before doing anything since we otherwise don't get it until it changes */ if(window->State.pWState.keyboardHeight == 0) { virtualkeyboard_get_height(&window->State.pWState.keyboardHeight); } -#endif domain = bps_event_get_domain(fgDisplay.pDisplay.event); if (domain == screen_get_domain()) { int eventType; @@ -674,8 +672,13 @@ /* PlayBook doesn't indicate what the new size will be, so we need to retrieve it from the window itself */ window->State.pWState.newWidth = glutGet(GLUT_WINDOW_WIDTH); window->State.pWState.newHeight = glutGet(GLUT_WINDOW_HEIGHT); + fghOnReshapeNotify(window, window->State.pWState.newWidth, window->State.pWState.newHeight, GL_FALSE); +#else + if(window->State.pWState.keyboardOpen == GL_FALSE) { + /* On rotation, if the keyboard is open, it will get the keyboard resize events anyway. Otherwise, handle the resize. */ + fghOnReshapeNotify(window, window->State.pWState.newWidth, window->State.pWState.newHeight, GL_FALSE); + } #endif - fghOnReshapeNotify(window, window->State.pWState.newWidth, window->State.pWState.newHeight, GL_FALSE); /* Reset sizes */ window->State.pWState.newWidth = 0; @@ -708,48 +711,9 @@ #ifndef __PLAYBOOK__ case NAVIGATOR_KEYBOARD_STATE: - { - LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_KEYBOARD_STATE"); - - navigator_keyboard_state_t state = navigator_event_get_keyboard_state(fgDisplay.pDisplay.event); - switch (state) - { - case NAVIGATOR_KEYBOARD_CLOSED: - LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_KEYBOARD_STATE-NAVIGATOR_KEYBOARD_CLOSED"); - /* NAVIGATOR_KEYBOARD_POSITION only occurs on open, so on keyboard close we need to reset the keyboard height */ - fgPlatformHandleKeyboardHeight(window, 0); - break; - case NAVIGATOR_KEYBOARD_OPENING: - case NAVIGATOR_KEYBOARD_OPENED: - case NAVIGATOR_KEYBOARD_CLOSING: - break; - case NAVIGATOR_KEYBOARD_UNRECOGNIZED: - LOGW("fgPlatformProcessSingleEvent: NAVIGATOR_KEYBOARD_STATE-NAVIGATOR_KEYBOARD_UNRECOGNIZED"); - break; - default: - LOGW("fgPlatformProcessSingleEvent: NAVIGATOR_KEYBOARD_STATE unknown: 0x%X", SLOG2_FA_SIGNED(state)); - break; - } - break; - } - case NAVIGATOR_KEYBOARD_POSITION: - { - /* Occurs only when keyboard has opened or resizes */ - LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_KEYBOARD_POSITION"); - - int keyboardOffset = navigator_event_get_keyboard_position(fgDisplay.pDisplay.event); - if(keyboardOffset == BPS_FAILURE) { - LOGW("fgPlatformProcessSingleEvent: NAVIGATOR_KEYBOARD_POSITION: getting keyboard offset failed"); - } else { - /* keyboardOffset is the offset from the top of the screen to the top of the keyboard, AKA the size of the uncovered screen - We want the height of the keyboard. So instead of determining the orientation, getting the right display size, and subtracting; - we just get the keyboard height which may be slower but easier to understand and work with */ - virtualkeyboard_get_height(&keyboardOffset); - fgPlatformHandleKeyboardHeight(window, keyboardOffset); - } + /* See virtual keyboard handling for info on why this is not used. */ break; - } case NAVIGATOR_DEVICE_LOCK_STATE: break; @@ -775,6 +739,7 @@ #endif case 0: //Doesn't exist in header, but shows up when keyboard shows and resizes + case NAVIGATOR_OTHER: break; default: @@ -782,8 +747,10 @@ break; } } -#ifdef __PLAYBOOK__ - /* While this could be used for non-PlayBook, BlackBerry 10 will still get navigator events, so use those. They are a bit more exact. */ + /* + * BlackBerry 10 navigator provides keyboard events, but they conflict with how we handle keyboard events. + * Causing multiple reshape messages and can leave window state incorrectly setup. + */ else if(domain == virtualkeyboard_get_domain()) { unsigned int eventType = bps_event_get_code(fgDisplay.pDisplay.event); switch (eventType) { @@ -816,7 +783,6 @@ break; } } -#endif } while(bps_get_event(&fgDisplay.pDisplay.event, 1) == BPS_SUCCESS && fgDisplay.pDisplay.event != NULL); /* Reset event to reduce chances of triggering something */ @@ -828,15 +794,13 @@ LOGI("fgPlatformMainLoopPreliminaryWork"); /* Request navigator events */ - navigator_request_events(0); + navigator_request_events(NAVIGATOR_EXTENDED_DATA); /* Allow rotation */ navigator_rotation_lock(false); -#ifdef __PLAYBOOK__ /* Request keyboard events */ virtualkeyboard_request_events(0); -#endif /* Request window events */ screen_request_events(fgDisplay.pDisplay.screenContext); Modified: trunk/freeglut/freeglut/src/blackberry/fg_window_blackberry.c =================================================================== --- trunk/freeglut/freeglut/src/blackberry/fg_window_blackberry.c 2014-11-03 04:18:51 UTC (rev 1727) +++ trunk/freeglut/freeglut/src/blackberry/fg_window_blackberry.c 2014-11-03 04:19:10 UTC (rev 1728) @@ -31,7 +31,7 @@ #include <GL/freeglut.h> #include "fg_internal.h" #include "egl/fg_window_egl.h" -#include <screen/screen.h> +#include <sys/pps.h> /* * Opens a window. Requires a SFG_Window object created and attached @@ -261,9 +261,20 @@ */ void fgPlatformIconifyWindow( SFG_Window *window ) { - //XXX This is possible via Cascades, but can't seem to find a C-level API - //XXX bb::Application::instance()->minimize(); +#ifndef __PLAYBOOK__ + pps_encoder_t encoder; + + pps_encoder_initialize(&encoder, false); + pps_encoder_add_string(&encoder, "msg", "minimizeWindow"); + + if (navigator_raw_write(pps_encoder_buffer(&encoder), pps_encoder_length(&encoder)) != BPS_SUCCESS) { + fgWarning("Could not iconify window on BlackBerry"); + } + + pps_encoder_cleanup(&encoder); +#else fprintf(stderr, "fgPlatformGlutIconifyWindow: STUB\n"); +#endif } /* @@ -279,6 +290,7 @@ */ void fgPlatformGlutSetIconTitle( const char* title ) { + //XXX Possibly a window cover label? fprintf(stderr, "fgPlatformGlutSetIconTitle: STUB\n"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jt...@us...> - 2015-02-18 00:37:13
|
Revision: 1743 http://sourceforge.net/p/freeglut/code/1743 Author: jtsiomb Date: 2015-02-18 00:37:05 +0000 (Wed, 18 Feb 2015) Log Message: ----------- Applied Daniel Macks' patch to use ${CMAKE_INSTALL_LIBDIR} instead of hardcoding lib for the installation directory of libraries, with the additional modification of installing the pkg-config files there too. closing bug #217 Modified Paths: -------------- trunk/freeglut/freeglut/CMakeLists.txt trunk/freeglut/freeglut/freeglut.pc.in Modified: trunk/freeglut/freeglut/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/CMakeLists.txt 2015-01-03 11:55:09 UTC (rev 1742) +++ trunk/freeglut/freeglut/CMakeLists.txt 2015-02-18 00:37:05 UTC (rev 1743) @@ -1,6 +1,9 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) PROJECT(freeglut) +# for multiarch LIBDIR support (requires cmake>=2.8.8) +INCLUDE(GNUInstallDirs) + # NOTE: On Windows and Cygwin, the dll's are placed in the # CMAKE_RUNTIME_OUTPUT_DIRECTORY, while their corresponding import # libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY. On other @@ -413,8 +416,8 @@ IF(FREEGLUT_BUILD_SHARED_LIBS) INSTALL(TARGETS freeglut RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) IF(INSTALL_PDB) INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/freeglut${CMAKE_DEBUG_POSTFIX}.pdb @@ -425,8 +428,8 @@ IF(FREEGLUT_BUILD_STATIC_LIBS) INSTALL(TARGETS freeglut_static RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) IF(INSTALL_PDB) INSTALL(FILES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/Debug/freeglut_static${CMAKE_DEBUG_POSTFIX}.pdb @@ -522,6 +525,6 @@ SET(PC_FILENAME "freeglut-gles.pc") ENDIF() CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY) -INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION lib/pkgconfig/ RENAME ${PC_FILENAME}) +INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME}) # TODO: change the library and .pc name when building for GLES, # e.g. -lglut-GLES Modified: trunk/freeglut/freeglut/freeglut.pc.in =================================================================== --- trunk/freeglut/freeglut/freeglut.pc.in 2015-01-03 11:55:09 UTC (rev 1742) +++ trunk/freeglut/freeglut/freeglut.pc.in 2015-02-18 00:37:05 UTC (rev 1743) @@ -1,5 +1,5 @@ prefix=@CMAKE_INSTALL_PREFIX@ -libdir=${prefix}/lib +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/include Name: glut This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jt...@us...> - 2015-03-07 20:57:25
|
Revision: 1752 http://sourceforge.net/p/freeglut/code/1752 Author: jtsiomb Date: 2015-03-07 20:57:16 +0000 (Sat, 07 Mar 2015) Log Message: ----------- updated the readme file, and removed out of date and unmaintained files from the project root Modified Paths: -------------- trunk/freeglut/freeglut/README Removed Paths: ------------- trunk/freeglut/freeglut/LISEZMOI.cygwin_mingw trunk/freeglut/freeglut/LISEZ_MOI trunk/freeglut/freeglut/NEWS trunk/freeglut/freeglut/README.mac trunk/freeglut/freeglut/TODO Deleted: trunk/freeglut/freeglut/LISEZMOI.cygwin_mingw =================================================================== --- trunk/freeglut/freeglut/LISEZMOI.cygwin_mingw 2015-03-07 18:55:40 UTC (rev 1751) +++ trunk/freeglut/freeglut/LISEZMOI.cygwin_mingw 2015-03-07 20:57:16 UTC (rev 1752) @@ -1,218 +0,0 @@ -Glut alors! - -Par Jean-Seb le vendredi 10 juillet 2009, 00:18 - - -Freeglut est une \xE9volution open-source de Glut. -Sous Windows, on peut l'utiliser avec Cygwin. -Facile ? Oui, si on accepte de distribuer "cygwin1.dll" -Aidons Freeglut \xE0 conqu\xE9rir son ind\xE9pendance ! -m.\xE0.j 10/7/2009 : g\xE9n\xE9ration d'une librairie pour linker depuis la dll. - - -R\xE9cup\xE9ration des sources - - * Reprenez les sources de la version 2.6.0 qui int\xE8gre les changements - r\xE9cents. - * Pour l'instant, il s'agit d'une RC (Release Candidate), mais la version - finale ne saurait tarder. - * L'utilisation de la 2.6 est pr\xE9f\xE9rable \xE0 la branche 2.4-stable, de - nombreux bugs \xE9tant corrig\xE9s. - * Vous trouverez les sources sur le site de Freeglut: - o http://freeglut.sourceforge.net/ - - -Principe -Objectif - - * Nous allons cr\xE9er une dll li\xE9e \xE0 Cygwin, et une biblioth\xE8que statique - ind\xE9pendante - * Nous cr\xE9erons \xE9galement une librairie dynamique, permettant de linker avec - la dll. - -Liste des fichiers g\xE9n\xE9r\xE9s - - * freeglut.dll : une dll classique pour le linkage dynamique. - * libfreeglut.a : la biblioth\xE8que statique. Le programme final est autonome - (du moins pour OpenGL). - * libfreeglutdll.a : la biblioth\xE8que dynamique. Le programme final a besoin - de freeglut.dll. - - -Pr\xE9paration - - * D\xE9pliez l'archive freeglut. - * Allez dans le r\xE9pertoire src (situ\xE9 \xE0 la racine du r\xE9pertoire Freeglut), - et cr\xE9ez un sous-r\xE9pertoire "Gl" - o Dans ce sous-r\xE9pertoire, copiez les fichiers du r\xE9pertoire - "include/Gl" - - * Pourquoi faut-il cr\xE9er un r\xE9pertoire "Gl" pour la compilation ? - o C'\xE9tait juste pour simplifier les choses lors de mes essais. - o Sinon vous pouvez cr\xE9er directement les r\xE9pertoires, et copier les - fichiers comme indiqu\xE9 au point installation (lire plus loin). - - * Faites un peu de m\xE9nage dans /lib : - o Effacez toutes les r\xE9f\xE9rences \xE0 la glut, pour ne pas avoir de - conflit au linkage. - o Cette \xE9tape est facultative, vous pouvez \xE9galement choisir de ne - faire le m\xE9nage qu' apr\xE8s une compilation r\xE9ussie de Freeglut. - o Attention \xE0 ne pas effacer, dans un enthousiasme r\xE9dempteur, la - biblioth\xE8que glu32.lib (\xE0 ne pas confondre avec glut32.lib). - - -Compilation - - * Oubliez le triptyque ./configure , make , make install. - o Ca ne marche pas du tout avec Cygwin. - - * Voici un Makefile qui fera l'affaire: - -#Makefile pour Freeglut 2.6.0-rc et Cygwin -#A placer dans le r\xE9pertoire "src/Common" - -sources=$(wildcard *.c) -objs=$(sources:.c=.o) -libname=freeglut - - -CFLAGS=-O2 -DTARGET_HOST_MS_WINDOWS -DX_DISPLAY_MISSING -DFREEGLUT_STATIC -I./ -LDFLAGS=-lopengl32 -lgdi32 -lwinmm - -nocyg=-mno-cygwin -mwindows - -all: $(objs) - #construction dll li\xE9e \xE0 cygwin1.dll - gcc $(nocyg) $(objs) -shared $(LDFLAGS) -o $(libname).dll - nm $(libname).dll | awk 'BEGIN { print "EXPORTS" } /T _glut/ {sub( /^.*T _/, "\t"); print}' > $(libname).def - dlltool --dllname $(libname).dll --input-def $(libname).def --output-lib lib$(libname)dll.a - - #construction biblioth\xE8que statique ind\xE9pendante de cygwin - ar cr lib$(libname).a $(objs) - #pas forc\xE9ment obligatoire (cr\xE9ation d'un index pour acc\xE9l\xE9rer les acc\xE8s) - ranlib lib$(libname).a - -%.o: %.c - gcc $(nocyg) -c $(CFLAGS) $< - -clean: - rm -f *.o $(libname).dll $(libname).def lib$(libname)dll.a lib$(libname).a - - - - -Quelques remarques sur le Makefile - - * Ce makefile cr\xE9e une dll, une biblioth\xE8que statique (une archive, en - d'autres termes) et la biblioth\xE8que dynamique qui permettra l'utilisation - de la dll. - - * Ne cherchez pas \xE0 stripper la biblioth\xE8que statique! Vous ne pourriez plus - compiler en statique. - o Par contre, vous pouvez stripper l'ex\xE9cutable final obtenu lors de - la compilation de votre application. - - * J'ai choisi d'appeller la dll et les biblioth\xE8ques par leurs "vrais noms": - freeglut.dll libfreeglutdll.a et libfreeglut.a. - o Le script configure recr\xE9ait (pour des raisons de compatibilit\xE9 avec - l'ancienne biblioth\xE8que Glut) glut.dll et libglut.a. - o Lors des mes essais, j'ai eu des conflits avec une authentique - "glut" qui trainait dans mon "/lib". J'ai d\xE9cid\xE9 d'appeller les - choses par leur nom, afin d'\xE9viter les confusions. - o Rien ne vous emp\xEAche de renommer la dll, si vous avez besoin - d'utiliser des programmes Glut que vous ne pouvez pas recompiler. - - * La biblioth\xE8que dynamique est g\xE9n\xE9r\xE9e \xE0 partir de la dll. - o Par souci de concision, j'ai utilis\xE9 awk. Il g\xE9n\xE8re le fichier - d'exports utilis\xE9 par dlltool. - o La seule chose notable est la s\xE9lection des fonctions dont le nom - commence par _glut, afin d'\xE9viter d'inclure dans la librairie - dynamique des fonctions sans rapport avec freeglut. - o ensuite, on utilise dlltool de fa\xE7on tr\xE8s classique. - -nm $(libname).dll | awk 'BEGIN { print "EXPORTS" } /T _glut/ {sub( /^.*T _/, "\t"); print}' > $(libname).def -dlltool --dllname $(libname).dll --input-def $(libname).def --output-lib lib$(libname)dll.a - - - - -Installation - - * Copiez libfreeglut.a, libfreeglutdll.a dans le r\xE9pertoire /lib de Cygwin. - * Copiez freglut.dll dans le system32 de Windows (ce qui est pratique, mais - pas propre!). - * Copiez les fichiers headers de Freeglut (/include/gl) dans /usr/include/Gl - de Cygwin. - * Copiez les fichiers headers (toujours /include/gl) dans - /usr/include/mingw/Gl : ceci sert aux compilations avec le flag - -mno-cygwin, qui utilise alors les includes de mingw. - o Vous aurez \xE9ventuellement besoin d'\xE9craser d'anciens fichiers - include, correspondants \xE0 Glut, si vous l'avez install\xE9 avec Cygwin. - - -Utilisation de la biblioth\xE8que - - * Nous allons tester avec le programme shapes, pr\xE9sent dans - progs/demos/shapes - o -mno-cygwin sert \xE0 forcer l'utilisation de Mingw sans la grosse - d\xE9pendance cygwin1.dll. - o -mwindows sert uniquement \xE0 enlever l'horrible fen\xEAtre shell (tr\xE8s - utile pour la mise au point, par contre). - o -L. (notez le point apr\xE8s le "L") : j'ai laiss\xE9 libfreeglut.a, - libfreeglutdll.a et freeglut.dll dans le r\xE9pertoire de test, le - temps des tests justement. - - -Compilation en librairie statique freeglut, sans cygwin - - * Toute l'astuce r\xE9side dans le define : -DFREEGLUT_STATIC - o Il sert \xE0 obtenir la bonne d\xE9coration des noms de fonctions dans les - imports de la lib Freeglut. - o Vous pouvez essayer sans et prendre un \xE9diteur hexa pour voir les - diff\xE9rences dans l'objet. - * attention \xE0 l'ordre des biblioth\xE8ques : -lfreeglut (statique) doit se - trouver avant la d\xE9claration des biblioth\xE8ques dynamiques. - - * gcc shapes.c -L. -lfreeglut -lopengl32 -lwinmm -lgdi32 -mno-cygwin - -mwindows -DFREEGLUT_STATIC - - -Compilation avec dll freeglut, sans cygwin - - * Pour le define, m\xEAme remarque que ci-dessus - * L'ordre des biblioth\xE8ques n'a plus d'importance. - - * gcc shapes.c -L. -lopengl32 -lwinmm -lgdi32 -lfreeglut -mno-cygwin - -DFREEGLUT_STATIC - - -Compilation avec dll freeglut, avec Cygwin - - * Cet exemple est donn\xE9 uniquement pour r\xE9f\xE9rence, le th\xE8me de ce billet \xE9tant de se d\xE9barrasser de Cygwin. - o Disons que \xE7a peut servir pendant la mise au point (et encore). - - * gcc shapes.c -L. -lopengl32 -lwinmm -lgdi32 -lfreeglut - - - -O\xF9 sont les dooooocs ? - - * Freeglut est livr\xE9 avec sa documentation, plus tr\xE8s \xE0 jour. - o Il semble qu'il y ait un probl\xE8me avec la doc Glut originale. Non - seulement elle ne correspond pas forc\xE9ment au fonctionnement de - Freeglut, mais de plus, son auteur (Mark Kilgard) l'a copyright\xE9. Sa - distribution est donc difficile. - - * Jocelyn Fr\xE9chot a entrepris une mise \xE0 niveau des docs pour la version - 2.6.0. On peut les trouver sur son site pour l'instant: - o http://jocelyn.frechot.free.fr/freeglut/ - - -Quelque chose a surv\xE9cu ... - - * J'ai \xE9galement test\xE9 la recompilation des d\xE9mos de la lib Glut originelle - (paix \xE0 ses cendres). - o Rien de particulier \xE0 signaler. - - * Merci \xE0 tous les mainteneurs courageux de Freeglut, qu'on croyait morts, - mais qui bougent encore. Deleted: trunk/freeglut/freeglut/LISEZ_MOI =================================================================== --- trunk/freeglut/freeglut/LISEZ_MOI 2015-03-07 18:55:40 UTC (rev 1751) +++ trunk/freeglut/freeglut/LISEZ_MOI 2015-03-07 20:57:16 UTC (rev 1752) @@ -1,86 +0,0 @@ -Br\xE8ve Vue d'ensemble -==================== - -C'est le paquet de freeglut. - -Freeglut, le toolkit de service d'openGL ("OpenGL Utility Toolkit") libre, est cens\xE9 pour \xEAtre -un libre changent l'indig\xE8ne \xE0 la biblioth\xE8que de GLUT de Mark Kilgard. Il est distribu\xE9 sous -un permis de mod\xE8le de X-Consortium (voyez COPIER pour des d\xE9tails), de vous offrir une chance -d'employer et/ou modifier la source. - -Il se sert de biblioth\xE8ques OpenGL, GLU, GLib, et pthreads-win32. La biblioth\xE8que ne se sert -d'aucun code de SURABONDANCE et n'est pas 100% compatible. La recompilation de code et/ou les -l\xE9g\xE8res modifications pourraient \xEAtre exig\xE9es pour vos applications pour fonctionner avec le -freeglut. - - -PORTS -===== - -X11 et les ports Win32 sont \xE0 une \xE9tape avan\xE7\xE9e d'alpha, qui signifie qu'elles fournissent la fonctionnalit\xE9 limit\xE9e de la SURABONDANCE api 3. Il y a un cours d'en de recherche pour v\xE9rifier si le port de BeOS pourrait \xEAtre facilement fait en utilisant la structure courante de freeglut. - - INSTALLATION -============ - -Voyez le dossier d'INSTALLATION. Pour le Windows: - -1)T\xE9l\xE9chargez Freeglut.tar.gz - -2)Renommez en Freeglut.tar - -3)D\xE9compressez avec WINZIP - -4)Dans MSVC,vous obtenez un r\xE9pertoire FREEGLUT\DEBUG ou se trouve FREEGLUT.DLL - -5)Si vous n'avez pas FEEGLUT.LIB,il faut la construire: - Ouvrez FREEGLUT.DSW(C'est un workspace) - ouvrez le projet et cliquez sur "BUILD" puis "SET ACTIVE CONFIGURATION" - ajoutez "FREEGLUT-DEBUG". - -6)Pour votre propre projet,apres la compilation,appuyer sur ALT-F7.Cliquez sur LINK,puis sur - CATEGORIES et selectionnez "INPUT".Plus bas dans la fenetre,il y a un champ appel\xE9 - "ADDITIONNAL LIBRARY PATH",ajoutez:C:\MSVC\FREEGLUT\DEBUG pour que le programme trouve la - FREEGLUT.LIB. - -7)Copiez(NE PAS DEPLACER) la FREEGLUT.DLL de DEBUG vers le r\xE9pertoire qui contient votre fichier - EXE. - -8)Pour une installation globale copier FREEGLUT.DLL dans C:\WINNT\SYSTEM32. - - - -CONTRIBUTION -============ - -Le bogue et les pi\xE8ces rapport\xE9es absentes de dispositifs sont certainement bienvenus. Juste -comme des commentaires et des propositions de FREEGLUT api 1 soyez. Veuillez juste pour rendre -le regard de difficult\xE9s visuellement juste comme le reste du code (les \xE9tiquettes ont converti -les 4 espaces blancs). Les commentaires sont vraiment bienvenus, comme je crois qu'il ferait -beau pour des personnes nouveaux que frais \xE0 OpenGL voient comment les choses sont faites... - - -EMPLACEMENT DE WEB ET ENTRER EN CONTACT AVEC LE D'AUTEUR -======================================================== - -Le projet de Freeglut s'est d\xE9plac\xE9 au SourceForge : -http://freeglut.sourceforge.net - - -LE D'ESPOIR -=========== -Espoir vous trouvez mon travail de fa\xE7on ou d'autre utile. -Pawel W. Olszta, <ol...@so...> - - -D\xC9PASSEMENT DU BATON==================== - -En d\xE9cembre 2000, Pawel a d\xE9cid\xE9 qu'il n'a plus souhait\xE9 maintenir le freeglut parce qu'il s'est -d\xE9plac\xE9 hors du champ de graphiques. J'ai offert pour succ\xE9der de lui et avoir couru le projet -depuis 2001 le 13 janv.. I'm \xE9galement l'auteur et le d\xE9fenseur de la suite de biblioth\xE8que de -PLIB et du 'freeglut' ; vraiment ajustements dedans bien avec ce travail. J'esp\xE8re juste que je -peux vivre jusqu'aux niveaux \xE9lev\xE9s de Pawel's. Pawel reste sur la liste active de r\xE9alisateurs. -Steve Baker <sjb...@ai...> - http://plib.sourceforge.net - - - Deleted: trunk/freeglut/freeglut/NEWS =================================================================== --- trunk/freeglut/freeglut/NEWS 2015-03-07 18:55:40 UTC (rev 1751) +++ trunk/freeglut/freeglut/NEWS 2015-03-07 20:57:16 UTC (rev 1752) @@ -1,70 +0,0 @@ -Jan 16th 2000: - - First really functional release of freeglut. - - -Jan 13th 2001: - - Steve Baker takes over as maintainer of freeglut. - - -Jun ??th 2003: - - freeglut 1.4 released. - -September 29, 2003: - - freeglut 2.0.0 released. - -... - -Mar ??, 2009: - - freeglut 2.6.0 released. Changes compared to 2.4.0: - - * Tons of bug fixes - - * Added deprecated, but working Joystick API. - - * Added new constant GLUT_INIT_STATE for glutGet() to check if freeglut is - already initialized. - - * Added new API entry for full-screen mode - - void glutFullScreenToggle( void ); - - with a related new constant GLUT_FULL_SCREEN for glutGet(). - - * Added new API entry to de-initialize freeglut: - - void glutExit( void ); - - * Added more special keys: GLUT_KEY_NUM_LOCK, GLUT_KEY_BEGIN GLUT_KEY_DELETE - - * Added support for windows without captions and/or borders via two new - constants GLUT_CAPTIONLESS and GLUT_BORDERLESS for glutInitDisplayMode - (currently works for Windows only). - - * Added support for multisampling: The number of samples per pixel to use - when GLUT_MULTISAMPLE is specified in glutInitDisplayMode() can be set via - glutSetOption() with parameter GLUT_MULTISAMPLE now. glutGet() with the - same token retrieves that value. The possible number of samples per pixels - can be queried via the new API entry - - int *glutGetModeValues( GLenum mode, int *size ); - - with mode GLUT_MULTISAMPLE. (glutGetModeValues() currently only works for - X11) - - * Added new constant GLUT_AUX for glutSetOption() to set the number of - auxiliary buffers. The possible number of auxiliary buffers can be - queried via glutGetModeValues with mode GLUT_AUX. - - * Added support for versioned (i.e. 3.0) OpenGL contexts: New API entries - - void glutInitContextVersion( int majorVersion, int minorVersion ); - void glutInitContextFlags( int flags ); - - with related new constants GLUT_DEBUG and GLUT_FORWARD_COMPATIBLE for - the latter API entry. Added new constants GLUT_INIT_MAJOR_VERSION, - GLUT_INIT_MINOR_VERSION and GLUT_INIT_FLAGS for glutGet(). Modified: trunk/freeglut/freeglut/README =================================================================== --- trunk/freeglut/freeglut/README 2015-03-07 18:55:40 UTC (rev 1751) +++ trunk/freeglut/freeglut/README 2015-03-07 20:57:16 UTC (rev 1752) @@ -1,77 +1,61 @@ +BRIEF OVERVIEW +============== - BRIEF OVERVIEW - ============== +This is the freeglut package. - This is the freeglut package. +Freeglut, the Free OpenGL Utility Toolkit, is meant to be a free alternative to +Mark Kilgard's GLUT library. Freeglut is free software, distributed under an +MIT/X11 style license. You are free to use, modify, and redistribute FreeGLUT +with or without modifications (see COPYING for details). - Freeglut, the Free openGL Utility Toolkit, is meant to be a free alter- - native to Mark Kilgard's GLUT library. It is distributed under an X-Consor- - tium style license (see COPYING for details), to offer you a chance to use - and/or modify the source. +PORTS +===== - It makes use of OpenGL, GLU, and pthreads-win32 libraries. The library does - not make use of any GLUT code and is not 100% compatible. Code recompilation - and/or slight modifications might be required for your applications to work - with freeglut. +Currently supported platforms: + - UNIX systems with X11 (such as GNU/Linux, FreeBSD, etc) + - MS Windows + - MacOS X with XQuartz (no native Cocoa support yet) + - Android (NDK) + - Blackberry +Consult the platform-specific readme files for details on the level of support +and build instructions. - PORTS - ===== - Both X11 and Win32 ports are in an advanced alpha stage, which means that - they provide limited functionality of GLUT API 3. A somewhat more - limited port (mostly due to limits of the OS) to Andriod is now also - available. +INSTALLATION +============ +See README.cmake as a starting point, as well as the other README +files for further info. - INSTALLATION - ============ - See README.cmake as a starting point, as well as the other README - files for further info. +CONTRIBUTING +============ +Patches for bugfixes and new features are certainly welcome. Please send patches +to the freeglut-developer mailing list (see CONTACT below). - CONTRIBUTING - ============ +Feel free to report any bugs you encounter, using our bug tracking system: +https://sourceforge.net/p/freeglut/bugs/ +Feature requests are also welcome at: +https://sourceforge.net/p/freeglut/feature-requests/ - Bug and missing features patches are certainly welcome. Just as comments - and FREEGLUT API propositions are. +If your bug report needs urgent attention, please also post a message to the +aforementioned freeglut-developer mailing list, to make sure we'll see it ASAP. - Just please to make the fixes look visually just as the rest of the code - does (tabs converted 4 white spaces). Comments are really welcome, as I - believe it would be nice for people fresh new to OpenGL see how the things - are done... +CONTACT +======= - WEB SITE AND CONTACTING THE AUTHOR - ================================== +FreeGLUT website: http://freeglut.sourceforge.net - Freeglut project has moved to the SourceForge: - http://freeglut.sourceforge.net +FreeGLUT mailing lists: + - developer: https://lists.sourceforge.net/lists/listinfo/freeglut-developer + - bugs: https://lists.sourceforge.net/lists/listinfo/freeglut-bugs + - announce: https://lists.sourceforge.net/lists/listinfo/freeglut-announce - - THE HOPE - ======== - - Hope you find my work somehow useful. - Pawel W. Olszta, <ol...@so...> - - - PASSING THE BATON - ================= - - In late December 2000, Pawel decided that he no longer - wished to maintain freeglut because he has moved out of - the graphics field. I volunteered to take over from him - and have been running the project since Jan 13th 2001. - - I'm also the author and maintainer of the PLIB library suite - and 'freeglut' really fits in well with that work. - - I just hope I can live up to Pawel's high standards. Pawel - remains on the active developers list. - - Steve Baker <sjb...@ai...> - http://plib.sourceforge.net - - + You need to subscribe before posting to any of our mailing lists. Make sure + to avoid selecting "daily digest mode" if you intend to post, so that you can + reply properly to specific messages. Also, please do not top-post, and try to + send properly formated emails (text, hard-wrapped at 72 columns, no binary or + large attachements). Deleted: trunk/freeglut/freeglut/README.mac =================================================================== --- trunk/freeglut/freeglut/README.mac 2015-03-07 18:55:40 UTC (rev 1751) +++ trunk/freeglut/freeglut/README.mac 2015-03-07 20:57:16 UTC (rev 1752) @@ -1,33 +0,0 @@ - January 2011 -To the gentle Mac user, - -I realize that this is hardly a full explanation of how to build on a Mac, -but it will need to suffice for now. - -There was an e-mail on the "freeglut" developers mailing list titled -"Compiling Static freeglut on mac" with a datestamp of 10/12/2010 at -11:20 AM (possibly corrected for Central time, USA). Another e-mail -on the same mailing list from the same person, in reply to his original -missive, is dated 11/9/2010 at 10:03 PM. This file is an attempt to -capture the knowledge in those two e-mails. - -The author of the e-mails was trying to compile a static "freeglut" -library on Mac OSX version 10.5.8. He tried building both freeglut -versions 2.4.0 and 2.6.0 with a command ... - -./configure --disabled-shared --enable-static -make - -... and got a "non_lazy_ptr" error in both cases. He was able to fix -the problem by using the following "configure" command instead: - -./configure --disable-warnings --disable-shared --enable-static CPPFLAGS=-I/usr/X11/include -L/usr/X11/lib LDFLAGS=-I/usr/X11/include -L/usr/X11/lib -framework GLUT - - -Any further information on building "freeglut" on a Mac would be deeply -appreciated. I believe that much of the information on building it on -*nix systems also applies to the Mac. - -John F. Fay -1/22/11 - Deleted: trunk/freeglut/freeglut/TODO =================================================================== --- trunk/freeglut/freeglut/TODO 2015-03-07 18:55:40 UTC (rev 1751) +++ trunk/freeglut/freeglut/TODO 2015-03-07 20:57:16 UTC (rev 1752) @@ -1,107 +0,0 @@ - - The not-so-up-to-date TODO list can be found under following URL: - http://freeglut.sourceforge.net/progress.html - -Issues in Freeglut (so we don't forget): - -*fixed*(D) I'd like to change the names of the Windows target directories from names like "Debug__Win32_freeglut_static" (or something like that) to names like "DebugStatic". - -Issues that can Wait until 2.2.0: - -(1) In the Atlantis demo, under windows and with the task bar to the left of the screen, the GLUT window comes up in a position relative to the corner of the screen while the "freeglut" window comes up down and to the right of where it was the last time it was opened. - -(2) In the Atlantis demo, if you stop the animation and move the mouse around with a menu open, the whales jiggle but don't circulate. My guess is that you need a way to redisplay the menu without forcing a redisplay from the application. - -(3) In the Atlantis demo, if you bring up the menu in GLUT the animation stops; in freeglut the fish and whales wiggle without advancing. This may be another manifestation of (2). - -(4) In the Atlantis demo modified to draw a solid torus instead of a mother whale, the torus is not shaded according to the lighting. This is true with both GLUT and freeglut. With freeglut, when you bring up a menu the shading used to turn on but doesn't any longer; with GLUT it never did and still does not. Interestingly, if you change to a teapot it is shaded, but other geometric shapes are not shaded. - -*fixed*(5) The "freeglut" wire cone does not look like the GLUT wire cone. There are several differences, one of which is that the "freeglut" cone draws the base. - -*fixed*(6) With the "bluepony" demo under Windows, if you reshape the window using the mouse, the scene does not redraw until you move it with a keypress (arrow key or space bar to start the animation). Check out the "CS_VREDRAW or CS_HREDRAW" sections in MSVC help for a pointer about this. - -(7) If you compare the "bounce" demo with freeglut and GLUT, you see that the "freeglut" lights are larger and dimmer (and don't shine on the walls) than the GLUT lights. - -*fixed*(8) Large submenus in "freeglut" tend to cover their parent menus, making it difficult to get past them. This is visible in the "geoface" demo. In GLUT the menus can extend outside the window; "freeglut" should do the same thing. - -(9) In the "gliq" demo, the cones forming the ends of the arrows in the "select board" are lighted differently in "freeglut" than they are in GLUT. - -*fixed*(10) The "skyfly" demo resized my video and set it to 256 colors but didn't set it back when it was done. This is a problem with "skyfly" and not freeglut. <This seems to have fixed itself.> - - -*fixed*(11) We seem to have troubles with programs that use display lists. Check out the "walker" demo and load a new curve set. If you have the debugger going while it is loading, you get the new curves; otherwise you don't. This has to do with the debugger hiding the freeglut window while the display list is being changed. <This seems to have fixed itself.> - -*fixed*(12) The "fgCleanUpGlutsMess" function seems to duplicate the "fgDestroyStructure" or "fgDeinitialize" function and should probably be removed. - -*fixed*(13) The "G_LOG_DOMAIN" defined constants are never used. Should we start using them in warning and error messages or should we delete them? - -*fixed*(14) The "freeglut_internal.h" file on lines 45ff defines or undefines "G_DISABLE_ASSERT" and "G_DISABLE_CHECKS" but these are never used. Shall we start using them or should we delete them? - -*fixed*(15) P-GUIDE apparently calls the get and set window size functions repeatedly. Each time it does, the window shrinks by 2 pixels in each direction. - -(16) (for Don Heyse) We need to implement the "glutLayerGet ( GLUT_NORMAL_DAMAGED )" call. - - -(17) Also from Aleksandar Donev: can some add support for building a debugging version of freeglut to the makefiles? I have no clue how to use automake... - -(18) There is a big guess about the mouse buttons count under X11 (always 3) -- I must remember to correct the menu activation code if this shows to be invalid. - -(19) None of the bizarre input devices found in GLUT API is supported (and probably won't). - -(20) The joystick code should work fine but I haven't tested it out yet. It might not compile under FreeBSD, as I had to convert it from C++ to C and had no possibility to compile it under FreeBSD. - -(21) The menu is displayed using OpenGL, so it requires the window's contents to be refreshed at an interactive rate, which sometimes does not happen. That's why I'll consider adding optional window-system menu navigation later. For now -- extensive testing is what I believe should be done with the menu system. (Several of the GLUT demos use the menu system. John Fay has checked it out pretty well.) - -(22) Need to have own cursor shapes, so that freeglut can pass them to the windowing system, draw them using glBitmap() and/or texture mapping. The cursor shapes are very probable to be found in XFree86 sources. - -(23) Indexed color mode might work, however I have not tested it yet. glutGetColor/glutSetColor is not implemented. Again, looks like a single Xlib call, but there might be some problems with the colormap access. Need to switch into indexed color mode some day and check it out (does Mesa 3.1 work with indexed color mode?) - -(24) Overlays are not supported, but one of the GLUT conformance tests fails due to glutLayerGet( GLUT_NORMAL_DAMAGED ) returning FALSE when the window has actually been damaged. - -(25) Layers would be good for drawing the menus and mouse cursor, as they wouldn't force the application redraw to update their state. - -(26) Does the init display string work? - -(27) Is the game mode string parsed correctly? - -(28) Does the geometry need normal vectors? - -(29) The visibility/window status function is a conceptual mess. I had to peer into the GLUT source code to see what actually happens inside. It helped me a bit, but still one of the visibility tests fails. This is probably the reason for which a window covered by enlightenment status bar is marked as hidden and does not get redrawn. - -(30) GLX 1.3 spec states that glXChooseVisual() et consortes are deprecated. Should move to glXFBConfig. - -(31) Need to investigate what happens when initial window position is set to (-1,-1). GLUT specification says, that the window positioning should be left to the window system. And I do not know how to force it do so... - -(32) I was told it is wrong to have the redisplay forced in the main loop. Is that right? - -(33) Some of the tests freeze because they do not generate the glutPostRedisplay() call every frame. Again, this is somehow handled by GLUT, but I can't see how. And why. Looks like I've fixed it (or rather hacked it?) by forcing a redisplay every frame, but this is no good and kills interactiveness of my console :D - -(34) We should really implement overlays, if only for the sake of completeness. - -(35) Menus do not display in single-buffered windows, although they are active and the user can pick from them if he knows how to move the mouse exactly right. - -(36) In the "boundary.c" demo in the "advanced" directory, if the outline rendering is turned on the menu background turns black. - -(37) In the "comp.c" demo in the "advanced" directory, we find that we need a window to be defined before "glutGet ( GLUT_DISPLAY_MODE_POSSIBLE )" can be called. GLUT does not have this restriction. In "freeglut" there is a check at the beginning of the "fgSetupPixelFormat" call and a few references to "window->" later in the function. - -(38) When you get around the requirement for an existing window in "comp.c", you find that "freeglut" renders the window differently from GLUT. For starters, "freeglut" looks like it is double-buffering while GLUT looks like it is single-buffering. In 'freeglut" the background is all black while in GLUT it starts black and turns white before your eyes. - -(39) Running the "convolve" GLUT demo in the "advanced" directory (after fixing it so it doesn't terminate on error), I find that the "freeglut" version runs much more slowly than the GLUT version. I think this has to do with forcing redraws when the menu comes up. - -(40) The "genmipmap" demo runs much more slowly in "freeglut" than in GLUT (try moving a window!) and flashes the texture over the whole window instead of just the part of the window where it finally settles down. - -(41) We need to keep the "freeglut" structure current (including the GLUT action on window closure) after the last window closes. (Aleksandar Donev e-mail, 7/4/03, 5:00 PM). - -*fixed*(42) Menus need to display in their own subwindow with a special menu OpenGL rendering context. This will fix a wide range of menu-related bugs. - -*fixed*(43) We need to keep the "freeglut" structure current (including the GLUT action on window closure) after the last window closes. - -*fixed*(44) The "freeglut" wire cone differs from the GLUT wire cone. As a minimum, it draws the base where GLUT does not. I would check the solid cone as well. - -(45) The different mouse pointers (crosshair, double pointer, etc.) do not get shown. - -(46) The visibility callback is not invoked when minimizing a window. It should be. - -(47) We should add a "glutExit" call to the interface. Also a "glutGet" to tell whether it has been initialized properly. And have "freeglut" call "glutExit" before it calls "exit ()". - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2015-07-11 21:26:58
|
Revision: 1770 http://sourceforge.net/p/freeglut/code/1770 Author: dcnieho Date: 2015-07-11 21:26:56 +0000 (Sat, 11 Jul 2015) Log Message: ----------- Create cmake package using imported targets. Create and install the necessary files so that cmake can find FreeGLUT in config mode ("find_package(FreeGLUT CONFIG)"). This pushes cmake_minimum_required to 3.0.0. (cherry picked from commit ba7326ce8db20dd52785ef1a08da06d8341fc4c1) (cherry picked from commit ba7326ce8db20dd52785ef1a08da06d8341fc4c1) Modified Paths: -------------- trunk/freeglut/freeglut/CMakeLists.txt Added Paths: ----------- trunk/freeglut/freeglut/FreeGLUTConfig.cmake.in Modified: trunk/freeglut/freeglut/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/CMakeLists.txt 2015-07-11 21:26:48 UTC (rev 1769) +++ trunk/freeglut/freeglut/CMakeLists.txt 2015-07-11 21:26:56 UTC (rev 1770) @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR) PROJECT(freeglut) # for multiarch LIBDIR support (requires cmake>=2.8.8) @@ -20,6 +20,7 @@ set(VERSION_MAJOR 3) set(VERSION_MINOR 0) set(VERSION_PATCH 0) +set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) # Update fg_version.h to match the versions number here in cmake CONFIGURE_FILE(src/fg_version.h.in src/fg_version.h) @@ -454,30 +455,34 @@ ENDIF() IF(FREEGLUT_BUILD_SHARED_LIBS) - INSTALL(TARGETS freeglut + INSTALL(TARGETS freeglut EXPORT FreeGLUTTargets RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION include ) IF(INSTALL_PDB) INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/freeglut${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin - CONFIGURATIONS Debug) + CONFIGURATIONS Debug + COMPONENT Devel) ENDIF() ENDIF() IF(FREEGLUT_BUILD_STATIC_LIBS) - INSTALL(TARGETS freeglut_static + INSTALL(TARGETS freeglut_static EXPORT FreeGLUTTargets RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION include ) IF(INSTALL_PDB) INSTALL(FILES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/Debug/freeglut_static${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION lib - CONFIGURATIONS Debug) + CONFIGURATIONS Debug + COMPONENT Devel) ENDIF() ENDIF() -INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL) +INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL COMPONENT Devel) @@ -571,6 +576,36 @@ SET(PC_FILENAME "freeglut-gles.pc") ENDIF() CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY) -INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME}) +INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME} COMPONENT Devel) # TODO: change the library and .pc name when building for GLES, # e.g. -lglut-GLES + +INCLUDE(CMakePackageConfigHelpers) +WRITE_BASIC_PACKAGE_VERSION_FILE( + "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfigVersion.cmake" + VERSION ${VERSION} + COMPATIBILITY AnyNewerVersion +) + +# needs cmake 3.0 (as does the "INCLUDES DIRECTORY" argument to install(TARGETS)): +EXPORT(EXPORT FreeGLUTTargets + FILE "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTTargets.cmake" + NAMESPACE FreeGLUT:: +) +CONFIGURE_FILE(FreeGLUTConfig.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfig.cmake" + @ONLY +) +SET(ConfigPackageLocation lib/cmake/FreeGLUT) +INSTALL(EXPORT FreeGLUTTargets + FILE FreeGLUTTargets.cmake + NAMESPACE FreeGLUT:: + DESTINATION ${ConfigPackageLocation} +) +INSTALL( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfigVersion.cmake" + DESTINATION ${ConfigPackageLocation} + COMPONENT Devel +) Added: trunk/freeglut/freeglut/FreeGLUTConfig.cmake.in =================================================================== --- trunk/freeglut/freeglut/FreeGLUTConfig.cmake.in (rev 0) +++ trunk/freeglut/freeglut/FreeGLUTConfig.cmake.in 2015-07-11 21:26:56 UTC (rev 1770) @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/FreeGLUTTargets.cmake") Property changes on: trunk/freeglut/freeglut/FreeGLUTConfig.cmake.in ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2015-12-14 16:22:53
|
Revision: 1780 http://sourceforge.net/p/freeglut/code/1780 Author: dcnieho Date: 2015-12-14 16:22:51 +0000 (Mon, 14 Dec 2015) Log Message: ----------- Mention Wayland build requirements in documentation Following https://github.com/dcnieho/FreeGLUT/issues/38 ; mention Wayland support in README, Wayland build instructions and requirements in README.cmake. Signed-off-by: Manuel Bachmann <man...@io...h> (cherry picked from commit 18773bcc818714436e3aeb6229b2f84125d6edc4) (cherry picked from commit 18773bcc818714436e3aeb6229b2f84125d6edc4) Modified Paths: -------------- trunk/freeglut/freeglut/AUTHORS trunk/freeglut/freeglut/README trunk/freeglut/freeglut/README.cmake Modified: trunk/freeglut/freeglut/AUTHORS =================================================================== --- trunk/freeglut/freeglut/AUTHORS 2015-12-14 16:22:44 UTC (rev 1779) +++ trunk/freeglut/freeglut/AUTHORS 2015-12-14 16:22:51 UTC (rev 1780) @@ -32,6 +32,9 @@ Sylvain Beucler support for Android, X11/EGL, OpenGL(ES) 2.x, misc fixes +Manuel Bachmann + support for Wayland + Diederick C. Niehorster Chris Marshall Clive McCarthy Modified: trunk/freeglut/freeglut/README =================================================================== --- trunk/freeglut/freeglut/README 2015-12-14 16:22:44 UTC (rev 1779) +++ trunk/freeglut/freeglut/README 2015-12-14 16:22:51 UTC (rev 1780) @@ -12,7 +12,7 @@ ===== Currently supported platforms: - - UNIX systems with X11 (such as GNU/Linux, FreeBSD, etc) + - UNIX systems with X11 and Wayland (such as GNU/Linux, FreeBSD, etc) - MS Windows - MacOS X with XQuartz (no native Cocoa support yet) - Android (NDK) Modified: trunk/freeglut/freeglut/README.cmake =================================================================== --- trunk/freeglut/freeglut/README.cmake 2015-12-14 16:22:44 UTC (rev 1779) +++ trunk/freeglut/freeglut/README.cmake 2015-12-14 16:22:51 UTC (rev 1780) @@ -40,10 +40,14 @@ - Make sure you have the basics for compiling code, such as C compiler (e.g., GCC) and the make package. - Also make sure you have packages installed that provide the relevant - header files for x11 (including xrandr) and opengl (e.g., - libgl1-mesa-dev, libx11-dev and libxrandr-dev on Debian/Ubuntu). -- Install XInput: libxi-dev / libXi-devel -- Run 'cmake .' in the freeglut directory to generate the makefile. + header files for opengl (e.g., libgl1-mesa-dev on Debian/Ubuntu) and + the chosen backend : + - X11: x11 (e.g., libx11-dev, libxrandr-devel on Debian/Ubuntu) and + XInput (libxi-dev / libXi-devel) + - Wayland: wayland (e.g., libwayland-dev and libegl1-mesa-dev on + Debian/Ubuntu) and xkbcommon (libxkbcommon-dev /libxkbcommon-devel) +- Run 'cmake .' (or 'cmake . -DFREEGLUT_WAYLAND=ON' for Wayland) in the + freeglut directory to generate the makefile. - Run 'make' to build, and 'make install' to install freeglut. - If you wish to change any build options run 'ccmake .' @@ -59,6 +63,8 @@ FREEGLUT_BUILD_STATIC_LIBS [ON, OFF] Build freeglut as a static library FREEGLUT_GLES [ON, OFF] Link with GLEs libraries instead of OpenGL +FREEGLUT_WAYLAND [ON, OFF] Link with Wayland libraries instead + of X11 FREEGLUT_PRINT_ERRORS [ON, OFF] Controls whether errors are default handled or not when user does not provide an error callback This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2017-06-30 23:20:59
|
Revision: 1808 http://sourceforge.net/p/freeglut/code/1808 Author: dcnieho Date: 2017-06-30 23:20:57 +0000 (Fri, 30 Jun 2017) Log Message: ----------- Initial work on callbacks with user data parameters. -glutCreateMenuUcall -glutTimerFuncUcall -glutIdleFuncUcall Modified Paths: -------------- trunk/freeglut/freeglut/include/GL/freeglut_ext.h trunk/freeglut/freeglut/src/fg_callbacks.c trunk/freeglut/freeglut/src/fg_ext.c trunk/freeglut/freeglut/src/fg_init.c trunk/freeglut/freeglut/src/fg_internal.h trunk/freeglut/freeglut/src/fg_main.c trunk/freeglut/freeglut/src/fg_menu.c trunk/freeglut/freeglut/src/fg_structure.c Added Paths: ----------- trunk/freeglut/freeglut/include/GL/freeglut_ucall.h Modified: trunk/freeglut/freeglut/include/GL/freeglut_ext.h =================================================================== --- trunk/freeglut/freeglut/include/GL/freeglut_ext.h 2017-06-14 20:51:30 UTC (rev 1807) +++ trunk/freeglut/freeglut/include/GL/freeglut_ext.h 2017-06-30 23:20:57 UTC (rev 1808) @@ -274,6 +274,9 @@ #define GLUT_BORDERLESS 0x0800 #define GLUT_SRGB 0x1000 +/* User-argument callbacks and implementation */ +#include "freeglut_ucall.h" + #ifdef __cplusplus } #endif Added: trunk/freeglut/freeglut/include/GL/freeglut_ucall.h =================================================================== --- trunk/freeglut/freeglut/include/GL/freeglut_ucall.h (rev 0) +++ trunk/freeglut/freeglut/include/GL/freeglut_ucall.h 2017-06-30 23:20:57 UTC (rev 1808) @@ -0,0 +1,93 @@ +#ifndef __FREEGLUT_UCALL_H__ +#define __FREEGLUT_UCALL_H__ + +/* + * freeglut_ucall.h + * + * Callbacks with user data arguments. + * + * 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. + */ + +#ifdef __cplusplus + extern "C" { +#endif + +/* + * Menu stuff, see fg_menu.c + */ +FGAPI int FGAPIENTRY glutCreateMenuUcall( void (* callback)( int menu, void* user_data ), void* user_data ); + +/* + * Global callback functions, see fg_callbacks.c + */ +FGAPI void FGAPIENTRY glutTimerFuncUcall( unsigned int time, void (* callback)( int, void* ), int value, void* user_data ); +FGAPI void FGAPIENTRY glutIdleFuncUcall( void (* callback)( void* ), void* user_data ); + +/* + * Window-specific callback functions, see fg_callbacks.c + */ +FGAPI void FGAPIENTRY glutKeyboardFuncUcall( void (* callback)( unsigned char, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutSpecialFuncUcall( void (* callback)( int, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutReshapeFuncUcall( void (* callback)( int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutVisibilityFuncUcall( void (* callback)( int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutDisplayFuncUcall( void (* callback)( void* ), void* user_data ); +FGAPI void FGAPIENTRY glutMouseFuncUcall( void (* callback)( int, int, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutMotionFuncUcall( void (* callback)( int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutPassiveMotionFuncUcall( void (* callback)( int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutEntryFuncUcall( void (* callback)( int, void* ), void* user_data ); + +FGAPI void FGAPIENTRY glutKeyboardUpFuncUcall( void (* callback)( unsigned char, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutSpecialUpFuncUcall( void (* callback)( int, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutJoystickFuncUcall( void (* callback)( unsigned int, int, int, int, void* ), int pollInterval, void* user_data ); +FGAPI void FGAPIENTRY glutMenuStateFuncUcall( void (* callback)( int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutMenuStatusFuncUcall( void (* callback)( int, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutOverlayDisplayFuncUcall( void (* callback)( void* ), void* user_data ); +FGAPI void FGAPIENTRY glutWindowStatusFuncUcall( void (* callback)( int, void* ), void* user_data ); + +FGAPI void FGAPIENTRY glutSpaceballMotionFuncUcall( void (* callback)( int, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutSpaceballRotateFuncUcall( void (* callback)( int, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutSpaceballButtonFuncUcall( void (* callback)( int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutButtonBoxFuncUcall( void (* callback)( int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutDialsFuncUcall( void (* callback)( int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutTabletMotionFuncUcall( void (* callback)( int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutTabletButtonFuncUcall( void (* callback)( int, int, int, int, void* ), void* user_data ); + +FGAPI void FGAPIENTRY glutMouseWheelFuncUcall( void (* callback)( int, int, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutPositionFuncUcall( void (* callback)( int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutCloseFuncUcall( void (* callback)( void* ), void* user_data ); +FGAPI void FGAPIENTRY glutWMCloseFuncUcall( void (* callback)( void* ), void* user_data ); +FGAPI void FGAPIENTRY glutMenuDestroyFuncUcall( void (* callback)( void* ), void* user_data ); + +/* + * Multi-touch/multi-pointer extensions + */ +FGAPI void FGAPIENTRY glutMultiEntryFuncUcall( void (* callback)( int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutMultiButtonFuncUcall( void (* callback)( int, int, int, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutMultiMotionFuncUcall( void (* callback)( int, int, int, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutMultiPassiveFuncUcall( void (* callback)( int, int, int, void* ), void* user_data ); + +/* + * Initialization functions, see fg_init.c + */ +#include <stdarg.h> +FGAPI void FGAPIENTRY glutInitErrorFuncUcall( void (* callback)( const char *fmt, va_list ap, void* ), void* user_data ); +FGAPI void FGAPIENTRY glutInitWarningFuncUcall( void (* callback)( const char *fmt, va_list ap, void* ), void* user_data ); + +/* Mobile platforms lifecycle */ +FGAPI void FGAPIENTRY glutInitContextFuncUcall(void (* callback)(void*), void* user_data); +FGAPI void FGAPIENTRY glutAppStatusFuncUcall(void (* callback)(int, void*), void* user_data); + +#ifdef __cplusplus + } +#endif + +/*** END OF FILE ***/ + +#endif /* __FREEGLUT_UCALL_H__ */ + Property changes on: trunk/freeglut/freeglut/include/GL/freeglut_ucall.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/freeglut/freeglut/src/fg_callbacks.c =================================================================== --- trunk/freeglut/freeglut/src/fg_callbacks.c 2017-06-14 20:51:30 UTC (rev 1807) +++ trunk/freeglut/freeglut/src/fg_callbacks.c 2017-06-30 23:20:57 UTC (rev 1808) @@ -35,18 +35,31 @@ * Global callbacks. */ /* Sets the global idle callback */ +void FGAPIENTRY glutIdleFuncUcall( FGCBIdleUC callback, FGCBUserData userData ) +{ + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutIdleFuncUcall" ); + fgState.IdleCallback = callback; + fgState.IdleCallbackData = userData; +} + +void glutIdleFuncCallback( void* userData ) +{ + FGCBIdle callback = (FGCBIdle)userData; + callback(); +} + void FGAPIENTRY glutIdleFunc( FGCBIdle callback ) { FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutIdleFunc" ); - fgState.IdleCallback = callback; + glutIdleFuncUcall( glutIdleFuncCallback, (FGCBUserData)callback ); } /* Creates a timer and sets its callback */ -void FGAPIENTRY glutTimerFunc( unsigned int timeOut, FGCBTimer callback, int timerID ) +void FGAPIENTRY glutTimerFuncUcall( unsigned int timeOut, FGCBTimerUC callback, int timerID, FGCBUserData userData ) { SFG_Timer *timer, *node; - FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutTimerFunc" ); + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutTimerFuncUcall" ); if( (timer = fgState.FreeTimers.Last) ) { @@ -59,9 +72,10 @@ "Memory allocation failure in glutTimerFunc()" ); } - timer->Callback = callback; - timer->ID = timerID; - timer->TriggerTime = fgElapsedTime() + timeOut; + timer->Callback = callback; + timer->CallbackData = userData; + timer->ID = timerID; + timer->TriggerTime = fgElapsedTime() + timeOut; /* Insert such that timers are sorted by end-time */ for( node = fgState.Timers.First; node; node = node->Node.Next ) @@ -73,6 +87,18 @@ fgListInsert( &fgState.Timers, &node->Node, &timer->Node ); } +void glutTimerFuncCallback( int ID, FGCBUserData userData ) +{ + FGCBTimer callback = (FGCBTimer)userData; + callback( ID ); +} + +void FGAPIENTRY glutTimerFunc( unsigned int timeOut, FGCBTimer callback, int timerID ) +{ + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutTimerFunc" ); + glutTimerFuncUcall( timeOut, glutTimerFuncCallback, timerID, (FGCBUserData)callback ); +} + /* Deprecated version of glutMenuStatusFunc callback setting method */ void FGAPIENTRY glutMenuStateFunc( FGCBMenuState callback ) { Modified: trunk/freeglut/freeglut/src/fg_ext.c =================================================================== --- trunk/freeglut/freeglut/src/fg_ext.c 2017-06-14 20:51:30 UTC (rev 1807) +++ trunk/freeglut/freeglut/src/fg_ext.c 2017-06-30 23:20:57 UTC (rev 1808) @@ -210,6 +210,12 @@ CHECK_NAME(glutSetVertexAttribCoord3); CHECK_NAME(glutSetVertexAttribNormal); CHECK_NAME(glutSetVertexAttribTexCoord2); + + /* freeglut user callback functions */ + CHECK_NAME(glutCreateMenuUcall); + CHECK_NAME(glutTimerFuncUcall); + CHECK_NAME(glutIdleFuncUcall); + //TODO #undef CHECK_NAME return NULL; Modified: trunk/freeglut/freeglut/src/fg_init.c =================================================================== --- trunk/freeglut/freeglut/src/fg_init.c 2017-06-14 20:51:30 UTC (rev 1807) +++ trunk/freeglut/freeglut/src/fg_init.c 2017-06-30 23:20:57 UTC (rev 1808) @@ -70,6 +70,7 @@ { NULL, NULL }, /* Timers */ { NULL, NULL }, /* FreeTimers */ NULL, /* IdleCallback */ + NULL, /* IdleCallbackData */ 0, /* ActiveMenus */ NULL, /* MenuStateCallback */ NULL, /* MenuStatusCallback */ @@ -299,6 +300,7 @@ fgListInit( &fgState.FreeTimers ); fgState.IdleCallback = NULL; + fgState.IdleCallbackData = NULL; fgState.MenuStateCallback = ( FGCBMenuState )NULL; fgState.MenuStatusCallback = ( FGCBMenuStatus )NULL; Modified: trunk/freeglut/freeglut/src/fg_internal.h =================================================================== --- trunk/freeglut/freeglut/src/fg_internal.h 2017-06-14 20:51:30 UTC (rev 1807) +++ trunk/freeglut/freeglut/src/fg_internal.h 2017-06-30 23:20:57 UTC (rev 1808) @@ -216,6 +216,8 @@ /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */ /* Freeglut callbacks type definitions */ +typedef void* FGCBUserData; + typedef void (* FGCBDisplay )( void ); typedef void (* FGCBReshape )( int, int ); typedef void (* FGCBPosition )( int, int ); @@ -251,12 +253,15 @@ /* The global callbacks type definitions */ typedef void (* FGCBIdle )( void ); +typedef void (* FGCBIdleUC )( FGCBUserData ); typedef void (* FGCBTimer )( int ); +typedef void (* FGCBTimerUC )( int, FGCBUserData ); typedef void (* FGCBMenuState )( int ); typedef void (* FGCBMenuStatus )( int, int, int ); /* The callback used when creating/using menus */ typedef void (* FGCBMenu )( int ); +typedef void (* FGCBMenuUC )( int, FGCBUserData ); /* The FreeGLUT error/warning handler type definition */ typedef void (* FGError ) ( const char *fmt, va_list ap); @@ -327,7 +332,8 @@ SFG_List Timers; /* The freeglut timer hooks */ SFG_List FreeTimers; /* The unused timer hooks */ - FGCBIdle IdleCallback; /* The global idle callback */ + FGCBIdleUC IdleCallback; /* The global idle callback */ + FGCBUserData IdleCallbackData; /* The global idle callback data */ int ActiveMenus; /* Num. of currently active menus */ FGCBMenuState MenuStateCallback; /* Menu callbacks are global */ @@ -384,7 +390,8 @@ { SFG_Node Node; int ID; /* The timer ID integer */ - FGCBTimer Callback; /* The timer callback */ + FGCBTimerUC Callback; /* The timer callback */ + FGCBUserData CallbackData; /* The timer callback user data */ fg_time_t TriggerTime; /* The timer trigger time */ }; @@ -662,7 +669,8 @@ void *UserData; /* User data passed back at callback */ int ID; /* The global menu ID */ SFG_List Entries; /* The menu entries list */ - FGCBMenu Callback; /* The menu callback */ + FGCBMenuUC Callback; /* The menu callback */ + FGCBUserData CallbackData; /* The menu callback user data */ FGCBDestroy Destroy; /* Destruction callback */ GLboolean IsActive; /* Is the menu selected? */ void* Font; /* Font to be used for displaying this menu */ @@ -970,7 +978,7 @@ void fgDestroyWindow( SFG_Window* window ); /* Menu creation and destruction. Defined in fg_structure.c */ -SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ); +SFG_Menu* fgCreateMenu( FGCBMenuUC menuCallback, FGCBUserData userData ); void fgDestroyMenu( SFG_Menu* menu ); /* Joystick device management functions, defined in fg_joystick.c */ Modified: trunk/freeglut/freeglut/src/fg_main.c =================================================================== --- trunk/freeglut/freeglut/src/fg_main.c 2017-06-14 20:51:30 UTC (rev 1807) +++ trunk/freeglut/freeglut/src/fg_main.c 2017-06-30 23:20:57 UTC (rev 1808) @@ -233,7 +233,7 @@ fgListRemove( &fgState.Timers, &timer->Node ); fgListAppend( &fgState.FreeTimers, &timer->Node ); - timer->Callback( timer->ID ); + timer->Callback( timer->ID, timer->CallbackData ); } } @@ -509,7 +509,7 @@ fgStructure.CurrentWindow->IsMenu ) /* fail safe */ fgSetWindow( window ); - fgState.IdleCallback( ); + fgState.IdleCallback( fgState.IdleCallbackData ); } else fghSleepForEvents( ); Modified: trunk/freeglut/freeglut/src/fg_menu.c =================================================================== --- trunk/freeglut/freeglut/src/fg_menu.c 2017-06-14 20:51:30 UTC (rev 1807) +++ trunk/freeglut/freeglut/src/fg_menu.c 2017-06-30 23:20:57 UTC (rev 1808) @@ -609,7 +609,7 @@ /* Deactivate menu and then call callback (we don't want menu to stay in view while callback is executing, and user should be able to change menus in callback) */ fgDeactivateMenu( parent_window ); - active_menu->Callback( active_entry->ID ); + active_menu->Callback( active_entry->ID, active_menu->CallbackData ); /* Restore the current window and menu */ fgSetWindow( save_window ); @@ -780,16 +780,29 @@ /* * Creates a new menu object, adding it to the freeglut structure */ -int FGAPIENTRY glutCreateMenu( FGCBMenu callback ) +int FGAPIENTRY glutCreateMenuUcall( FGCBMenuUC callback, FGCBUserData userData ) { /* The menu object creation code resides in fg_structure.c */ - FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenu" ); + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenuUcall" ); if (fgState.ActiveMenus) fgError("Menu manipulation not allowed while menus in use."); - return fgCreateMenu( callback )->ID; + return fgCreateMenu( callback, userData )->ID; } +/* Standard glutCreateMenu */ +void glutCreateMenuCallback( int menu, FGCBUserData userData ) +{ + FGCBMenu callback = (FGCBMenu)userData; + callback( menu ); +} + +int FGAPIENTRY glutCreateMenu( FGCBMenu callback ) +{ + FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenu" ); + return glutCreateMenuUcall( glutCreateMenuCallback, (FGCBUserData)callback ); +} + /* * Destroys a menu object, removing all references to it */ Modified: trunk/freeglut/freeglut/src/fg_structure.c =================================================================== --- trunk/freeglut/freeglut/src/fg_structure.c 2017-06-14 20:51:30 UTC (rev 1807) +++ trunk/freeglut/freeglut/src/fg_structure.c 2017-06-30 23:20:57 UTC (rev 1808) @@ -116,7 +116,7 @@ /* * This private function creates a menu and adds it to the menus list */ -SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ) +SFG_Menu* fgCreateMenu( FGCBMenuUC menuCallback, FGCBUserData userData ) { SFG_Window *current_window = fgStructure.CurrentWindow; @@ -134,10 +134,11 @@ fgSetWindow( current_window ); /* Initialize the object properties: */ - menu->ID = ++fgStructure.MenuID; - menu->Callback = menuCallback; - menu->ActiveEntry = NULL; - menu->Font = fgState.MenuFont; + menu->ID = ++fgStructure.MenuID; + menu->Callback = menuCallback; + menu->CallbackData = userData; + menu->ActiveEntry = NULL; + menu->Font = fgState.MenuFont; fgListInit( &menu->Entries ); fgListAppend( &fgStructure.Menus, &menu->Node ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2017-06-30 23:22:28
|
Revision: 1821 http://sourceforge.net/p/freeglut/code/1821 Author: dcnieho Date: 2017-06-30 23:22:26 +0000 (Fri, 30 Jun 2017) Log Message: ----------- Added "hack" function for glutCreateMenuUcall Not desired, but potentially needed as with the other "hack" functions Modified Paths: -------------- trunk/freeglut/freeglut/include/GL/freeglut_ucall.h trunk/freeglut/freeglut/src/mswin/fg_menu_mswin.c Modified: trunk/freeglut/freeglut/include/GL/freeglut_ucall.h =================================================================== --- trunk/freeglut/freeglut/include/GL/freeglut_ucall.h 2017-06-30 23:22:19 UTC (rev 1820) +++ trunk/freeglut/freeglut/include/GL/freeglut_ucall.h 2017-06-30 23:22:26 UTC (rev 1821) @@ -82,6 +82,27 @@ FGAPI void FGAPIENTRY glutInitContextFuncUcall( void (* callback)( void* ), void* user_data ); FGAPI void FGAPIENTRY glutAppStatusFuncUcall( void (* callback)( int, void* ), void* user_data ); +/* + * Continued "hack" from GLUT applied to Ucall functions. + * For more info, see bottom of freeglut_std.h + */ + +/* to get the prototype for exit() */ +#include <stdlib.h> + +#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) && !defined(__WATCOMC__) +FGAPI int FGAPIENTRY __glutCreateMenuUcallWithExit(void(*func)(int, void*), void(__cdecl *exitfunc)(int), void* user_data); +#ifndef FREEGLUT_BUILDING_LIB +#if defined(__GNUC__) +#define FGUNUSED __attribute__((unused)) +#else +#define FGUNUSED +#endif +static int FGAPIENTRY FGUNUSED glutCreateMenuUcall_ATEXIT_HACK(void(*func)(int, void*), void* user_data) { return __glutCreateMenuUcallWithExit(func, exit, user_data); } +#define glutCreateMenuUcall glutCreateMenuUcall_ATEXIT_HACK +#endif +#endif + #ifdef __cplusplus } #endif Modified: trunk/freeglut/freeglut/src/mswin/fg_menu_mswin.c =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_menu_mswin.c 2017-06-30 23:22:19 UTC (rev 1820) +++ trunk/freeglut/freeglut/src/mswin/fg_menu_mswin.c 2017-06-30 23:22:26 UTC (rev 1821) @@ -106,3 +106,8 @@ return glutCreateMenu( callback ); } +int FGAPIENTRY __glutCreateMenuUcallWithExit(void(*callback)(int, void*), void(__cdecl *exit_function)(int), void* user_data) +{ + __glutExitFunc = exit_function; + return glutCreateMenuUcall(callback, user_data); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2017-06-30 23:22:41
|
Revision: 1822 http://sourceforge.net/p/freeglut/code/1822 Author: dcnieho Date: 2017-06-30 23:22:39 +0000 (Fri, 30 Jun 2017) Log Message: ----------- Added timer_callback sample for user callbacks Modified Paths: -------------- trunk/freeglut/freeglut/CMakeLists.txt Added Paths: ----------- trunk/freeglut/freeglut/progs/demos/timer_callback/ trunk/freeglut/freeglut/progs/demos/timer_callback/timer.c Modified: trunk/freeglut/freeglut/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/CMakeLists.txt 2017-06-30 23:22:26 UTC (rev 1821) +++ trunk/freeglut/freeglut/CMakeLists.txt 2017-06-30 23:22:39 UTC (rev 1822) @@ -551,6 +551,7 @@ ENDIF() ADD_DEMO(subwin progs/demos/subwin/subwin.c) ADD_DEMO(timer progs/demos/timer/timer.c) +ADD_DEMO(timer_callback progs/demos/timer_callback/timer.c) Added: trunk/freeglut/freeglut/progs/demos/timer_callback/timer.c =================================================================== --- trunk/freeglut/freeglut/progs/demos/timer_callback/timer.c (rev 0) +++ trunk/freeglut/freeglut/progs/demos/timer_callback/timer.c 2017-06-30 23:22:39 UTC (rev 1822) @@ -0,0 +1,174 @@ +/* Timer (callback) demo + * + * Written by John Tsiombikas <nu...@me...> + * Modified by Vincent Simonetti + * + * A modification of the timer sample, but with this + * offering a use of the user-data callback. + */ +#include <stdio.h> +#include <GL/freeglut.h> + +struct display_index_s +{ + /* color index will be advanced every time the timer expires */ + int surround_color_index; + int center_color_index; +}; +typedef struct display_index_s display_index_t; + +struct timer_state_s +{ + int* color_index_ptr; + int* timer_time_ptr; +}; +typedef struct timer_state_s timer_state_t; + +struct menu_state_s +{ + int* timer_time_ptr; + int menu_id; +}; +typedef struct menu_state_s menu_state_t; + +void disp(void* uptr); +void timer_func(int which, void* uptr); + +const float color[][3] = { + {1, 0, 0}, + {0, 1, 0}, + {0, 0, 1}, + {1, 1, 0}, + {0, 1, 1}, + {1, 0, 1} +}; +const int timerInts[] = { + 250, + 500, + 1000 +}; + +void createMenuEntries(menu_state_t* menuState) +{ + int i; + for (i = 0; i < sizeof(timerInts) / sizeof(*timerInts); i++) + { + char temp[10] = {'\0'}; + /* flag current value */ + if ((*menuState->timer_time_ptr) == timerInts[i]) + temp[0] = '+'; + else + temp[0] = '-'; + + sprintf(temp + 1, " %4d ms", timerInts[i]); + + glutAddMenuEntry(temp, timerInts[i]); + } +} + +void updateMenuEntries(menu_state_t* menuState) +{ + int i; + for (i = 0; i < sizeof(timerInts) / sizeof(*timerInts); i++) + { + char temp[10] = { '\0' }; + /* flag current value */ + if ((*menuState->timer_time_ptr) == timerInts[i]) + temp[0] = '+'; + else + temp[0] = '-'; + + sprintf(temp + 1, " %4d ms", timerInts[i]); + + glutChangeToMenuEntry(i+1, temp, timerInts[i]); + } +} + +void MenuHandler(int timerInt, void* user_ptr) +{ + menu_state_t* menuState; + + if (!user_ptr) + { + /* In case main menu is selected somehow */ + return; + } + + menuState = (menu_state_t*)user_ptr; + + *menuState->timer_time_ptr = timerInt; + glutSetMenu(menuState->menu_id); + updateMenuEntries(menuState); +} + +int main(int argc, char **argv) +{ + int timerSurroundInt = 1000, timerCenterInt = 500; + display_index_t displayIndex = { 0, 2 }; + timer_state_t surroundTimerState = { &displayIndex.surround_color_index, &timerSurroundInt }; + timer_state_t centerTimerState = { &displayIndex.center_color_index, &timerCenterInt }; + menu_state_t surroundMenuState = { &timerSurroundInt, 0 }; + menu_state_t centerMenuState = { &timerCenterInt, 0 }; + + glutInit(&argc, argv); + glutInitWindowSize(128, 128); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); + glutCreateWindow("timer test"); + + glutDisplayFuncUcall(disp, &displayIndex); + + /* get timer started, its reset in the timer function itself */ + glutTimerFuncUcall(timerSurroundInt, timer_func, 1, &surroundTimerState); + glutTimerFuncUcall(timerCenterInt, timer_func, 2, ¢erTimerState); + + /* menus for setting timing */ + surroundMenuState.menu_id = glutCreateMenuUcall(MenuHandler, &surroundMenuState); + createMenuEntries(&surroundMenuState); + + centerMenuState.menu_id = glutCreateMenuUcall(MenuHandler, ¢erMenuState); + createMenuEntries(¢erMenuState); + + glutCreateMenuUcall(MenuHandler, NULL); /* doesn't matter, no clickable entries in this menu */ + glutAddSubMenu("Center", centerMenuState.menu_id); + glutAddSubMenu("Surround", surroundMenuState.menu_id); + glutAttachMenu(GLUT_RIGHT_BUTTON); + + glutMainLoop(); + return 0; +} + +void disp(void* user_ptr) +{ + const display_index_t* displayIndex; + int cidx, pcidx; + + displayIndex = (display_index_t*)user_ptr; + + cidx = displayIndex->surround_color_index; + glClearColor(color[cidx][0], color[cidx][1], color[cidx][2], 1); + glClear(GL_COLOR_BUFFER_BIT); + + pcidx = displayIndex->center_color_index; + glPointSize(10.f); + glColor3f(color[pcidx][0], color[pcidx][1], color[pcidx][2]); + glBegin(GL_POINTS); + glVertex2i(0,0); + glEnd(); + + glutSwapBuffers(); +} + +void timer_func(int which, void* user_ptr) +{ + const timer_state_t* timerState; + + timerState = (timer_state_t*)user_ptr; + + /* advance the color index and trigger a redisplay */ + *timerState->color_index_ptr = (*timerState->color_index_ptr + 1) % (sizeof color / sizeof *color); + + glutPostRedisplay(); + + /* (re)set the timer callback and ask glut to call it in x ms */ + glutTimerFuncUcall(*timerState->timer_time_ptr, timer_func, which, user_ptr); +} Property changes on: trunk/freeglut/freeglut/progs/demos/timer_callback/timer.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dc...@us...> - 2018-03-26 20:32:33
|
Revision: 1840 http://sourceforge.net/p/freeglut/code/1840 Author: dcnieho Date: 2018-03-26 20:32:31 +0000 (Mon, 26 Mar 2018) Log Message: ----------- cleaning up mixed tabs and spaces Modified Paths: -------------- trunk/freeglut/freeglut/include/GL/freeglut_ucall.h trunk/freeglut/freeglut/progs/demos/shapes/shapes.c trunk/freeglut/freeglut/src/fg_callback_macros.h trunk/freeglut/freeglut/src/fg_display.c trunk/freeglut/freeglut/src/fg_font_data.c trunk/freeglut/freeglut/src/fg_input_devices.c trunk/freeglut/freeglut/src/fg_internal.h trunk/freeglut/freeglut/src/fg_menu.c trunk/freeglut/freeglut/src/fg_spaceball.c trunk/freeglut/freeglut/src/fg_state.c trunk/freeglut/freeglut/src/fg_structure.c trunk/freeglut/freeglut/src/mswin/fg_init_mswin.c trunk/freeglut/freeglut/src/mswin/fg_menu_mswin.c trunk/freeglut/freeglut/src/mswin/fg_spaceball_mswin.c trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c trunk/freeglut/freeglut/src/mswin/fg_window_mswin.c Modified: trunk/freeglut/freeglut/include/GL/freeglut_ucall.h =================================================================== --- trunk/freeglut/freeglut/include/GL/freeglut_ucall.h 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/include/GL/freeglut_ucall.h 2018-03-26 20:32:31 UTC (rev 1840) @@ -82,7 +82,7 @@ FGAPI void FGAPIENTRY glutInitContextFuncUcall( void (* callback)( void* ), void* user_data ); FGAPI void FGAPIENTRY glutAppStatusFuncUcall( void (* callback)( int, void* ), void* user_data ); -/* +/* * Continued "hack" from GLUT applied to Ucall functions. * For more info, see bottom of freeglut_std.h */ Modified: trunk/freeglut/freeglut/progs/demos/shapes/shapes.c =================================================================== --- trunk/freeglut/freeglut/progs/demos/shapes/shapes.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/progs/demos/shapes/shapes.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -5,10 +5,10 @@ in OpenGLUT. It may also be useful to see which parameters control what behavior in the OpenGLUT objects. - + Spinning wireframe and solid-shaded shapes are displayed. Some parameters can be adjusted. - + Keys: - <tt>Esc </tt> Quit - <tt>q Q </tt> Quit @@ -34,7 +34,7 @@ \author Portions Copyright (C) 2004, the OpenGLUT project contributors. <br> OpenGLUT branched from freeglut in February, 2004. - + \image html openglut_shapes.png OpenGLUT Geometric Shapes Demonstration \include demos/shapes/shapes.c */ @@ -63,7 +63,7 @@ } /* - * OpenGL 2+ shader mode needs some function and macro definitions, + * OpenGL 2+ shader mode needs some function and macro definitions, * avoiding a dependency on additional libraries like GLEW or the * GL/glext.h header */ @@ -283,10 +283,10 @@ GLint attrib = gl_GetAttribLocation(program, name); if (attrib == -1) { - fprintf(stderr, "Warning: Could not bind attrib %s\n", name); + fprintf(stderr, "Warning: Could not bind attrib %s\n", name); } - checkError ("getAttribOrUniformLocation"); + checkError ("getAttribOrUniformLocation"); return attrib; } else @@ -294,16 +294,16 @@ GLint uniform = gl_GetUniformLocation(program, name); if (uniform == -1) { - fprintf(stderr, "Warning: Could not bind uniform %s\n", name); + fprintf(stderr, "Warning: Could not bind uniform %s\n", name); } - checkError ("getAttribOrUniformLocation"); + checkError ("getAttribOrUniformLocation"); return uniform; } } GLuint program; -GLint attribute_fg_coord = -1, attribute_fg_normal = -1; +GLint attribute_fg_coord = -1, attribute_fg_normal = -1; GLint uniform_m = -1, uniform_p = -1, uniform_m_3x3_inv_transp = -1; GLint shaderReady = 0; /* Set to 1 when all initialization went well, to -1 when shader somehow unusable. */ @@ -800,10 +800,10 @@ case '.': case '>': stacks++; break; - case '9': + case '9': case '(': if( depth > -1 ) depth--; break; - case '0': + case '0': case ')': ++depth; break; case 'P': Modified: trunk/freeglut/freeglut/src/fg_callback_macros.h =================================================================== --- trunk/freeglut/freeglut/src/fg_callback_macros.h 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/fg_callback_macros.h 2018-03-26 20:32:31 UTC (rev 1840) @@ -39,11 +39,11 @@ /* What supports variadic macros based off Wikipedia article on it (GCC-like must support C99 or higher to use variadic macros) */ #if (((defined(__GNUC__) && (__GNUC__ >= 3)) || \ - (defined(__clang__))) && \ - (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) || \ - (defined(_MSC_VER) && (_MSC_VER >= 1400)) || \ - (defined(__BORLANDC__) && (__BORLANDC__ >= 0x570)) || \ - (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x530)) + (defined(__clang__))) && \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) || \ + (defined(_MSC_VER) && (_MSC_VER >= 1400)) || \ + (defined(__BORLANDC__) && (__BORLANDC__ >= 0x570)) || \ + (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x530)) #define FG_COMPILER_SUPPORTS_VA_ARGS 1 #else #define FG_COMPILER_SUPPORTS_VA_ARGS 0 @@ -58,7 +58,7 @@ * * This took a while to figure out, so be sure try to understand what is happening so that you can ensure that whatever you * change won't break other areas. - * + * * If you are just adding a new callback/changing it's argument count, just go to the bottom of the file. * * This whole file exists purely for the sake of preventing the need to implement additional parsing logic for each callback @@ -70,26 +70,26 @@ * then the GCC macro, so maybe it's good to stay as is. * * Onto the different "versions" of macros: - * - * The first is for any compiler that supports C99 by default. It requires each callback to have a specific argument count - * passthrough macro. The only reason there are specific count macros is so that (see paraghraph below) don't need have their own - * set of callback macros. Ideally, there would only be ZERO and ONE_OR_MORE. This works by having callback-specific macros call a - * specific handler macro to return user data (ZERO) or return one or more arguments along with userData (ONE_OR_MORE) where, with + * + * The first is for any compiler that supports C99 by default. It requires each callback to have a specific argument count + * passthrough macro. The only reason there are specific count macros is so that (see paraghraph below) don't need have their own + * set of callback macros. Ideally, there would only be ZERO and ONE_OR_MORE. This works by having callback-specific macros call a + * specific handler macro to return user data (ZERO) or return one or more arguments along with userData (ONE_OR_MORE) where, with * variadic macros, it just reuses the arguments. * - * The last macro set is for the poor individual who has to use a compiler that doesn't support C99 by default, or may not support - * it at all. Stuff like MSVC6... It works by having a specific-count macro that "extracts" each argument to have them reused without + * The last macro set is for the poor individual who has to use a compiler that doesn't support C99 by default, or may not support + * it at all. Stuff like MSVC6... It works by having a specific-count macro that "extracts" each argument to have them reused without * the parathesis. * - * There is a 3rd macro set that only worked on GCC/Clang, and thus was removed (last seen in revision e9676fc of the GIT mirror. + * There is a 3rd macro set that only worked on GCC/Clang, and thus was removed (last seen in revision e9676fc of the GIT mirror. * Not sure at this time what the SVN number is.) as it's a non-standard functionality. */ /* * EXPAND_WCB() is used as: - * + * * EXPAND_WCB( cbname )(( arg_list, userData )) - * + * * ... where {(arg_list)} is the parameter list and userData is user * provided data. * @@ -140,7 +140,7 @@ #define EXPAND_WCB(cbname) EXPAND_WCB_SUB_ ## cbname -/* +/* * Freeglut callbacks type definitions macros * * Every time a callback is updated in fg_internal.h is updated, this needs updated @@ -261,8 +261,8 @@ } #define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b) \ - IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT_UCALL(a,b) \ - IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b) + IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT_UCALL(a,b) \ + IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b) /* * Combine _glut and _cb macros: @@ -276,12 +276,12 @@ IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b) #define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0(a) \ - IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,a) \ - IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a) + IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,a) \ + IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a) #define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG0_2NAME(a,b) \ - IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,b) \ - IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b) + IMPLEMENT_CALLBACK_FUNC_CB_ARG0(a,b) \ + IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b) #define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG1(a) \ IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \ @@ -288,8 +288,8 @@ IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a) #define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG1(a) \ - IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \ - IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a) + IMPLEMENT_CALLBACK_FUNC_CB_ARG1(a,a) \ + IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a) #define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG2(a) \ IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \ @@ -300,12 +300,12 @@ IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,b) #define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2(a) \ - IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \ - IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a) + IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,a) \ + IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a) #define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG2_2NAME(a,b) \ - IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,b) \ - IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b) + IMPLEMENT_CALLBACK_FUNC_CB_ARG2(a,b) \ + IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b) #define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG3(a) \ IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \ @@ -316,12 +316,12 @@ IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_2NAME_GLUT(a,a) #define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3(a) \ - IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \ - IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a) + IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,a) \ + IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,a) #define IMPLEMENT_GLUT_CALLBACK_FUNC_ARG3_2NAME(a,b) \ - IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,b) \ - IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b) + IMPLEMENT_CALLBACK_FUNC_CB_ARG3(a,b) \ + IMPLEMENT_CALLBACK_FUNC_2NAME_GLUT_BASE(a,b) #define IMPLEMENT_CURRENT_WINDOW_CALLBACK_FUNC_ARG4(a) \ IMPLEMENT_CALLBACK_FUNC_CB_ARG4(a,a) \ Modified: trunk/freeglut/freeglut/src/fg_display.c =================================================================== --- trunk/freeglut/freeglut/src/fg_display.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/fg_display.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -42,10 +42,10 @@ { FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutPostRedisplay" ); if ( ! fgStructure.CurrentWindow ) - { + { fgError ( " ERROR: Function <%s> called" " with no current window defined.", "glutPostRedisplay" ) ; - } + } fgStructure.CurrentWindow->State.WorkMask |= GLUT_DISPLAY_WORK; } Modified: trunk/freeglut/freeglut/src/fg_font_data.c =================================================================== --- trunk/freeglut/freeglut/src/fg_font_data.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/fg_font_data.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -4,7 +4,7 @@ */ /* - * This file has been automatically generated by the + * This file has been automatically generated by the * genfonts utility. * * The legal status of this file is a bit vague. The font glyphs @@ -31,7 +31,7 @@ * * Copyright (c) 1999-2000 by Pawel W. Olszta * Written by Pawel W. Olszta, <ol...@so...> - * + * * 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 @@ -55,7 +55,7 @@ /* * The following bitmapped fonts are defined in this file: - * + * * 1. fgFontFixed8x13 * -misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1 * 2. fgFontFixed9x15 Modified: trunk/freeglut/freeglut/src/fg_input_devices.c =================================================================== --- trunk/freeglut/freeglut/src/fg_input_devices.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/fg_input_devices.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -111,7 +111,7 @@ { const char *dial_device=NULL; dial_device = getenv ( "GLUT_DIALS_SERIAL" ); - fgPlatformRegisterDialDevice ( dial_device ); + fgPlatformRegisterDialDevice ( dial_device ); if ( !dial_device ) return; if ( !( dialbox_port = serial_open ( dial_device ) ) ) return; Modified: trunk/freeglut/freeglut/src/fg_internal.h =================================================================== --- trunk/freeglut/freeglut/src/fg_internal.h 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/fg_internal.h 2018-03-26 20:32:31 UTC (rev 1840) @@ -214,7 +214,7 @@ /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */ -/* +/* * Freeglut callbacks type definitions * * If anything here is modified or added, update fg_callback_macros.h functions. @@ -392,7 +392,7 @@ int NumActiveJoysticks; /* Number of active joysticks (callback defined and positive pollrate) -- if zero, don't poll joysticks */ GLboolean InputDevsInitialised; /* Only initialize if application calls for them */ - int MouseWheelTicks; /* Number of ticks the mouse wheel has turned */ + int MouseWheelTicks; /* Number of ticks the mouse wheel has turned */ int AuxiliaryBufferNumber;/* Number of auxiliary buffers */ int SampleNumber; /* Number of samples per pixel */ @@ -417,7 +417,7 @@ typedef struct tagSFG_Display SFG_Display; struct tagSFG_Display { - SFG_PlatformDisplay pDisplay; + SFG_PlatformDisplay pDisplay; int ScreenWidth; /* The screen's width in pixels */ int ScreenHeight; /* The screen's height in pixels */ @@ -447,7 +447,7 @@ SFG_WindowHandleType Handle; /* The window's handle */ SFG_WindowContextType Context; /* The window's OpenGL/WGL context */ - SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */ + SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */ int DoubleBuffered; /* Treat the window as double-buffered */ @@ -536,7 +536,7 @@ int DesiredZOrder; /* desired window Z Order position */ fgDesiredVisibility DesiredVisibility;/* desired visibility (hidden, iconic, shown/normal) */ - SFG_PlatformWindowState pWState; /* Window width/height (X11) or rectangle/style (Windows) from before a resize, and other stuff only needed on specific platforms */ + SFG_PlatformWindowState pWState; /* Window width/height (X11) or rectangle/style (Windows) from before a resize, and other stuff only needed on specific platforms */ long JoystickPollRate; /* The joystick polling rate */ fg_time_t JoystickLastPoll; /* When the last poll happened */ @@ -589,10 +589,10 @@ (((window).CallBacks[WCB_ ## cbname]) = (SFG_Proc)(func)); \ (((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \ } \ - else if( FETCH_USER_DATA_WCB( window, cbname ) != udata ) \ - { \ - (((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \ - } \ + else if( FETCH_USER_DATA_WCB( window, cbname ) != udata ) \ + { \ + (((window).CallbackDatas[WCB_ ## cbname]) = (udata)); \ + } \ } while( 0 ) /* @@ -611,7 +611,7 @@ /* * FETCH_USER_DATA_WCB() is used as: - * + * * FETCH_USER_DATA_WCB( window, cbname ); * * ...where {window} is the freeglut window, @@ -626,9 +626,9 @@ /* * EXPAND_WCB() is used as: - * + * * EXPAND_WCB( cbname )(( arg_list, userData )) - * + * * ... where {(arg_list)} is the parameter list and userData is user * provided data. * @@ -655,7 +655,7 @@ * * callback( arg_list, userData ); * - * ...where userData is added to the arg_list, but the parentheses + * ...where userData is added to the arg_list, but the parentheses * are REQUIRED in the {arg_list}. * * NOTE that it does a sanity-check and also sets the @@ -670,7 +670,7 @@ FGCB ## cbname ## UC func = (FGCB ## cbname ## UC)(FETCH_WCB( window, cbname )); \ FGCBUserData userData = FETCH_USER_DATA_WCB( window, cbname ); \ fgSetWindow( &window ); \ - func EXPAND_WCB( cbname )(( arg_list, userData )); \ + func EXPAND_WCB( cbname )(( arg_list, userData )); \ } \ } while( 0 ) @@ -945,7 +945,7 @@ typedef struct tagSFG_Joystick SFG_Joystick; struct tagSFG_Joystick { - SFG_PlatformJoystick pJoystick; + SFG_PlatformJoystick pJoystick; int id; GLboolean error; Modified: trunk/freeglut/freeglut/src/fg_menu.c =================================================================== --- trunk/freeglut/freeglut/src/fg_menu.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/fg_menu.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -135,7 +135,7 @@ static GLvoid fghGetVMaxExtent( SFG_Window* window, int* x, int* y ) { if( fgStructure.GameModeWindow ) - fgPlatformGetGameModeVMaxExtent ( window, x, y ); + fgPlatformGetGameModeVMaxExtent ( window, x, y ); else { *x = fgDisplay.ScreenWidth; @@ -784,10 +784,10 @@ { /* The menu object creation code resides in fg_structure.c */ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenuUcall" ); - if (fgState.ActiveMenus) - { - fgError( "Menu manipulation not allowed while menus in use." ); - } + if (fgState.ActiveMenus) + { + fgError( "Menu manipulation not allowed while menus in use." ); + } return fgCreateMenu( callback, userData )->ID; } Modified: trunk/freeglut/freeglut/src/fg_spaceball.c =================================================================== --- trunk/freeglut/freeglut/src/fg_spaceball.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/fg_spaceball.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -35,7 +35,7 @@ void fgSpaceballClose(void) { - fgPlatformSpaceballClose(); + fgPlatformSpaceballClose(); } int fgHasSpaceball(void) @@ -88,12 +88,12 @@ int fgHasSpaceball(void) { - return 0; + return 0; } int fgSpaceballNumButtons(void) { - return 0; + return 0; } void fgSpaceballSetWindow(SFG_Window *window) Modified: trunk/freeglut/freeglut/src/fg_state.c =================================================================== --- trunk/freeglut/freeglut/src/fg_state.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/fg_state.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -270,7 +270,7 @@ case GLUT_NUM_DIALS: if ( fgState.InputDevsInitialised ) return 8; return 0; - + case GLUT_NUM_BUTTON_BOX_BUTTONS: return 0; @@ -293,7 +293,7 @@ return fgState.KeyRepeat; default: - return fgPlatformGlutDeviceGet ( eWhat ); + return fgPlatformGlutDeviceGet ( eWhat ); } } Modified: trunk/freeglut/freeglut/src/fg_structure.c =================================================================== --- trunk/freeglut/freeglut/src/fg_structure.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/fg_structure.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -83,7 +83,7 @@ fgError( "Out of memory. Could not create window." ); } - fgPlatformCreateWindow ( window ); + fgPlatformCreateWindow ( window ); fghClearCallBacks( window ); SET_WCB( *window, Reshape, fghDefaultReshape, NULL); @@ -183,10 +183,10 @@ SET_WCB( *window, Destroy, destroy, destroyData ); } - /* - * Similarly, clear all work set for the window, none of this has to be executed anymore - */ - window->State.WorkMask = 0; + /* + * Similarly, clear all work set for the window, none of this has to be executed anymore + */ + window->State.WorkMask = 0; } /* Modified: trunk/freeglut/freeglut/src/mswin/fg_init_mswin.c =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_init_mswin.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/mswin/fg_init_mswin.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -102,17 +102,17 @@ HDC context = CreateDC(fgDisplay.pDisplay.DisplayName,0,0,0); if( context ) { - fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES ); - fgDisplay.ScreenHeight = GetDeviceCaps( context, VERTRES ); - fgDisplay.ScreenWidthMM = GetDeviceCaps( context, HORZSIZE ); - fgDisplay.ScreenHeightMM = GetDeviceCaps( context, VERTSIZE ); - DeleteDC(context); + fgDisplay.ScreenWidth = GetDeviceCaps( context, HORZRES ); + fgDisplay.ScreenHeight = GetDeviceCaps( context, VERTRES ); + fgDisplay.ScreenWidthMM = GetDeviceCaps( context, HORZSIZE ); + fgDisplay.ScreenHeightMM = GetDeviceCaps( context, VERTSIZE ); + DeleteDC(context); } else - fgWarning("fgPlatformInitialize: " - "CreateDC failed, Screen size info may be incorrect\n" + fgWarning("fgPlatformInitialize: " + "CreateDC failed, Screen size info may be incorrect\n" "This is quite likely caused by a bad '-display' parameter"); - + } /* Set the timer granularity to 1 ms */ timeBeginPeriod ( 1 ); @@ -142,7 +142,7 @@ void fgPlatformDeinitialiseInputDevices ( void ) { #if !defined(_WIN32_WCE) - fghCloseInputDevices (); + fghCloseInputDevices (); #endif /* !defined(_WIN32_WCE) */ fgState.JoysticksInitialised = GL_FALSE; fgState.InputDevsInitialised = GL_FALSE; @@ -162,7 +162,7 @@ void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext ) { - /* Do nothing -- this is required for X11 */ + /* Do nothing -- this is required for X11 */ } /* -- PLATFORM-SPECIFIC INTERFACE FUNCTION -------------------------------------------------- */ Modified: trunk/freeglut/freeglut/src/mswin/fg_menu_mswin.c =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_menu_mswin.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/mswin/fg_menu_mswin.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -85,7 +85,7 @@ /* window that got focus was not one of the active menus. That means we'll * close the active menu's unless the window that got focus was their parent */ menu = fgGetActiveMenu(); - + if (newFocusWnd != menu->ParentWindow->Window.Handle) { /* focus shifted to another window than the menu's parent, close menus */ @@ -108,6 +108,6 @@ int FGAPIENTRY __glutCreateMenuUcallWithExit(void(*callback)(int, void*), void(__cdecl *exit_function)(int), void* user_data) { - __glutExitFunc = exit_function; - return glutCreateMenuUcall(callback, user_data); + __glutExitFunc = exit_function; + return glutCreateMenuUcall(callback, user_data); } Modified: trunk/freeglut/freeglut/src/mswin/fg_spaceball_mswin.c =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_spaceball_mswin.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/mswin/fg_spaceball_mswin.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -2,7 +2,7 @@ * fg_spaceball_mswin.c * * Spaceball support for Windows - * + * * Copyright (c) 2012 Stephen J. Baker. All Rights Reserved. * Written by Evan Felix <karcaw at gmail.com> * Creation date: Sat Feb 4, 2012 @@ -32,7 +32,7 @@ /* * Modified by Jinrong Xie <stonexjr at gmail.com> 12/24/2014 * for Space Navigator support on Windows. - * This code is enhanced by at least supporting 3Dconnexion's + * This code is enhanced by at least supporting 3Dconnexion's * six degree of freedom navigator. */ @@ -43,7 +43,7 @@ #include "../fg_internal.h" enum { - SPNAV_EVENT_ANY, + SPNAV_EVENT_ANY, SPNAV_EVENT_MOTION_TRANSLATION, SPNAV_EVENT_MOTION_ROTATION, SPNAV_EVENT_BUTTON /* includes both press and release */ @@ -55,145 +55,145 @@ void fgPlatformInitializeSpaceball(void) { - HWND hwnd; - sball_initialized = 1; - if (!fgStructure.CurrentWindow) - { - sball_initialized = 0; - return; - } - hwnd = fgStructure.CurrentWindow->Window.Handle; + HWND hwnd; + sball_initialized = 1; + if (!fgStructure.CurrentWindow) + { + sball_initialized = 0; + return; + } + hwnd = fgStructure.CurrentWindow->Window.Handle; - { - BOOL ok; - UINT cbSize = sizeof(__fgSpaceball); - __fgSpaceball.hwndTarget = hwnd; - ok = RegisterRawInputDevices(&__fgSpaceball, 1, cbSize); + { + BOOL ok; + UINT cbSize = sizeof(__fgSpaceball); + __fgSpaceball.hwndTarget = hwnd; + ok = RegisterRawInputDevices(&__fgSpaceball, 1, cbSize); - if (!ok){ - __fgSpaceball.hwndTarget = NULL; - sball_initialized = 0; - } - } + if (!ok){ + __fgSpaceball.hwndTarget = NULL; + sball_initialized = 0; + } + } } void fgPlatformSpaceballClose(void) { - return; + return; } int fgPlatformHasSpaceball(void) { - return __fgSpaceball.hwndTarget ? 1 : 0; + return __fgSpaceball.hwndTarget ? 1 : 0; } int fgPlatformSpaceballNumButtons(void) { - return 0; + return 0; } void fgPlatformSpaceballSetWindow(SFG_Window *window) { - return; + return; } int fgIsSpaceballWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam) { - return 0; + return 0; } void fgSpaceballHandleWinEvent(HWND hwnd, WPARAM wParam, LPARAM lParam) { - #define LOGITECH_VENDOR_ID 0x46d - HRAWINPUT hRawInput = (HRAWINPUT)lParam; - UINT inputCode = (UINT)wParam; - UINT size; - BYTE *rawInputBuffer; - PRAWINPUT pRawInput; - UINT res; - RID_DEVICE_INFO sRidDeviceInfo; + #define LOGITECH_VENDOR_ID 0x46d + HRAWINPUT hRawInput = (HRAWINPUT)lParam; + UINT inputCode = (UINT)wParam; + UINT size; + BYTE *rawInputBuffer; + PRAWINPUT pRawInput; + UINT res; + RID_DEVICE_INFO sRidDeviceInfo; - if (!sball_initialized) - { - fgPlatformInitializeSpaceball(); - if (!sball_initialized) - { - return; - } - } + if (!sball_initialized) + { + fgPlatformInitializeSpaceball(); + if (!sball_initialized) + { + return; + } + } - res = GetRawInputData(hRawInput, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)); - if (res == -1) - return; + res = GetRawInputData(hRawInput, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)); + if (res == -1) + return; - rawInputBuffer = malloc(size * sizeof *rawInputBuffer); - pRawInput = (PRAWINPUT)rawInputBuffer; + rawInputBuffer = malloc(size * sizeof *rawInputBuffer); + pRawInput = (PRAWINPUT)rawInputBuffer; - res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER)); - if (res == -1) - return; - if (pRawInput->header.dwType != RIM_TYPEHID) - return; + res = GetRawInputData(hRawInput, RID_INPUT, pRawInput, &size, sizeof(RAWINPUTHEADER)); + if (res == -1) + return; + if (pRawInput->header.dwType != RIM_TYPEHID) + return; - sRidDeviceInfo.cbSize = sizeof(RID_DEVICE_INFO); - size = sizeof(RID_DEVICE_INFO); - res = GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICEINFO, &sRidDeviceInfo, &size); - if (res == -1) - return; - { - SFG_Window* window = fgWindowByHandle(hwnd); - if ((window == NULL)) - return; + sRidDeviceInfo.cbSize = sizeof(RID_DEVICE_INFO); + size = sizeof(RID_DEVICE_INFO); + res = GetRawInputDeviceInfo(pRawInput->header.hDevice, RIDI_DEVICEINFO, &sRidDeviceInfo, &size); + if (res == -1) + return; + { + SFG_Window* window = fgWindowByHandle(hwnd); + if ((window == NULL)) + return; - if (sRidDeviceInfo.hid.dwVendorId == LOGITECH_VENDOR_ID) - { - // Motion data comes in two parts: motion type and - // displacement/rotation along three axis. - // Orientation is a right handed coordinate system with - // X goes right, Y goes up and Z goes towards viewer, e.g. - // the one used in OpenGL - if (pRawInput->data.hid.bRawData[0] == - SPNAV_EVENT_MOTION_TRANSLATION) - { // Translation vector - short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]); - short X = pnData[0]; - short Y = -pnData[2]; - short Z = pnData[1]; - INVOKE_WCB(*window, SpaceMotion, (X, Y, Z)); - } - else if (pRawInput->data.hid.bRawData[0] == - SPNAV_EVENT_MOTION_ROTATION) - { // Axis aligned rotation vector - short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]); - short rX = pnData[0]; - short rY = -pnData[2]; - short rZ = pnData[1]; - INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ)); - } - else if (pRawInput->data.hid.bRawData[0] == - SPNAV_EVENT_BUTTON) - { // State of the keys - unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]); - unsigned int state = GLUT_UP; - if (FETCH_WCB(*window, SpaceButton)) - { - int i; - for (i = 0; i < 32; i++) - { - unsigned long stateBefore = __fgSpaceKeystate&(1 << i); - unsigned long stateNow = dwKeystate&(1 << i); + if (sRidDeviceInfo.hid.dwVendorId == LOGITECH_VENDOR_ID) + { + // Motion data comes in two parts: motion type and + // displacement/rotation along three axis. + // Orientation is a right handed coordinate system with + // X goes right, Y goes up and Z goes towards viewer, e.g. + // the one used in OpenGL + if (pRawInput->data.hid.bRawData[0] == + SPNAV_EVENT_MOTION_TRANSLATION) + { // Translation vector + short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]); + short X = pnData[0]; + short Y = -pnData[2]; + short Z = pnData[1]; + INVOKE_WCB(*window, SpaceMotion, (X, Y, Z)); + } + else if (pRawInput->data.hid.bRawData[0] == + SPNAV_EVENT_MOTION_ROTATION) + { // Axis aligned rotation vector + short* pnData = (short*)(&pRawInput->data.hid.bRawData[1]); + short rX = pnData[0]; + short rY = -pnData[2]; + short rZ = pnData[1]; + INVOKE_WCB(*window, SpaceRotation, (rX, rY, rZ)); + } + else if (pRawInput->data.hid.bRawData[0] == + SPNAV_EVENT_BUTTON) + { // State of the keys + unsigned long dwKeystate = *(unsigned long*)(&pRawInput->data.hid.bRawData[1]); + unsigned int state = GLUT_UP; + if (FETCH_WCB(*window, SpaceButton)) + { + int i; + for (i = 0; i < 32; i++) + { + unsigned long stateBefore = __fgSpaceKeystate&(1 << i); + unsigned long stateNow = dwKeystate&(1 << i); - if (stateBefore && !stateNow) - INVOKE_WCB(*window, SpaceButton, (stateBefore, GLUT_UP)); - if (!stateBefore && stateNow) - INVOKE_WCB(*window, SpaceButton, (stateNow, GLUT_DOWN)); + if (stateBefore && !stateNow) + INVOKE_WCB(*window, SpaceButton, (stateBefore, GLUT_UP)); + if (!stateBefore && stateNow) + INVOKE_WCB(*window, SpaceButton, (stateNow, GLUT_DOWN)); - } - } - __fgSpaceKeystate = dwKeystate; - } - } - } + } + } + __fgSpaceKeystate = dwKeystate; + } + } + } } #endif \ No newline at end of file Modified: trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -32,7 +32,7 @@ extern GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, unsigned char layer_type ); -/* +/* * Helper functions for getting client area from the window rect * and the window rect from the client area given the style of the window * (or a valid window pointer from which the style can be queried). @@ -146,7 +146,7 @@ HDC hdc = fgStructure.CurrentWindow->Window.pContext.Device; int iPixelFormat = GetPixelFormat( hdc ); DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd); - + returnValue = pfd.cColorBits; if (pfd.iPixelType==PFD_TYPE_RGBA) returnValue += pfd.cAlphaBits; @@ -183,7 +183,7 @@ GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect); #else ClientToScreen(fgStructure.CurrentWindow->Window.Handle, &topLeft); - + if (fgStructure.CurrentWindow->Parent) /* For child window, we should return relative to upper-left * of parent's client area. @@ -257,7 +257,7 @@ */ borderWidth = ((winRect.right-winRect.left)-(clientRect.right-clientRect.left))/2; captionHeight = (winRect.bottom-winRect.top)-(clientRect.bottom-clientRect.top)-borderWidth; /* include top border in caption height */ - + switch( eWhat ) { case GLUT_WINDOW_BORDER_WIDTH: @@ -289,7 +289,7 @@ break; } - return -1; + return -1; } Modified: trunk/freeglut/freeglut/src/mswin/fg_window_mswin.c =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_window_mswin.c 2018-03-26 20:24:31 UTC (rev 1839) +++ trunk/freeglut/freeglut/src/mswin/fg_window_mswin.c 2018-03-26 20:32:31 UTC (rev 1840) @@ -239,7 +239,7 @@ ppfd->dwLayerMask = 0; ppfd->dwVisibleMask = 0; ppfd->dwDamageMask = 0; - + ppfd->cColorBits = (BYTE) GetDeviceCaps( hdc, BITSPIXEL ); } @@ -291,7 +291,7 @@ /* windows hack for multismapling/sRGB */ if ( ( fgState.DisplayMode & GLUT_MULTISAMPLE ) || ( fgState.DisplayMode & GLUT_SRGB ) ) - { + { HGLRC rc, rc_before=wglGetCurrentContext(); HWND hWnd; HDC hDC, hDC_before=wglGetCurrentDC(); @@ -430,7 +430,7 @@ windowRect.left = clientRect->left; windowRect.top = clientRect->top; } - + /* done, copy windowRect to output */ CopyRect(clientRect,&windowRect); } @@ -467,7 +467,7 @@ POINT topLeftClient = {0,0}; freeglut_return_if_fail((window && window->Window.Handle)); - + /* Get size of client rect */ GetClientRect(window->Window.Handle, clientRect); if (posIsOutside) @@ -497,9 +497,9 @@ } m_proc_t; static BOOL CALLBACK m_proc(HMONITOR mon, - HDC hdc, - LPRECT rect, - LPARAM data) + HDC hdc, + LPRECT rect, + LPARAM data) { m_proc_t *dp=(m_proc_t *)data; MONITORINFOEX info; @@ -518,7 +518,7 @@ return TRUE; } -/* +/* * this function returns the origin of the screen identified by * fgDisplay.pDisplay.DisplayName, and 0 otherwise. * This is used in fgOpenWindow to open the gamemode window on the screen @@ -727,9 +727,9 @@ /* Enable multitouch: additional flag TWF_FINETOUCH, TWF_WANTPALM */ #ifdef WM_TOUCH - if (fghRegisterTouchWindow == (pRegisterTouchWindow)0xDEADBEEF) - fghRegisterTouchWindow = (pRegisterTouchWindow)GetProcAddress(GetModuleHandle("user32"),"RegisterTouchWindow"); - if (fghRegisterTouchWindow) + if (fghRegisterTouchWindow == (pRegisterTouchWindow)0xDEADBEEF) + fghRegisterTouchWindow = (pRegisterTouchWindow)GetProcAddress(GetModuleHandle("user32"),"RegisterTouchWindow"); + if (fghRegisterTouchWindow) fghRegisterTouchWindow( window->Window.Handle, TWF_FINETOUCH | TWF_WANTPALM ); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jt...@us...> - 2018-04-02 03:16:52
|
Revision: 1842 http://sourceforge.net/p/freeglut/code/1842 Author: jtsiomb Date: 2018-04-02 03:16:50 +0000 (Mon, 02 Apr 2018) Log Message: ----------- - fallback to non-sRGB visuals if the context creation failed (GLX-only) - added new glutGet query: GLUT_WINDOW_SRGB (untested on windows) Modified Paths: -------------- trunk/freeglut/freeglut/include/GL/freeglut_ext.h trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c trunk/freeglut/freeglut/src/x11/fg_state_x11_glx.c trunk/freeglut/freeglut/src/x11/fg_window_x11.c Modified: trunk/freeglut/freeglut/include/GL/freeglut_ext.h =================================================================== --- trunk/freeglut/freeglut/include/GL/freeglut_ext.h 2018-03-27 07:41:18 UTC (rev 1841) +++ trunk/freeglut/freeglut/include/GL/freeglut_ext.h 2018-04-02 03:16:50 UTC (rev 1842) @@ -92,6 +92,8 @@ #define GLUT_ALLOW_NEGATIVE_WINDOW_POSITION 0x0207 /* GLUT doesn't allow negative window positions by default */ +#define GLUT_WINDOW_SRGB 0x007D + /* * New tokens for glutInitDisplayMode. * Only one GLUT_AUXn bit may be used at a time. Modified: trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c =================================================================== --- trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c 2018-03-27 07:41:18 UTC (rev 1841) +++ trunk/freeglut/freeglut/src/mswin/fg_state_mswin.c 2018-04-02 03:16:50 UTC (rev 1842) @@ -46,8 +46,15 @@ * #include <GL/wglext.h> * So we copy the necessary parts out of it to support the multisampling query */ +#ifndef WGL_SAMPLES_ARB #define WGL_SAMPLES_ARB 0x2042 +#endif +#ifndef WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 +#endif +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); + #if defined(_WIN32_WCE) # include <Aygshell.h> # ifdef FREEGLUT_LIB_PRAGMAS @@ -284,6 +291,25 @@ #endif /* defined(_WIN32_WCE) */ return 0; + case GLUT_WINDOW_SRGB: + if( fgStructure.CurrentWindow != NULL ) { + static int attr = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB; + static PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribivARB; + HDC hdc = fgStructure.CurrentWindow->Window.pContext.Device; + int ipixfmt = GetPixelFormat(hdc); + int val; + + if(!wglGetPixelFormatAttribivARB) { + if(!(wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribivARB"))) { + return 0; + } + } + if(wglGetPixelFormatAttribivARB(hdc, ipixfmt, 0, 1, &attr, &val)) { + return val; + } + } + return 0; + default: fgWarning( "glutGet(): missing enum handle %d", eWhat ); break; Modified: trunk/freeglut/freeglut/src/x11/fg_state_x11_glx.c =================================================================== --- trunk/freeglut/freeglut/src/x11/fg_state_x11_glx.c 2018-03-27 07:41:18 UTC (rev 1841) +++ trunk/freeglut/freeglut/src/x11/fg_state_x11_glx.c 2018-04-02 03:16:50 UTC (rev 1842) @@ -83,6 +83,7 @@ GLX_QUERY( GLUT_WINDOW_ACCUM_BLUE_SIZE, GLX_ACCUM_BLUE_SIZE ); GLX_QUERY( GLUT_WINDOW_ACCUM_ALPHA_SIZE, GLX_ACCUM_ALPHA_SIZE ); GLX_QUERY( GLUT_WINDOW_STEREO, GLX_STEREO ); + GLX_QUERY( GLUT_WINDOW_SRGB, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); # undef GLX_QUERY Modified: trunk/freeglut/freeglut/src/x11/fg_window_x11.c =================================================================== --- trunk/freeglut/freeglut/src/x11/fg_window_x11.c 2018-03-27 07:41:18 UTC (rev 1841) +++ trunk/freeglut/freeglut/src/x11/fg_window_x11.c 2018-04-02 03:16:50 UTC (rev 1842) @@ -182,6 +182,8 @@ fgState.DisplayMode |= GLUT_DOUBLE ; fghChooseConfig(&WINDOW_CONFIG); fgState.DisplayMode &= ~GLUT_DOUBLE; + + if( WINDOW_CONFIG ) goto done_retry; } #endif @@ -190,8 +192,20 @@ fgState.DisplayMode &= ~GLUT_MULTISAMPLE ; fghChooseConfig(&WINDOW_CONFIG); fgState.DisplayMode |= GLUT_MULTISAMPLE; + + if( WINDOW_CONFIG ) goto done_retry; } + + if( fgState.DisplayMode & GLUT_SRGB ) + { + fgState.DisplayMode &= ~GLUT_SRGB ; + fghChooseConfig(&WINDOW_CONFIG); + fgState.DisplayMode |= GLUT_SRGB; + + if( WINDOW_CONFIG ) goto done_retry; + } } +done_retry: FREEGLUT_INTERNAL_ERROR_EXIT( WINDOW_CONFIG != NULL, "FBConfig with necessary capabilities not found", "fgOpenWindow" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jt...@us...> - 2022-03-07 05:57:39
|
Revision: 1875 http://sourceforge.net/p/freeglut/code/1875 Author: jtsiomb Date: 2022-03-07 05:57:37 +0000 (Mon, 07 Mar 2022) Log Message: ----------- Added GLUT_ACTIVE_SUPER modifier, and corresponding GLUT_KEY_SUPER_L and GLUT_KEY_SUPER_R special keys. These should map to Windows and Command keys on regular PC keyboards and apple keyboards respectively. Only implemented on X11 for now. Modified Paths: -------------- trunk/freeglut/freeglut/include/GL/freeglut_ext.h trunk/freeglut/freeglut/src/x11/fg_main_x11.c Modified: trunk/freeglut/freeglut/include/GL/freeglut_ext.h =================================================================== --- trunk/freeglut/freeglut/include/GL/freeglut_ext.h 2022-02-06 11:48:31 UTC (rev 1874) +++ trunk/freeglut/freeglut/include/GL/freeglut_ext.h 2022-03-07 05:57:37 UTC (rev 1875) @@ -44,8 +44,15 @@ #define GLUT_KEY_CTRL_R 0x0073 #define GLUT_KEY_ALT_L 0x0074 #define GLUT_KEY_ALT_R 0x0075 +#define GLUT_KEY_SUPER_L 0x0076 +#define GLUT_KEY_SUPER_R 0x0077 /* + * Additional GLUT modifiers + */ +#define GLUT_ACTIVE_SUPER 0x0008 + +/* * GLUT API Extension macro definitions -- behaviour when the user clicks on an "x" to close a window */ #define GLUT_ACTION_EXIT 0 Modified: trunk/freeglut/freeglut/src/x11/fg_main_x11.c =================================================================== --- trunk/freeglut/freeglut/src/x11/fg_main_x11.c 2022-02-06 11:48:31 UTC (rev 1874) +++ trunk/freeglut/freeglut/src/x11/fg_main_x11.c 2022-03-07 05:57:37 UTC (rev 1875) @@ -135,6 +135,8 @@ ret |= GLUT_ACTIVE_CTRL; if( state & Mod1Mask ) ret |= GLUT_ACTIVE_ALT; + if( state & Mod2Mask ) + ret |= GLUT_ACTIVE_SUPER; return ret; } @@ -1012,6 +1014,14 @@ case XK_Control_R: special = GLUT_KEY_CTRL_R; break; case XK_Alt_L: special = GLUT_KEY_ALT_L; break; case XK_Alt_R: special = GLUT_KEY_ALT_R; break; + case XK_Meta_L: + case XK_Super_L: + special = GLUT_KEY_SUPER_L; + break; + case XK_Meta_R: + case XK_Super_R: + special = GLUT_KEY_SUPER_R; + break; } /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jt...@us...> - 2022-03-08 01:11:40
|
Revision: 1876 http://sourceforge.net/p/freeglut/code/1876 Author: jtsiomb Date: 2022-03-08 01:11:38 +0000 (Tue, 08 Mar 2022) Log Message: ----------- Added keyboard demo, and changed the spaceball demo to also build on windows Modified Paths: -------------- trunk/freeglut/freeglut/CMakeLists.txt Added Paths: ----------- trunk/freeglut/freeglut/progs/demos/keyboard/ trunk/freeglut/freeglut/progs/demos/keyboard/keyboard.c Modified: trunk/freeglut/freeglut/CMakeLists.txt =================================================================== --- trunk/freeglut/freeglut/CMakeLists.txt 2022-03-07 05:57:37 UTC (rev 1875) +++ trunk/freeglut/freeglut/CMakeLists.txt 2022-03-08 01:11:38 UTC (rev 1876) @@ -567,14 +567,13 @@ progs/demos/shapes/glmatrix.h progs/demos/shapes/glmatrix.c) ADD_DEMO(smooth_opengl3 progs/demos/smooth_opengl3/smooth_opengl3.c) -IF(UNIX) - ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c - progs/demos/spaceball/vmath.c - progs/demos/spaceball/vmath.h) -ENDIF() +ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c + progs/demos/spaceball/vmath.c + progs/demos/spaceball/vmath.h) ADD_DEMO(subwin progs/demos/subwin/subwin.c) ADD_DEMO(timer progs/demos/timer/timer.c) ADD_DEMO(timer_callback progs/demos/timer_callback/timer.c) +ADD_DEMO(keyboard progs/demos/keyboard/keyboard.c) Added: trunk/freeglut/freeglut/progs/demos/keyboard/keyboard.c =================================================================== --- trunk/freeglut/freeglut/progs/demos/keyboard/keyboard.c (rev 0) +++ trunk/freeglut/freeglut/progs/demos/keyboard/keyboard.c 2022-03-08 01:11:38 UTC (rev 1876) @@ -0,0 +1,156 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <GL/freeglut.h> + +void display(void); +void draw_text(int x, int y, const char *str); +const char *skeyname(int skey); +void reshape(int x, int y); +void keypress(unsigned char key, int x, int y); +void keyrelease(unsigned char key, int x, int y); +void skeypress(int key, int x, int y); +void skeyrelease(int key, int x, int y); + +unsigned int modstate; +int cur_key = -1; +int cur_skey = -1; +int win_width, win_height; + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitWindowSize(400, 200); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); + glutCreateWindow("Keyboard demo"); + + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keypress); + glutKeyboardUpFunc(keyrelease); + glutSpecialFunc(skeypress); + glutSpecialUpFunc(skeyrelease); + + glutMainLoop(); + return 0; +} + +void display(void) +{ + char str[256]; + + glClear(GL_COLOR_BUFFER_BIT); + + strcpy(str, "Key:"); + if(cur_key > 0) { + if(isprint(cur_key)) { + sprintf(str + 4, " '%c'", cur_key); + } else { + sprintf(str + 4, " 0x%02x", cur_key); + } + + + if(modstate & GLUT_ACTIVE_SHIFT) { + strcat(str, " shift"); + } + if(modstate & GLUT_ACTIVE_CTRL) { + strcat(str, " ctrl"); + } + if(modstate & GLUT_ACTIVE_ALT) { + strcat(str, " alt"); + } + if(modstate & GLUT_ACTIVE_SUPER) { + strcat(str, " super"); + } + } + draw_text(win_width / 3, 2 * win_height / 3, str); + + strcpy(str, "Special key: "); + if(cur_skey > 0) { + strcat(str, skeyname(cur_skey)); + } + draw_text(win_width / 3, win_height / 3, str); + + glutSwapBuffers(); +} + +void draw_text(int x, int y, const char *str) +{ + glRasterPos2i(x, y); + while(*str) { + glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, *str++); + } +} + +const char *skeyname(int skey) +{ + static const char *fkeys[] = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12"}; + + switch(skey) { + case GLUT_KEY_LEFT: return "left"; + case GLUT_KEY_UP: return "up"; + case GLUT_KEY_RIGHT: return "right"; + case GLUT_KEY_DOWN: return "down"; + case GLUT_KEY_PAGE_UP: return "page up"; + case GLUT_KEY_PAGE_DOWN: return "page down"; + case GLUT_KEY_HOME: return "home"; + case GLUT_KEY_END: return "end"; + case GLUT_KEY_INSERT: return "insert"; + case GLUT_KEY_NUM_LOCK: return "num lock"; + case GLUT_KEY_BEGIN: return "begin"; + case GLUT_KEY_DELETE: return "delete"; + case GLUT_KEY_SHIFT_L: return "L Shift"; + case GLUT_KEY_SHIFT_R: return "R Shift"; + case GLUT_KEY_CTRL_L: return "L Ctrl"; + case GLUT_KEY_CTRL_R: return "R Ctrl"; + case GLUT_KEY_ALT_L: return "L Alt"; + case GLUT_KEY_ALT_R: return "R Alt"; + case GLUT_KEY_SUPER_L: return "L Super"; + case GLUT_KEY_SUPER_R: return "R Super"; + default: + if(skey >= GLUT_KEY_F1 && skey <= GLUT_KEY_F12) { + return fkeys[skey - GLUT_KEY_F1]; + } + + break; + } + return "<unknown>"; +} + +void reshape(int x, int y) +{ + win_width = x; + win_height = y; + glViewport(0, 0, x, y); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, x, 0, y, -1, 1); +} + +void keypress(unsigned char key, int x, int y) +{ + if(key == 27) exit(0); + + modstate = glutGetModifiers(); + cur_key = key; + glutPostRedisplay(); +} + +void keyrelease(unsigned char key, int x, int y) +{ + cur_key = -1; + glutPostRedisplay(); +} + +void skeypress(int key, int x, int y) +{ + cur_skey = key; + glutPostRedisplay(); +} + +void skeyrelease(int key, int x, int y) +{ + cur_skey = -1; + glutPostRedisplay(); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |