tpaviot / oce

OpenCASCADE Community Edition (OCE): a community driven fork of the Open CASCADE library.
http://groups.google.com/group/oce-dev
GNU Lesser General Public License v2.1
808 stars 284 forks source link

Error: no image library available ( freeimage ) #744

Closed grotius-cnc closed 2 years ago

grotius-cnc commented 2 years ago

Hi,

I have problem's previewing a simple picture in the opencascade screen. I am sure my opencascade code implementation is correct. Have tried different implemenations but all output is the same.

There is no library found, i guess a png lib? I installed freetype from source and did a make install, but error still remains the same.

The terminal output : Error: no image library available

I have occt 7.5 installed on linux debian 11.

Do you have a idea what this could be?

grotius-cnc commented 2 years ago

Hi,

I solved this. Somehow it isn't using the freeimage options when doing a cmake ..

After $ mkdir build && cd build && cmake .. open /build/CMakeCache.txt line 1078, USE_FREEIMAGE:BOOL=ON $ cmake ..

Code for testing that worked ok

        Standard_Integer aWidth=500,aHeight = 500;
        BRepBuilderAPI_MakeFace aFace(gp_Pln(gp_Pnt(0,0,0),gp_Dir(0,0,1)),0,Standard_Real(aWidth),0,Standard_Real(aHeight));
        AIS_TexturedShape *aTextShape=new AIS_TexturedShape(aFace.Shape());
        aTextShape->SetTextureFileName("/home/user/Desktop/Qt-Graphics_Widget/libwallpaper/LinuxCNC-Wallpaper.png");
       // aTextShape->SetTextureFileName(Graphic3d_NOT_2D_GRASS); // enum Graphic3d_NameOfTexture2D
        aTextShape->SetTextureMapOn();
        aTextShape->SetDisplayMode(3);
        m_context->Display(aTextShape,Standard_False);

Or

      // https://sourceforge.net/projects/freeimage/
        Standard_CString FileName("/home/user/Desktop/Qt-Graphics_Widget/libwallpaper/LinuxCNC-Wallpaper.png");
        Aspect_FillMethod FillStyle(Aspect_FM_STRETCH);//Aspect_FM_STRETCH
        Standard_Boolean update(Standard_True);
        m_view->SetBackgroundImage(FileName, FillStyle, update) ;

Possible dependencies:

sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libx11-dev libgl1-mesa-dev libfreeimage-dev rapidjson-dev
sudo apt-get install libfreeimage3 libfreeimage-dev ffmpeg
grotius-cnc commented 2 years ago

By another attempt, i did : cmake .. -D USE_FREEIMAGE:BOOL=ON