X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscreen%2FTestRenderTexture.cpp;h=615c22917bcc19441a9343a203506b4141cc46a6;hb=f19e83dcf10d5fced3d799c884a4654d7ada6548;hp=490e41e93a4bb8f53675739b411204d7d7620054;hpb=f0c35fde6dc76be5820e1754d4966d7d9b75feef;p=simgear.git diff --git a/simgear/screen/TestRenderTexture.cpp b/simgear/screen/TestRenderTexture.cpp index 490e41e9..615c2291 100644 --- a/simgear/screen/TestRenderTexture.cpp +++ b/simgear/screen/TestRenderTexture.cpp @@ -9,13 +9,38 @@ #include -#include SG_GL_H -#include SG_GLUT_H +#include + +#ifdef __APPLE__ +# include +#else +# include +#endif + +#include #include #include #include #include +#include + +// DEBUG - add a lot of noise +//#ifndef _DEBUG +//#define _DEBUG +//#endif + +#if defined (_DEBUG) +const char * get_attr_name( int val, int * pdef ); +#define dbg_printf printf +#else +#if defined (__GNUC__) +#define dbg_printf(format,args...) ((void)0) +#else // defined (__GNUC__) +#define dbg_printf +#endif // defined (__GNUC__) +#endif // defined (_DEBUG) + void Reshape(int w, int h); @@ -53,7 +78,7 @@ static int g_currentString = 0; // Function : PrintGLerror // Description : //--------------------------------------------------------------------------- -void PrintGLerror( char *msg ) +void PrintGLerror( const char *msg ) { GLenum errCode; const GLubyte *errStr; @@ -85,6 +110,10 @@ RenderTexture* CreateRenderTexture(const char *initstr) { fprintf(stderr, "RenderTexture Initialization failed!\n"); } + else + { + printf("RenderTexture Initialization done.\n"); + } // for shadow mapping we still have to bind it and set the correct // texture parameters using the SGI_shadow or ARB_shadow extension @@ -196,7 +225,8 @@ void Keyboard(unsigned char key, int x, int y) bShowDepthTexture = !bShowDepthTexture; break; case 13: - ++g_currentString%=g_numModeTestStrings; + ++g_currentString %= g_numModeTestStrings; + dbg_printf("Changed to #%d = [%s]\n", g_currentString, g_modeTestStrings[g_currentString]); DestroyRenderTexture(rt); rt = CreateRenderTexture(g_modeTestStrings[g_currentString]); break; @@ -331,11 +361,18 @@ int main(int argc, char *argv[]) rt = CreateRenderTexture(g_modeTestStrings[g_currentString]); + if (rt->IsInitialized() && rt->BeginCapture()) { + rt->EndCapture(); + dbg_printf("Torus should also be shown.\n"); + } else { + dbg_printf("No Torus init = %s\n", (rt->IsInitialized() ? "ok" : "NOT INITIALISED")); + } + printf("Press Enter to change RenderTexture parameters.\n" "Press 'r' to toggle the rectangle's motion.\n" "Press 't' to toggle the torus' motion.\n"); - + glutMainLoop(); return 0; }