From: ehofman Date: Tue, 8 Dec 2009 09:48:00 +0000 (+0000) Subject: John Denker: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dea145b9210f67239fa887d013faf341e276c849;p=flightgear.git John Denker: Suggestion: It might be helpful to promote each of the .c files to .cxx. Rationale: -- The configure/makefile system handles CFLAGS differently from CXXFLAGS. -- It is important for the *info programs to compiled and run in exactly the same environment as the main fgfs program. Some users depend on compiler or linker flags such as rpath that strongly affect the results of the *info programs. -- There is no downside; you code compiles just fine as-is under the c++ compiler. timoore split the original patch so that alcinfo.cxx can be commited to the ehofman/sound branch seperately. --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 46db97225..c3e2dc570 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,10 +8,10 @@ else test_up_PLIB_LIBS = -lplibsg -lplibul endif -est_epsilon_SOURCES = est-epsilon.c +est_epsilon_SOURCES = est-epsilon.cxx est_epsilon_LDADD = $(opengl_LIBS) -gl_info_SOURCES = gl-info.c +gl_info_SOURCES = gl-info.cxx gl_info_LDADD = $(opengl_LIBS) al_info_SOURCES = al-info.c diff --git a/tests/est-epsilon.c b/tests/est-epsilon.c deleted file mode 100644 index 5ff0a8aca..000000000 --- a/tests/est-epsilon.c +++ /dev/null @@ -1,34 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef HAVE_WINDOWS_H -# include -#endif - -#include - -#include -#if defined( __APPLE__) -# include -#else -# include -#endif - -int main() { - GLfloat a, t; - - a = 1.0; - - do { - printf("a = %.10f\n", a); - a = a / 2.0; - t = 1.0 + a; - } while ( t > 1.0 ); - - a = a + a; - - printf("Estimated GLfloat epsilon = %.10f\n", a); - - return(0); -} diff --git a/tests/est-epsilon.cxx b/tests/est-epsilon.cxx new file mode 100644 index 000000000..5ff0a8aca --- /dev/null +++ b/tests/est-epsilon.cxx @@ -0,0 +1,34 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include + +#include +#if defined( __APPLE__) +# include +#else +# include +#endif + +int main() { + GLfloat a, t; + + a = 1.0; + + do { + printf("a = %.10f\n", a); + a = a / 2.0; + t = 1.0 + a; + } while ( t > 1.0 ); + + a = a + a; + + printf("Estimated GLfloat epsilon = %.10f\n", a); + + return(0); +} diff --git a/tests/gl-info.c b/tests/gl-info.c deleted file mode 100644 index 7d5be7d37..000000000 --- a/tests/gl-info.c +++ /dev/null @@ -1,123 +0,0 @@ -/* -From: Steve Baker -Sender: root@fatcity.com -To: OPENGL-GAMEDEV-L -Subject: Re: Win32 OpenGL Resource Page -Date: Fri, 24 Apr 1998 07:33:51 -0800 -*/ - - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef HAVE_WINDOWS_H -# include -#endif - -#include -#include - -#include -#if defined( __APPLE__) -# include -# include -#else -# include -# ifdef HAVE_GLUT_H -# include -# endif -#endif - - -void getPrints ( GLenum token, char *string ) -{ - printf ( "%s = \"%s\"\n", string, glGetString ( token ) ) ; -} - -void getPrint2f ( GLenum token, char *string ) -{ - GLfloat f[2] ; - glGetFloatv ( token, f ) ; - printf ( "%s = %g,%g\n", string, f[0],f[1] ) ; -} - -void getPrintf ( GLenum token, char *string ) -{ - GLfloat f ; - glGetFloatv ( token, &f ) ; - printf ( "%s = %g\n", string, f ) ; -} - -void getPrint2i ( GLenum token, char *string ) -{ - GLint i[2] ; - glGetIntegerv ( token, i ) ; - printf ( "%s = %d,%d\n", string, i[0],i[1] ) ; -} - -void getPrinti ( GLenum token, char *string ) -{ - GLint i ; - glGetIntegerv ( token, &i ) ; - printf ( "%s = %d\n", string, i ) ; -} - -int main ( int argc, char **argv ) -{ -#ifdef HAVE_GLUT_H - glutInit ( &argc, argv ) ; - glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ; - glutCreateWindow ( "You should never see this window!" ) ; - - getPrints ( GL_VENDOR , "GL_VENDOR" ) ; - getPrints ( GL_RENDERER , "GL_RENDERER" ) ; - getPrints ( GL_VERSION , "GL_VERSION" ) ; - getPrints ( GL_EXTENSIONS , "GL_EXTENSIONS" ) ; - - getPrinti ( GL_RED_BITS , "GL_RED_BITS" ) ; - getPrinti ( GL_GREEN_BITS , "GL_GREEN_BITS" ) ; - getPrinti ( GL_BLUE_BITS , "GL_BLUE_BITS" ) ; - getPrinti ( GL_ALPHA_BITS , "GL_ALPHA_BITS" ) ; - getPrinti ( GL_DEPTH_BITS , "GL_DEPTH_BITS" ) ; - getPrinti ( GL_INDEX_BITS , "GL_INDEX_BITS" ) ; - getPrinti ( GL_STENCIL_BITS, "GL_STENCIL_BITS" ) ; - - getPrinti ( GL_ACCUM_RED_BITS , "GL_ACCUM_RED_BITS" ) ; - getPrinti ( GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS" ) ; - getPrinti ( GL_ACCUM_BLUE_BITS , "GL_ACCUM_BLUE_BITS" ) ; - getPrinti ( GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS" ) ; - - getPrinti ( GL_AUX_BUFFERS, "GL_AUX_BUFFERS" ) ; - - getPrinti ( GL_MAX_ATTRIB_STACK_DEPTH , "GL_MAX_ATTRIB_STACK_DEPTH" ) ; - getPrinti ( GL_MAX_NAME_STACK_DEPTH , "GL_MAX_NAME_STACK_DEPTH" ) ; - getPrinti ( GL_MAX_TEXTURE_STACK_DEPTH , "GL_MAX_TEXTURE_STACK_DEPTH" ) ; - getPrinti ( GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH" ) ; - getPrinti ( GL_MAX_MODELVIEW_STACK_DEPTH , "GL_MAX_MODELVIEW_STACK_DEPTH" ) ; - - getPrinti ( GL_MAX_CLIP_PLANES , "GL_MAX_CLIP_PLANES" ) ; - getPrinti ( GL_MAX_EVAL_ORDER , "GL_MAX_EVAL_ORDER" ) ; - getPrinti ( GL_MAX_LIGHTS , "GL_MAX_LIGHTS" ) ; - getPrinti ( GL_MAX_LIST_NESTING , "GL_MAX_LIST_NESTING" ) ; - getPrinti ( GL_MAX_TEXTURE_SIZE , "GL_MAX_TEXTURE_SIZE" ) ; - getPrint2i( GL_MAX_VIEWPORT_DIMS , "GL_MAX_VIEWPORT_DIMS" ) ; - - getPrintf ( GL_POINT_SIZE_GRANULARITY, "GL_POINT_SIZE_GRANULARITY" ) ; - getPrint2f( GL_POINT_SIZE_RANGE , "GL_POINT_SIZE_RANGE" ) ; - - printf("Default values:\n\n"); - - getPrinti( GL_UNPACK_ALIGNMENT , "GL_UNPACK_ALIGNMENT" ) ; - getPrinti( GL_UNPACK_ROW_LENGTH , "GL_UNPACK_ROW_LENGTH" ) ; - getPrinti( GL_UNPACK_SKIP_PIXELS , "GL_UNPACK_SKIP_PIXELS" ) ; - getPrinti( GL_UNPACK_SKIP_ROWS , "GL_UNPACK_SKIP_ROWS" ) ; - getPrinti( GL_BLEND_SRC , "GL_BLEND_SRC" ) ; - getPrinti( GL_BLEND_DST , "GL_BLEND_DST" ) ; -#else - - printf("GL Utility Toolkit (glut) was not found on this system.\n"); -#endif - - return 0 ; -} diff --git a/tests/gl-info.cxx b/tests/gl-info.cxx new file mode 100644 index 000000000..7d5be7d37 --- /dev/null +++ b/tests/gl-info.cxx @@ -0,0 +1,123 @@ +/* +From: Steve Baker +Sender: root@fatcity.com +To: OPENGL-GAMEDEV-L +Subject: Re: Win32 OpenGL Resource Page +Date: Fri, 24 Apr 1998 07:33:51 -0800 +*/ + + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include +#include + +#include +#if defined( __APPLE__) +# include +# include +#else +# include +# ifdef HAVE_GLUT_H +# include +# endif +#endif + + +void getPrints ( GLenum token, char *string ) +{ + printf ( "%s = \"%s\"\n", string, glGetString ( token ) ) ; +} + +void getPrint2f ( GLenum token, char *string ) +{ + GLfloat f[2] ; + glGetFloatv ( token, f ) ; + printf ( "%s = %g,%g\n", string, f[0],f[1] ) ; +} + +void getPrintf ( GLenum token, char *string ) +{ + GLfloat f ; + glGetFloatv ( token, &f ) ; + printf ( "%s = %g\n", string, f ) ; +} + +void getPrint2i ( GLenum token, char *string ) +{ + GLint i[2] ; + glGetIntegerv ( token, i ) ; + printf ( "%s = %d,%d\n", string, i[0],i[1] ) ; +} + +void getPrinti ( GLenum token, char *string ) +{ + GLint i ; + glGetIntegerv ( token, &i ) ; + printf ( "%s = %d\n", string, i ) ; +} + +int main ( int argc, char **argv ) +{ +#ifdef HAVE_GLUT_H + glutInit ( &argc, argv ) ; + glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ; + glutCreateWindow ( "You should never see this window!" ) ; + + getPrints ( GL_VENDOR , "GL_VENDOR" ) ; + getPrints ( GL_RENDERER , "GL_RENDERER" ) ; + getPrints ( GL_VERSION , "GL_VERSION" ) ; + getPrints ( GL_EXTENSIONS , "GL_EXTENSIONS" ) ; + + getPrinti ( GL_RED_BITS , "GL_RED_BITS" ) ; + getPrinti ( GL_GREEN_BITS , "GL_GREEN_BITS" ) ; + getPrinti ( GL_BLUE_BITS , "GL_BLUE_BITS" ) ; + getPrinti ( GL_ALPHA_BITS , "GL_ALPHA_BITS" ) ; + getPrinti ( GL_DEPTH_BITS , "GL_DEPTH_BITS" ) ; + getPrinti ( GL_INDEX_BITS , "GL_INDEX_BITS" ) ; + getPrinti ( GL_STENCIL_BITS, "GL_STENCIL_BITS" ) ; + + getPrinti ( GL_ACCUM_RED_BITS , "GL_ACCUM_RED_BITS" ) ; + getPrinti ( GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS" ) ; + getPrinti ( GL_ACCUM_BLUE_BITS , "GL_ACCUM_BLUE_BITS" ) ; + getPrinti ( GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS" ) ; + + getPrinti ( GL_AUX_BUFFERS, "GL_AUX_BUFFERS" ) ; + + getPrinti ( GL_MAX_ATTRIB_STACK_DEPTH , "GL_MAX_ATTRIB_STACK_DEPTH" ) ; + getPrinti ( GL_MAX_NAME_STACK_DEPTH , "GL_MAX_NAME_STACK_DEPTH" ) ; + getPrinti ( GL_MAX_TEXTURE_STACK_DEPTH , "GL_MAX_TEXTURE_STACK_DEPTH" ) ; + getPrinti ( GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH" ) ; + getPrinti ( GL_MAX_MODELVIEW_STACK_DEPTH , "GL_MAX_MODELVIEW_STACK_DEPTH" ) ; + + getPrinti ( GL_MAX_CLIP_PLANES , "GL_MAX_CLIP_PLANES" ) ; + getPrinti ( GL_MAX_EVAL_ORDER , "GL_MAX_EVAL_ORDER" ) ; + getPrinti ( GL_MAX_LIGHTS , "GL_MAX_LIGHTS" ) ; + getPrinti ( GL_MAX_LIST_NESTING , "GL_MAX_LIST_NESTING" ) ; + getPrinti ( GL_MAX_TEXTURE_SIZE , "GL_MAX_TEXTURE_SIZE" ) ; + getPrint2i( GL_MAX_VIEWPORT_DIMS , "GL_MAX_VIEWPORT_DIMS" ) ; + + getPrintf ( GL_POINT_SIZE_GRANULARITY, "GL_POINT_SIZE_GRANULARITY" ) ; + getPrint2f( GL_POINT_SIZE_RANGE , "GL_POINT_SIZE_RANGE" ) ; + + printf("Default values:\n\n"); + + getPrinti( GL_UNPACK_ALIGNMENT , "GL_UNPACK_ALIGNMENT" ) ; + getPrinti( GL_UNPACK_ROW_LENGTH , "GL_UNPACK_ROW_LENGTH" ) ; + getPrinti( GL_UNPACK_SKIP_PIXELS , "GL_UNPACK_SKIP_PIXELS" ) ; + getPrinti( GL_UNPACK_SKIP_ROWS , "GL_UNPACK_SKIP_ROWS" ) ; + getPrinti( GL_BLEND_SRC , "GL_BLEND_SRC" ) ; + getPrinti( GL_BLEND_DST , "GL_BLEND_DST" ) ; +#else + + printf("GL Utility Toolkit (glut) was not found on this system.\n"); +#endif + + return 0 ; +}