[osg-users] drawing a line using mouse

2010-06-23 Thread Devanshi Tiwari
Hi,
 i am new to osg.i have learnt to plot a scene using a LAS file in osg.
now i wish to draw a line using mouse on my scene and using the coordinates of 
the end points find the distance covered by that line.
can anyone guide me plz

Thank you!

Cheers,
Devanshi :P

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





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


Re: [osg-users] OSG and vsync

2010-06-23 Thread Giovanni Ferrari
Thank you very much for your reply ! 
I understand your suggestion about using external syncs to run at a multiple of 
the frame rate but i i don't understand the built in 2 frames of latency in 
Nvidia cards. 

I tell you this cause i used my system both with and without vsync and i 
noticed than running with vsync i don't have tearing but i measure extra 40ms 
of retard in the total closed loop respect to the free run case (no vsync). 
(with total closed loop i mean image rendering time + transmission time + 
elaboration of frame time + results_time)

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





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


Re: [osg-users] Reading/Writing osg::Image data [SEC=UNCLASSIFIED]

2010-06-23 Thread Paul Pocock
Thanks Ulrich, I eventually got it going, posting for reference:
Size I allocated was the issue.

Regards



Reading:
===

unsigned char* data = new unsigned char[texSize*texSize*texSize*4];
   
std::ifstream fin(filename.c_str(),std::ios::in | std::ios::binary);
   
fin.read((char*)data ,(texSize*texSize*texSize*4));

fin.close();
   
osg::ref_ptr image = new osg::Image;
 image->setImage(texSize, texSize, texSize,4, GL_RGBA,
L_UNSIGNED_BYTE,data,osg::Image::USE_NEW_DELETE);


Writing:
=

 std::ofstream fout
("data/textures/image3d/imagedata3d_128",std::ios::app | std::ios::out |
std::ios::binary);
  
 unsigned int size = image->getTotalSizeInBytesIncludingMipmaps();
 fout.write( (char*)image->data(), size );

// Check
if ( fout.fail() )
std::cout<<"Failed to write image->data"< Hi Paul,
>
> On 23/06/10 11:53 , Paul Pocock wrote:
>   
>> I'm trying to write 3d texture data to file but when loading back into
>> osg::Image I'm getting rubbish:
>>
>> Writing to file with 3d texture data:
>>
>> unsigned int size = image->getTotalSizeInBytesIncludingMipmaps();
>> fout.write( (char*)image->data(), size );
>>
>>
>> Reading from file:
>>
>> unsigned char* data = new unsigned char[texSize*texSize*texSize*4];
>> std::ifstream fin("image3ddata2",std::ios::binary);
>>
>> fin.read((char*)&data ,(sizeof(unsigned char)* 4 * texSize * texSize *
>> texSize));
>>
>> osg::ref_ptr image = new osg::Image;
>> image->setImage(texSize,texSize,texSize,4, GL_RGBA,
>> GL_UNSIGNED_BYTE,data, osg::Image::USE_NEW_DELETE);
>>
>>
>> Can anyone see anything I'm doing wrong? Either Writing or Reading?
>> 
> I cannot spot anything obviously wrong with the code.
> Can you check if the file on disk is okay, so that either part (writing or 
> reading) can be
> ruled out?
>
> I'd also try to set the memory to some pattern before reading, in case the 
> file isn't
> fully read or something.
>
> Cheers,
> /ulrich
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>   


IMPORTANT: This email remains the property of the Department of Defence and is 
subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have 
received this email in error, you are requested to contact the sender and 
delete the email.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Reading/Writing osg::Image data [SEC=UNCLASSIFIED]

2010-06-23 Thread Ulrich Hertlein
Hi Paul,

On 23/06/10 11:53 , Paul Pocock wrote:
> I'm trying to write 3d texture data to file but when loading back into
> osg::Image I'm getting rubbish:
> 
> Writing to file with 3d texture data:
> 
> unsigned int size = image->getTotalSizeInBytesIncludingMipmaps();
> fout.write( (char*)image->data(), size );
> 
> 
> Reading from file:
> 
> unsigned char* data = new unsigned char[texSize*texSize*texSize*4];
> std::ifstream fin("image3ddata2",std::ios::binary);
>
> fin.read((char*)&data ,(sizeof(unsigned char)* 4 * texSize * texSize *
> texSize));
>
> osg::ref_ptr image = new osg::Image;
> image->setImage(texSize,texSize,texSize,4, GL_RGBA,
> GL_UNSIGNED_BYTE,data, osg::Image::USE_NEW_DELETE);
> 
> 
> Can anyone see anything I'm doing wrong? Either Writing or Reading?

I cannot spot anything obviously wrong with the code.
Can you check if the file on disk is okay, so that either part (writing or 
reading) can be
ruled out?

I'd also try to set the memory to some pattern before reading, in case the file 
isn't
fully read or something.

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


Re: [osg-users] Extracting Node Names from NodePath

2010-06-23 Thread Ulrich Hertlein
Hi John,

On 23/06/10 23:26 , John Galt wrote:
> I used node1->setName("Specific Name"); for all the 3 nodes and I am looking 
> for the
> specific name to be returned.
> 
> However, all I get is empty strings. 
> My node1 = readFromFile("dumptruckosg");
> node2 = readFromFile("lz.osg");
> node3 = readFromFile("MyOwnAC3dModel.ac");
> 
> The code returns only "dumptruck.osg" as the NodeName when I intersect with
> dumptruck.osg but it returns an empty string when I intersect with lz.osg and
> myownac3dmodel.ac. I am positive that the intersections are occuring because 
> the
> intersection coordinates are perfectly coming through.

Are you checking the entire node path for the name, or maybe only the last node?

Keep in mind that you get the entire node path, but the name is only set for 
one of them.
You'll probably get something like this:

root -> node1 (name="Specific Name") -> node -> ... -> Geode

So the one you're looking for is neither the first nor the last node in the 
path.

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


Re: [vpb] does vpb have Graphics card requirement?

2010-06-23 Thread Shiwei Hu
Hi,

Thanks for your reply, Maybe the graphics board is bad.


Thank you!

Cheers,
Shiwei

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





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


Re: [osg-users] OSG and vsync (UNCLASSIFIED)

2010-06-23 Thread Bunfield, Dennis AMRDEC/AEgis
Classification: UNCLASSIFIED
Caveats: FOUO

The sync actually blocks on the first open gl call.  So your osg update
and cull stages will run then you will block on the draw stage until the
vsync.  Your problem is actually worse than 20ms w/o you knowing it.
For Nvidia cards there is a built in 2 frames of latency.  So even after
your sync you won't see the image you updated come out the DVI until 2
render frames later.

In order for you to do what you want you will need some expensive frame
lock hardware with external syncs to run at a multiple of the frame
rate.

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
Giovanni Ferrari
Sent: Wednesday, June 23, 2010 3:28 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] OSG and vsync

Hi,

i'm developing an application that need vsync to avoid tearing but i'm
having some problems.
Here is the (really simplified) code structure of my application: 


Code:

...
while ( !mViewer->done() ) {
  mGraph->Update(...);
  mViewer->frame();
}





I've noticed frame() function is blocking when vsync is enabled.
This means that i call the frame function, i stay blocked for something
like 20ms (50hz PAL), and then i must terminate the Update call in the
vsync period otherwise i won't be able to draw a new frame ( the graphic
card draw the old content of frame buffer without changes performed in
the update function. Changes will be performed in the next frame ).

As you can immagine this is a big problem for real-time applications
cause i'm introducing 20ms of retard.

Is there a way to syncronize frame call without using vsync ? or can i
scompose the frame function to be able to separate functions that
operate on the graph from those that perform the rendering ? 
The second solution could help me cause i would be able to operate on
the graph with mGraph->Update(...) even if the frame "part" that write
the frameBuffer is blocked.

I hope i've explained my problem clearly.

Thank you!

Cheers,
Giovanni

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





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


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


Re: [osg-users] Shader composition, OpenGL modes and custom modes

2010-06-23 Thread Roland Smeenk
Hi Robert,

I have to dig up the thoughts I had during the period I implemented the shader 
composition that you reviewed. The goals you mention where also the ones I 
tried to achieve.


robertosfield wrote:
> 
> The absolute minimum code changes required in end user apps is none at
> all, might this be possible?  If that is to be achieved then we need
> to be able to use the osg::StateSet::setMode(GLenum,...) and all the
> osg::StateSet::setAttribute(..) and all StateAttributes subclasses
> that we are familiar with.


As you probably saw in my submission this can be done for StateAttributes that 
are set and modes that are automatically applied by a StateAttribute. For 
explicitly setting GL modes I used a lookup map, which did not really feel like 
an ideal solution.


robertosfield wrote:
> 
> Now some parts of OpenGL state are common
> between the fixed function pipeline and the shader pipeline and live
> on right from GL1 to GL4 and GLES2, these parts needn't change one bit
> which is good news.


By this you mean the parts of the pipeline that are not (yet) programmable?


robertosfield wrote:
> 
> However, the majority of glEnable/glDisable(GLenum) and the associated
> glFunctionCalls aren't mapped, for these we'd need to automatically
> map these to equivalent glShader/glPrograms and glUniforms.  This
> mapping will have to automatically detect these modes and avoid
> calling the usual glEnable/glDisable, as well as be redirected into a
> current active set of modes that are enabled, this active set of modes
> would then map to the appropriate combination of shaders to implement
> them.  This mapping of modes is something that osg::State could do for
> us without any changes to osg::State. 
 

An example of a such a mode is GL_NORMALIZE. It is a mode that doesn't have any 
additional parameters controlling it and therefore did not need a 
StateAttribute. 
I tried to solve this with the lookup map I mentioned above. It is the 
_GLModeShaderModeMap in the osg::State class. It maps modes that are directly 
set to corresponding ShaderModes.

Side note:
In case of shader generation glEnable/glDisable can be implemented in  two 
ways. We have either the choice to leave out the code of disabled modes and 
generate a new shader program or disable a piece of shader code in an already 
existing shader program by wrapping it in an if statement. Both choices should 
be possible to be able to select the best possible shader program granularity 
to use at runtime. (big shader program with lot of uniforms for static 
branching vs. lots of smaller shader programs that are switched during 
rendering)


robertosfield wrote:
> 
> The second half of this approach would be for the 
> osg::StateAttrirbute::apply(..) methods to use uniforms to pass in the state 
> to the shaders rather than their use glFunctionCalls.  Again this is 
> something that should be possible to hide from the set of those 
> StateAttribute subclasses and osg::State. I *think* it should be possible to 
> get something working along these lines.  Implementation will tell us whether 
> it's possible though. 
 

Do you mean that it should be possible to leave for example TexEnv::apply() 
unmodified?
As you probably saw I modified the implementation of TexEnv::apply() to set the 
needed uniforms needed by the particular piece of shader code implementing 
TexEnv in shader code.


robertosfield wrote:
> 
> Now mapping of the fixed function pipeline to shaders conveniently is
> only part of the story with shader composition.  We actually want end
> users to be able to selectively replace parts of the glProgram without
> their own shaders, both replacing the fixed function parts and
> composing your own shaders - we'd want a full mix and match, from all
> standard fixed function equivalents to all custom shaders.  Now one
> element of what makes the current fixed function pipeline so
> convenient is that we can enable/disable whole chunks of fixed
> function pipeline anywhere in the scene graph, and the one of OSG's
> greatest assets over the years has been the decoupling of modes from
> attributes making these OpenGL feature really accessible, this asset
> would be great to carry over into the new era of shader composition.
> Since I'm wanting to a real easy mix/match of the fixed function and
> custom shaders then I also want to blurr the distinction when using
> modes.


This is exactly the holy grail to achieve. Often the actual compositing is done 
by letting the users draw the shader graph with a tool or in some other way 
describing the possible graph layouts. In my implementation I try to 
dynamically connect shader modes. This is currently done in a limited way as it 
only involves string based input and output parameter matching. This is a part 
that needs further attention.


robertosfield wrote:
> 
> My thought is to allow users to use osg::StateSet::setMode(GLenum...)
> with not just the standard GLenum we know and love, and that are
> man

Re: [osg-users] geometry

2010-06-23 Thread Trajce (Nick) Nikolov
ah .. ok

-Nick


On Wed, Jun 23, 2010 at 11:18 PM, Gianni Ambrosio wrote:

> Nick, I didn't get the second solution, anyway I think my case is a little
> bit particular. I don't need to move the arrow around but it is just part of
> a cross axes I have to add to the scene. It is fixed under a separate
> camera. So the transformation you can see as first parameter of
> createPyramid() method is just to generalize the creation of the three axes
> (X, Y and Z).
>
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29338#29338
>
>
>
>
>
> ___
> 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] geometry

2010-06-23 Thread Gianni Ambrosio
Nick, I didn't get the second solution, anyway I think my case is a little bit 
particular. I don't need to move the arrow around but it is just part of a 
cross axes I have to add to the scene. It is fixed under a separate camera. So 
the transformation you can see as first parameter of createPyramid() method is 
just to generalize the creation of the three axes (X, Y and Z).

Gianni

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





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


Re: [osg-users] Render graphics for 3DReady-TV?

2010-06-23 Thread David Glenn
What I learned from the NAB Show is that there are two methodologies for 3D 
Stereo broadcast. 

Sony showed me how they are doing there stereo vision for Blue Ray -  send a 
frame for each eye sequencealy at 120hz and the TV brakes it down to a stereo 
picture at 60Hz. 

I assume that Samsung and Panasonic is also  doing something like that.

Microsoft showed how they are going to stream a split screen and turn that into 
a stereo image using their Silverlight stuff. 

You know, I'm still trying to get a grasp on 2K and 4K formats! 

NVidia is banking that anyone that does any video anything on an app will go 
out and buy there $3K Quatro card made for video editing - I assume that it 
does stereo also! 

3D Stereo is not a high requirement at the moment, so I'll stick to my colored 
glasses for now!

Good Luck with the Stereo TV stuff!
... 

D Glenn


D Glenn (a.k.a David Glenn) - Join the Navy and See the World ... from your 
Desk!

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





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


Re: [osg-users] Shader composition, OpenGL modes and custom modes

2010-06-23 Thread Bruce Wheaton
So, we would do the same enable calls on state sets with custom made enums, and 
then also provide a shader function that will be used only if that feature is 
enabled?

It sounds like a great idea... although isn't it maybe sufficiently useful that 
it deserves it's own enable and set functions, especially if all the enums are 
custom? Then name collisions won't be a problem.

The more I think about it though, the more it does seem like enable/disable and 
set value is a good fit. The there could also be different backend methods to 
create the final shader - by compilation if there's enough time, or by 
conditional if the graphics system does it quickly enough...

One worry might be the implication that every single 'building block' could be 
dropped in and things will still work. I have a number of shader pieces that 
only work in the context of a bunch of other shader pieces being active, along 
with the correct textures etc etc.

It's definitely intriguing.

Bruce

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





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


Re: [osg-users] Render graphics for 3DReady-TV?

2010-06-23 Thread Bruce Wheaton
May not be so bad. HDMI and BluRay are standardizing on a 'top-bottom' format, 
with 2 1280x720 eye images and a 30 pixel border.

There may also be a flag that has to get set in the HDMI stream, that will be 
awkward, but making the top-bottom 3D should be trivial. Possibly some of the 
TVs will have a switch to tell the TV the content is 3D, or possibly, the 
strange resolution will tell it to switch to 3D mode.

Bruce

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





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


[osg-users] OSG and vsync

2010-06-23 Thread Giovanni Ferrari
Hi,

i'm developing an application that need vsync to avoid tearing but i'm having 
some problems.
Here is the (really simplified) code structure of my application: 


Code:

...
while ( !mViewer->done() ) {
  mGraph->Update(...);
  mViewer->frame();
}





I've noticed frame() function is blocking when vsync is enabled.
This means that i call the frame function, i stay blocked for something like 
20ms (50hz PAL), and then i must terminate the Update call in the vsync period 
otherwise i won't be able to draw a new frame ( the graphic card draw the old 
content of frame buffer without changes performed in the update function. 
Changes will be performed in the next frame ).

As you can immagine this is a big problem for real-time applications cause i'm 
introducing 20ms of retard.

Is there a way to syncronize frame call without using vsync ? or can i scompose 
the frame function to be able to separate functions that operate on the graph 
from those that perform the rendering ? 
The second solution could help me cause i would be able to operate on the graph 
with mGraph->Update(...) even if the frame "part" that write the frameBuffer is 
blocked.

I hope i've explained my problem clearly.

Thank you!

Cheers,
Giovanni

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





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


Re: [osg-users] Sudden runtime error

2010-06-23 Thread Martin Naylor
Hi,
I missed this thread, but I believe it could be something to do with VS and
the way it handles debugging of template libraries.
Could be completey wrong (more than likely) :)
You will probably find somewhere that your VS project was mixing template
libraries (debug and release), just a guess though.

Regards
Martin.

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Tom Pearce
Sent: 23 June 2010 20:15
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Sudden runtime error

Hi Gordon,

Thanks for the suggestions.  I am working in release, and I don't have any
of the debug libs on my machine.  I re-extracted all osg files just in case
something got corrupted.  I cleaned and rebuilt the application.  Didn't
help.

However, I started a new Visual Studio project, copied all the settings over
exactly, and now it works fine.  This makes me pretty confident that the
issue is not to do with OSG but rather with Vis Studio, but I'm completely
at a loss as to what the problem actually is - nothing short of creating a
fresh project fixed the issue.

Just for the sake of completeness I want to share what I discovered about
where in the code I could cause/not cause the crash:

Having 5 or fewer osg::Vec3d or Vec3f (up to 5 of each) class members was
safe - no crash.  A sixth of each, however, lead to the program crashing
when trying to create a Group.  I put a Node directly in front, the node was
created successfully, it was still crashing on Group.

Again, I don't think the issue is with OSG - and I don't think I got libs
mixed up, since I don't really have any stale libs on the machine.  Have
other Vis Studio users experienced anything like this?  I suppose I just
have to keep in mind that when weird stuff happens I can try creating a
fresh project but that seems like a weak solution.



Cheers,
Tom

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





___
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] OpenGL Shader application problem

2010-06-23 Thread Wojciech Lewandowski

Phil,

No shaders attached. This turns off shaders so effectively you turn on fixed 
pipeline.


WL

--
From: "Phil Fugue" 
Sent: Wednesday, June 23, 2010 5:11 PM
To: 
Subject: Re: [osg-users] OpenGL Shader application problem


Wojtek,

Thanks, I'll try that.  Blind shots are fine, since this is so mysterious. 
:)


By empty program, do you mean with no shaders attached, or do you mean 
with shaders containing the fixed OpenGL functionality?  I'm concerned 
just an empty program will result in overiding the fixed functionalty of 
all the geometry that doesnt have its own custom shader.


But I'll give it a try, and let you know.  Thanks
Phil

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





___
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] Sudden runtime error

2010-06-23 Thread Tom Pearce
Hi Gordon,

Thanks for the suggestions.  I am working in release, and I don't have any of 
the debug libs on my machine.  I re-extracted all osg files just in case 
something got corrupted.  I cleaned and rebuilt the application.  Didn't help.

However, I started a new Visual Studio project, copied all the settings over 
exactly, and now it works fine.  This makes me pretty confident that the issue 
is not to do with OSG but rather with Vis Studio, but I'm completely at a loss 
as to what the problem actually is - nothing short of creating a fresh project 
fixed the issue.

Just for the sake of completeness I want to share what I discovered about where 
in the code I could cause/not cause the crash:

Having 5 or fewer osg::Vec3d or Vec3f (up to 5 of each) class members was safe 
- no crash.  A sixth of each, however, lead to the program crashing when trying 
to create a Group.  I put a Node directly in front, the node was created 
successfully, it was still crashing on Group.

Again, I don't think the issue is with OSG - and I don't think I got libs mixed 
up, since I don't really have any stale libs on the machine.  Have other Vis 
Studio users experienced anything like this?  I suppose I just have to keep in 
mind that when weird stuff happens I can try creating a fresh project but that 
seems like a weak solution.



Cheers,
Tom

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





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


Re: [osg-users] geometry

2010-06-23 Thread Trajce (Nick) Nikolov
Here is what I would do:

1) Create the whole arrow in one geometry including the line - by default
let say make it fixed pointing up (0,0,1). Here is your createArrow thing
that will give you the whole arrow
2) Add MatrixTransform on top of this geometry - with this, you can control
the position, direction and scale
3) Use quaternions for the arrow orientation osg::Quat

This way would not need to rebuilt it for each change

or

build the arrow completely in geometry shader - you would need to pass only
a line this way - only two vertices

-Nick


On Wed, Jun 23, 2010 at 6:32 PM, Gianni Ambrosio  wrote:

> OK, thanks Nick for the explanation & suggestion. At first I started adding
> the geometry to a geode separately but I would like to add the entire arrow
> to the geode instead of adding the two parts. I mean somethig like that:
>
> osg::Geode g;
> g->addDrawable(createArrow());
>
> osg::Geometry* createArrow()
> {
>   // here use createPyramid() and then add the line
> }
>
> Is it possible? I dont like to do as follows:
>
> osg::Geode g;
> g->addDrawable(createPyramid());
> g->addDrawable(createLine());
>
> I mean, I would like to create the arrow as a single geometry but calling
> the createPyramid() method.
>
> Regards
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29328#29328
>
>
>
>
>
> ___
> 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] FirstPersonManipulator

2010-06-23 Thread Julien Soula
Hi,

Is this manipulator still on tests ?
I just tried it and had the same "You are lost in space" error as Pierre 
Bourdin, with a terrain, which was my first goal...
Pretty much better on a building roof situated on this same terrain, where it 
seems to work fine.
If there was some improvement, could you please keep me informed ?


Thx a lot and good job,

Cheers,
Julien

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





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


Re: [osg-users] osgGA::GUIEventHandler problem

2010-06-23 Thread Martin Naylor
Hi Ku,
Not sure about the below, but could it be that you are getting two clicks
because you are receiving one on the first click and one on release?
You may need to post some code of your event handler.

Hope it helps

Martin Naylor

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Ku Krapox
Sent: 23 June 2010 11:10
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] osgGA::GUIEventHandler problem

Hi,

I keep having this strange behavior with my custom osgGA::GUIEventHandler
class : the handle() method is executed twice each time I click on the
handled object... I'm catching PUSH events only, and every single click on
my object results in two runs in the corresponding block of the handle()
method.

The first idea would be that my EventHandler is added twice on my object but
it is NOT the case. I'm setting it inside the constructor of another object,
which is instanciated only once in the whole app.

My handled object is inside an osg::Camera, could it be because of this?
Picking objects inside a camera is tricky, but I managed to do it. The only
problem is that they are picked twice... does a camera generate two PUSH
events when clicked?

So here I am...  Does anyone have a clue on what's wrong with my handler? Or
how I could debug it?

Thanks! :) 

Cheers,
Ku

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





___
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] geometry

2010-06-23 Thread Gianni Ambrosio
OK, thanks Nick for the explanation & suggestion. At first I started adding the 
geometry to a geode separately but I would like to add the entire arrow to the 
geode instead of adding the two parts. I mean somethig like that:

osg::Geode g;
g->addDrawable(createArrow());

osg::Geometry* createArrow()
{
   // here use createPyramid() and then add the line
}

Is it possible? I dont like to do as follows:

osg::Geode g;
g->addDrawable(createPyramid());
g->addDrawable(createLine());

I mean, I would like to create the arrow as a single geometry but calling the 
createPyramid() method.

Regards
Gianni

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





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


Re: [osg-users] geometry

2010-06-23 Thread Trajce (Nick) Nikolov
I think you can not mix index based geometry with non-index based geometry
within one geometry (I might be wrong here! ). If you want to draw a line
outside the pyramid, then attach another geometry to the geode doing just
the line in a way you want. Are yo after drawing an arrow? If so, your
approach will rebuild the arrow geometry for each matrix transform -
change.
-Nick


On Wed, Jun 23, 2010 at 6:08 PM, Gianni Ambrosio  wrote:

> Thanks Nick for the code.
>
> Now I would like to understand why I must add the indices in this case
> since for a simple line I just need to insert the vertices in the geometry
> node.
> In fact I would like to add the line to the geometry outside of the
> createPyramid method, where the line is created without the use of indices,
> just vertices.
>
> Regards
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29326#29326
>
>
>
>
>
> ___
> 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] geometry

2010-06-23 Thread Gianni Ambrosio
Thanks Nick for the code.

Now I would like to understand why I must add the indices in this case since 
for a simple line I just need to insert the vertices in the geometry node.
In fact I would like to add the line to the geometry outside of the 
createPyramid method, where the line is created without the use of indices, 
just vertices.

Regards
Gianni

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





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


[osg-users] Shader composition, OpenGL modes and custom modes

2010-06-23 Thread Robert Osfield
Hi All,

I'm currently brainstorming on how to support of shader composition in
the OSG, and would like to get some feedback one element of a possible
approach that I'm considering.

Two of my design goals is to provide a good mapping between the fixed
function pipeline and shader based pipelines, and I'd also like to
minimize the number of code changes required by end user applications.
 Whether these are both attainable or not we'll work in the next few
weeks, but I guess few would disagree with that these are worthy
goals.

The absolute minimum code changes required in end user apps is none at
all, might this be possible?  If that is to be achieved then we need
to be able to use the osg::StateSet::setMode(GLenum,...) and all the
osg::StateSet::setAttribute(..) and all StateAttributes subclasses
that we are familiar with.  Now some parts of OpenGL state are common
between the fixed function pipeline and the shader pipeline and live
on right from GL1 to GL4 and GLES2, these parts needn't change one bit
which is good news.

However, the majority of glEnable/glDisable(GLenum) and the associated
glFunctionCalls aren't mapped, for these we'd need to automatically
map these to equivalent glShader/glPrograms and glUniforms.  This
mapping will have to automatically detect these modes and avoid
calling the usual glEnable/glDisable, as well as be redirected into a
current active set of modes that are enabled, this active set of modes
would then map to the appropriate combination of shaders to implement
them.  This mapping of modes is something that osg::State could do for
us without any changes to osg::State.  The second half of this
approach would be for the osg::StateAttrirbute::apply(..) methods to
use uniforms to pass in the state to the shaders rather than their use
glFunctionCalls.  Again this is something that should be possible to
hide from the set of those StateAttribute subclasses and osg::State.
I *think* it should be possible to get something working along these
lines.  Implementation will tell us whether it's possible though.

Now mapping of the fixed function pipeline to shaders conveniently is
only part of the story with shader composition.  We actually want end
users to be able to selectively replace parts of the glProgram without
their own shaders, both replacing the fixed function parts and
composing your own shaders - we'd want a full mix and match, from all
standard fixed function equivalents to all custom shaders.  Now one
element of what makes the current fixed function pipeline so
convenient is that we can enable/disable whole chunks of fixed
function pipeline anywhere in the scene graph, and the one of OSG's
greatest assets over the years has been the decoupling of modes from
attributes making these OpenGL feature really accessible, this asset
would be great to carry over into the new era of shader composition.
Since I'm wanting to a real easy mix/match of the fixed function and
custom shaders then I also want to blurr the distinction when using
modes.  Which leads me to a suggestion that might be controversial...
and the crux for this post...

My thought is to allow users to use osg::StateSet::setMode(GLenum...)
with not just the standard GLenum we know and love, and that are
managed by Khronos, but to allow us to use our own custom mode values
that extend beyond that our gl.h headers provide.  These GLenum values
would down to OSG users to decide when they set up their custom
shaders, and for them to tell the OSG how to map them to shaders when
doing shader composition.   Perhaps we could just ear mark a certain
range of values that we use ourselves, perhaps even tell Khronos about
it so they can advice us to avoid certain ranges that the plan on
using.  Perhaps we just do it informally and pick a pretty distant
range along way from anything that OpenGL uses right now.

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


Re: [osg-users] geometry

2010-06-23 Thread Trajce (Nick) Nikolov
Hi Gianni,

here is working code snippet with the line

*osg::Geometry* createPyramid(const osg::Matrixd& iTransform, const
osg::Vec4& iColor)*
*{*
*  osg::Geometry* geom = new osg::Geometry;*
*
*
*  osg::Vec3Array* vertices = new osg::Vec3Array(5+2);*
*  (*vertices)[0].set(iTransform.preMult(osg::Vec3d(8.0f, 0.0f, 0.0f)));*
*  (*vertices)[1].set(iTransform.preMult(osg::Vec3d(0.0f, 8.0f, 0.0f)));*
*  (*vertices)[2].set(iTransform.preMult(osg::Vec3d(-8.0f, 0.0f, 0.0f)));*
*  (*vertices)[3].set(iTransform.preMult(osg::Vec3d(0.0f, -8.0f, 0.0f)));*
*  (*vertices)[4].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));*
*
*
*  (*vertices)[5].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));
//4line*
*  (*vertices)[6].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, -50.0f)));
//4line*
*
*
*  osg::UByteArray* indices = new osg::UByteArray(20);*
*  (*indices)[0]=0;  (*indices)[1]=1;  (*indices)[2]=4;*
*  (*indices)[3]=1;  (*indices)[4]=2;  (*indices)[5]=4;*
*  (*indices)[6]=2;  (*indices)[7]=3;  (*indices)[8]=4;*
*  (*indices)[9]=3;  (*indices)[10]=0; (*indices)[11]=4;*
*  (*indices)[12]=1; (*indices)[13]=0; (*indices)[14]=3;*
*  (*indices)[15]=2; (*indices)[16]=1; (*indices)[17]=3;*
*
*
*  (*indices)[18]=5;*
*  (*indices)[19]=6;*
*
*
*  geom->setVertexArray(vertices);*
*  geom->setVertexIndices(indices);*
*
*
*  osg::Vec4Array* colors = new osg::Vec4Array;*
*  colors->push_back(iColor);*
*  geom->setColorArray(colors);*
*  geom->setColorBinding(osg::Geometry::BIND_OVERALL);*
*
*
*  geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,
0, indices->size()-2));*
*
*
*  geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,
indices->size()-2, 2)); //4line*
*
*
*  return geom;*
*}*
-Nick


On Wed, Jun 23, 2010 at 5:32 PM, Gianni Ambrosio  wrote:

> Hi,
> what's wrong in the following code?
>
>
> Code:
> osg::Geometry* createPyramid(const osg::Matrixd& iTransform, const
> osg::Vec4& iColor)
> {
>   osg::Geometry* geom = new osg::Geometry;
>
>   osg::Vec3Array* vertices = new osg::Vec3Array(5+2);
>   (*vertices)[0].set(iTransform.preMult(osg::Vec3d(8.0f, 0.0f, 0.0f)));
>   (*vertices)[1].set(iTransform.preMult(osg::Vec3d(0.0f, 8.0f, 0.0f)));
>   (*vertices)[2].set(iTransform.preMult(osg::Vec3d(-8.0f, 0.0f, 0.0f)));
>   (*vertices)[3].set(iTransform.preMult(osg::Vec3d(0.0f, -8.0f, 0.0f)));
>   (*vertices)[4].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));
>
>   (*vertices)[5].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));
> //4line
>   (*vertices)[6].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, -50.0f)));
> //4line
>
>   osg::UByteArray* indices = new osg::UByteArray(18);
>   (*indices)[0]=0;  (*indices)[1]=1;  (*indices)[2]=4;
>   (*indices)[3]=1;  (*indices)[4]=2;  (*indices)[5]=4;
>   (*indices)[6]=2;  (*indices)[7]=3;  (*indices)[8]=4;
>   (*indices)[9]=3;  (*indices)[10]=0; (*indices)[11]=4;
>   (*indices)[12]=1; (*indices)[13]=0; (*indices)[14]=3;
>   (*indices)[15]=2; (*indices)[16]=1; (*indices)[17]=3;
>
>   geom->setVertexArray(vertices);
>   geom->setVertexIndices(indices);
>
>   osg::Vec4Array* colors = new osg::Vec4Array;
>   colors->push_back(iColor);
>   geom->setColorArray(colors);
>   geom->setColorBinding(osg::Geometry::BIND_OVERALL);
>
>   geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,
> 0, indices->size()));
>
>   geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 5,
> 2)); //4line
>
>   return geom;
> }
>
>
>
> I added the three "//4line" lines of code to explain my problem. In this
> case I would add a line starting from the top of the pyramid downwards but I
> just see the pyramid instead.
>
> Regards
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29322#29322
>
>
>
>
>
> ___
> 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] geometry

2010-06-23 Thread Gianni Ambrosio
Hi,
what's wrong in the following code?


Code:
osg::Geometry* createPyramid(const osg::Matrixd& iTransform, const osg::Vec4& 
iColor)
{
   osg::Geometry* geom = new osg::Geometry;

   osg::Vec3Array* vertices = new osg::Vec3Array(5+2);
   (*vertices)[0].set(iTransform.preMult(osg::Vec3d(8.0f, 0.0f, 0.0f)));
   (*vertices)[1].set(iTransform.preMult(osg::Vec3d(0.0f, 8.0f, 0.0f)));
   (*vertices)[2].set(iTransform.preMult(osg::Vec3d(-8.0f, 0.0f, 0.0f)));
   (*vertices)[3].set(iTransform.preMult(osg::Vec3d(0.0f, -8.0f, 0.0f)));
   (*vertices)[4].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));

   (*vertices)[5].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f))); 
//4line
   (*vertices)[6].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, -50.0f))); 
//4line

   osg::UByteArray* indices = new osg::UByteArray(18);
   (*indices)[0]=0;  (*indices)[1]=1;  (*indices)[2]=4;
   (*indices)[3]=1;  (*indices)[4]=2;  (*indices)[5]=4;
   (*indices)[6]=2;  (*indices)[7]=3;  (*indices)[8]=4;
   (*indices)[9]=3;  (*indices)[10]=0; (*indices)[11]=4;
   (*indices)[12]=1; (*indices)[13]=0; (*indices)[14]=3;
   (*indices)[15]=2; (*indices)[16]=1; (*indices)[17]=3;

   geom->setVertexArray(vertices);
   geom->setVertexIndices(indices);

   osg::Vec4Array* colors = new osg::Vec4Array;
   colors->push_back(iColor);
   geom->setColorArray(colors);
   geom->setColorBinding(osg::Geometry::BIND_OVERALL);

   geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, 
indices->size()));

   geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 5, 2)); 
//4line

   return geom;
}



I added the three "//4line" lines of code to explain my problem. In this case I 
would add a line starting from the top of the pyramid downwards but I just see 
the pyramid instead.

Regards
Gianni

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





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


Re: [osg-users] Future of osgIntrospection + genwrapper, volunteers required.

2010-06-23 Thread Wang Rui
Hi Robert,

Thanks. I will complete the cmake scripts of osgIntrospection once I got the
permission tomorrow.

Cheers,

Wang Rui

2010/6/23 Robert Osfield 

> Hi Wang Rui,
>
> I've just tried your Cmake scripts out and they compile
> osgIntrospection.  As it's a reasonable first step I've gone ahead an
> merged these CmakeLists.txt and CMakeModules files and checked them
> into osgIntrospection/svn/trunk.
>
> I'll contact Jose Luis Hidalgo about getting your write permission for
> osgIntrospection.
>
> Cheers,
> Robert.
>
> On Wed, Jun 23, 2010 at 1:35 PM, Wang Rui  wrote:
> > Hi Robert,
> > FYI, I have created a set of cmake scripts to build OSG based projects
> > before. I just tested it with the osgIntrospection library only and it
> seems
> > to work well. I would like to share it with the community and see if it
> can
> > be a not bad replacement.
> > Besides, osgBullet and osgworks created by Paul Martz also has a couple
> of
> > light-weight cmake scripts. I wonder if it can work on more platforms.
> (mine
> > is only tested on windows and linux)
> > Please note that I didn't add cmake scripts for wrappers and examples in
> the
> > attachment at present. Let's first have a look at all possibilities. :)
> > Cheers,
> > Wang Rui
> >
> > 2010/6/23 Robert Osfield 
> >>
> >> Hi All,
> >>
> >> On Wed, Jun 23, 2010 at 12:44 PM, Robert Osfield
> >>  wrote:
> >> > I'll create the above osgIntrospection project this week
> >>
> >> The first step is now done, I've created a new osgIntrospection
> >> project and moved in the source for the include/osgIntrospection
> >> src/osgIntrospection, src/osgWrappers and the
> >> examples/osgintrospection, you can check it out at:
> >>
> >>  svn co http://www.openscenegraph.org/svn/osg/osgIntrospection/trunk
> >> osgIntrospection
> >>
> >> I have yet copied in a working set of CMakeLists.txt files yet though,
> >> so the the above project doesn't compile, it just the headers and
> >> sources.  The current work in OSG svn/trunk for osgIntrospection uses
> >> the OSG's CMakeLists.txt set that is probably overkill for
> >> osgIntrospection.  Perhaps using VPB's CMakeLists.txt set would be a
> >> bit less overdone, but even that is based on the OSG's.  A new bunch
> >> of Cmake scripts would probably be best.
> >>
> >> Thoughts?
> >> 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
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OpenGL Shader application problem

2010-06-23 Thread Phil Fugue
Wojtek,

Thanks, I'll try that.  Blind shots are fine, since this is so mysterious. :)

By empty program, do you mean with no shaders attached, or do you mean with 
shaders containing the fixed OpenGL functionality?  I'm concerned just an empty 
program will result in overiding the fixed functionalty of all the geometry 
that doesnt have its own custom shader.

But I'll give it a try, and let you know.  Thanks
Phil

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





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


Re: [osg-users] Future of osgIntrospection + genwrapper, volunteers required.

2010-06-23 Thread Robert Osfield
Hi All,

Now that osgIntrospection has been copied out from OpenScneGraph and
ready to live on it's own, I've taken the next step to remove
osgIntrospection and the wrappers from the OpenSceneGraph/svn/trunk.
These changes are now checked in to svn/trunk, which will mean the up
coming OSG-2.9.9 will no longer have osgIntrospection, with the OSG
now another step closer to OSG-3.0.

If you rely upon osgIntrospection then please check out and contribute
to the new osgIntrospection project.

svn co http://www.openscenegraph.org/svn/osg/osgIntrospection/trunk
osgIntrospection

The sources are now all in place, and CMake preliminary support is
checked in, but there it supports for building wrappers and the
example left to complete.  Please pitch in and consider becoming an
active contributor to osgIntrospection and genwrapper.

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


Re: [osg-users] Remove osg::Material from models

2010-06-23 Thread Robert Osfield
Hi Roman,

On Wed, Jun 23, 2010 at 3:10 PM, Roman Grigoriev  wrote:
> BTW in GL3 path osgText doesn't work at all. No font texture.

Right now you have to provide your own shaders as the fixed function
pipeline isn't supported under the pure GL3 build of the OSG.

I'm currently working on shader composition support for the OSG that
will include mapping of fixed function pipeline to shaders which
should in theory provide support for elements like osgText in GL3 and
GLES2.

In the meantime I would recommend you build the OSG against GL2, and
the OSG will automatically pick up on most of the GL3 features at
runtime.

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


Re: [osg-users] Remove osg::Material from models

2010-06-23 Thread Roman Grigoriev
Thank you!
BTW in GL3 path osgText doesn't work at all. No font texture. 

Cheers,
Roman

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





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


Re: [osg-users] Extracting Node Names from NodePath

2010-06-23 Thread John Galt
Hi,

I did the same thing you suggest but it doesn't work for me.

I used node1->setName("Specific Name"); for all the 3 nodes and I am looking 
for the specific name to be returned.

However, all I get is empty strings. 
My node1 = readFromFile("dumptruckosg");
node2 = readFromFile("lz.osg");
node3 = readFromFile("MyOwnAC3dModel.ac");


The code returns only "dumptruck.osg" as the NodeName when I intersect with 
dumptruck.osg but it returns an empty string when I intersect with lz.osg and 
myownac3dmodel.ac. I am positive that the intersections are occuring because 
the intersection coordinates are perfectly coming through.

However, I am unable to get the Specific Name I assigned for the nodes.




Thank you!

Cheers,
John

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





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


Re: [osg-users] cross axes

2010-06-23 Thread Gianni Ambrosio
Hi Jean-Sebastien,


Skylark wrote:
> 
> So they're useful for some things but I wouldn't 
> use them for this (personally).
> 


I agree, if I understood correctly it doesn't make much sense in my case.

Thanks fot the other ways you suggested.

Regards
Gianni

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





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


Re: [osg-users] Future of osgIntrospection + genwrapper, volunteers required.

2010-06-23 Thread Robert Osfield
Hi Wang Rui,

I've just tried your Cmake scripts out and they compile
osgIntrospection.  As it's a reasonable first step I've gone ahead an
merged these CmakeLists.txt and CMakeModules files and checked them
into osgIntrospection/svn/trunk.

I'll contact Jose Luis Hidalgo about getting your write permission for
osgIntrospection.

Cheers,
Robert.

On Wed, Jun 23, 2010 at 1:35 PM, Wang Rui  wrote:
> Hi Robert,
> FYI, I have created a set of cmake scripts to build OSG based projects
> before. I just tested it with the osgIntrospection library only and it seems
> to work well. I would like to share it with the community and see if it can
> be a not bad replacement.
> Besides, osgBullet and osgworks created by Paul Martz also has a couple of
> light-weight cmake scripts. I wonder if it can work on more platforms. (mine
> is only tested on windows and linux)
> Please note that I didn't add cmake scripts for wrappers and examples in the
> attachment at present. Let's first have a look at all possibilities. :)
> Cheers,
> Wang Rui
>
> 2010/6/23 Robert Osfield 
>>
>> Hi All,
>>
>> On Wed, Jun 23, 2010 at 12:44 PM, Robert Osfield
>>  wrote:
>> > I'll create the above osgIntrospection project this week
>>
>> The first step is now done, I've created a new osgIntrospection
>> project and moved in the source for the include/osgIntrospection
>> src/osgIntrospection, src/osgWrappers and the
>> examples/osgintrospection, you can check it out at:
>>
>>  svn co http://www.openscenegraph.org/svn/osg/osgIntrospection/trunk
>> osgIntrospection
>>
>> I have yet copied in a working set of CMakeLists.txt files yet though,
>> so the the above project doesn't compile, it just the headers and
>> sources.  The current work in OSG svn/trunk for osgIntrospection uses
>> the OSG's CMakeLists.txt set that is probably overkill for
>> osgIntrospection.  Perhaps using VPB's CMakeLists.txt set would be a
>> bit less overdone, but even that is based on the OSG's.  A new bunch
>> of Cmake scripts would probably be best.
>>
>> Thoughts?
>> 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] cross axes

2010-06-23 Thread Jean-Sébastien Guay

Hello Gianni,


One more question. Suppose I have two viewers and I would like to show the axes 
just in one of them. Since the camera with the axes model is in the scene, is 
there any flexible way to enable/disable the axes in one viewer?


You could search the archives for hints of how to display something in 
only one view. It's been discussed before, and there are a few ways to 
do it.


I generally do it by adding the appropriate subgraph (object or HUD 
camera) directly under the master camera of the view in which I want to 
see it (view->getCamera()) instead of under a scene root which is 
visible in all views. I find that easy to manage.


Another way is to add a cull callback which will examine the current 
camera and only traverse the children if it's the right one(s).


Yet another way is with node masks and cull masks in the cullVisitor, 
but you'll run out of bits in a 32-bit node mask pretty fast, especially 
if you use node masks for other things too. Node masks have the 
disadvantage that your whole app needs to know all the node masks in use 
everywhere or else you'll end up with one bit being used for two things 
and will have problems. So they're useful for some things but I wouldn't 
use them for this (personally).


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] Future of osgIntrospection + genwrapper, volunteers required.

2010-06-23 Thread Robert Osfield
Hi All,

On Wed, Jun 23, 2010 at 12:44 PM, Robert Osfield
 wrote:
> I'll create the above osgIntrospection project this week

The first step is now done, I've created a new osgIntrospection
project and moved in the source for the include/osgIntrospection
src/osgIntrospection, src/osgWrappers and the
examples/osgintrospection, you can check it out at:

  svn co http://www.openscenegraph.org/svn/osg/osgIntrospection/trunk
osgIntrospection

I have yet copied in a working set of CMakeLists.txt files yet though,
so the the above project doesn't compile, it just the headers and
sources.  The current work in OSG svn/trunk for osgIntrospection uses
the OSG's CMakeLists.txt set that is probably overkill for
osgIntrospection.  Perhaps using VPB's CMakeLists.txt set would be a
bit less overdone, but even that is based on the OSG's.  A new bunch
of Cmake scripts would probably be best.

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


Re: [osg-users] Future of osgIntrospection + genwrapper, volunteers required.

2010-06-23 Thread Robert Osfield
I have been pondering on the issue of osgIntrospection and feel the
next step should be to create a new osgIntrospection project that
retains API compatibility with the current lib and wrappers, but just
provide them in a separate project.  The layout of the project would
be:

  osgIntrospection/include/osgIntrospection
  osgIntrospection/src/osgIntrospection

  osgIntrospection/src/osgWrappers/osg/
  osgIntrospection/src/osgWrappers/osgUtil/
  osgIntrospection/src/osgWrappers/osgDB/ etc.

  osgIntrosepction/examples/osgintrospection

With this structure we could directly move the various elements across
to the new project with as little disruption as possible.  I'll leave
genwrapper as a separate project for the time being, but this could
potentially be rolled into it.  This is something for the new project
maintainers to worry about though, my plan is to make the above
project then hand over responsibility to the new maintainers.

I'll create the above osgIntrospection project this week, and then
pull osgIntrospection out of the core OpenSceneGaph in time for the
next OSG-2.9.9 dev release that I'll make at the end of the week.

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


Re: [osg-users] Future of osgIntrospection + genwrapper, volunteers required.

2010-06-23 Thread Robert Osfield
Hi Wang Rui,

On Tue, Jun 22, 2010 at 8:23 AM, Wang Rui  wrote:
> I would like to take part in the coming osgIntrospection library, either as
> a contributor or a leader.

Thanks for your offer of help.  Alas so far the only offer of help,
hopefully others will chip in once we get the ball rolling.  I'll post
in a follow up email my plans.

>  I have experience maintaining projects with SVN.
> But the problem is that I'm not an osgIntrospection user and don't have a
> comprehensive idea of the future of this library. So just consider me as a
> volunteer if there were not enough people attending this new project. :)

Ideally I would like to see a project lead that actually uses
osgIntrospection for their daily work - this will ensure that they are
well motivated and skilled to keep it relevant to their work and as a
consequence of benefit to others as well.  Maintaining
osgIntrospection out of kindness or curiosity is much less of spur for
long term commitment.

Perhaps if no one has the scratch it itch then perhaps just sleeping
in a quite corner is not bad thing for the project.

> If possible, maybe what I'm going to do is to merge the wrapper and related
> examples (there is a Tcl/Tk example besides
> examples/osgintrospection) first, and see if we can have an easy-to-use
> front-end in the next step. This is also helpful in developing the
> reflection mechanism using serializers.

Lack of good examples of use of osgIntrospection may well be one of
the things holding it back of the years.  I do feel that it turned out
too be a bit too overcomplicated for average users to get their head
around.

Using osgIntrospection as a learning tool for a new introspection
scheme for the OSG would be useful.  What I don't want to do is go the
route that osgIntrospection went of being really in-depth and with it
complex.  If we could distilling the good things about
osgIntrospection to an extent that we can provide wrappers with a low
footprint and that are easy to use and manage then we'll be a in good
place.

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


[osg-users] osgGA::GUIEventHandler problem

2010-06-23 Thread Ku Krapox
Hi,

I keep having this strange behavior with my custom osgGA::GUIEventHandler class 
: the handle() method is executed twice each time I click on the handled 
object... I'm catching PUSH events only, and every single click on my object 
results in two runs in the corresponding block of the handle() method.

The first idea would be that my EventHandler is added twice on my object but it 
is NOT the case. I'm setting it inside the constructor of another object, which 
is instanciated only once in the whole app.

My handled object is inside an osg::Camera, could it be because of this? 
Picking objects inside a camera is tricky, but I managed to do it. The only 
problem is that they are picked twice... does a camera generate two PUSH events 
when clicked?

So here I am...  Does anyone have a clue on what's wrong with my handler? Or 
how I could debug it?

Thanks! :) 

Cheers,
Ku

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





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


Re: [osg-users] slow rendering of large number of points since each of them is in a geode of its own...

2010-06-23 Thread Sunil S Nandihalli
Thanks Robert,
Sunil.

On Wed, Jun 23, 2010 at 2:24 PM, Robert Osfield wrote:

> Hi Sunil,
>
> I am not at all surprised that performacne is slow.  What you are
> doing is the best way possible to destroy performance - killing CPU
> and GPU efficiency at the same, well done :-)
>
> The right way to do what you want is to implement a custom picking
> route, that enables you to pick the points you want in the they way
> you want.  You should be able to build an osg::KdTree to help you,
> have a look at the exisiting implementation for line intersection
> (osgUtil::LineSegmentIntersection/osgUtil::IntersectionVisitor/osg::KdTree)
> for inspiration.
>
> Robert.
>
> On Wed, Jun 23, 2010 at 9:49 AM, Sunil S Nandihalli
>  wrote:
> > Hello everybody,
> >  I have a large number of points to be displayed ..(about 200,000) .. I
> want
> > to be able to pick each one of them. I have made each point a seperate
> geode
> > ..The rendering is very slow. Possibly if I place all of them in a single
> > geometry/drawable it could improve the performance.. but then I don't
> know
> > how to enable picking of each and every point (via mouse) .. I was
> wondering
> > if any of you had any solution to this problem.
> > Thanks in advance
> > Sunil.
> > ___
> > 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] slow rendering of large number of points since each of them is in a geode of its own...

2010-06-23 Thread Robert Osfield
Hi Sunil,

I am not at all surprised that performacne is slow.  What you are
doing is the best way possible to destroy performance - killing CPU
and GPU efficiency at the same, well done :-)

The right way to do what you want is to implement a custom picking
route, that enables you to pick the points you want in the they way
you want.  You should be able to build an osg::KdTree to help you,
have a look at the exisiting implementation for line intersection
(osgUtil::LineSegmentIntersection/osgUtil::IntersectionVisitor/osg::KdTree)
for inspiration.

Robert.

On Wed, Jun 23, 2010 at 9:49 AM, Sunil S Nandihalli
 wrote:
> Hello everybody,
>  I have a large number of points to be displayed ..(about 200,000) .. I want
> to be able to pick each one of them. I have made each point a seperate geode
> ..The rendering is very slow. Possibly if I place all of them in a single
> geometry/drawable it could improve the performance.. but then I don't know
> how to enable picking of each and every point (via mouse) .. I was wondering
> if any of you had any solution to this problem.
> Thanks in advance
> Sunil.
> ___
> 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] [forum] JFIF header decoding

2010-06-23 Thread Robert Osfield
Hi Suneetha,

This really isn't an OSG question.  Might I suggest you look up
libjpeg, it does of JPEG files, it's likely you can use this lib to
read all the elements you want.

Robert.

On Wed, Jun 23, 2010 at 7:46 AM, suneetha vakkalagadda
 wrote:
> Hi,
>
> I need the details of :
>
> 1. Thumbnail Image width
> 2. Thumbnail Image height
> 3. Row striding of thumbnail image
> 4. Bits per componenet
>
> These are present in JFIF header part of JPG.
> More specifically these are present in APP0 segment. (Part of JFIF and the 
> Marker is: 0xFFE0)
>
> Thank you!
>
> Cheers,
> suneetha
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29285#29285
>
>
>
>
>
> ___
> 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] slow rendering of large number of points since each of them is in a geode of its own...

2010-06-23 Thread Sunil S Nandihalli
Hello everybody,
 I have a large number of points to be displayed ..(about 200,000) .. I want
to be able to pick each one of them. I have made each point a seperate geode
..The rendering is very slow. Possibly if I place all of them in a single
geometry/drawable it could improve the performance.. but then I don't know
how to enable picking of each and every point (via mouse) .. I was wondering
if any of you had any solution to this problem.
Thanks in advance
Sunil.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Extracting Node Names from NodePath

2010-06-23 Thread Trajce (Nick) Nikolov
Hi John,

the node path stores all the nodes from the root to the node containing the
geometry (a Geode). In your case, if you picked node1, the nodepath will be
root;PAT1;node1. You can iterate over them and get the name with
node->getName(). The lead node would be nodepath.back()

-Nick


On Wed, Jun 23, 2010 at 9:54 AM, John Galt  wrote:

> Hi,
>
> I have my scene set up as follows:
>
> osg::Node* node1;
> osg::Node* node2;
> osg::Node* node3;
>
> I have loaded node1, node2 and node3 using readNodeFromFile function.
>
> Then I have my nodes attached to my root as follows:
>
> root->addChild(PAT1);
> PAT1->addChild(node1);
> root->addChild(PAT2);
> PAT1->addChild(node2);
> root->addChild(PAT3);
> PAT1->addChild(node3);
>
> Then I got a HitList and extracted Hits out of it. For each particular hit,
> I have extracted the NodePath. What exactly does the NodePath store? How do
> I extract the names of the Nodes that contain the geometry i.e., how do I
> use the NodePath to return the bottom most (leaf node?) node (node1, node2
> or node3) in my scene graph?
>
>
>
> Thank you!
>
> Cheers,
> John
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29291#29291
>
>
>
>
>
> ___
> 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] Sudden runtime error

2010-06-23 Thread Gordon Tomlinson
Have you picked up a Debug lib(if in release or visa versa)  you should not
have?

Have you picked up a lib/dll build with a different compiler or re-dist
package?

Have you done a full clean and rebuild just incase a change has not been
picked up by VS (I see this one a lot where we have a stale lib/dll)

If you do a osg::Node* node = new osg::Node(); instaead of osg::Geode* geode
= new osg::Geode(); does that work ? ( ps I always but () on my news for
none POD's should not make a difference unless theres an issue with a
default Ctor or Ctor chain)


__
Gordon Tomlinson 

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

__


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Tom Pearce
Sent: Wednesday, June 23, 2010 2:10 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Sudden runtime error

Hello OSG users,

This afternoon, I had a program I've been working on start crashing on me
and I thought I'd see if anyone had insight into where I should be looking
for the problem.  I've been making changes to the code and re-building the
project to test the changes, but I don't know that my changes had anything
to do with this.

Basically, yesterday morning my application started crashing right when I
exited the viewer (by hitting "esc") - instead of just exiting the program,
an error message would pop up that the program stopped working unexpectedly.
This seemed unusual since I'd never had it happen before, but it wasn't
interfering with my ability to test the part of the code I was working on so
I didn't pursue it further at that point.

This afternoon, the application starts up but at one particular line
(nothing complicated, just osg::Geode* geode = new osg::Geode; ) the command
prompts displays "This application has requested the Runtime to terminate it
in an unusual way.  Please contact the application's support team for more
information."

Thus far, I have rebooted and re-extracted all osg files from the zip I
downloaded.  I tried changing the name of the variable on that line, and I
made sure to clean and rebuild the solution.  None of that changed anything.
I also set the OSG_NOTIFY_LEVEL to DEBUG but there were no messages that
popped up between my debugging message the line before and when it displays
the error message.  I don't think the issue is with my code because when I
copy the source to my other computer, the program works just fine.  In
addition, other applications I've created with osg (including Geode of
course) still execute just fine.

I'm not looking for someone to solve this for me, but I thought I'd see if
anyone else has had similar issues crop up and could point me in the right
direction.  System info:  Windows 7 64-bit, osg-2.8.2, Visual Studio 9.


Cheers,
Tom

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





___
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] HitLists

2010-06-23 Thread John Galt
Hi,

Thanks for the help guys. It worked. 

Alberto, I considered using IntersectionVisitor at first but found tutorials 
and examples that use IntersectVisitor so I decided to stick with it.

Thank you!

Cheers,
John

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





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


[osg-users] Extracting Node Names from NodePath

2010-06-23 Thread John Galt
Hi,

I have my scene set up as follows:

osg::Node* node1;
osg::Node* node2;
osg::Node* node3;

I have loaded node1, node2 and node3 using readNodeFromFile function.

Then I have my nodes attached to my root as follows: 

root->addChild(PAT1);
PAT1->addChild(node1);
root->addChild(PAT2);
PAT1->addChild(node2);
root->addChild(PAT3);
PAT1->addChild(node3);

Then I got a HitList and extracted Hits out of it. For each particular hit, I 
have extracted the NodePath. What exactly does the NodePath store? How do I 
extract the names of the Nodes that contain the geometry i.e., how do I use the 
NodePath to return the bottom most (leaf node?) node (node1, node2 or node3) in 
my scene graph?



Thank you!

Cheers,
John

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





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


Re: [osg-users] cross axes

2010-06-23 Thread Gianni Ambrosio
One more question. Suppose I have two viewers and I would like to show the axes 
just in one of them. Since the camera with the axes model is in the scene, is 
there any flexible way to enable/disable the axes in one viewer?

Regards
Gianni

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





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


Re: [osg-users] cross axes

2010-06-23 Thread Gianni Ambrosio
I have one question about my posted code. I added

viewerWindow->addSlave(camera, false);

otherwise "camera->getView()" call in "AxisCameraUpdateCallback::operator()" 
fails. I didn't find any documentation about that and I tried just intuitively.

Regards
Gianni

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





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


Re: [osg-users] cross axes

2010-06-23 Thread Gianni Ambrosio
Since I did't find a complete example for adding a cross axes in a view, here 
is the sample code I roughly implemented. I starded from what Jimmy suggested 
here http://forum.openscenegraph.org/viewtopic.php?t=2205&highlight=axis.



Code:

   ViewerQT* viewerWindow = new ViewerQT;
   osg::Group* root = new osg::Group;
   osg::Camera* camera = createHUD();
   viewerWindow->addSlave(camera, false);
   root->addChild(camera);
   root->addChild(loadedModel);
   viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
   viewerWindow->setSceneData(root);
   viewerWindow->show();

osg::Camera* createHUD()
{
   osg::Camera* camera = new osg::Camera;
   camera->setProjectionMatrix(osg::Matrix::ortho2D(-1.5, 17.75, -1.5, 13.86));
   camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
   camera->setClearMask(GL_DEPTH_BUFFER_BIT);
   camera->setRenderOrder(osg::Camera::POST_RENDER);
   camera->setUpdateCallback(new AxisCameraUpdateCallback);

   osg::Node* axes = osgDB::readNodeFile("axes.osg");
   camera->addChild(axes);

   return camera;
}

class AxisCameraUpdateCallback:public osg::NodeCallback
{
public:
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if(nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
{
osg::Camera* camera = dynamic_cast(node);
if (camera)
{
   osg::View* view = camera->getView();
   if (view && view->getNumSlaves() > 0)
   {
   osg::View::Slave* slave = &view->getSlave(0);
   if(slave->_camera.get() == camera)
   {
   osg::Camera* masterCam = view->getCamera();
   osg::Vec3 eye, center, up;
   masterCam->getViewMatrixAsLookAt(eye, center, up, 30);
   osg::Matrixd matrix;
   matrix.makeLookAt(eye-center, osg::Vec3(0, 0, 0), up); 
// always look at (0, 0, 0)
   camera->setViewMatrix(matrix);
   }
   }
}
}
traverse(node,nv);
}
};




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





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


Re: [osg-users] cross axes

2010-06-23 Thread Gianni Ambrosio
Thanks Paul, you are right!

Regards
Gianni

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





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


[osg-users] [forum] JFIF header decoding

2010-06-23 Thread suneetha vakkalagadda
Hi,

I need the details of :

1. Thumbnail Image width
2. Thumbnail Image height
3. Row striding of thumbnail image
4. Bits per componenet

These are present in JFIF header part of JPG.
More specifically these are present in APP0 segment. (Part of JFIF and the 
Marker is: 0xFFE0)

Thank you!

Cheers,
suneetha

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





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


Re: [osg-users] [osg-submissions] Shader composition

2010-06-23 Thread PCJohn

Hi Robert,


I would appreciate others having a look at Roland's implementation as well.


I took a look at Rolands code some time ago as I built my own simple 
shader composition for myself as well. The problems, I found myself with 
shader composition is that I often need to customize the shaders. Many 
people may want to keep functionality similar to OpenGL pipeline, thus 
they would prefer to use Gouraud shading. Me, I want to use Phong 
shading. One person may prefer Blinn-Phong (half-vector) specular 
reflection, while I prefer Phong reflection (reflection vector). Some 
people would want to include Shadow maps that needs their small piece of 
code in fragment shader. Others as me, look for shadow volumes in the 
future while they considers using geometry shaders.


In my opinion, the most difficult part of the design would be to allow a 
programmer to make all these things and to add even more of them in the 
future, based on the craziest (but meaningful) ideas of the programmers.


One more experience from me: Shader compilation is time expensive work 
by my experience. Say, it is a real difference to compile twenty shaders 
or compile one and reuse it twenty times from cache. It would be nice to 
have a cache and if the shader of particular parameters were already 
generated, it would be reused. (Not sure, if Rolands submission includes 
cache feature.)


Looking forward to have a shader composition in OSG!
John

BTW: Sending copy to OSG-discussion as well, for others input.


Robert Osfield wrote:

In terms of the final approach I merge, I would like to retain the
flexibility of the OSG current StateAttribute + GL mode approach, this
is already a form of state composition that has all the
inheritance/compositional behavior that I'd like to see, but we
currently rely upon the GL drivers to do the mapping fixed function
pipeline to shaders for us.  Roland's approach does provide something
similar to this, am I'm still learning about the implementation
details so can't yet comment in full of how close it gets.

I would appreciate others having a look at Roland's implementation as well.

Robert.

On Tue, Jun 22, 2010 at 12:56 PM, Wojciech Lewandowski
 wrote:
  

Hi, Robert

I hope you will also look at Virtual Program in shader composition example.
I am not trying to sell the implementation but I really would like to see
shader composition simple and easy to use and I think that VirtualProgram
approach could be seen as such fairly simple interface.

I was hoping that current osg::Program could be extended to allow incomplete
shaders like VirtualProgram allows. In that case VirtualProgram could be
removed. OSG could solve shader completness in similar way as uniforms are
handled: neccessary uniforms are selected and applied when program is
applied.

I think shaders could be selected and compiled in the same moment ie when
program is applied and using similar logic and handling as uniforms. We
would need to have the functional name for the shader to select shaders used
by program. That name would work bit like uniform name. It was "semantics"
parameter in VirtualProgram but some other shader names could be used as
well for this purpose.

And the other subject I think may affect your work are Open GL 4.0
subroutines. Lets make the shader composition in OSG future compatible with
this concept.

That are only my 2 cents. I don't want to start any fierce discussion. I
will accept a solution you would select as most appropriate.

Cheers,
Wojtek

--
From: "Robert Osfield" 
Sent: Monday, June 21, 2010 7:02 PM
To: 
Subject: Re: [osg-submissions] Shader composition



Hi Roland, Johannes et. al,

I've mostly cleared my desk for other tasks so am now ready to dive
back into the topic of shader composition.  My plan this week is to
dig out my own design notes, and do a review of Roland's submissions
and experiment with the runtime usage/results of the submission to get
better idea of the problem domain and the submission itself.

Any updates on the submission or any thoughts on shader composition
would be most welcome.  Once I'm more back up to speed on Roland's
submission and my collected more of my own thoughts together I'll
strik a discussion on osg-users about shader composition, but feel
free to chip in on this thread if you have comments about Roland's
submission.

Cheers,
Robert.
___
osg-submissions mailing list
osg-submissi...@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
  

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



___
osg-submissions mailing list
osg-submissi...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submis