Re: [osg-users] Oldie, but goodie... Aero themes and OpenGL/MFC

2015-07-01 Thread Andrew Cunningham
Hi,

I created a new class that inherits from CSplitterWndEx ( I am using the  MFC 
feature pack, but it should apply to CSplitterWnd )

and added these methods

virtual void StartTracking(int ht);
virtual void StopTracking(BOOL bAccept);
virtual void OnInvertTracker(const CRect rect);

If enableTrackSplitter_=false, you will no longer get the nasty trails left 
over the 3D window.


void CTransposableSplitterWnd::StartTracking(int ht)
{
CSplitterWndEx::StartTracking(ht);
}

void CTransposableSplitterWnd::StopTracking(BOOL bAccept)
{
CSplitterWndEx::StopTracking(bAccept);
}

void CTransposableSplitterWnd::OnInvertTracker(const CRect rect)
{
if(enableTrackSplitter_){
CSplitterWndEx::OnInvertTracker(rect);
}
}



Cheers,
Andrew

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64238#64238





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Oldie, but goodie... Aero themes and OpenGL/MFC

2015-06-30 Thread Lincoln Nxumalo
Hi,

I've managed to solve the rubber-band selection by drawing a openscenegraph 
quad in screen coordinates.

I used the Screen Aligned Quad tutorial from Delta3D. I hope another newbie 
will find this helpful:

http://delta3d.org/deltawiki/index.php?title=Tutorials.

I still need help with the MFC splitter window though. Thanks in advance.


... 

Thank you!

Cheers,
Lincoln

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64216#64216





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Oldie, but goodie... Aero themes and OpenGL/MFC

2015-06-29 Thread Lincoln Nxumalo
Hi Émeric,

Could you please share more information on your MFC code? Can you perhaps share 
the code?

I'm using CDC to draw the rectangle but it keeps getting erased when the frame 
is redrawn. I would really appreciate your help.  Thanks in advance. 

... 

Thank you!

Cheers,
Kulani

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=62963#62963





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Oldie, but goodie... Aero themes and OpenGL/MFC

2015-06-29 Thread Lincoln Nxumalo
Hi Andrew,

Could you please post your MFC code to handle the splitter window? I am not 
sure where and how you change the background of the 3D window. Which class is 
the 3D Window?

... 

Thank you!

Cheers,
Lincoln

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64204#64204





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Oldie, but goodie... Aero themes and OpenGL/MFC

2015-01-19 Thread Émeric MASCHINO
Hi,

2015-01-09 23:58 GMT+01:00 Andrew Cunningham andr...@mac.com:
 Hi,
 I finally got around to resolving these MFC/Aero issues using the following .

snip

 Hope someone finds this helpful

While I didn't hit the Aero issue you're talking about (I'm still on
Windows XP), this post remains helpful as I'm getting performance
issue with a similar MFC/OSG application.

By contrast with the osgviewerMFC example where the cOSG class (that
makes the glue between OSG and MFC) is a component of the view
(CMFC_OSG_MDIView), I imagine that in your situation, this cannot be
the case, as each view of your CSplitterWnd would otherwise have it's
own OSG viewer/scene graph, right? I also imagine that you're using a
CompositeViewer rather than a Viewer instance to manage the OSG part
of your different CSplitterWnd views? Where did you put the instance
of this CompositeViewer, as a member variable of the child frame?

In my application, I'm relying upon a CompositeViewer, a member
variable of the child frame. This child frame also has a CSplitterWnd
member variable. Each view of the CompositeViewer inherits the window
data from the CSplitterWnd view's HWND. With this architecture, the
performances are far from stellar. Basically, the framerate is divided
by the number of views. If it does matter, I'm using a separate render
thread for each CompositeViewer. Since there's one CompositeViewer per
child frame, there's in fact one distinct CompositeViewer by opened
document. I don't know if it's the optimum architecture. For the
records, I've also tried one unique CompositeViewer and render thread
at the application level, shared by all the child frames/opened
documents, but I was getting random crashes. But that's another story,
back to the performance problem. Do you also notice performance issue
with your application? I don't know where it comes from, maybe context
switching as each view of the CompositeViewer inherit a different
graphics context from the CSplitterWnd view? I've discarded the
CSplitterWnd as the cause, as I'm getting the same kind of performance
drop simply replacing the Viewer in the osgviewerMFC example with a
CompositeViewer holding two views of the same scene graph.

For completeness, I've also looked at the osgviewerQt example that
makes use of a CompositeViewer, each view also having it's own
graphics context. I'm not seeing any performance problem there on the
same PC.

Cheers,

 Émeric
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Oldie, but goodie... Aero themes and OpenGL/MFC

2015-01-19 Thread Émeric MASCHINO
Andrew,

 I think you will find that not many people really dug into using MFC with
 OSG ( as you can tell by the deafening silence on the forum on these topics)

Yes, indeed...

 I am using a separate CMFC_OSG_MDIView for each CView. I am not sure why you
 see that would be a problem. It does mean a separate Camera and separate
 osgViewer::Viewer etc for each CView but as you can share
 ,osg::Group/osg::Geometry objects as needed between scene graphs, I am not
 sure why this would have any downside.

OK, there's the difference. You're still using an osgViewer::Viewer
instance per CMFC_OSG_MDIView, while on my side, I was trying to use
one osgViewer::CompositeViewer to manage all the osgViewer::View
inheriting the CMFC_OSG_MDIView window data.

 The big difference between what I do and the OSG MFC examples is that
 - I am single threaded

I'm running a separate render thread.

 I found that the osg threading mechanism seemed to be flawed, as I had 4 osg
 threads using 100% of the CPU even when the app was idle. Perhaps I was
 missing something. But it seems fundamental that , for example, the cull
 thread is always running and never sleeping. Great for real-time games, not
 so much for applications that need to be 'nice'.

Could it be that you're using continuous rendering (default option)
rather than on-demand rendering? You can change this with
osgViewer::ViewerBase::setRunFrameScheme(osgViewer::ViewerBase::ON_DEMAND).
The drawback is that you'll thus have to override the MFC stack to
trigger osgViewer::View::requestRedraw() when required (e.g. OnSize).

 - I then completely bypass the viewer OSG event handler and handle all
 events using the standard MFC event mechanism. That is I handle OnPaint,
 OnKeyDown,OnLButtonDown etc etc and do what is needed. For example, in my
 OnDraw(CDC *cdc) I call viewer()-frame(); I had to do a couple of funky
 things to get this to work properly  . I can give you more details if you
 want to go that way.

I see. In this case, the above on-demand rendering trick won't work as
ViewerBase::run() performs various tests in order to determine if
osgViewer::ViewerBase::frame() should be called to redraw the display.

 Émeric
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Oldie, but goodie... Aero themes and OpenGL/MFC

2015-01-09 Thread Andrew Cunningham
Hi,
I finally got around to resolving these MFC/Aero issues using the following .

For drawing the selection box over a complex scene...
- Capture the 3D scene image as a texture map
- Turn off the 3D scene
- map the texture onto a 2D quad that will in the background filling the window
- While interactively drawing the zoom/selection box draw a outlined QUAD into 
a HUD over the 2D texture mapped quad.

MFC CSplitterWnd issues
- Overridde CSplitterWnd::OnInvertTracker to be a no-op to prevent 'trails' 
being left on the 3D window while you drag the splitter.
- Handle these Windows messages for the Frame containing the CSplitterWnd
ON_WM_ENTERSIZEMOVE()
ON_WM_EXITSIZEMOVE()
In between these two calls, handle OnDraw in the 3D window by filling the 
Window with a solid color ( or whatever) using GDI, not by trying to render 
OpenGL/OSG.

Hope someone finds this helpful

Cheers,
Andrew

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=62278#62278





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Oldie, but goodie... Aero themes and OpenGL/MFC

2013-09-25 Thread Chris Hanson
Yeah, I'm afraid you may have to do that.

Once the double-buffer has been swapped to the screen, you can't draw on it
anymore.

Some implementations may allow you to hint that you want a COPY swap, which
leaves the buffer still intact in the back buffer after swap, so you could
draw on it, but I don't think you can guarantee it.

You probably want to RTT render the main scene to a texture, then to
display it, just rasterize it onto a fullscreen quad each time. This makes
it efficient to draw _any_ UI elements on top of it, without having to XOR
(XOR is hard to see on mid-grey colors anyway) because you're actually
clearing and re-blitting the texture on each update redraw.


On Tue, Sep 24, 2013 at 6:26 PM, Andrew Cunningham andr...@mac.com wrote:

 I am using a double-buffered window as per the OSG MFC example.
 traits-doubleBuffer = true;  The MFC example shows a nice overlay HUD of
 rendering statistics.

 This just seems such a typical 3D UI interaction - to show a rectangular
 area on the screen under mouse control for selection or zooming that it
 surprises me there is not a canned solution. I suppose I could grab the
 pixel buffer and make that a static background while I draw the rectangle.
 It is crucial the full 3D scene be not continuously redrawn while drawing
 this zoom box.

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=56474#56474





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Digital Imaging • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography
• Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS •
Android
@alphapixel https://twitter.com/alphapixel facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Oldie, but goodie... Aero themes and OpenGL/MFC

2013-09-24 Thread Andrew Cunningham
I am using a double-buffered window as per the OSG MFC example. 
traits-doubleBuffer = true;  The MFC example shows a nice overlay HUD of 
rendering statistics.

This just seems such a typical 3D UI interaction - to show a rectangular area 
on the screen under mouse control for selection or zooming that it surprises me 
there is not a canned solution. I suppose I could grab the pixel buffer and 
make that a static background while I draw the rectangle. It is crucial the 
full 3D scene be not continuously redrawn while drawing this zoom box.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56474#56474





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org