Tue, 10/09/2012 - 20:26
Hello,
I'm trying to start using OCC for my QT projects.
I download and rebuild OCC 6.5.3 under Win7 x64 and VS2010, all was fine, then compile and run MFC samples, they build and run fine too.
Now trying to create a simple QT project under VS2010, when I creating WNT_GraphicDevice object code is work:
Handle_WNT_GraphicDevice myGraphicDevice = new WNT_GraphicDevice();
// create the Viewer
TCollection_ExtendedString Name("Viewer 2D");
TCollection_AsciiString Domain("My Domain");
my2DViewer = new V2d_Viewer(myGraphicDevice, Name.ToExtString(), Domain.ToCString());
// set default values for grids
my2DViewer->SetCircularGridValues(0,0,10,8,0);
my2DViewer->SetRectangularGridValues(0,0,10,10,0);
//
myAISInteractiveContext2D = new AIS2D_InteractiveContext(my2DViewer);
but when I create Graphic3d_WNTGraphicDevice object, programm is crashing on NEW operator
Handle_Graphic3d_WNTGraphicDevice myGraphicDevice3D = new Graphic3d_WNTGraphicDevice();
file new.cpp
void *__CRTDECL operator new(size_t size) _THROW1(_STD bad_alloc)
{ // try to allocate size bytes
void *p;
>>>>>> while ((p = malloc(size)) == 0)
if (_callnewh(size) == 0)
{ // report no memory
static const std::bad_alloc nomem;
_RAISE(nomem);
}
return (p);
}
why MFC samples work fine? where is error? how to configure QT project?
where I can find any tutorials for using OCC??
it's big and hard to learn.. =((
Wed, 10/10/2012 - 07:29
Try this:
static Handle(Graphic3d_GraphicDevice) defaultdevice;
if( defaultdevice.IsNull() )
defaultdevice = new Graphic3d_GraphicDevice( aDisplay );
return new V3d_Viewer(defaultdevice,aName,aDomain,ViewSize,ViewProj, Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT, ComputedMode,aDefaultComputedMode,V3d_TEX_NONE);
where aDisplay getenv("DISPLAY")
Other Parameter:
a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos, Standard_True, Standard_True);
I got this piece of code from the "QT-IMPORT/EXPORT" example. It works well for my projects.
Wed, 10/10/2012 - 12:21
I guess this code is for Unix-like system, I need windows application
full code from example:
#ifndef WNT
static Handle(Graphic3d_GraphicDevice) defaultdevice;
if( defaultdevice.IsNull() )
defaultdevice = new Graphic3d_GraphicDevice( aDisplay );
return new V3d_Viewer(defaultdevice,aName,aDomain,ViewSize,ViewProj,
Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
ComputedMode,aDefaultComputedMode,V3d_TEX_NONE);
#else
static Handle(Graphic3d_WNTGraphicDevice) defaultdevice;
if( defaultdevice.IsNull() )
defaultdevice = new Graphic3d_WNTGraphicDevice();
return new V3d_Viewer(defaultdevice,aName,aDomain,ViewSize,ViewProj,
Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
ComputedMode,aDefaultComputedMode,V3d_TEX_NONE);
#endif
Wed, 10/10/2012 - 13:07
I found a error, OCC could not find TKOpenGl.dll and load it.
I copy and edit files env.bat and msvc.bat from samples to my project directory. And use msvc.bat to run VS2010.
Wed, 10/10/2012 - 19:41
Oh i'm sorry. For sure this one seems to be for Unix-Systems. I copied the wrong piece of code. But as i see you've found the right one for Windows-Application. This works for me, too.
For the DLL-Problem:
Look at http://www.opencascade.org/org/forum/thread_22004/?forum=3 -> the last post of mine