Revision: 15033
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15033
Author:   mxcurioni
Date:     2008-05-28 23:19:56 +0200 (Wed, 28 May 2008)

Log Message:
-----------
soc-2008-mxcurioni: corrected GLStrokeRender::preparePaper function for paper 
texture loading. The canvas view now has its frame properly initialized to 
fixed dimensions. When the Freestyle render is executed, the render is 
displayed for a fraction of a second and is then erased by a standard gray 
background. I have to analyze what command I need to call to keep the result on 
display.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript     
2008-05-28 21:15:40 UTC (rev 15032)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/SConscript     
2008-05-28 21:19:56 UTC (rev 15033)
@@ -55,14 +55,10 @@
 prefix = 'intern/app_blender'
 app_sources = env.Glob(prefix + '/*.cpp')
 
-#      swig wrapper
-#prefix = 'intern/swig'
-#swig_sources = env.Glob(prefix + '/*.cpp')
-swig_sources = []
 
 sources =      system_sources + image_sources + geometry_sources + 
scene_graph_sources \
                  +     winged_edge_sources + view_map_sources + stroke_sources 
+ rendering_sources \
-                 + app_sources + swig_sources
+                 + app_sources
 
 env.BlenderLib (libname="bf_freestyle",
                                sources=sources,

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp
       2008-05-28 21:15:40 UTC (rev 15032)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp
       2008-05-28 21:19:56 UTC (rev 15033)
@@ -214,7 +214,7 @@
 //  char number[10];
 //
   _pViewer->updateGL();
-  _pViewer->swapBuffers();
+  //_pViewer->swapBuffers();
   //QImage fb = _pViewer->grabFrameBuffer();
   //  sprintf(number, "%3d", counter);
   //  strcat(fileName, number);

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.cpp
     2008-05-28 21:15:40 UTC (rev 15032)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.cpp
     2008-05-28 21:19:56 UTC (rev 15033)
@@ -618,22 +618,13 @@
 // COPIED FROM LIBQGLVIEWER
 //*******************************
 
-       // inherited 
-       void AppGLWidget::swapBuffers() {}
-       
+       // inherited    
        //Updates the display. Do not call draw() directly, use this method 
instead. 
        void AppGLWidget::updateGL() {}
 
        //Makes this widget's rendering context the current OpenGL rendering 
context. Useful with several viewers
-       void AppGLWidget::makeCurrent() {}
+       void AppGLWidget::makeCurrent() { }
 
-
        // not-inherited
-
-       //      Convenient way to call setSceneCenter() and setSceneRadius() 
from a (world axis aligned) bounding box of the scene.
-       void AppGLWidget::setSceneBoundingBox(const Vec& min, const Vec& max) { 
_camera->setSceneBoundingBox(min,max); }
-               
-       void AppGLWidget::saveSnapshot(bool b) {}
-
         void AppGLWidget::setStateFileName(const string& name) { 
stateFileName_ = name; };
-
+       void AppGLWidget::saveSnapshot(bool b) {}

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h
       2008-05-28 21:15:40 UTC (rev 15032)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h
       2008-05-28 21:19:56 UTC (rev 15033)
@@ -47,6 +47,7 @@
 # include "../rendering/GLDebugRenderer.h"
 //# include <QGLViewer/qglviewer.h>
 
+
 //soc
 #include "AppGLWidget_camera.h"
 #include "AppGLWidget_vec.h"
@@ -76,14 +77,15 @@
 public:
 
        //inherited
-               inline real width() { return _width; }
-               inline real height() { return _height; }
-               void swapBuffers();
+               inline unsigned int width() { return _width; }
+               inline unsigned int height() { return _height; }
+               inline void setWidth( unsigned int width ) { _width = width; }
+               inline void setHeight( unsigned int height ) { _height = 
height; }
+               
                void updateGL();
                void makeCurrent();
        
        // not-inherited
-               void setSceneBoundingBox(const Vec& min, const Vec& max);
                void saveSnapshot(bool b);
                void setStateFileName(const string& name);
        
@@ -91,7 +93,7 @@
                Camera * _camera;
 
 protected:
-       real _width, _height;
+       unsigned int _width, _height;
        Vec _min,_max;
        string stateFileName_;
 
@@ -306,7 +308,7 @@
        Vec max_(_ModelRootNode->bbox().getMax()[0],
                        _ModelRootNode->bbox().getMax()[1],
                        _ModelRootNode->bbox().getMax()[2]);
-    setSceneBoundingBox(min_, max_);
+    _camera->setSceneBoundingBox(min_, max_);
     _camera->showEntireScene();
   }
   

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp 
    2008-05-28 21:15:40 UTC (rev 15032)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp 
    2008-05-28 21:19:56 UTC (rev 15033)
@@ -20,7 +20,9 @@
                AppGLWidget *view = new AppGLWidget;
                
                c->SetView(view);
-       
+               view->setWidth(640);
+               view->setHeight(640);
+               
                c->Load3DSFile( TEST_3DS_FILE );
                
                c->InsertStyleModule( 0, TEST_STYLE_MODULE_FILE );

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp
  2008-05-28 21:15:40 UTC (rev 15032)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp
  2008-05-28 21:19:56 UTC (rev 15033)
@@ -368,11 +368,13 @@
        BLI_splitdirstring(name, filename);
 
 //soc  if (qim.isNull()) 
-       if( qim )
+  if (!qim) //soc 
     {
       cerr << "  Error: unable to read \"" << filename << "\"" << endl;
+       IMB_freeImBuf(qim);
       return false;
     }
+
   if( qim->depth > 8) //soc
     {
       cerr<<"  Error: \""<< filename <<"\" has "<< qim->depth <<" 
bits/pixel"<<endl; //soc
@@ -416,9 +418,10 @@
        char filename[FILE_MAXFILE];
        BLI_splitdirstring(name, filename);
        
-  if (!qim) //soc
+  if (!qim) //soc 
     {
       cerr << "  Error: unable to read \"" << filename << "\"" << endl;
+       IMB_freeImBuf(qim);
       return false;
     }
   if (qim->depth > 8) //soc
@@ -463,11 +466,13 @@
        char filename[FILE_MAXFILE];
        BLI_splitdirstring(name, filename);
 
-  if (!qim) //soc
+  if (!qim) //soc 
     {
       cerr << "  Error: unable to read \"" << filename << "\"" << endl;
+       IMB_freeImBuf(qim);
       return false;
     }
+
   if (qim->depth > 8) //soc
     {
       cerr<<"  Error: \""<<filename<<"\" has "<< qim->depth <<" 
bits/pixel"<<endl; //soc
@@ -508,19 +513,24 @@
        ImBuf *qim = IMB_loadiffname(name, 0);
        char filename[FILE_MAXFILE];
        BLI_splitdirstring((char *)name, filename);
+       qim->depth = 32;
 
   if (!qim) //soc 
     {
       cerr << "  Error: unable to read \"" << filename << "\"" << endl;
+       IMB_freeImBuf(qim);
       return false;
     }
 
-  if (qim->depth !=32) //soc
-    {
-      cerr<<"  Error: \""<<filename<<"\" has "<<qim->depth<<" 
bits/pixel"<<endl; //soc
-      return false;
-    }
-  //soc QImage qim2=QGLWidget::convertToGLFormat( qim );
+       //soc: no test because IMB_loadiffname creates 32 bit image directly
+       //
+       //   if (qim->depth != 32) 
+       //     {
+       //       cerr<<"  Error: \""<<filename<<"\" has "<< qim->depth <<" 
bits/pixel"<<endl; //soc
+       // IMB_freeImBuf(qim);
+       //       return false;
+       //     }
+       // QImage qim2=QGLWidget::convertToGLFormat( qim );
 
   glBindTexture(GL_TEXTURE_2D, itexname);
        
@@ -532,10 +542,10 @@
                  GL_LINEAR);     
 
   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, qim->x, qim->y, 0, 
-              GL_RGBA, GL_UNSIGNED_BYTE, qim->rect);   //soc: here qim->rect, 
not qim2->rect, used
+              GL_RGBA, GL_UNSIGNED_BYTE, qim->rect); // soc: was qim2
 
   //cout << "  \"" << filename.toAscii().data() << "\" loaded with "<< 
qim.depth() << " bits per pixel" << endl;
-       cout << "  \"" << StringUtils::toAscii(filename) << "\" loaded with "<< 
qim->depth << " bits per pixel" << endl;
+       cout << "  \"" << StringUtils::toAscii(filename) << "\" loaded with 32 
bits per pixel" << endl;
   return true;
 }
 


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to