Re: [osg-users] noob question about texture3d

2009-09-28 Thread Otto Cologne
Thanks that helped a bit.

Any idea why 

Code:

osg::ref_ptrosg::Image ima = new osg::Image;
ima-allocateImage(160, 200, 160, GL_LUMINANCE, GL_UNSIGNED_BYTE);
std::cout  ima-getImageSizeInBytes()  std::endl;



returns 32000 instead of the expected 512?

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





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


Re: [osg-users] noob question about texture3d

2009-09-28 Thread Robert Osfield
Hi Otto,

On Mon, Sep 28, 2009 at 9:34 AM, Otto Cologne schur...@gmx.de wrote:
 Any idea why

 Code:

 osg::ref_ptrosg::Image ima = new osg::Image;
 ima-allocateImage(160, 200, 160, GL_LUMINANCE, GL_UNSIGNED_BYTE);
 std::cout  ima-getImageSizeInBytes()  std::endl;

 returns 32000 instead of the expected 512?

The osg::Image class has a series of methods for getting the size of the image:

/** Return the number of bits required for each pixel. */
inline unsigned int getPixelSizeInBits() const { return
computePixelSizeInBits(_pixelFormat,_dataType); }

/** Return the number of bytes each row of pixels occupies
once it has been packed. */
inline unsigned int getRowSizeInBytes() const { return
computeRowWidthInBytes(_s,_pixelFormat,_dataType,_packing); }

/** Return the number of bytes each image (_s*_t) of pixels occupies. */
inline unsigned int getImageSizeInBytes() const { return
getRowSizeInBytes()*_t; }

/** Return the number of bytes the whole row/image/volume of
pixels occupies. */
inline unsigned int getTotalSizeInBytes() const { return
getImageSizeInBytes()*_r; }


Each of these in term computes the next dimension up, from a single
pixel to a row, to whole 2d image, to a while 3d image.  In hindsight
the naming could have been chosen better.  For 3D images you'll want
to use getTotalSizeInBytes().

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


Re: [osg-users] OSG_FEM

2009-09-28 Thread Ugras Erdogan
Hi Umit,
Thanks for the answer. But I actually wondered if there are any finite element 
analysis kit compatible with OSG or has anyone coded a numerical analysis 
package (ie: linear decomposition, spectral decomposition, linear and/or 
nonlinear optimization, matrix analysis routiones) for the OSG distribution?
Regards,
Ugras





From: Ümit Uzun umituzu...@gmail.com
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Sent: Monday, September 28, 2009 1:19:36 PM
Subject: Re: [osg-users] OSG_FEM

Hi Ugras,

Actually I can't understand very well what you really want but you can look at 
http://www.simlab-soft.com/Products.html for modeling kit that can be used with 
OSG.

Regards.

Ümit Uzun



2009/9/28 Ugras Erdogan ugraserdo...@yahoo.com

Dear All,
Would anyone suggest a finite element modeling kit that can be used with OSG? 
I haven't noticed yet, but is there any numerical analysis package that is 
bundled with OSG distribution?
Best Regards,
Ugras

___
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


Re: [osg-users] [osgPPU] Using osgPPU

2009-09-28 Thread Hadrien Thomas
Hi,

Here is the minimal code I use that may help somebody in the future:
It lacks some comments but it's because I'm not sure I understand everything (I 
have been helped to get that)


Code:

#include osgViewer/Viewer
#include osgDB/ReadFile
#include osg/ShapeDrawable
#include iostream

#include osg/Texture2D
#include osg/Camera

#include osgPPU/Processor.h
#include osgPPU/UnitInOut.h
#include osgPPU/UnitOut.h
#include osgPPU/UnitTexture.h
#include osgPPU/ShaderAttribute.h


osg::Texture* createRenderTexture(int tex_width, int tex_height, bool depth)
{
// create simple 2D texture
osg::Texture2D* texture2D = new osg::Texture2D;
texture2D-setTextureSize(tex_width, tex_height);
texture2D-setResizeNonPowerOfTwoHint(false);
texture2D-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture2D-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);

texture2D-setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER);

texture2D-setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER);
texture2D-setBorderColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f));

osg::Image *image = new osg::Image();

image-allocateImage(tex_width, tex_height, 1, GL_RGBA, GL_FLOAT);
memset(image-data(), 0, image-getTotalSizeInBytes());

texture2D-setImage(image);
texture2D-setUnRefImageDataAfterApply(true);

// setup float format
if (!depth)
{
texture2D-setInternalFormat(GL_RGBA16F_ARB);
texture2D-setSourceFormat(GL_RGBA);
texture2D-setSourceType(GL_FLOAT);
}else{
texture2D-setInternalFormat(GL_DEPTH_COMPONENT);
}

return texture2D;
}


//--
//  Quad
//--

osg::Drawable* createSquare(float textureCoordMax=1.0f)
{
// set up the Geometry.
osg::Geometry* geom = new osg::Geometry;

osg::Vec3Array* coords = new osg::Vec3Array(4);
(*coords)[0].set(-1.0f,0.0f,1.0f);
(*coords)[1].set(-1.0f,0.0f,-1.0f);
(*coords)[2].set(1.0f,0.0f,-1.0f);
(*coords)[3].set(1.0f,0.0f,1.0f);
geom-setVertexArray(coords);

osg::Vec3Array* norms = new osg::Vec3Array(1);
(*norms)[0].set(0.0f,-1.0f,0.0f);
geom-setNormalArray(norms);
geom-setNormalBinding(osg::Geometry::BIND_OVERALL);

osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(0.0f,0.0f);
(*tcoords)[1].set(0.0f,textureCoordMax);
(*tcoords)[2].set(textureCoordMax,textureCoordMax);
(*tcoords)[3].set(textureCoordMax,0.0f);
geom-setTexCoordArray(0,tcoords);

geom-addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));

return geom;
}

//--
int main(int argc, char **argv)
{
// construct the scene
osg::Group* node = new osg::Group();
osg::Drawable* quad = createSquare();
osg::Geode* geode = new osg::Geode();
geode-addDrawable(quad);
node-addChild(geode);

// construct the viewer.
osgViewer::Viewer* viewer = new osgViewer::Viewer();
unsigned int screenWidth;
unsigned int screenHeight;

osg::GraphicsContext::getWindowingSystemInterface()-getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0),
 screenWidth, screenHeight);
unsigned int windowWidth = 640;
unsigned int windowHeight = 480;
viewer-setUpViewInWindow((screenWidth-windowWidth)/2, 
(screenHeight-windowHeight)/2, windowWidth, windowHeight);
viewer-setThreadingModel(osgViewer::Viewer::SingleThreaded);

// stateset
osg::StateSet *stateSet = quad-getOrCreateStateSet();

// texture
osg::Texture2D* texture = new osg::Texture2D;
osg::Image* image = osgDB::readImageFile(PathToImage);
if (!image)
{
std::cout   couldn't find texture, quiting.  std::endl;
return 1;
}
texture-setImage(image);
osgPPU::UnitTexture* unitTexture= new osgPPU::UnitTexture(texture);


//
// First
osgPPU::UnitInOut* unitInOut= new osgPPU::UnitInOut();
unitInOut-setInputToUniform(unitTexture,textureNameInShader,true);
osgPPU::ShaderAttribute* shaderAttribute= new osgPPU::ShaderAttribute();
{
osg::Shader* shader= new osg::Shader(osg::Shader::FRAGMENT);
const char* shaderSource=
uniform sampler2D textureNameInShader;\n
void main()\n
{\n
  

Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-28 Thread Jean-Sébastien Guay

Hi Dimitrios,

   I tried to write a function during the weekend. It works but the result is not so accurate. The floating objects are going up and down but they're not completely synchronized with the ocean surface. It seems that they are moving on a different phase or something. Here's my code 


Sorry, but since I'm not working on this right now as I mentioned 
before, I can't spend too much time helping you out with this... But one 
thing I found odd:



unsigned int frame = ++_oldFrame;


This will increment _oldFrame in place, and ALSO store the result in 
frame. So if _oldFrame was 1 before this line, it will be 2 after and 
the frame variable will also contain 2. Is this what you want? I don't 
think that you should be incrementing _oldFrame on each call of your 
function, it might change how the ocean surface is rendered... Try frame 
= _oldFrame + 1 instead.


Other than that I don't see anything suspect in your code, but it's hard 
to debug things by email - you have the code in front of you and a test 
case that doesn't give the right results, so you're best placed to debug 
it...


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OSG Windows XP environment setup??

2009-09-28 Thread Montgomery, John T.
Hi All,

I have (successfully, I think) compiled both Debug and Release of the current 
versions of OSG::Present3D.
I am on WinXP SP2, and using VS 9 (2008)

When I run present3dd C:\OSG_dev\OSG-Data\introduction.p3d from within the IDE, 
it runs as expected.
But, when I run it from a standard command-line console,  present3d crashes on 
find file Present3D/OpenSceneGraphlogo.png - it does the same anytime it 
tries to 'find file'.

I am not sure where to find a definitive statement how my environment should be 
set up?

In PATH I have included:

C:\OSG\bin\;
C:\OSG_dev\3rdParty\bin;
C:\OSG_dev\OSG-Data;
...but no other environmental variables.

Running Present3Dd for introduction.p3d on the command-line yields the error 
(in a windows dialogue):

Debug assertion failed!

Program: C:\OSG\bin\present3Dd.exe
File:  f:\dd\vctools\crt_bld\self_x86\crt\xstring  *** what's the f: ??! - 
where's that coming from ***
Line: 1595

Expression: string subscript out of range.
...
--

Any suggestions to get things running normally would be appreciated, thanks.

:-)
John Montgomery
Campfield, Glassel, Scotland.
Tel: 013398 82900
Mob: 07592 463 757
Website: http://www.thevigils.co.uk



The University of Aberdeen is a charity registered in Scotland, No SC013683.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG Windows XP environment setup?? SOLVED

2009-09-28 Thread Montgomery, John T.
Not clear why, but...

Each time I was running from within C:\OSG_dev\OSG-Data and therefore, using 
only 'introduction.p3d'
However, running from 'C:\Documents and Settings' - thus requiring a full-path 
for the input file - ' C:\OSG_dev\OSG-Data\introduction.p3d'
It worked!


:-)
John Montgomery, Glassel, Scotland.
Website: http://www.thevigils.co.uk





-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Montgomery, 
John T.
Sent: 28 September 2009 15:14
To: OSG (osg-users@lists.openscenegraph.org)
Subject: [osg-users] OSG Windows XP environment setup??

Hi All,

I have (successfully, I think) compiled both Debug and Release of the current 
versions of OSG::Present3D.
I am on WinXP SP2, and using VS 9 (2008)

When I run present3dd C:\OSG_dev\OSG-Data\introduction.p3d from within the IDE, 
it runs as expected.
But, when I run it from a standard command-line console,  present3d crashes on 
find file Present3D/OpenSceneGraphlogo.png - it does the same anytime it 
tries to 'find file'.

I am not sure where to find a definitive statement how my environment should be 
set up?

In PATH I have included:

C:\OSG\bin\;
C:\OSG_dev\3rdParty\bin;
C:\OSG_dev\OSG-Data;
...but no other environmental variables.

Running Present3Dd for introduction.p3d on the command-line yields the error 
(in a windows dialogue):

Debug assertion failed!

Program: C:\OSG\bin\present3Dd.exe
File:  f:\dd\vctools\crt_bld\self_x86\crt\xstring  *** what's the f: ??! - 
where's that coming from ***
Line: 1595

Expression: string subscript out of range.
...
--

Any suggestions to get things running normally would be appreciated, thanks.

:-)
John Montgomery
Campfield, Glassel, Scotland.
Tel: 013398 82900
Mob: 07592 463 757
Website: http://www.thevigils.co.uk



The University of Aberdeen is a charity registered in Scotland, No SC013683.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


The University of Aberdeen is a charity registered in Scotland, No SC013683.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG Windows XP environment setup??

2009-09-28 Thread Paul Martz
You'll need to set OSG_FILE_PATH to include the OpenSceneGraph-Data 
directory. If you don't have it, it's under svn. See the wiki.


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ http://www.skew-matrix.com/
+1 303 859 9466

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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-28 Thread Dimitrios Filiagos
Hi,

I checked the _oldFrame and you are absolutely right.


Thanks!


Dimitrios

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





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


Re: [osg-users] [3rdparty] osgOcean collision detection

2009-09-28 Thread Jean-Sébastien Guay

Hi Dimitrios,


I checked the _oldFrame and you are absolutely right.


So does that mean that my suggestion fixed it for you?

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Terrain generator compatible with OSG

2009-09-28 Thread Felipe Lemus
Hi,

Thanks both for your answers. Sorry, but I have been disconnected the last 
week. I am doing my final year project. I have designed a multimodal interface 
for control and monitor UAVs (Unmanned Aerial Vehicles). I have many tools: 
Head Tracking, Touch screens, 3D sound, etc... 

But I want to design with OGS a scenario with a plane with a mobile camera 
following a road in a 3D space and simulate a real situation for the station. 
So I only need a 3D scenario with a road, and I will add models imported form 
3D studio like cars, trucks, etc...

I am trying to install the programs that you recommended me, Jason. Thanks for 
the help. All new ideas are welcome!!!

Thank you!

Cheers,
Felipe

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





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


Re: [osg-users] Terrain generator compatible with OSG

2009-09-28 Thread Chris 'Xenon' Hanson
Felipe Lemus wrote:
 I am trying to install the programs that you recommended me, Jason. Thanks 
 for the help. All new ideas are welcome!!!

  The decision between VirtualPlanetBuilder and OSGEarth comes down to whether 
you want to
pre-build a database from the source data (VPB) or have the scen built 
on-the-fly from the
source data (OSGEarth). They both have their advantages. VPB scenes are very 
fast to load,
all the difficult work having been done up front during the VPB scene build 
stage.
OSGEarth can more easily display up-to-date changing terrain/ortho data as it 
builds it
all on the fly.

 Thank you!
 Cheers,
 Felipe

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [help]MinGW building error

2009-09-28 Thread Thiago Mael de Castro
Hi, Rain

It seems like this version of MinGW´s GCC does not define the preprocessor 
directive _GLIBCXX_USE_WCHAR_T, used in the iosfwd include for defining the 
wchar streams.
I was getting the same error and then forced the directive definition by 
passing the -D_GLIBCXX_USE_WCHAR_T option to GCC´s invocation (or DEFINES +=  
_GLIBCXX_USE_WCHAR_T in the .pro file if you´re using qmake). My code compiled 
well, but it happens that in my case the methods that need this #define are not 
actually used, so be careful.

Hope this helps!

Att,
Thiago

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





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


[osg-users] osgviewerQtWidget Quadbuffer Stereo Alpha Problems

2009-09-28 Thread Scott Senften
HI all,

I'm having two difficulties with osgviewerQtWidget on linux, and I was
hoping someone else may have already seen this and can give me some
insight as to my troubles.

In main.cpp, I added the following lines to turn on quadbuffer stereo.


QPointertestMainWin myMainWindow = new testMainWin;

#if DO_OUTBOARD_WINDOW
QPointertestOutboardWin mySecondaryWindow = new testOutboardWin;
#endif

/* added these 3 lines */
osg::DisplaySettings* ds = osg::DisplaySettings::instance();
ds-setStereo( true );
ds-setStereoMode( osg::DisplaySettings::QUAD_BUFFER );

  // The .ui file uses the Promoted widget, CompositeViewerQOSG
osg::ref_ptrCompositeViewerQOSG compositeViewer =
myMainWindow-ui.osgGraphicsArea;

osg::ref_ptrViewQOSG view1 = new ViewQOSG(
myMainWindow-ui.graphicsView1 );
view1-setObjectName(ViewQOSG 1);


When I do so, I get the following warning/error

Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,)

quadbuffer stereo is anabled on the system and I have other OGL apps
that work as expected.  It appears that the context is valid but I
haven't been able to retrieve the visual it thinks it's using to see
if it's picked an appropriate one.

ANAGLYPHIC stereo works as expected.

My other issue is trying to get a visual with alpha.  Similarly...

QPointertestMainWin myMainWindow = new testMainWin;

#if DO_OUTBOARD_WINDOW
QPointertestOutboardWin mySecondaryWindow = new testOutboardWin;
#endif

/* added these two lines */
osg::DisplaySettings* ds = osg::DisplaySettings::instance();
ds-setMinimumNumAlphaBits( 1 );

  // The .ui file uses the Promoted widget, CompositeViewerQOSG
osg::ref_ptrCompositeViewerQOSG compositeViewer =
myMainWindow-ui.osgGraphicsArea;

osg::ref_ptrViewQOSG view1 = new ViewQOSG(
myMainWindow-ui.graphicsView1 );
view1-setObjectName(ViewQOSG 1);


This gives me

X Error: BadMatch (invalid parameter attributes) 8
  Extension:143 (Uknown extension)
  Minor opcode: 5 (Unknown request)
  Resource id:  0x6400026
Error: In Texture::Extensions::setupGLExtensions(..) OpenGL version
test failed, requires valid graphics context.
Segmentation fault

which I'm assuming is because the context is either invalid or not current.

If anyone has seen these problems and has some insight, I'd be
grateful for your experience.

Thanks

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