Re: [osg-users] Render to texture with 32BIT (float) : How to test

2009-08-20 Thread Adrian Egli OpenSceneGraph (3D)
Hi Torben,

Well if you don't attach the texture object (32BIT) just the image (32BIT)
the RTT works with 8BIT. I guess OSG generates a own texture object and
attach the image. but this isn't a 32Bit texture (internal format). So you
would be attach the texture object, this is the correct way.

/regards
adrian

2009/8/19 Torben Dannhauer z...@saguaro-fight-club.de

 Hi,

 hmmm, whats the difference between both lines?

 Greetings,
 Torben

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





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




-- 

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


Re: [osg-users] Need help regarding rendering to a texture

2009-08-20 Thread J.P. Delport

Hi,

what do you get on screen with the code I attached? Should be a red 
square. What is your desired output?


jp

Brett Thomas Lee wrote:

Hi,

Thank you very much for the reply.Even though i changed those two things im 
unable get my desired output.

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





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



--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: [osg-users] Reference count catcher?

2009-08-20 Thread Ufuk
Hi Chris  Gordon,i did not know visual studio has an ability like that.
i believe i don't know how to use visual studio.. i realized that there are
many features that i did not know especially about these breakpoints.

Hi Jean-Sebastian,
thank you for your answer.. i will search the previous posts of you in the
archives.. it will be really useful for me because even if i use ref_ptr all
the time, i have memory leaks and i can't find them..
it will be useful for me...

thanks...

On Wed, Aug 19, 2009 at 10:27 PM, Jean-Sébastien Guay 
jean-sebastien.g...@cm-labs.com wrote:

 Hi Ufuk,

  thank you for your attention.. :)
 actually i didn't know that it is deleted on suitable time. i always
 expected it to be deleted when i set to NULL.


 Perhaps it's as simple as: the render back-end had a ref_ptr to your
 geometry because it was busy rendering it. So when you set your pointer to
 NULL, the ref count went down to 1, and at the end of rendering the current
 frame the render back-end released all its ref_ptrs and your geometry was
 deleted.

 Also, search the archives, I have posted a while back a modification to
 osg::Referenced that allowed you to have certain functions called each time
 a ref_ptr increments or decrements its reference count, along with Win32
 functions that captured the call stack at that point. I had developed it as
 a way of tracking a memory leak that was caused by circular ref_ptrs. The
 modifications in question were not general enough to be integrated (in
 particular they had no Linux/MacOS X implementation), but they were
 certainly useful for me, and it could be instructive to you if you want to
 know exactly who has each reference to your object.

 Hope this helps,

 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




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


[osg-users] 3DS writer: starting to code

2009-08-20 Thread Sukender
Hi all,

For all of those interested in a 3DS *writer* plugin, I begin coding. However:
- I only need a very basic one (faces, texture coords, simple materials), so if 
I'm alone this going to be an incomplete one
- I don't have much time (of course... else it wouldn't be fun...)
- I know very few about 3DS and low-level Geometries/Primitives/etc.

I'm looking at the OBJ writer, but I must admit I can't copy-paste-modify it 
efficiently.
So, please raise your hand if:
- You're interested
- You got ideas (especially on how to write a quite clean 3DS writer that can 
be extender later)
- You already have coded something, even partial
- You have anything that could help

Thanks!

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] 3D HUD Elements

2009-08-20 Thread Robert Osfield
Hi Jimmy,

If you are doing the frame loop you know when it's the first frame
before you just place any viewer setup prior to the frame loop.  The
_firstFrame code block you see if just a fallback in case the viewer
hasn't already been setup.

Robert.

On Wed, Aug 19, 2009 at 10:49 PM, Jimmy Lindummy...@gmail.com wrote:
 Hi,

 Here is the code of frame()


 Code:
 void ViewerBase::frame(double simulationTime)
 {
    if (_done) return;

    if (_firstFrame)
    {
        viewerInit();

        if (!isRealized())
        {
            realize();
        }

        _firstFrame = false;
    }
    advance(simulationTime);

    eventTraversal();
    updateTraversal();
    renderingTraversals();
 }



 It calls viewerInit() on the first frame.
 Don't I need to do that myself if I expand the code?
 By looking at the viewerInit() code. I think I might be able to expand the 
 code and init all the view I created.

 Thank you!

 Cheers,
 Jimmy

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





 ___
 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] osg 2.2 Adding and removing eventhandlers

2009-08-20 Thread James Sim
Hi Robert,

Thanks for the reply, can i use the newer versions of osg with visual studio 
2003?

I am trying to create a button class and thus i would like to embed the 
behaviours and event handling into the class itself.

Is my approach wrong? Should i be creating a separate class for event handling?

Thank you!

Cheers,
James

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





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


Re: [osg-users] osg 2.2 Adding and removing eventhandlers

2009-08-20 Thread Robert Osfield
Hi James,

From your email It isn't at all clear what you are doing, why you are
doing it, let alone what you are doing wrong.

It's very odd that you are trying to add a node as a event handler to
the viewer.  The OSG has an event traversal that will ensure your node
gets events.  Please have a look at the examples, and do a search for
EventCallback.

Also please try and upgrade to 2.8.2, the OSG has improved alot since 2.2.

Robert.

On Thu, Aug 20, 2009 at 5:01 AM, James Simyawny1...@hotmail.com wrote:
 Hi,

 I have a class called A that inherits osgGA::GUIEventHandler and osg::Switch. 
 I passed in the viewer from the main class to class A through class A's 
 constructor.

 In class A's constructor, i add the eventhandler to itself through the viewer.

 The problem occurs when i try to remove the children through the main class.

 What should be the proper way to do it?

 class A : public osg::Switch, osgGA::GUIEventHandler
 {
  A (osgViewer::Viewer * viewer)
  {
     viewer-addEventHandler(this)
  }
 }

 class MAIN
 {
  osgViewer viewer * viewer = new osgViewer();
  A a = new A(viewer);
  osg::Group * mainGroup = new osg::Group();
  mainGroup-addChild(a);
  viewer-setSceneData(mainGroup);

  mainGroup-removeChild(0, mainGroup-getNumChild()-1);
 }

 Thank you!

 Cheers,
 James

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





 ___
 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] Navigation control

2009-08-20 Thread Akilan
Hi,

I would like to design a navigation control similar to the one what google earth
is using for navigating my terrain DB. I have OSG 2.2 installed. Do I need 
anything extra
to do that? osgWidget is not available in that. How  to do that?

Thank you!

Cheers,
Akilan

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





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


Re: [osg-users] Navigation control

2009-08-20 Thread Tomlinson, Gordon
You will need to write your own motion controller / Model / Manipulator 

See  OpenSceneGraph\include\osgGA and OpenSceneGraph\src\osgGA

There are several Manipulators there that will show you how you can
write your own to do exactly what you want and need

Gordon
Product Manager 3d
__
Gordon Tomlinson
Email  : gtomlinson @ overwatch.textron.com
__


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Akilan
Sent: Thursday, August 20, 2009 7:19 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Navigation control

Hi,

I would like to design a navigation control similar to the one what
google earth is using for navigating my terrain DB. I have OSG 2.2
installed. Do I need anything extra to do that? osgWidget is not
available in that. How  to do that?

Thank you!

Cheers,
Akilan

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





___
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] OSG 2.8.2 rpms for Centos 5 and RedHat 5

2009-08-20 Thread Eric Sokolowsky
Peter Bear wrote:
 Hi,
 
 I got the error libcurl.so.3()(64bit) is needed by package 
 OpenSceneGraph-libs-2.8.2-1.x86_64 (/OpenSceneGraph-libs-2.8.2-1.x86_64) 
 while installing the libraries, and yes, I have checked and yum says curl is 
 installed.
 
 Cheers,
 Peter

Can you show me the output of this command:

  rpm -qa | grep curl

If it doesn't show the 64-bit version of curl, you can install it with
this command:

  yum install curl.x86_64

The 64-bit version of libcurl should be in /usr/lib64.

I'm trying to get a public yum repository set up so yum can be used to
automatically install required, missing dependencies (to avoid problems
such as this one).

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


[osg-users] Compress image

2009-08-20 Thread Ufuk
is there any function that compress image in osg?
for example i have an 256x256 image and i want to compress it to 128x128 or
64x64...

i checked for osg::Image::scaleImage() but it did not change the
resolution.. maybe i did something wrong?

Here is the code:

///
void simUtil::SimImageUtils::scaleAndSaveImage( osg::Image* image, float
scaleFactor, const std::string filename )
{
   osg::ref_ptrosg::Image cImage = new osg::Image(*image);

   cImage-scaleImage(image-s() * scaleFactor, image-t() * scaleFactor,
image-r() * scaleFactor);

   osgDB::writeImageFile(*image, filename);
}
///

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


Re: [osg-users] Compress image

2009-08-20 Thread Ümit Uzun
Hi Ufuk;

Compress word doesn't define your expected operation very well. This
operation's name is Mipmapping. You should generate automatic mipmapping for
your texture in runtime and the you can choose any resolution you have
created to use your program.

Regards.

Ümit Uzun


2009/8/20 Ufuk ufuk@gmail.com

 is there any function that compress image in osg?
 for example i have an 256x256 image and i want to compress it to 128x128 or
 64x64...

 i checked for osg::Image::scaleImage() but it did not change the
 resolution.. maybe i did something wrong?

 Here is the code:


 ///
 void simUtil::SimImageUtils::scaleAndSaveImage( osg::Image* image, float
 scaleFactor, const std::string filename )
 {
osg::ref_ptrosg::Image cImage = new osg::Image(*image);

cImage-scaleImage(image-s() * scaleFactor, image-t() * scaleFactor,
 image-r() * scaleFactor);

osgDB::writeImageFile(*image, filename);
 }

 ///

 --
 Ufuk

 ___
 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] Compress image

2009-08-20 Thread Ufuk
Hi Ümit,yes, i need mipmapping but i want to store these mipmapped textures
on disk. i dont want so many calculations on rendering...
so i wanted to store these images on disk.

do you know a way to do this or i should write a code?


On Thu, Aug 20, 2009 at 5:43 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Ufuk;

 Compress word doesn't define your expected operation very well. This
 operation's name is Mipmapping. You should generate automatic mipmapping for
 your texture in runtime and the you can choose any resolution you have
 created to use your program.

 Regards.

 Ümit Uzun


 2009/8/20 Ufuk ufuk@gmail.com

 is there any function that compress image in osg?
 for example i have an 256x256 image and i want to compress it to 128x128
 or 64x64...

 i checked for osg::Image::scaleImage() but it did not change the
 resolution.. maybe i did something wrong?

 Here is the code:


 ///
 void simUtil::SimImageUtils::scaleAndSaveImage( osg::Image* image, float
 scaleFactor, const std::string filename )
 {
osg::ref_ptrosg::Image cImage = new osg::Image(*image);

cImage-scaleImage(image-s() * scaleFactor, image-t() * scaleFactor,
 image-r() * scaleFactor);

osgDB::writeImageFile(*image, filename);
 }

 ///

 --
 Ufuk

 ___
 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




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


Re: [osg-users] Compress image

2009-08-20 Thread Jean-Sébastien Guay

Hi Ufuk,

yes, i need mipmapping but i want to store these mipmapped textures on 
disk. i dont want so many calculations on rendering...

so i wanted to store these images on disk.


You could just use a tool that converts your images to .dds with 
embedded mipmaps, I think in recent versions of OSG these are read 
correctly. Plus, the .dds format is more efficient in terms of video 
memory usage.


Hope this helps,

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] 3DS loader revisited?

2009-08-20 Thread Sukender
Hi Robert,

Good news! I've sync'd the 3DS reader with lib3DS 2.0.0-rc1 (well, I need to 
modify the CMakeList now). I'm not 100% sure that the one I used ( 
http://www.lib3ds.org/ ) is the same as the one used in OSG... Am I wrong ? If 
not, is it a problem ?

Should the lib3DS files be in osgPlugins/3ds, or osgPlugins/3ds/lib3DS, or 
simply oustide as an external dependency to make sync easier?

Once cleaned and submitted, I'll work on the 3DS writer, as told in another 
thread.

Cheers,

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

- Mail Original -
De: Robert Osfield robert.osfi...@gmail.com
À: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Envoyé: Mercredi 5 Août 2009 17h40:54 GMT +01:00 Amsterdam / Berlin / Berne / 
Rome / Stockholm / Vienne
Objet: Re: [osg-users] 3DS loader revisited?

Hi Sukender,

In the past (quite a few years ago now) I did sync with lib3ds, but it
didn't change for a long while so haven't kept up with it.  The OSG's
version has now diverged substationally from lib3ds with it's use of
istream's rather than FILE so an easy merge will no longer be
possible.

What could probably do is backport the features from the current
lib3ds you want.

Robert.

On Wed, Aug 5, 2009 at 3:30 PM, Sukendersuky0...@free.fr wrote:
 Hi all,

 I'm working on something that needs 3DS import (Well, a modified 3DS import, 
 that reads data in keyframes). However I noticed the underlying lib3DS seems 
 a bit old (and it seems the few problems I got are related). Is that really 
 true? Should we work on upgrading the loader, or is there a risk to break 
 compatibility?
 Any thoughts will be appreciated...
 Thanks!

 Sukender
 PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Compress image

2009-08-20 Thread Ümit Uzun
Hi Ufuk;

If you want to create mippaped images on your disk instead of
programmaticaly. I suggest you to use GIMP to mipmap(rescale each different
resolution image separately) and when you need you can call related
resolution image :)

Is this your expected or you want to create one image which has all
resoluted images in it? If you want kind of this operation you can use dds
format. But I don't know osg does support reading mipmapped dds format.

Regards.

Ümit Uzun


2009/8/20 Ufuk ufuk@gmail.com

 Hi Ümit,yes, i need mipmapping but i want to store these mipmapped
 textures on disk. i dont want so many calculations on rendering...
 so i wanted to store these images on disk.

 do you know a way to do this or i should write a code?


 On Thu, Aug 20, 2009 at 5:43 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Ufuk;

 Compress word doesn't define your expected operation very well. This
 operation's name is Mipmapping. You should generate automatic mipmapping for
 your texture in runtime and the you can choose any resolution you have
 created to use your program.

 Regards.

 Ümit Uzun


 2009/8/20 Ufuk ufuk@gmail.com

  is there any function that compress image in osg?
 for example i have an 256x256 image and i want to compress it to 128x128
 or 64x64...

 i checked for osg::Image::scaleImage() but it did not change the
 resolution.. maybe i did something wrong?

 Here is the code:


 ///
 void simUtil::SimImageUtils::scaleAndSaveImage( osg::Image* image, float
 scaleFactor, const std::string filename )
 {
osg::ref_ptrosg::Image cImage = new osg::Image(*image);

cImage-scaleImage(image-s() * scaleFactor, image-t() * scaleFactor,
 image-r() * scaleFactor);

osgDB::writeImageFile(*image, filename);
 }

 ///

 --
 Ufuk

 ___
 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




 --
 Ufuk

 ___
 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] Compress image

2009-08-20 Thread Ufuk
actually i just want to have a scale code of image..
half and quarter resolution would be enough for me..
i wanted to scale them when i create terrain.

i have a terrain editor and viewer which are 2 separate programs.
on editor, in saving process, i want to store lower resolution textures too
and i wanted to create in my program.

my terrain viewer program will load all textures and use low resolution
textures for pages which are far away from the camera..

i don't want to use .dds because in terrain editor, user can use any texture
he wants. so i don't want to give up texture selection dynamism here.. i
can't limit users just with my textures which are selected before.

On Thu, Aug 20, 2009 at 5:58 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Ufuk;

 If you want to create mippaped images on your disk instead of
 programmaticaly. I suggest you to use GIMP to mipmap(rescale each different
 resolution image separately) and when you need you can call related
 resolution image :)

 Is this your expected or you want to create one image which has all
 resoluted images in it? If you want kind of this operation you can use dds
 format. But I don't know osg does support reading mipmapped dds format.


 Regards.

 Ümit Uzun


 2009/8/20 Ufuk ufuk@gmail.com

 Hi Ümit,yes, i need mipmapping but i want to store these mipmapped
 textures on disk. i dont want so many calculations on rendering...
 so i wanted to store these images on disk.

 do you know a way to do this or i should write a code?


 On Thu, Aug 20, 2009 at 5:43 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Ufuk;

 Compress word doesn't define your expected operation very well. This
 operation's name is Mipmapping. You should generate automatic mipmapping for
 your texture in runtime and the you can choose any resolution you have
 created to use your program.

 Regards.

 Ümit Uzun


 2009/8/20 Ufuk ufuk@gmail.com

  is there any function that compress image in osg?
 for example i have an 256x256 image and i want to compress it to 128x128
 or 64x64...

 i checked for osg::Image::scaleImage() but it did not change the
 resolution.. maybe i did something wrong?

 Here is the code:


 ///
 void simUtil::SimImageUtils::scaleAndSaveImage( osg::Image* image, float
 scaleFactor, const std::string filename )
 {
osg::ref_ptrosg::Image cImage = new osg::Image(*image);

cImage-scaleImage(image-s() * scaleFactor, image-t() *
 scaleFactor, image-r() * scaleFactor);

osgDB::writeImageFile(*image, filename);
 }

 ///

 --
 Ufuk

 ___
 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




 --
 Ufuk

 ___
 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




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


Re: [osg-users] 3DS loader revisited?

2009-08-20 Thread Robert Osfield
Hi Sukender,

On Thu, Aug 20, 2009 at 3:57 PM, Sukendersuky0...@free.fr wrote:
 Good news! I've sync'd the 3DS reader with lib3DS 2.0.0-rc1 (well, I need to 
 modify the CMakeList now). I'm not 100% sure that the one I used ( 
 http://www.lib3ds.org/ ) is the same as the one used in OSG... Am I wrong ? 
 If not, is it a problem ?

I believe it's probaby the same lib3ds, it's quite a few years since I
reviewed the original source though.  You should be able to spot
similarities with the existing code base.

Just adopting lib3ds won't carry the modifications that have been made
by members of the OSG community so support reading for istreams etc,
so I don't think a straight adoption of lib3ds will be possible
without modifications of lib3ds or our plugin.  I'm opposed to
adopting any new code that drops existing functionality, the existing
functionality is being actively used by members of the community.
While 3ds write hasn't been up to now a requirement.

 Should the lib3DS files be in osgPlugins/3ds, or osgPlugins/3ds/lib3DS, or 
 simply oustide as an external dependency to make sync easier?

I've original put lib3ds into the 3ds plugin directory just to enable
easy build for OSG users.  These days with CMake building against 3rd
party dependencies is less onerous, so potentially would could spin it
out.  The bottom line is the ability to support all that is supported
by the existing plugin.

 Once cleaned and submitted, I'll work on the 3DS writer, as told in another 
 thread.

So are you porting the existing plugin across to use the external
lib3ds, writing a new plugin from scratch, adapting the new lib3ds to
be closer to what we have?

I'm curious as to why writing to .3ds is a goal, as a exchange format
it's pretty poor.

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


Re: [osg-users] Frame rates vary dramatically across runs

2009-08-20 Thread Robert Osfield
Hi Wojtek,

I've done my best to enjoy my vacation(s!) and now will take joy in
pestering you about the changes we discussed, did you get around to
making them :-)

Cheers,
Robert.

On Mon, Jul 27, 2009 at 4:27 PM, Wojciech
Lewandowskilewandow...@ai.com.pl wrote:
 Robert,

 I'll try to do it.
 Enjoy your vacations,

 Wojtek

 - Original Message - From: Robert Osfield
 robert.osfi...@gmail.com
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Sent: Monday, July 27, 2009 4:37 PM
 Subject: Re: [osg-users] Frame rates vary dramatically across runs


 Hi Wojtek,

 On Mon, Jul 27, 2009 at 3:23 PM, Wojciech
 Lewandowskilewandow...@ai.com.pl wrote:

 I think we are pretty much on the same page. Question (which J-S asked)
 is
 who does this ? I may not uderstand all the intricacies, but I promised
 to
 look at the code and come up with submission proposal in next few days. I
 ll
 try do to my best, but let me know, if You feel like its better to leave
 the
 problem for You to solve.

 I'm just about to head off on another weeks family holiday so I won't
 be able to take on work right away, so please feel free in diving in
 and making the required changes.  Any changes it'd be worth pushing on
 to the list to get them tried out.

 Cheers,
 Robert.
 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Compress image

2009-08-20 Thread Robert Osfield
Hi Ufuk,

To do OpenGL calls like the gluScale that osg::Image::scaleImage
invokes you must call it from a thread that has valid graphics context
current, otherwise you'll at best get a non, but most likely
corruption/crashes.   This may or may not be the problem in your case.

Robert.

On Thu, Aug 20, 2009 at 4:26 PM, Ufukufuk@gmail.com wrote:
 actually i just want to have a scale code of image..
 half and quarter resolution would be enough for me..
 i wanted to scale them when i create terrain.
 i have a terrain editor and viewer which are 2 separate programs.
 on editor, in saving process, i want to store lower resolution textures too
 and i wanted to create in my program.
 my terrain viewer program will load all textures and use low resolution
 textures for pages which are far away from the camera..
 i don't want to use .dds because in terrain editor, user can use any texture
 he wants. so i don't want to give up texture selection dynamism here.. i
 can't limit users just with my textures which are selected before.
 On Thu, Aug 20, 2009 at 5:58 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Ufuk;

 If you want to create mippaped images on your disk instead of
 programmaticaly. I suggest you to use GIMP to mipmap(rescale each different
 resolution image separately) and when you need you can call related
 resolution image :)

 Is this your expected or you want to create one image which has all
 resoluted images in it? If you want kind of this operation you can use dds
 format. But I don't know osg does support reading mipmapped dds format.

 Regards.

 Ümit Uzun


 2009/8/20 Ufuk ufuk@gmail.com

 Hi Ümit,
 yes, i need mipmapping but i want to store these mipmapped textures on
 disk. i dont want so many calculations on rendering...
 so i wanted to store these images on disk.
 do you know a way to do this or i should write a code?

 On Thu, Aug 20, 2009 at 5:43 PM, Ümit Uzun umituzu...@gmail.com wrote:

 Hi Ufuk;

 Compress word doesn't define your expected operation very well. This
 operation's name is Mipmapping. You should generate automatic mipmapping 
 for
 your texture in runtime and the you can choose any resolution you have
 created to use your program.

 Regards.

 Ümit Uzun


 2009/8/20 Ufuk ufuk@gmail.com

 is there any function that compress image in osg?
 for example i have an 256x256 image and i want to compress it to
 128x128 or 64x64...
 i checked for osg::Image::scaleImage() but it did not change the
 resolution.. maybe i did something wrong?
 Here is the code:

 ///
 void simUtil::SimImageUtils::scaleAndSaveImage( osg::Image* image,
 float scaleFactor, const std::string filename )
 {
    osg::ref_ptrosg::Image cImage = new osg::Image(*image);
    cImage-scaleImage(image-s() * scaleFactor, image-t() *
 scaleFactor, image-r() * scaleFactor);
    osgDB::writeImageFile(*image, filename);
 }

 ///

 --
 Ufuk

 ___
 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




 --
 Ufuk

 ___
 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




 --
 Ufuk

 ___
 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] Frame rates vary dramatically across runs

2009-08-20 Thread Robert Osfield
Hi Wojtek,

Arg... I'm working through my osg-submission backlog but didn't spot
the thread your submitted the changes on as being connected.  I should
have read through all the submissions before posting...

I've tracked down the appropriate thread now - I've even commented on
the thread last week, so it looks like my memory is not serving me
well...

But now I'll get on with doing a proper review, thanks for the patience,

Robert.

On Thu, Aug 20, 2009 at 5:16 PM, Wojciech
Lewandowskilewandow...@ai.com.pl wrote:
 Hi Robert,

 Weird. I have sent this on 7th of August and it arrived back to me through
 osg-users and osg-submissions mailing lists:

 Re: [osg-submissions] [osg-users] FBOs without color or depthattachments
 /DrawBuffer/ ReadBuffer

 I wanted to send you a link to forums, but I cannot find it there, though.
 However, I have found a post that refers to my submission:

 http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg30839.html

 But when I move one post back it moves me to much older post. So its not
 available on forums. Where is the problem ? Maybe because it was sent to
 both osg-users and osg-submissions ? To be sure I copied it below
 (attachment also provided):

 

 Hi Robert and J-S and all interested,

 I have prepared the code for the proposal.  There was a  bunch of changes to
 Camera/SceneView/CullVisitor/RenderStage (and few other files). Its not
 exactly like what we planned because practice once again showed the theories
 are only work on paper and on the internet;- ).

 I initially have written the code for lazy updates of DrawBuffer and
 ReadBuffer to osg::State. But during debugging  reading FBO spec again, I
 learned that  it does not make sense. OpenGL treats DrawBuffer/ReadBuffers
 as members of FBO state. Buffers are not unique per GL context but each FBO
 can have them set differently and once FBO is bound its
 DrawBuffer/ReadBuffer selection is made active. So it won't work to keep
 them in State.

 For the first point of our plan I also had to make modifications.
 Fortunately, as planned, camera uses inheritance DRAW_BUFFER / READ_BUFFER
 masks. However,  RenderStage code seems to not always expect presence of
 associated camera that would contain valid DrawBuffer/ReadBuffer settings.
 For this case it was neccessary to add  _drawBufferApplyMask /
 _readBufferApplyMask flags to RenderStage. These flags effectively replace
 former case of RenderStage::_drawBuffer/RenderStage::_readBuffer being set
 to GL_NONE. These flags are now used to inform RenderStage to inherit / not
 touch buffer settings from what was set in prior stage.

 See the attached code for details. I must admit that this modification
 eluded me a bit. I hope I did everything properly, but I really count on
 peer reviews.

 I have left FORCE_COLOR_ATTACHMENT / FORCE_DEPTH_ATTACHMENT defines in the
 RenderStage.cpp. I expect that Robert will take decision to remove them or
 keep them for a while. FORCE_COLOR_ATTACHMENT is set to 0 but
 FORCE_DEPTH_ATTACHMENT is set to 1. I tested the changes with Viewer
 Prerender/ Shadow examples. I noticed that when DEPTH_ATTACHMENT is not
 forced, depth tests in Prerender fail and Cow.osg or Cessna.osg are
 displayyed with holes. So it would be necccesary to test all examples
 using FBOs and check if they require exlpicit setting of depth attachments.
 Once examples are fixed one may turn off  FORCE_DEPTH_ATTACHMENT in
 RenderStage.cpp.

 Uff, It was bit exhausting. I have spent 3 days on this stuff and I must
 admit that it is still undertested. Unfortunatelly, I have to move over to
 other activities this week. If it becomes neccessary, I will go back to the
 subject after next weekend. Although I doubt I will be able to do any coding
 this week but  I should be able to stay in touch with forums.  I also hope,
 that in the meantime You will look at these changes, test them and make
 neccessary tweaks or send me requests for aditional changes.


 

 Cheers,

 Wojtek



 - Original Message -
 From: Robert Osfield robert.osfi...@gmail.com
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Sent: Thursday, August 20, 2009 5:34 PM
 Subject: Re: [osg-users] Frame rates vary dramatically across runs
 Hi Wojtek,

 I've done my best to enjoy my vacation(s!) and now will take joy in
 pestering you about the changes we discussed, did you get around to
 making them :-)

 Cheers,
 Robert.

 On Mon, Jul 27, 2009 at 4:27 PM, Wojciech
 Lewandowskilewandow...@ai.com.pl wrote:
 Robert,

 I'll try to do it.
 Enjoy your vacations,

 Wojtek

 - Original Message - From: Robert Osfield
 robert.osfi...@gmail.com
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Sent: Monday, July 27, 2009 4:37 PM
 Subject: Re: [osg-users] Frame rates vary dramatically across runs


 Hi Wojtek,

 On Mon, Jul 27, 2009 at 3:23 PM, Wojciech
 Lewandowskilewandow...@ai.com.pl wrote:

 I think we are pretty much on the same page. Question (which J-S 

[osg-users] Loading an osg::Image using setImage

2009-08-20 Thread Andrew Thompson
Hi there, 

I am trying to load an osg::Image using the setImage method - inparticular I am 
copying a Managed bitmap (System.Drawing.Bitmap) to the osg::Image to use it as 
a texture map. 

As you can see I'm having a few problems. Here's the osg::Image texture mapped 
onto a quad when I load it in from file using osgDB::readImageFile

[Image: http://i137.photobucket.com/albums/q217/andyb1979/tquadreadimage.png ]

Here's the same textured quad, but the osg::Image was created using setImage 
and a copy from a managed bitmap

[Image: http://i137.photobucket.com/albums/q217/andyb1979/th_tquadsetimage.png ]

As you can see the image seems to have been inverted and flipped!

Here is my code to convert a managed bitmap to osg::Image. The input bitmap has 
been loaded from file, is in the format 24bpp RGB. 

I know I'm getting the size/bits per pixel right as the output osg::Image is 
the right shape and size, with no tearing. However I don't know why the image 
is inverted!


Code:

osg::ref_ptrosg::Image 
SceneUtil::ManagedBitmapToOSGImage(System::Drawing::Bitmap ^ bitmap)
{
//
// Check params
//

if (bitmap == nullptr)
{
throw gcnew Exception(Unable to convert 
System::Drawing::Bitmap to osg::Image as the input image is null);
}

if (bitmap-PixelFormat != 
System::Drawing::Imaging::PixelFormat::Format24bppRgb)
{
throw gcnew Exception(Unable to convert 
System::Drawing::Bitmap to osg::Image as the input image must be in the format 
Format24bppRgb);
}

// Create a new OSG Image
osg::ref_ptrosg::Image image = new osg::Image();

System::Drawing::Imaging::BitmapData ^ bitmapData = bitmap-LockBits(
System::Drawing::Rectangle(0, 0, bitmap-Width, 
bitmap-Height), 
System::Drawing::Imaging::ImageLockMode::ReadOnly, 
System::Drawing::Imaging::PixelFormat::Format24bppRgb);

// Create data to hold the destination image
BYTE * ptrSrcImage = (BYTE*)bitmapData-Scan0.ToPointer();
BYTE * ptrDestImage = new unsigned char [bitmap-Width * bitmap-Height 
* 3];   
BYTE * ptrSourceRow = nullptr;
BYTE * ptrDestRow = nullptr;

int iWidth = bitmapData-Width;
int iHeight = bitmapData-Height;
int iStride = bitmapData-Stride;

// Copy the System::Drawing::Bitmap instance over line by line - this 
gets around the 
// lack of stride support in the osg::Image. 
for(int i = 0; i  iHeight; i++)
{
// Get the source row pointer
ptrSourceRow = ptrSrcImage + (i * iStride);

// Get the destination row pointer
ptrDestRow = ptrDestImage + (i * (iWidth * 3));

// Copy the source row to the destination row
memcpy(ptrDestRow, ptrSourceRow, iWidth * 3);
}

// Set the data on the osg::Image
image-setImage(
bitmap-Width, 
bitmap-Height, 
1, 
GL_RGB,
GL_RGB,
GL_UNSIGNED_BYTE, 
ptrDestImage, 
osg::Image::USE_NEW_DELETE);

bitmap-UnlockBits(bitmapData);

return image;
}




Any ideas?

Thank you!

Andrew

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





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


[osg-users] Orienting a model (matrixtrans) toward a target location?

2009-08-20 Thread Kris Dale
Hello all!

I've searched through the forums and all over google and can't seem to find 
anything on this subject.  I'm sure this probably isn't TOO complicated but I'm 
still new to this and my graphics / linear knowledge probably isn't what it 
should be.

Here's my problem..  or what I'm attempting to do anyway.  I have a model 
loaded into a node loaded into a matrixtransformation.  While at some point in 
space, I want to orient the model back at a target location.  For simplicity 
and ease of explaining the design, let's call the model a rocket.  The idea is 
to orient the rocket toward the target location and then set an update 
callback moving it along that path.

All of this is no big deal other than setting the initial orientation.  I'm not 
really sure how to do that.  I know how to make rotations and such, but I don't 
really know how to dynamically check to see if the current orientation is 
aligned on the right path.

Eventually I'd like the orientation to be animated (ie. a callback that rotates 
the model in place until it's aligned with the target path or something of that 
nature) but for the moment I'd like to just know how to come up with a single 
rotation from any point toward another point.  I THINK I can figure out the 
rest...  maybe... hopefully?  :)  hahaha.  

Thanks to anyone that can help me out with this..
Kris

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





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


Re: [osg-users] Loading an osg::Image using setImage

2009-08-20 Thread Farshid Lashkari
Hi Andrew,
It looks like the original bitmap is in BGR format, so you will probably
need to use the GL_BGR pixel format when calling setImage(). To unflip the
image it seems like you can iterate backwards over the source image inside
your copy loop:

ptrSourceRow = ptrSrcImage + ( (iHeight  - 1 - i) * iStride);

I believe this should fix your problems.

Cheers,
Farshid

On Thu, Aug 20, 2009 at 9:46 AM, Andrew Thompson andyb1...@yahoo.co.ukwrote:

 Hi there,

 I am trying to load an osg::Image using the setImage method - inparticular
 I am copying a Managed bitmap (System.Drawing.Bitmap) to the osg::Image to
 use it as a texture map.

 As you can see I'm having a few problems. Here's the osg::Image texture
 mapped onto a quad when I load it in from file using osgDB::readImageFile

 [Image:
 http://i137.photobucket.com/albums/q217/andyb1979/tquadreadimage.png ]

 Here's the same textured quad, but the osg::Image was created using
 setImage and a copy from a managed bitmap

 [Image:
 http://i137.photobucket.com/albums/q217/andyb1979/th_tquadsetimage.png ]

 As you can see the image seems to have been inverted and flipped!

 Here is my code to convert a managed bitmap to osg::Image. The input bitmap
 has been loaded from file, is in the format 24bpp RGB.

 I know I'm getting the size/bits per pixel right as the output osg::Image
 is the right shape and size, with no tearing. However I don't know why the
 image is inverted!


 Code:

 osg::ref_ptrosg::Image
 SceneUtil::ManagedBitmapToOSGImage(System::Drawing::Bitmap ^ bitmap)
 {
//
// Check params
//

if (bitmap == nullptr)
{
throw gcnew Exception(Unable to convert
 System::Drawing::Bitmap to osg::Image as the input image is null);
}

if (bitmap-PixelFormat !=
 System::Drawing::Imaging::PixelFormat::Format24bppRgb)
{
throw gcnew Exception(Unable to convert
 System::Drawing::Bitmap to osg::Image as the input image must be in the
 format Format24bppRgb);
}

// Create a new OSG Image
osg::ref_ptrosg::Image image = new osg::Image();

System::Drawing::Imaging::BitmapData ^ bitmapData =
 bitmap-LockBits(
System::Drawing::Rectangle(0, 0, bitmap-Width,
 bitmap-Height),
System::Drawing::Imaging::ImageLockMode::ReadOnly,
System::Drawing::Imaging::PixelFormat::Format24bppRgb);

// Create data to hold the destination image
BYTE * ptrSrcImage = (BYTE*)bitmapData-Scan0.ToPointer();
BYTE * ptrDestImage = new unsigned char [bitmap-Width *
 bitmap-Height * 3];
BYTE * ptrSourceRow = nullptr;
BYTE * ptrDestRow = nullptr;

int iWidth = bitmapData-Width;
int iHeight = bitmapData-Height;
int iStride = bitmapData-Stride;

// Copy the System::Drawing::Bitmap instance over line by line -
 this gets around the
// lack of stride support in the osg::Image.
for(int i = 0; i  iHeight; i++)
{
// Get the source row pointer
ptrSourceRow = ptrSrcImage + (i * iStride);

// Get the destination row pointer
ptrDestRow = ptrDestImage + (i * (iWidth * 3));

// Copy the source row to the destination row
memcpy(ptrDestRow, ptrSourceRow, iWidth * 3);
}

// Set the data on the osg::Image
image-setImage(
bitmap-Width,
bitmap-Height,
1,
GL_RGB,
GL_RGB,
GL_UNSIGNED_BYTE,
ptrDestImage,
osg::Image::USE_NEW_DELETE);

bitmap-UnlockBits(bitmapData);

return image;
 }




 Any ideas?

 Thank you!

 Andrew

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





 ___
 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] Shdows Problem o vista

2009-08-20 Thread Danny Lesnik
Hi,

I'm using Visual Studio 2008 with osg 2.8.1. I have vary strange problem with 
with shadows on my scene. On vista all shadows are moved chaoticaly (see 
attached pictures ). However on XP everything is OK and I can see my shadows 
casted by camera lights.

I'm using the following code:

 const int ShadowTraversalMask = 0x2;
osg::ref_ptrosgShadow::ShadowedScene shadowedScene = new 
osgShadow::ShadowedScene;
shadowedScene-setReceivesShadowTraversalMask(ShadowTraversalMask);

shadowedScene-setCastsShadowTraversalMask(ShadowTraversalMask);

osg::ref_ptrosgShadow::ShadowMap sm = new osgShadow::ShadowMap;
shadowedScene-setShadowTechnique(sm.get());
int mapres = 4096;
sm-setTextureSize(osg::Vec2s(mapres,mapres));

node-setNodeMask(ShadowTraversalMask);
shadowedScene-addChild(node);

How can I solve this problem on Vista 



Thank you!

Cheers,
Danny

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



attachment: XP.JPGattachment: Vista.jpg___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Loading an osg::Image using setImage

2009-08-20 Thread Andrew Burnett-Thompson
Hmm, well that was easy!

The flipping of rows worked fine, to set the image I used GL_BGR for pixel
format only, keeping GL_RGB as internal pixel format (else I got a gray
square).

Thank you for an extremely helpful response :)

Andrew

On Thu, Aug 20, 2009 at 6:15 PM, Farshid Lashkari fla...@gmail.com wrote:

 Hi Andrew,
 It looks like the original bitmap is in BGR format, so you will probably
 need to use the GL_BGR pixel format when calling setImage(). To unflip the
 image it seems like you can iterate backwards over the source image inside
 your copy loop:

 ptrSourceRow = ptrSrcImage + ( (iHeight  - 1 - i) * iStride);

 I believe this should fix your problems.

 Cheers,
 Farshid

 On Thu, Aug 20, 2009 at 9:46 AM, Andrew Thompson andyb1...@yahoo.co.ukwrote:

 Hi there,

 I am trying to load an osg::Image using the setImage method - inparticular
 I am copying a Managed bitmap (System.Drawing.Bitmap) to the osg::Image to
 use it as a texture map.

 As you can see I'm having a few problems. Here's the osg::Image texture
 mapped onto a quad when I load it in from file using osgDB::readImageFile

 [Image:
 http://i137.photobucket.com/albums/q217/andyb1979/tquadreadimage.png ]

 Here's the same textured quad, but the osg::Image was created using
 setImage and a copy from a managed bitmap

 [Image:
 http://i137.photobucket.com/albums/q217/andyb1979/th_tquadsetimage.png ]

 As you can see the image seems to have been inverted and flipped!

 Here is my code to convert a managed bitmap to osg::Image. The input
 bitmap has been loaded from file, is in the format 24bpp RGB.

 I know I'm getting the size/bits per pixel right as the output osg::Image
 is the right shape and size, with no tearing. However I don't know why the
 image is inverted!


 Code:

 osg::ref_ptrosg::Image
 SceneUtil::ManagedBitmapToOSGImage(System::Drawing::Bitmap ^ bitmap)
 {
//
// Check params
//

if (bitmap == nullptr)
{
throw gcnew Exception(Unable to convert
 System::Drawing::Bitmap to osg::Image as the input image is null);
}

if (bitmap-PixelFormat !=
 System::Drawing::Imaging::PixelFormat::Format24bppRgb)
{
throw gcnew Exception(Unable to convert
 System::Drawing::Bitmap to osg::Image as the input image must be in the
 format Format24bppRgb);
}

// Create a new OSG Image
osg::ref_ptrosg::Image image = new osg::Image();

System::Drawing::Imaging::BitmapData ^ bitmapData =
 bitmap-LockBits(
System::Drawing::Rectangle(0, 0, bitmap-Width,
 bitmap-Height),
System::Drawing::Imaging::ImageLockMode::ReadOnly,
System::Drawing::Imaging::PixelFormat::Format24bppRgb);

// Create data to hold the destination image
BYTE * ptrSrcImage = (BYTE*)bitmapData-Scan0.ToPointer();
BYTE * ptrDestImage = new unsigned char [bitmap-Width *
 bitmap-Height * 3];
BYTE * ptrSourceRow = nullptr;
BYTE * ptrDestRow = nullptr;

int iWidth = bitmapData-Width;
int iHeight = bitmapData-Height;
int iStride = bitmapData-Stride;

// Copy the System::Drawing::Bitmap instance over line by line -
 this gets around the
// lack of stride support in the osg::Image.
for(int i = 0; i  iHeight; i++)
{
// Get the source row pointer
ptrSourceRow = ptrSrcImage + (i * iStride);

// Get the destination row pointer
ptrDestRow = ptrDestImage + (i * (iWidth * 3));

// Copy the source row to the destination row
memcpy(ptrDestRow, ptrSourceRow, iWidth * 3);
}

// Set the data on the osg::Image
image-setImage(
bitmap-Width,
bitmap-Height,
1,
GL_RGB,
GL_RGB,
GL_UNSIGNED_BYTE,
ptrDestImage,
osg::Image::USE_NEW_DELETE);

bitmap-UnlockBits(bitmapData);

return image;
 }




 Any ideas?

 Thank you!

 Andrew

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





 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Convert paged to non-paged terrain database

2009-08-20 Thread Appolloni, Thomas
Justin wrote:

 Thanks to Robert and Paul, I created the attached application to do
the 
 terrain database conversion.  Perhaps it will be of some use to
someone else.
 
 Using this application, my paged database of 655936 kB was converted
to a 
 non-paged database of 415288 kB.
 
 Of course, I decided to take it a step further and perform texture
conversions 
 as well.  I wanted to convert the .dds texture files to .jpg.  This
code is 
 stubbed in; however, it does not work.  I thought I could simply call 
 osgDB::writeImageFile.  Unfortunately, the individual image format
writer 
 plugins do not appear to handle converting from different pixel
formats or 
 packing.  Does OSG contain code for converting osg::Image between
different 
 pixel formats?  Am I missing an easier option?
 
 Thanks,
 Justin

Justin,

I didn't see any additional traffic on this thread. Were you able to get
a
solution to this image conversion problem. I'm now facing a similar
situation
with the .dds image node from generated osgdem tiles and want to convert

those images into .jpg or other formats.

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


[osg-users] textures in shaders

2009-08-20 Thread Michele Olsen
Hello,

I have been having some trouble rendering textured models with shaders. I am a 
little confused about how to set the sampler uniform to the textures. 

Also, from my understanding, if a vertex shader is not specified that 
functionality is pushed to the fixed pipeline?

Here is what I have. 

Application:

Code:

#include osgViewer/Viewer
#include osgDB/ReadFile
#include osgDB/FileUtils
#include iostream
#include string

/* loadShaderSource from 
http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/ShadersIntroduction
 */
bool loadShaderSource(osg::Shader* obj, const std::string fileName )
{
  std::string fqFileName = osgDB::findDataFile(fileName);
  if( fqFileName.length() == 0 )
{
  std::cout  File \  fileName  \ not found.  std::endl;
  return false;
}
  bool success = obj-loadShaderSourceFromFile( fqFileName.c_str());
  if ( !success  )
{
  std::cout  Couldn't load file:   fileName  std::endl;
  return false;
}
  else
{
  return true;
}
}

int main(int argc, char ** argv)
{
  osgViewer::Viewer viewer;
  
  osg::ref_ptrosg::Group root = new osg::Group();
  osg::ref_ptrosg::Node snowplow = 
osgDB::readNodeFile(PlowModel/Plow_Main.DAE);

  osg::ref_ptrosg::StateSet snowplowState = snowplow-getOrCreateStateSet();

  /// load and compile shader

  osg::ref_ptrosg::Program program = new osg::Program();
  osg::ref_ptrosg::Shader fragshader = new osg::Shader(osg::Shader::FRAGMENT);
  program-addShader( fragshader );

  loadShaderSource( fragshader, texture_fragment.glsl);

  osg::ref_ptrosg::Uniform baseTexture = new osg::Uniform(textureSampler, 
0);

  snowplowState-addUniform( baseTexture );

  snowplowState-setAttributeAndModes( program, osg::StateAttribute::ON );


  root-addChild(snowplow.get());

  viewer.setSceneData( root.get() );
  return viewer.run();
}





Shader:

Code:


//
/*  added for texturing */
//
uniform sampler2D textureSampler;
//

void main()
{
//
/*  added for texturing */
//
vec3 texturedColor = vec3 (texture2D (textureSampler, 
gl_TexCoord[0].st));
//

/*/
/* changed for texturing */
/* gl_FragColor = gl_Color; */
gl_FragColor = vec4 (texturedColor.rg, 1.0, 1.0);

}





Thanks for your help!

Michele

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





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


Re: [osg-users] Convert paged to non-paged terrain database

2009-08-20 Thread KSpam
On Thursday 20 August 2009 10:53:13 Appolloni, Thomas wrote:
  Of course, I decided to take it a step further and perform texture

 conversions

  as well.  I wanted to convert the .dds texture files to .jpg.  This

 code is

  stubbed in; however, it does not work.  I thought I could simply call
  osgDB::writeImageFile.  Unfortunately, the individual image format

 writer

  plugins do not appear to handle converting from different pixel

 formats or

  packing.  Does OSG contain code for converting osg::Image between

 different

  pixel formats?  Am I missing an easier option?
 
  Thanks,
  Justin

 Justin,

 I didn't see any additional traffic on this thread. Were you able to get
 a
 solution to this image conversion problem. I'm now facing a similar
 situation
 with the .dds image node from generated osgdem tiles and want to convert

 those images into .jpg or other formats.

 Regards,
 Tom

Tom,

It has been a while since I looked into this.  I did not find a solution in 
OSG, and the problem was not important enough to warrant spending more time on 
it.

If I had to revisit this problem today, I would look into using Boost.GIL 
(Generic Image Library) for the conversion.

http://www.boost.org/doc/libs/1_39_0/libs/gil/doc/index.html

GIL is a header-only library that allows you to generically convert between 
different pixel and packing formats.  With this library, you could convert an 
osg::Image object containing .dds data into an osg::Image object containing 
.jpg data.  Alternately, you could create a Boost.GIL image using the .dds 
osg::Image data and use Boost.GIL I/O to output the Boost.GIL image as a .jpg 
file.

Hopefully, someone can chime in with a simple solution.

Respectfully,
Justin

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


Re: [osg-users] textures in shaders

2009-08-20 Thread Jason Daly

Michele Olsen wrote:

Hello,

I have been having some trouble rendering textured models with shaders. I am a little confused about how to set the sampler uniform to the textures. 


Also, from my understanding, if a vertex shader is not specified that 
functionality is pushed to the fixed pipeline?
  


Correct (at least for now :-) )

Here is what I have. 
  


At a quick glance, it looks OK to me (although you see me to be doing 
odd things with the fragment color).  I'd double-check that the model is 
actually using texture unit 1.  I've seen some COLLADA models 
(particularly those exported from 3ds MAX) that try to use texture unit 
1 instead.


--J


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


Re: [osg-users] textures in shaders

2009-08-20 Thread Michele Olsen

 'd double-check that the model is
 actually using texture unit 1. I've seen some COLLADA models
 (particularly those exported from 3ds MAX) that try to use texture unit
 1 instead.


That did it!!

Thank you!!

Michele

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





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


Re: [osg-users] softshadowmap and glsl shader

2009-08-20 Thread Michele Olsen
Hi,

This looks to be the answer to my problem

[url]
http://forum.openscenegraph.org/viewtopic.php?p=16504#16504[/url]

if the link doesn't work try searching for texture in shader

-Michele

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





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


[osg-users] apply() method??

2009-08-20 Thread Tim Allen
Hi,

I dont understand why apply() method is used in osg??? That means a 
function needs to be applied for all particular node types??

Thank you!

Cheers,
Tim

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





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


Re: [osg-users] apply() method??

2009-08-20 Thread Jason Daly

Tim Allen wrote:

Hi,

I dont understand why apply() method is used in osg??? That means a 
function needs to be applied for all particular node types??
  


http://en.wikipedia.org/wiki/Visitor_pattern

( replace visit() with apply() )

--J


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


Re: [osg-users] apply() method??

2009-08-20 Thread Tim Allen
Hi Jason Thank you very much for the quick reply.

Cheers,
Tim

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





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


Re: [osg-users] apply() method??

2009-08-20 Thread Jason Daly

Tim Allen wrote:

Hi Jason Thank you very much for the quick reply.
  


No problem.  OSG makes use of several of those design patterns.  If 
you're interested in how things are working under the hood, you might 
want to pick up the book by Gamma et al...


http://tinyurl.com/yxlas4

--J

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


Re: [osg-users] Orienting a model (matrixtrans) toward a target location?

2009-08-20 Thread Tony Horrobin
Hi Kris,

Is the target moving too?

Cheers,

Tony

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





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


[osg-users] osg Manipulator example problem

2009-08-20 Thread Markus Husseini
Hi,

i have included the code of the osg Manipulator Example from 
openscenegraph.org. But if i try to compile my code i get some errors, that

- addTransformUpdating
- setHandleEvents
- setActivationModKeyMask
- setActivationKeyEvent

are no Elements of osgManipulator::Dragger!?

Does I need an include? but witch one? or they are custom Elements?

Thank you!

Cheers,
Markus

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





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


Re: [osg-users] Orienting a model (matrixtrans) toward a target location?

2009-08-20 Thread Chris 'Xenon' Hanson
Tony Horrobin wrote:
 Hi Kris,
 Is the target moving too?
 Cheers,

  You know, my first contact with our own Paul Martz was way back in the late 
90s when he
gave me some code for a glLookAt type implementation. I'll see if I still have 
it around
-- it still is deeply buried in some old 3d code in our application.

-- 
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] Orienting a model (matrixtrans) toward atarget location?

2009-08-20 Thread Thrall, Bryan
Chris 'Xenon' Hanson wrote on Thursday, August 20, 2009 5:13 PM:

 Tony Horrobin wrote:
 Hi Kris,
 Is the target moving too?
 Cheers,
 
   You know, my first contact with our own Paul Martz was way back in
the late
 90s when he gave me some code for a glLookAt type implementation. I'll
see if
 I still have it around -- it still is deeply buried in some old 3d
code in
 our application. 

There's osg::Matrix::makeLookAt()

-- 
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Orienting a model (matrixtrans) toward atarget location?

2009-08-20 Thread Chris 'Xenon' Hanson
Thrall, Bryan wrote:
 There's osg::Matrix::makeLookAt()

  Wow. if only that were named something intuitive that I would have thought to 
look for.
Or Look At, as the case may be. ;)

  Does that answer your question, Kris?

-- 
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] apply() method??

2009-08-20 Thread Tim Allen
Thank you.I also have one more question,In some source example I find derived 
class is derived from osg::Drawable::UpdateCallback instead of a NodeCallback 
or DrawableCallback.Why is it used??

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





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


Re: [osg-users] apply() method??

2009-08-20 Thread Gordon Tomlinson
Hi

Please note that you should ask a new question by starting a new email
thread. This makes it easier for people to follow threads and maybe answer
and even find answers them selves

When you would use a draw call back, or an update call back is totality
dependent on what you're doing, are you updating or are you drawing etc. (
in a particular example it will be related to what that example is
illustrating)

I recommend that you have a read of Paul Martz quick Start guide if you have
not done so already, it should tell you about the different traversals' that
are in OSG and  the basics of a scene graph, once you have a grapes of this
then the example should make more sense and why different example use
different parts of OSG etc


See the www.osgbooks.com 



__
Gordon Tomlinson 

gor...@gordontomlinson.com
IM: gordon3db...@3dscenegraph.com
www.vis-sim.com www.gordontomlinson.com 

__

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Tim Allen
Sent: Thursday, August 20, 2009 9:29 PM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] apply() method??

Thank you.I also have one more question,In some source example I find
derived class is derived from osg::Drawable::UpdateCallback instead of a
NodeCallback or DrawableCallback.Why is it used??

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





___
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