diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-05-29 01:19:56 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-05-29 01:19:56 +0400 |
commit | 9986b5cd736a493026c9580a49bbf030cd1fa4be (patch) | |
tree | 6e6e3d36059cd890805fce1f7afbb743f3dfc5e0 /source/blender/freestyle/intern/rendering | |
parent | 58066fd0af30388a6bf29fa897fb0300b37c5c7b (diff) |
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.
Diffstat (limited to 'source/blender/freestyle/intern/rendering')
-rwxr-xr-x | source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp b/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp index c29ba759139..94518cee58f 100755 --- a/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/rendering/GLStrokeRenderer.cpp @@ -368,11 +368,13 @@ GLTextureManager::prepareTextureAlpha (string sname, GLuint itexname) 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 @@ GLTextureManager::prepareTextureLuminance (string sname, GLuint itexname) 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 @@ GLTextureManager::prepareTextureLuminanceAndAlpha (string sname, GLuint itexname 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 @@ GLTextureManager::preparePaper (const char *name, GLuint itexname) 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 @@ GLTextureManager::preparePaper (const char *name, GLuint itexname) 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; } |