X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscreen%2FTestRenderTexture.cpp;h=1e17c3dd12387ef875bd2484a489eb525dfba2c4;hb=5e542aa841b9bd661123e4eb6a2355a8a828084a;hp=2aa2e09f574adbc8a214fe5c52d629bfd3c724ef;hpb=c7cbb22667c901e6107dd099e02e9506f9fbd360;p=simgear.git diff --git a/simgear/screen/TestRenderTexture.cpp b/simgear/screen/TestRenderTexture.cpp index 2aa2e09f..1e17c3dd 100644 --- a/simgear/screen/TestRenderTexture.cpp +++ b/simgear/screen/TestRenderTexture.cpp @@ -17,6 +17,7 @@ # include #endif +#include #include #include @@ -24,6 +25,23 @@ #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); GLuint iTextureProgram = 0; @@ -60,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; @@ -92,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 @@ -203,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; @@ -338,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; }