X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscreen%2FTestRenderTexture.cpp;h=615c22917bcc19441a9343a203506b4141cc46a6;hb=f19e83dcf10d5fced3d799c884a4654d7ada6548;hp=2c7fc236d2022680fc90781a615bcd0e75f26b96;hpb=8f46f2cac8adaaef514e520cc688533b83a78ffe;p=simgear.git diff --git a/simgear/screen/TestRenderTexture.cpp b/simgear/screen/TestRenderTexture.cpp index 2c7fc236..615c2291 100644 --- a/simgear/screen/TestRenderTexture.cpp +++ b/simgear/screen/TestRenderTexture.cpp @@ -9,8 +9,15 @@ #include -#include SG_GL_H -#include SG_GLUT_H +#include + +#ifdef __APPLE__ +# include +#else +# include +#endif + +#include #include #include @@ -18,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; @@ -54,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; @@ -86,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 @@ -197,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; @@ -332,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; }