# include <GL/glut.h>
#endif
+#include <simgear/debug/logstream.hxx>
#include <simgear/screen/extensions.hxx>
#include <simgear/screen/RenderTexture.h>
#include <stdio.h>
#include <stdlib.h>
+// 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;
// Function : PrintGLerror
// Description :
//---------------------------------------------------------------------------
-void PrintGLerror( char *msg )
+void PrintGLerror( const char *msg )
{
GLenum errCode;
const GLubyte *errStr;
{
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
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;
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;
}