For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Creating Texture as Background Image

alex's picture
Forums: 

Hi

I am new to opencascade. I want to know how do create texture that has image display as background and another special thing i want to do is some pixel operation in current texture set.

I am want some pixel buffer in texture and update in some interval time...

Can anyone tell me how to do this stuff. ?

I have already done with OpenGL without OpenCasCade via glTexImage2D or glTexSubImage2D method.

Alex

Sharjith Naramparambath's picture

Hi,
To set texture image as background in OpenCASCADE you simply need to call the method
myView->SetBackgroundImage("background.bmp", Aspect_FM_STRETCH, true);

where myView is Handle(V3d_View) and background.bmp is a bitmap image you want to display as background.

Can you please tell me how to display background image in OpenGL using texture? I want to use the technique to display gradient background in OpenGL. Please send the detailed code.

Regards
N. Sharjith

P Dolbey's picture

The secret to getting a gradient background seems to be two-fold. This is the outline of the solution.

First you need to have your own rendering context which you can draw onto. You need to "offer" this context to OCC as its rendering context. Next you need to register a call-back function for the viewer, which is called in the OCC render process just before the buffers are swapped. This is accomplished using the alternative SetWindow method, which enables you to set both an exising rendering context and call-back function.

In my case the first part is relatively easy (well it is on XP). My rendering context can be grabbed directly from the Qt QGLWidget. The real call-back function paintOCC()is hooked by a static member function to emulate the objects "this" pointer. The paintOCC() just issues OpenGL calls, and I've just set up a GL_QUAD with a gradient that I can paint at the far depth point by setting up glOrtho projection, but I guess it could run any open gl command, texture etc.. I do need a specific line of code in the normal #ifdef WNT code to get the HGLRC and I'm not able to test the Linux X11 equivalent.

The gotcha so far is that by default I paint a grid onto my widget on the privelege plane. When I have an AIS object on screen, this looks great with a nice gradient background, but with no object the background quad seems to cover the grid. It looks like the state of the blending function is different between these two conditions, and I have blended the backgound to see the grid, but the blending effect changes as soon as load the test bottle which isn't nice.

I'm going to have a hack around to see if I can see where the difference comes from i the OCC code, then I'll put up my code for you to see - its easier to read than explain. If anyone can live without this nicety, reply here and I'll make available anyway - the effect does look quite nice!

If anyone else has tried this method and come up with a solution, please tell me how.

Pete

alex's picture

Sorry Gues

I was not able to check messages...About Dolbey Please can post codes. ??

About OpenGL my code that does pixel operation is here but keep in mind these operation could be done in withthin begin scene and end scene (swap buffer)..

glEnable(GL_TEXTURE_2D);
glGenTextures(1, &video_texture);
glBindTexture(GL_TEXTURE_2D, video_texture);

BYTE* black_frame = (BYTE*)malloc(width*height*4*sizeof(BYTE));
memset(black_frame, 0, width*height*4*sizeof(BYTE));

glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0,
GL_BGRA_EXT, GL_UNSIGNED_BYTE, black_frame);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);

free(black_frame);

Sharjith Naramparambath's picture

Hi
Sorry to trouble you again.But I didnot get what you said... "About OpenGL my code that does pixel operation is here but keep in mind these operation could be done in withthin begin scene and end scene (swap buffer).."

Can you please send me a sample code in opengl with gradient or texture background, as you have done it, to my mail id: sharjith@gmail.com

Thanks in anticipation.

Reards
N. Sharjith

P Dolbey's picture

They say give a man a fish and he will feed himself for a day; give him a fishing net and he'll feed himself for life.

I'm not just going to put my code on the web for download just yet for 2 reasons.

1. It doesn't work properly yet (as per my previous hastily written post).
2. It won't explain the basis of the solution.

Somewhere around OCC version 5, an alternate form of the SetWindow call was introduced into the API. Its documented in the Visual3d_View.cdl as

SetWindow ( me : mutable;
AWindow : Window from Aspect;
AContext: RenderingContext from Aspect;
ADisplayCB: GraphicCallbackProc from Aspect;
AClientData: Address from Standard
)
---Level: Public
---Purpose: Associates the window and context
-- to the view .
-- If is not NULL the graphic context is used
-- directly to draw something in this view.
-- Otherwise an internal context is created.
-- If is not NULL then a user display CB is
-- call at the end of the OCC graphic traversal and just
-- before the swap of buffers. The is pass
-- to this call back.
-- No new association if the window is already defined.
-- Category: Methods to modify the class definition
-- Warning: Raises ViewDefinitionError if it is impossible
-- to associate a view and a window.
-- (association already done or another problem)
-- Modifies the viewmapping of the associated view
-- when it calls the SetRatio method.
raises ViewDefinitionError from Visual3d is static;
---Purpose:
-- After this call, each view is mapped in an unique window.

In the Windows world, the Aspect_RenderingContex is a direct map to the HGLRC. This enables you re-use an existing OpenGL rendering context - but the function does execute another choosePixelFormat on Windows when called. In the Qt world this means you can actually re-use the OpenGL context within the QGLWidget. However you can provide the function with a zero value for AContext, in which case the viewer will construct its own rendering context as normal.

The function also enables you to register a callback procedure that will be called in the OCC rendering loop just before the final call to swapbuffers, irrespective of which rendering context you provide - the makeCurrent will already be called. For the interested, you can see the call back function being called in "call_togl_redraw" in opengl_togl_redraw.c.

The call back function itself need to math the prototype

int foo (Aspect_Drawable drawable, void* aPointer, Aspect_GraphicCallbackStruct* data)

This cannot be implemenented as a directly as class member function because it doesn't contain the magic "this" pointer. However it can be implemented a static class function, and we can implement the this pointer via the void* aPointer. The Aspect_Drawable contains some stuff that mignt be useful but for now I've just implemented it to provide the necessary padding.

The following segments are based on my QtOCC implementation (v0.6) but should be applicable to any presentation viewer framework.

First create 2 function prototypes in your header file - I've used the following in QtOCCViewWidget.h

static int CallBack (Aspect_Drawable, void*, Aspect_GraphicCallbackStruct*);

and

void paintOCC();

(Note I originally used paintGL() instead of paintOCC() but this resulted in both OCC and Qt calling the method)

To register the call back, I changed the initialize() method to read

#ifdef WNT
HGLRC rc = wglGetCurrentContext();

myWindow = new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)
::DownCast(myContext->CurrentViewer()->Device() ), (int)hi, (int)lo);
myView->SetWindow( myWindow, rc , CallBack, this );
#else
myWindow = new Xw_Window( Handle(Graphic3d_GraphicDevice)
::DownCast(myContext->CurrentViewer()->Device() ), (int)hi, (int) lo,
Xw_WQ_SAMEQUALITY,
Quantity_NOC_BLACK);
myView->SetWindow( myWindow );
#endif // WNT

// Set my window (Hwnd) into the OCC view
// myView->SetWindow( myWindow );

Note that I'm only affecting the Windows (WNT) version here. If you just use HGLRC rc = 0 then OCC creates the rendering context but still registers the call back.

The line "myView->SetWindow( myWindow, rc , CallBack, this);" registers the Callback function and passes the objects "this" pointers as the Aspect_GraphicCallbackStruct*.

Next I implement the callback routine in the class implementation. This routine has access to all the class members and methods but is not bound to a specific object instance. Here's the implemenation

int QtOCCViewWidget::CallBack (Aspect_Drawable drawable,
void* aPointer,
Aspect_GraphicCallbackStruct* data)
{
QtOCCViewWidget *aWidget = (QtOCCViewWidget *) aPointer;
aWidget->paintOCC();
return 0;
}

Finally I implement the paintOCC() routine - this is where the OpenGL gurus can start practising their skills. By default objects you draw here will be placed in the current OCC world space. To get a gradient background however I remap the screen to a bi-unit cube with a glOrtho, clamping the depth buffer from z=1 to z=-1 and place a GL_QUAD with a greyish gradient. Here's my current implementation.

void QtOCCViewWidget::paintOCC()
{
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, 1.0, -1.0);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE) ;
glShadeModel(GL_SMOOTH);
//glDisable(GL_LIGHTING);
glBegin(GL_QUADS);
{
glColor4f(0.1, 0.1, 0.1, 1.0);
glVertex3d( -1.0, -1.0, 1.0);
glVertex3d( 1.0, -1.0, 1.0);
glColor4f(0.9, 0.9, 0.9, 1.0);
glVertex3d( 1.0, 1.0, 1.0);
glVertex3d( -1.0, 1.0, 1.0);
}
glEnd();
}

(Another note - still not sure whether my glOrtho is correct yet, but it works!)

That should be pretty much it, except (as you can see from the glBlendFunc) I'm finding a problem, probably in the alpha colour components where the state of the rendering context id different with and without a AIS_Shape being drawn thats affect rendering of my grids. I've enabled debugging in the OCC openGL code and I am wading through GLIntercept logs to see if I can identify a fix.

Hope this makes sense. Any comments are gratefully received.

Enjoy

Pete

P Dolbey's picture

Apart from the obvious typos (math should read match, mignt should read might and so on, the line "However it can be implemented a static class function, and we can implement the this pointer via the void* aPointer" should read "However it can be implemented a static class function, and we can implement the this pointer via the Aspect_GraphicCallbackStruct* data pointer). Oh, for an edit function.

Pete

Pawel's picture

Hi Pete,

first of all thanks for the post. It's a really nice functionality anebling to access the OpenGL layer. Once again - a big thanks!

I've implemented the rendering in my app and it seems to work fine. The only thing I had to modify was to use a static variable to use the HGLRC (I have an MDI app).

Greets
Pawel

P Dolbey's picture

I hope you mean "non-static" class member otherwise you'll only have one rc shared across all windows in the class.

Anyway, great news.

Pete

Pawel's picture

Hi Pete,

no I mean static. I'm not an OpenGL expert but I've googled a bit and found actually three possible ways of creating the rendering context:
1) in SDI applications - created during the initilization and then deleted with wglDeleteContext when the application closes (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01)
2) in OnPaint method (http://www.codeguru.com/cpp/g-m/opengl/article.php/c5583/)
3) as static variable (http://www.codeproject.com/opengl/opengltry.asp)

Besides my application crashes if I create a separate rendering context for each of my document windows.

Pawel

P Dolbey's picture

You should be able to cache a local HGLRC in each window - this is what opencascade does. Otherwise you'll be running a wglCreateContext in every paint event which can become expensive. I looked at the code I was writing with MFC 10 years ago, and I used an MSDN technique which cached the rendering context in its own class. There shouldn't be anything funny about MDI in respect of SDI. My guess is that were not using wglMakeCurrent in the right way.

If it works for then OK, but I could take a look at your code if you want.

Pete

P Dolbey's picture

You should be able to cache a local HGLRC in each window - this is what opencascade does. Otherwise you'll be running a wglCreateContext in every paint event which can become expensive. I looked at the code I was writing with MFC 10 years ago, and I used an MSDN technique which cached the rendering context in its own class. There shouldn't be anything funny about MDI in respect of SDI. My guess is that were not using wglMakeCurrent in the right way.

If it works for then OK, but I could take a look at your code if you want.

Pete

Pawel's picture

Hi Pete,

this is my code:

//header
class OCCViewer
{
public:
private:
Handle_V3d_Viewer myViewer;
Handle_V3d_View myView;
Handle_AIS_InteractiveContext myAISContext;
Handle_Graphic3d_WNTGraphicDevice myGraphicDevice;
static HGLRC rc;
bool useDirectOpenGLRendering;
public:
static int CallBack (Aspect_Drawable ,void* ,Aspect_GraphicCallbackStruct*);
void PaintOCC();
static CCriticalSection g_cs;
...
}

//implementation
CCriticalSection OCCViewer::g_cs;
HGLRC OCCViewer::rc = wglGetCurrentContext();

///

OpenGL rendering function.
void OCCViewer::SetOpenGLRendering(bool directOpenGLRendering)
{
useDirectOpenGLRendering = directOpenGLRendering;
}

///

OpenGL rendering function.
void OCCViewer::PaintOCC()
{
if(useDirectOpenGLRendering == true)
{
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, 1.0, -1.0);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
glShadeModel(GL_SMOOTH);
glBegin(GL_QUADS);
{
glColor4f(0.0f, 0.0f, 0.0f, 0.8f);
glVertex3d( -1.0, -1.0, 1.0);
glVertex3d( 1.0, -1.0, 1.0);
glColor4f(0.7f, 0.7f, 0.7f, 0.8f);
glVertex3d( 1.0, 1.0, 1.0);
glVertex3d( -1.0, 1.0, 1.0);
}
glEnd();
}
}

///

User rendering callback function.
int OCCViewer::CallBack(Aspect_Drawable drawable,
void* aPointer,
Aspect_GraphicCallbackStruct* data)
{
g_cs.Lock();
OCCViewer *viewer = (OCCViewer *) aPointer;
if(viewer != NULL)
viewer->PaintOCC();
else
TraceWarning("OCCViewer Error. CallBack - viewer Null pointer.");
g_cs.Unlock();
return 0;
}

bool OCCViewer::InitViewer(void* wnd)
{
/*if ( myGraphicDevice.IsNull() )
{*/
try {
myGraphicDevice = new Graphic3d_WNTGraphicDevice();
} catch (Standard_Failure) {
return false;
}
/*}*/
TCollection_ExtendedString a3DName("Visu3D");
myViewer = new V3d_Viewer( myGraphicDevice, a3DName.ToExtString(),"", 1000.0,
V3d_XposYnegZpos, Quantity_NOC_BLACK,
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
Standard_True, Standard_False);
myViewer->Init();
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myView = myViewer->CreateView();
Handle(WNT_Window) aWNTWindow = new WNT_Window(myGraphicDevice, reinterpret_cast (wnd));
myView->SetWindow(aWNTWindow, rc, (&OCCViewer::CallBack), this);
//myView->SetWindow(aWNTWindow);
if (!aWNTWindow->IsMapped())
aWNTWindow->Map();
myAISContext = new AIS_InteractiveContext(myViewer);
myAISContext->UpdateCurrentViewer();
myView->Redraw();
myView->MustBeResized();

// TRIHEDRON
Handle(AIS_Trihedron) aTrihedron;
Handle(Geom_Axis2Placement) aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
aTrihedron=new AIS_Trihedron(aTrihedronAxis);
aTrihedron->UnsetSelectionMode();
myAISContext->Display(aTrihedron);

//static TRIHEDRON - not sizable, not movable
myView->TriedronDisplay(Aspect_TOTP_RIGHT_UPPER,Quantity_NOC_GREENYELLOW,0.05);

return true;
}

This code works fine. If I make HGLRC non-static and initialize it in OCCViewer::InitViewer the app generates exceptions after I've closed a viewer window (with multiple windows open).

I also tried to use the non-static HGLRC in an MFC MDI app, and make it current like this:
PaintOCC()
{
CDC* cdc = GetWindowDC();
HDC hdc = cdc->GetSafeHdc();
wglMakeCurrent(hdc, rc);
...
ReleaseDC(cdc);
}

The effects are similar to the ones described above (after I've closed the viewer created at first there's no rendering in the remaining ones).

Pawel

P Dolbey's picture

Sorry Pawel but thats a bit "screwy".

Your code line

HGLRC OCCViewer::rc = wglGetCurrentContext();

is being called as an intialisation even before you've hit the main/WinMain routine, abd certainly before you've created any windows, HWNDs or HDCs. Debugging it reveals that its effectively just acting like

HGLRC OCCViewer::rc = 0;

If your running in debug mode, just place a breakpoint on this line, or watch the value of the rc in your view constructor.

The reason your code works when you use a static variable is because when pass rc into setWindow, OCC uses the value of 0 to determine whether to create its own OpenGL rendering context or not. Actually, unless you want add the code to create the rc (choosePixelFormat etc) for some other reason, you might as well leave it this way and leave it up to OCC to create the context. The examples on Nehe's site give a statring pint for this. You can still exploit the callback routine this way. In my Qt code, the QGLWidget has already set up a rendering context and my reason for tying to re-use is to reduce the total number of system resources used.

If you want me to look at setting up a rendering context in MFC that can be shared by OCC, you might need to send me a simplifed version of your code + project files (peter @ dolbey dot freeserve dot co uk) - its been a long since I've coded OpenFL MFC progs, but I still have plenty of examples in the archives. However, in practice you might just as well remove all references to your static rc and just pass a constant zero value in setWindow - it looks like your "cheapest" option!

I'm also not convinced about having a global CriticalSection. I don't see anyway that your viewer will recieve multiple paint events from the single GUI thread - the paint events are inherently queued in the window message loop. You should be able to remove the g_cs lock/unlock as well as the rc - this is not needed anymore as a shared resource.

I see you've been having a play with the blending function - I'll see what this does in my own code.

However when the gradients running in the background, it does give a nice effect doesn't it - have you tried different colours on the quad's corners yet?

Cheers

Pete

P Dolbey's picture

Strange things happen with this gradient background technique if you don't display a Triedron i.e. you only get the gradient background if an object is selected under the mouse. This is of course totally "screwy" and to be honest I don't know how to fix it without taking the whole rendering engine apart.

So for now, you need to keep a Triedron displayed for the callback to work.

Pete

P Dolbey's picture

For anyone monitoring my attempts to get a "reliable" gradient background just using OpenGL calls, I have discovered solutions to both of my current problems.

The trihedron code was causing the lights to be turned off in all cases, whereas without the the trihedron being dispayed, the state of the lighting dependened on whether the shape was highlighed. A simple fix is to add a "glDisable (GL_LIGHTING);" int the callback routine.

void QtOCCViewWidget::paintOCC()
{
glDisable(GL_LIGHTING); //left on by trihedron

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

GLfloat left = -1.0f;
GLfloat right = 1.0f;
GLfloat bottom = -1.0f;
GLfloat top = 1.0f;
GLfloat depth = 1.0f;

glOrtho( left, right, bottom, top, 1.0, -1.0);

glBegin(GL_QUADS);
{
glColor4f ( 0.1f, 0.1f, 0.1f, 1.0f );
glVertex3d ( left, bottom, depth );
glVertex3d ( right, bottom, depth );
glColor4f ( 0.9f, 0.9f, 0.9f, 1.0f );
glVertex3d ( right, top, depth );
glVertex3d ( left, top, depth );
}
glEnd();
}

Notice all the blending has now been removed. The original problem I had was down to OCC trying to optimize the depth buffers - i.e. it did not perform depth sorting unless there were some faces to sort. This "feature" has to be switched off - it can be done when the viewer is created in my QtOCCViewerContext() constructor

.
myViewer->Init();
myViewer->SetZBufferManagment(Standard_False);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
.

- its the "myViewer->SetZBufferManagment(Standard_False);" that does the job.

This code is now probably stable enough to merit a new downloadable sample, but I will only do that if interest is shown on this thread as it takes up space from my web allowance.

Pete

Pawel's picture

Hi Pete,

I've looked at the code again and have some comments.

For some reason my HGLRC equals 0. I can't figure it out so for now I guess I'll leave creating the context to OC.

I used critical sections because I have can have access to my viewer from multiple threads - it's application specific. But I agree, maybe this should not be global. I'll look at that.

Your solution of the problem with the lights works well. However, removing the blending from the rendering function has a drawback. The color scale - myView->ColorScaleDisplay() - (if you have one) is not displayed anymore.

These are some observations I've made (unfortunately not many solutions :( )

Thanks again for your efforts.

Pawel

P Dolbey's picture

Pawel

These replies are getting awfully compressed to the right of the page .

I explained the reason for the HGLRC coming out as zero two posts up. You're basically initialising it before you've initialised OpenGL, or anything else come to that. As I said in that post, you might as well leave the context creation to OCC - but you've come to this conclusion on your own. From the thread perpespecive, both MFC and Qt use a single thread for their GUIs, and although there is some clever stuff around for multi-threading OpenGL but I didn't see that in your code.

I basically had a fun week-end drilling through rendering logs. If you're on a XP/Win32 platform grab a copy of GLintercept from

http://glintercept.nutty.org/index.html

(and use a the patched OpenGL32.dll in a separate folder and don't overwrite the one in system32). I've found it an powerful tool for trying to understand the OCC rendering process. I managed to find to fixes for the background gradient, point markers, and rediscovered the flicker fix given in

http://www.opencascade.org/org/forum/thread_8291/

that I had forgottent to apply to OCC 6.2. Obviously I haven't tried to fix a problem that I haven't experienced yet i.e. ColorScaleDisplay but my offer still stands - post a simplified version of your code that exhibits the problem to "peter at dolbey dot freeserve dot co dot uk" and I'll take a look at it - with no absolutely guarantee of success.

Pete

P Dolbey's picture

And squeezing into the corner...

I see what you mean about ColorScaleDisplay. Best results (near perfect) I've got so far are with

glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA);

There's another gotcha. If you use a grid echo, i.e. a immediate mode draw you need to glPushMatrix/glPopMatrix both projecttion and modelview matrices (as a "polite" routine should do anyway). Note that having both a ColorScaleDisplay and a grid echo don't work together with the background. Actually they don't workout the gradient either i.e. this an OCC bug.

Cheers

Pete

P Dolbey's picture

And looks something like this

http://myweb.tiscali.co.uk/dolbey/QtOpenCascade/QtOCCGrad.PNG

And here's my latest callback routine - I think I'll stop here!

void QtOCCViewWidget::paintOCC()
{
glDisable(GL_LIGHTING);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();

glEnable(GL_BLEND);
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA);

GLfloat left = -1.0f;
GLfloat right = 1.0f;
GLfloat bottom = -1.0f;
GLfloat top = 1.0f;
GLfloat depth = 1.0f;

glOrtho( left, right, bottom, top, 1.0, -1.0);

glBegin(GL_QUADS);
{
glColor4f ( 0.1f, 0.1f, 0.1f, 1.0f );
glVertex3d ( left, bottom, depth );
glVertex3d ( right, bottom, depth );
glColor4f ( 0.9f, 0.9f, 0.9f, 1.0f );
glVertex3d ( right, top, depth );
glVertex3d ( left, top, depth );
}
glEnd();

glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}

Pete

Pawel's picture

I've finally found the reason for the crashes in my app. It is actually pretty simple.

The OpenGL context is not available during the viewer initialization and so:

HGLRC rc = wglGetCurrentContext()

returns NULL. However, when I use

myView->SetWindow(aWNTWindow, rc, (&OCCViewer::CallBack), this);

(no matter if rc is static or not) OC takes a reference. This leads to problems during the destruction. So I just took:

myView->SetWindow(aWNTWindow, 0, (&OCCViewer::CallBack), this);

and it works well.

Pawel

Adrian Helcman's picture

hi pawel,

i have used your code, but if the 3d scene objects display mode is set to AIS_Shaded, the gradient is lost -> background color is used.
have you any idea, where is the problem?

adrian

Pawel's picture

Hi Adrian,

it's been a while since I last looked at the thread... So, what is the code you used exactly? Are you sure you do not interfere somewhere else?

I never had the problem you describe.

I'm still using OC6.2.

Pawel

Adrian Helcman's picture

pawel,

hm, i am using 5.2. can it be a problem?
are you able to compile your code for 5.2, or would you send me a sample project?

adrian

Pawel's picture

Hello Adrian,

yes I can try compiling with 5.2, but probably not sooner than during the weekend...

Could you please post your e-mail?

Best regards
Pawel

Achilles Karfis's picture

Hello,

My name is Achilles Karfis - Rural and surveyor engineer. I want to use opencascade technology in order to create a cad system.

My question is how to build open cascade in windows and how can I create a simple 2d cad project.

For me its clear that Geom2d is recommended but how about Draw?

How to connect Draw with openGL

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.