]> git.mxchange.org Git - simgear.git/blobdiff - simgear/screen/TestRenderTexture.cpp
Add a new node "float-property" to be used in float comparision in effect predicates
[simgear.git] / simgear / screen / TestRenderTexture.cpp
index 2c7fc236d2022680fc90781a615bcd0e75f26b96..615c22917bcc19441a9343a203506b4141cc46a6 100644 (file)
@@ -9,8 +9,15 @@
 
 #include <simgear/compiler.h>
 
-#include SG_GL_H
-#include SG_GLUT_H
+#include <osg/GL>
+
+#ifdef __APPLE__
+#  include <GLUT/glut.h>
+#else
+#  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;
@@ -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;
 }