Re: [osg-users] Using OsgViewerMFC to load a sphere

2008-07-15 Thread spowers
Hi and welcome to OSG.
 
You need to make sure your viewport and projection matrix have
equivalent aspect ratios.
 
The best way to do this in MFC is to use the viewport dimensions that
your using (traits-width, traits-height) and then change your
projection matrix to match that aspect ratio.
 
-Steve
 
 
 


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of TANG
Fangqin
Sent: Tuesday, July 15, 2008 10:34 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Using OsgViewerMFC to load a sphere
 
Hi All,
 
I am a beginner of OSG. 
I used OsgViewerMFC to load a sphere into the scene, but it displays as
an ellipsoid.
The radius doesn't seem to be equal in two orthotropic axes.
 
I find that it may be related to the width and height of the view window
when initializing.
 
The following codes are from OsgViewerMFC:
 
::GetWindowRect(m_hWnd, rect);
...
traits-x = 0;
traits-y = 0;
traits-width = rect.right - rect.left;
traits-height = rect.bottom - rect.top;
...
osg::GraphicsContext* gc =
osg::GraphicsContext::createGraphicsContext(traits.get());
 
How to solve this?
Thanks for your advices in advance.
Tang
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Runtime Crater

2008-07-11 Thread spowers
I am also interested in this. Basically I have a terrain that I want to
deform when an explosion happens.
 
I was thinking of using a vertex shader that will read a new texture
applied to the newly exploded area and deform the are based on that
texture. The problem with this is that the terrain will only be deformed
in the camera view and the physics model for vehicles will not be
affected by the new crater.
 
Are there any other techniques that would work better?
 
-Steve 
 


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of CG
Sent: Friday, July 11, 2008 12:37 PM
To: OpenSceneGraph Users
Subject: [osg-users] Runtime Crater
 
Hi all,
 
I need help in creating runtime craters (cause by explosion event), are
there any examples?
 
Thanks,
Cg




Make the most of what you can do on your PC and the Web, just the way
you want. Windows Live http://www.get.live.com/wl/all 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MFC Fullscreen With Multiple Monitors

2008-07-10 Thread spowers
Has no one run into this before? I've also tried creating a window in
MFC and using its WindowData object as the inherited window data object.
That did not work either. Any tips from anyone that has done this
before?
 
 


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, July 07, 2008 11:41 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] MFC Fullscreen With Multiple Monitors
 
I'm having a problem with inheriting window data from an MFC window in
OSG 2.2.
 
When I run an application with a dual monitor display the application
runs and OSG starts but it starts in fullscreen mode rather than
inheriting the MFC window size and location.
 
When I run the same application on the same machine but with only a
single monitor the OSG inherits the MFC window correctly.
 
 
Is there something that I'm missing?
 
Here is the code I use to create the window (borrowed from the MFC
viewer example):
 
   // Local Variable to hold window size data
   RECT rect;
 
   // Create the viewer for this window
   mViewer = new osgViewer::Viewer();
 
    Add a Stats Handler to the viewer
   mViewer-addEventHandler(new osgViewer::StatsHandler);
 
    Get the current window size
   ::GetWindowRect(m_hWnd, rect);
 
    Init the GraphicsContext Traits
   osg::ref_ptrosg::GraphicsContext::Traits traits = new
osg::GraphicsContext::Traits;
 
    Init the Windata Variable that holds the handle for the
Window to display OSG in.
   osg::ref_ptrosg::Referenced windata = new
osgViewer::GraphicsWindowWin32::WindowData(m_hWnd);
 
   // Setup the traits parameters
   traits-x = 0;
   traits-y = 0;
   traits-width = rect.right - rect.left;
   traits-height = rect.bottom - rect.top;
   traits-windowDecoration = false;
   traits-doubleBuffer = true;
   traits-sharedContext = 0;
   traits-setInheritedWindowPixelFormat = true;
   traits-inheritedWindowData = windata;
 
   // Create the Graphics Context
   osg::GraphicsContext* gc =
osg::GraphicsContext::createGraphicsContext(traits.get());
 
   // Init a new Camera (Master for this View)
   _camera = new osg::Camera;
 
   // Assign Graphics Context to the Camera
   _camera-setGraphicsContext(gc);
 
   // Set the viewport for the Camera
   _camera-setViewport(new osg::Viewport(traits-x, traits-y,
traits-width, traits-height));
 
   // Add the Camera to the Viewer
   mViewer-addSlave(_camera.get());
 
   // Add the Camera Manipulator to the Viewer
   //mViewer-setCameraManipulator(keyswitchManipulator.get());
 
   // Set the Scene Data
   mViewer-setSceneData(mRoot.get());
 
   // Realize the Viewer
   //mViewer-getCamera()-setViewport(traits-x, traits-y,
traits-width, traits-height);
   mViewer-realize();
 
Thanks -Steve 
 
 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] wxwidgets and osg

2008-07-08 Thread spowers
 
I believe it depends on where you call frame().
 
You can create a separate thread that will call frame() on its own timer
and will continue to render as wxWidgets is resizing. I havnt tested
this but it should work. The wx gui will not continue to render but the
OSG parts should.
 
I've done this for a MFC project in windows and the OSG parts of the
application continue to run when they are being resized.
 
I hope this helps!
 
-Steve
 
 


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of James
Dickson
Sent: Tuesday, July 08, 2008 1:31 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] wxwidgets and osg
 
Hi,
 
I have been trying out osg with wxwidgets, specifically playing with the
osgViewerWX sample, and was wondering if it is possible
to somehow maintain rendering whilst the wxFrame is resized. At the
moment when the wxFrame is made bigger the rendering area
is not redrawn until the next idle event, meaning it looks like the app
has failed in someway (obviously it hasn't) until it is updated.
 
Would it be inefficient to render every resize event? Or maybe snapshot
the front buffer to create a image that is just resized (as
if the user is resizing they aren't interacting with the rendering
window, if so how?)?
 
Thank you for any help\comments, appologies if my terminology is wrong,
I'm a bit new to all this :-)  

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


[osg-users] MFC Fullscreen With Multiple Monitors

2008-07-07 Thread spowers
I'm having a problem with inheriting window data from an MFC window in
OSG 2.2.
 
When I run an application with a dual monitor display the application
runs and OSG starts but it starts in fullscreen mode rather than
inheriting the MFC window size and location.
 
When I run the same application on the same machine but with only a
single monitor the OSG inherits the MFC window correctly.
 
 
Is there something that I'm missing?
 
Here is the code I use to create the window (borrowed from the MFC
viewer example):
 
   // Local Variable to hold window size data
   RECT rect;
 
   // Create the viewer for this window
   mViewer = new osgViewer::Viewer();
 
    Add a Stats Handler to the viewer
   mViewer-addEventHandler(new osgViewer::StatsHandler);
 
    Get the current window size
   ::GetWindowRect(m_hWnd, rect);
 
    Init the GraphicsContext Traits
   osg::ref_ptrosg::GraphicsContext::Traits traits = new
osg::GraphicsContext::Traits;
 
    Init the Windata Variable that holds the handle for the
Window to display OSG in.
   osg::ref_ptrosg::Referenced windata = new
osgViewer::GraphicsWindowWin32::WindowData(m_hWnd);
 
   // Setup the traits parameters
   traits-x = 0;
   traits-y = 0;
   traits-width = rect.right - rect.left;
   traits-height = rect.bottom - rect.top;
   traits-windowDecoration = false;
   traits-doubleBuffer = true;
   traits-sharedContext = 0;
   traits-setInheritedWindowPixelFormat = true;
   traits-inheritedWindowData = windata;
 
   // Create the Graphics Context
   osg::GraphicsContext* gc =
osg::GraphicsContext::createGraphicsContext(traits.get());
 
   // Init a new Camera (Master for this View)
   _camera = new osg::Camera;
 
   // Assign Graphics Context to the Camera
   _camera-setGraphicsContext(gc);
 
   // Set the viewport for the Camera
   _camera-setViewport(new osg::Viewport(traits-x, traits-y,
traits-width, traits-height));
 
   // Add the Camera to the Viewer
   mViewer-addSlave(_camera.get());
 
   // Add the Camera Manipulator to the Viewer
   //mViewer-setCameraManipulator(keyswitchManipulator.get());
 
   // Set the Scene Data
   mViewer-setSceneData(mRoot.get());
 
   // Realize the Viewer
   //mViewer-getCamera()-setViewport(traits-x, traits-y,
traits-width, traits-height);
   mViewer-realize();
 
Thanks -Steve 
 
 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Advice on Rendering Streaming video

2008-06-26 Thread spowers

Hey uli,

What do you mean by getting a nice image from that is a b??ch? Is the
image quality reduced?

Not sure what de-bayer algorithm I'm going to use. I have the source for
one that we have used before but I'm not sure how it will work on a
shader.

Is there an example of an osg::PixelBufferObject being used to stream to
an Image?? How is one attached to the image?

Also, about the non-power of 2 textures can I make the texture
scaled to the nearest power of two and just modify the texture
coordinates on the quad? Will doing this avoid the CPU scalling of the
texture?
 

-Steve
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ulrich
Hertlein
Sent: Wednesday, June 25, 2008 10:19 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Advice on Rendering Streaming video

[EMAIL PROTECTED] wrote:
 I've already set up an orthographic2D view that will look at a quad
 which will display the texture. The shader will then convert the
texture
 into RGB and do the whitebalance.  I am also able to swap the texture
 back and forth and maintain decent frame rates but the textures I'm
 using to test are only 64x64 pixels (tank.rgba and water.rgba) and I'm
 wondering if it would be too slow (30fps) to use the same method for
 1000x1000 pixel images.

The texture bandwidth isn't likely to be a problem, keep in mind that
bayer 
images are only 1/3 of an RGB image of the same size.

Things to look out for is to use non-power-of-two textures or texture
rectangles 
to avoid CPU scaling of the image.

You'll also want to attach a osg::PixelBufferObject to the osg::Image.

Unfortunately getting a nice image from that is a b??ch and the shaders
can get 
complex pretty fast, the number of texture lookups is probably the most 
expensive op.  What de-bayer algorithms are you looking at?

Cheers,
/uli
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Advice on Rendering Streaming video

2008-06-25 Thread spowers

The format the image data I'll be using is a proprietary format that
basically just has the raw bayer data below a header.

I do have an additional question about how to load the data into the
texture.

I've already set up an orthographic2D view that will look at a quad
which will display the texture. The shader will then convert the texture
into RGB and do the whitebalance.  I am also able to swap the texture
back and forth and maintain decent frame rates but the textures I'm
using to test are only 64x64 pixels (tank.rgba and water.rgba) and I'm
wondering if it would be too slow (30fps) to use the same method for
1000x1000 pixel images.

Is there another method that I should be trying out? 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ulrich
Hertlein
Sent: Monday, June 23, 2008 9:57 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Advice on Rendering Streaming video

[EMAIL PROTECTED] wrote:
 The video stream will be in Bayer format and will need to be converted
 to RGB before being displayed on the screen.
 
 I will also need to zoom the image and pan the image back and forth.
 There will be other filters that I'll need to apply but I think they
 will just end up being shaders.
... 
 I was contemplating dumping the raw data into a texture and doing all
 the decoding on the graphics card within a series of shaders. Is this
a
 viable approach?

Use of a shader for the debayer process is definitively the way to go if
you 
want to be realtime.  For any kind of reasonable result the debayer
algorithms 
will be too slow when done on the CPU.

Hopefully you'll have a grayscale image (and not something more
convoluted like 
YCbCr) so just upload that to a texture and knock yourself out with a
debayer 
shader! ;-)

Zoom/pan can also be done in the shader by modifying the texture
coordinates.

Just out of curiosity, what kind of image data are you using?  RED?
ARRI?

Cheers,
/ulrich

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


[osg-users] Advice on Rendering Streaming video

2008-06-23 Thread spowers

I need to write a media player like app that will decode a custom video
stream and display it on the screen.

The video stream will be in Bayer format and will need to be converted
to RGB before being displayed on the screen.

I will also need to zoom the image and pan the image back and forth.
There will be other filters that I'll need to apply but I think they
will just end up being shaders.

What is the best approach for using OSG for this purpose? 

I was contemplating dumping the raw data into a texture and doing all
the decoding on the graphics card within a series of shaders. Is this a
viable approach?

Is there another tool that is better suited for the task?

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


Re: [osg-users] osgviewerWx compile errors

2008-04-15 Thread spowers
I have an additional issue...

Configure/make/make install works fine without running wxWidgets/make 
install.

When I install wxWidgets using make install the configure step in OSG 
fails like so:

cmake-2.4.7-Linux-i386/bin/cmake ../ -DDYNAMIC_OPENSCENEGRAPH=ON 
-DDYNAMIC_OPENTHREADS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_OSG_EXAMPLES=ON
CMake Error: Error in cmake code at
OpenSceneGraph-2.2.0/build/cmake-2.4.7-Linux-i386/share/cmake-2.4/Modules/FindwxWidgets.cmake:561:
STRING sub-command REGEX, mode MATCHALL needs at least 5 arguments total 
to command.
Current CMake stack:
[2]
OpenSceneGraph-2.2.0/build/cmake-2.4.7-Linux-i386/share/cmake-2.4/Modules/FindwxWidgets.cmake
[1]OpenSceneGraph-2.2.0/CMakeLists.txt
CMake Error: Error in cmake code at
OpenSceneGraph-2.2.0/build/cmake-2.4.7-Linux-i386/share/cmake-2.4/Modules/FindwxWidgets.cmake:564:
STRING sub-command REGEX, mode MATCH needs at least 6 arguments total to 
command.
Current CMake stack:
[2]
OpenSceneGraph-2.2.0/build/cmake-2.4.7-Linux-i386/share/cmake-2.4/Modules/FindwxWidgets.cmake
[1]OpenSceneGraph-2.2.0/CMakeLists.txt
CMake Error: Error in cmake code at
OpenSceneGraph-2.2.0/build/cmake-2.4.7-Linux-i386/share/cmake-2.4/Modules/FindwxWidgets.cmake:567:
STRING sub-command REGEX, mode MATCHALL needs at least 5 arguments total 
to command.
Current CMake stack:
[2]
OpenSceneGraph-2.2.0/build/cmake-2.4.7-Linux-i386/share/cmake-2.4/Modules/FindwxWidgets.cmake
[1]OpenSceneGraph-2.2.0/CMakeLists.txt
-- Found JPEG: /usr/lib/libjpeg.so
-- Found PNG: /usr/lib/libpng.so
-- Configuring done


Any Ideas what the problem can be


Mario Valle wrote:
 Be sure to configure wxWidgets with OpenGL support.
 Ciao!
 mario


 spowers wrote:
 I downloaded wxWidgets 2.8.7 (wxAll) from www.wxwidgets.org.

 The compile of wxWidgets seemed to work fine.
 I ran:
 ./configure
 make
 make install

 and didnt notice any errors

 I then configured/compiled OSG v2.2
 cmake ../ -DDYNAMIC_OPENSCENEGRAPH=ON -DDYNAMIC_OPENTHREADS=ON 
 -DCMAKE_BUILD_TYPE=Debug -DBUILD_OSG_EXAMPLES=ON
 make

 and OSG came up with multiple compiler errors when compiling osgviewerWX
 example WX_GL_DOUBLEBUFFER was not declared in this scope
 example WX_GL_RGBA was not declared in this scope

 There are more but they all seem to be related to a faulty 
 installation of wxWidgets or a bad configuration of OSG.

 Is there something that I'm missing or possibly a version mismatch?

 Thanks,

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



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


[osg-users] osgviewerWx compile errors

2008-04-10 Thread spowers
I downloaded wxWidgets 2.8.7 (wxAll) from www.wxwidgets.org.

The compile of wxWidgets seemed to work fine.
I ran:
./configure
make
make install

and didnt notice any errors

I then configured/compiled OSG v2.2
cmake ../ -DDYNAMIC_OPENSCENEGRAPH=ON -DDYNAMIC_OPENTHREADS=ON 
-DCMAKE_BUILD_TYPE=Debug -DBUILD_OSG_EXAMPLES=ON
make

and OSG came up with multiple compiler errors when compiling osgviewerWX
example WX_GL_DOUBLEBUFFER was not declared in this scope
example WX_GL_RGBA was not declared in this scope

There are more but they all seem to be related to a faulty installation 
of wxWidgets or a bad configuration of OSG.

Is there something that I'm missing or possibly a version mismatch?

Thanks,

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


Re: [osg-users] osgviewerWx compile errors

2008-04-10 Thread spowers
That did it thanks!

I suspected it was a configure problem.

Steven Powers
General Dynamics Robotic Systems
Software Engineer
1234 Tech Court
Westminster, MD 21157-3029
(410) 876-9200 x3489 Fax:(410)-876-9470



Mario Valle wrote:
 Be sure to configure wxWidgets with OpenGL support.
 Ciao!
 mario


 spowers wrote:
 I downloaded wxWidgets 2.8.7 (wxAll) from www.wxwidgets.org.

 The compile of wxWidgets seemed to work fine.
 I ran:
 ./configure
 make
 make install

 and didnt notice any errors

 I then configured/compiled OSG v2.2
 cmake ../ -DDYNAMIC_OPENSCENEGRAPH=ON -DDYNAMIC_OPENTHREADS=ON 
 -DCMAKE_BUILD_TYPE=Debug -DBUILD_OSG_EXAMPLES=ON
 make

 and OSG came up with multiple compiler errors when compiling osgviewerWX
 example WX_GL_DOUBLEBUFFER was not declared in this scope
 example WX_GL_RGBA was not declared in this scope

 There are more but they all seem to be related to a faulty 
 installation of wxWidgets or a bad configuration of OSG.

 Is there something that I'm missing or possibly a version mismatch?

 Thanks,

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



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