gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog backend/render_handler_ogl.cpp


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_ogl.cpp
Date: Wed, 12 Sep 2007 10:26:09 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Bastiaan Jacques <bjacques>     07/09/12 10:26:09

Modified files:
        .              : ChangeLog 
        backend        : render_handler_ogl.cpp 

Log message:
                * backend/render_handler_ogl.cpp: Add a debugging function
                called check_error(), enabled by toggling the DEBUG_OPENGL
                macro. Don't bother setting variables to their defaults.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4286&r2=1.4287
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_ogl.cpp?cvsroot=gnash&r1=1.79&r2=1.80

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4286
retrieving revision 1.4287
diff -u -b -r1.4286 -r1.4287
--- ChangeLog   12 Sep 2007 09:55:59 -0000      1.4286
+++ ChangeLog   12 Sep 2007 10:26:08 -0000      1.4287
@@ -1,3 +1,9 @@
+2007-09-12 Bastiaan Jacques <address@hidden
+
+       * backend/render_handler_ogl.cpp: Add a debugging function
+       called check_error(), enabled by toggling the DEBUG_OPENGL
+       macro. Don't bother setting variables to their defaults.
+
 2007-09-12 Benjamin Wolsey <address@hidden>
 
        * testsuite/MovieTester{cpp,h}: remove utf8 from keypress,

Index: backend/render_handler_ogl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_ogl.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -b -r1.79 -r1.80
--- backend/render_handler_ogl.cpp      11 Sep 2007 08:23:31 -0000      1.79
+++ backend/render_handler_ogl.cpp      12 Sep 2007 10:26:09 -0000      1.80
@@ -5,7 +5,7 @@
 
 // A render_handler that uses SDL & OpenGL
 
-/* $Id: render_handler_ogl.cpp,v 1.79 2007/09/11 08:23:31 bjacques Exp $ */
+/* $Id: render_handler_ogl.cpp,v 1.80 2007/09/12 10:26:09 bjacques Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -51,6 +51,8 @@
 // 3 = use image::resample(), slow software resampling
 #define RESAMPLE_METHOD 2
 
+#define DEBUG_OPENGL 0
+
 
 // bitmap_info_ogl declaration
 class bitmap_info_ogl : public gnash::bitmap_info
@@ -74,6 +76,20 @@
 
 // static GLint iquad[] = {-1, 1, 1, 1, 1, -1, -1, -1};
 
+#ifdef DEBUG_OPENGL
+static void check_error()
+{
+    GLenum error = glGetError();
+
+    while (error != GL_NO_ERROR) {
+      
+      std::cerr << "OpenGL error: " << (const char*) gluErrorString(error)
+                << std::endl;
+      error = glGetError();
+    }
+}
+#endif // DEBUG_OPENGL
+
 class render_handler_ogl : public gnash::triangulating_render_handler
 {
 public:
@@ -462,7 +478,7 @@
        }
 
     void       begin_display(
-       const gnash::rgba& background_color,
+       const gnash::rgba& bg_color,
        int viewport_x0, int viewport_y0,
        int viewport_width, int viewport_height,
        float x0, float x1, float y0, float y1)
@@ -477,26 +493,19 @@
            glPushMatrix();
            glOrtho(x0, x1, y0, y1, -1, 1);
 
-           glEnable(GL_BLEND);
-           glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-           glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);        
// GL_MODULATE
-
-           glDisable(GL_TEXTURE_2D);
-
            // Clear the background, if background color has alpha > 0.
-           if (background_color.m_a > 0)
+           if (bg_color.m_a > 0)
                {
-                   // Draw a big quad.
-                   apply_color(background_color);
-                   glBegin(GL_QUADS);
-                   glVertex2f(x0, y0);
-                   glVertex2f(x1, y0);
-                   glVertex2f(x1, y1);
-                   glVertex2f(x0, y1);
-                   glEnd();
+               // Setup the clearing color.
+               glClearColor(bg_color.m_r / 255, bg_color.m_g / 255, 
bg_color.m_b / 255, 
+                            bg_color.m_a / 255);
+               glClear(GL_COLOR_BUFFER_BIT);
                }
 
+#ifdef DEBUG_OPENGL
+           check_error();
+#endif
+
            // Markus: Implement anti-aliasing here...
 #if 0
 /*
@@ -563,7 +572,11 @@
        // Clean up after rendering a frame.  Client program is still
        // responsible for calling glSwapBuffers() or whatever.
        {
-//         GNASH_REPORT_FUNCTION;
+//         GNASH_REPORT_FUNCTION
+
+#ifdef DEBUG_OPENGL
+           check_error();
+#endif // DEBUG_OPENGL
            
            glPopMatrix();
        }
@@ -1341,7 +1354,9 @@
 #endif
         
         glMatrixMode(GL_PROJECTION);
+       // Flip the image
         glOrtho(-OVERSIZE, OVERSIZE, OVERSIZE, -OVERSIZE, -1, 1);
+       // Restore the matrix mode to the default.
         glMatrixMode(GL_MODELVIEW);
         glLoadIdentity();
         




reply via email to

[Prev in Thread] Current Thread [Next in Thread]