Re: [osg-users] Modify Object After Picking

2008-02-15 Thread John Donovan
Gordon Tomlinson wrote:
 Another old school Performer way, would be to double draw your node once in
 normal mode and then a second time in wire frame mode

An extension to this, which I've read about but never implemented is, after 
rendering your object, set ztest to equal, switch to wireframe, set line 
thickness to 2 or 3 pixels, and render the backfaces of your object. You'll get 
a rather funky, and fairly cheap, silhouette of your object. AFAIK, this is how 
Modo does it's highlighting.

-JD


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Modify Object After Picking

2008-02-15 Thread John Donovan
Paul Martz wrote:
 I have done this before, and the results are interesting but not high
 quality due to differences in line/polygon rasterization. Still a good trick
 nonetheless.
-Paul

Yeah, I've seen line rasterization on different graphics cards produce 
different results, and sometimes it's completely broken. Wasn't there a Linux 
ATI driver issue that made wireframes in OSG useless?
I guess a lot of the issues also depend on the geometry and the depth precision 
of the scene.


-JD


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Congratulations ag! OpenSceneGraph Chinese Mirror have been finished , try it.

2008-02-11 Thread John Donovan

Happy New Year(in China , It is New Year.)


Gung hey fat choi!

-JD


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] View matrix center

2008-02-07 Thread John Donovan
Jean-Sébastien Guay wrote:
  The eye point is as expected, but instead I get center = (0,-39,0).

Presumably because getViewMatrixAsLookAt() doesn't do any magic, it just takes 
the Y axis (in this case) of the matrix as the view vector. This vector will be 
normalised (otherwise the camera would do funky things), so all it can do is 
subtract this unit vector from the eye position.
I guess the manipulator has some notion of the point about which it orbits, but 
I couldn't tell you what that is off-hand. The header will tell you, no doubt.

-JD, who is pressing all the right keys, just not necessarily in the right 
order.



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] changing colors of a geode

2007-12-18 Thread John Donovan
Gianluca Natale wrote:
 Hi all,
 
 I'm new to OSG.
 
 I cannot find a way to change the primary color of OpenGL in order to draw
 the same
 
 object twice in two different places with two different colors.

Just to throw in a third alternative, you could create a simple shader that
took a colour parameter. Depending on your application, this may be overkill,
but if later on you want to get more complicated with your shading this method
will scale nicely.
This is really just an illustration of how the same thing can be done in
different ways with OSG.

-JD


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] ANN: Reference Manual for v2.2 now available

2007-12-14 Thread John Donovan
Paul Martz wrote:
  * We could spend time writing short whitepapers on various OSG topics,

I'd be very much in favour of this form of documentation.
It allows users to pick and choose which papers to read, without having to buy
lots of doxygen output or stuff they already know.
Domain experts could write a paper, with maybe a editor-in-chief to ensure
consistency. Admittedly I can see most of this work just coming down to two or
three people, but the potential is there. Or maybe the domain expert could just
write some notes and someone could be employed as a ghost-writer; this might be
attractive to foreign users.
Once enough have been written, they could be compiled into a paper book as a
sort of OSG Gems.
This is something of a Utopian vision I admit, my experience tells me it
wouldn't work out like this; but it'd be a reasonable idea to aim for.
Incidentally, my offer to proof-read still stands.

-JD


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Looking towards 2.4, and what might go into it.

2007-12-11 Thread John Donovan
Robert Osfield wrote:
 On Dec 11, 2007 6:31 AM, J.P. Delport [EMAIL PROTECTED] wrote:
 could we get support for multiple render targets (MRT) integrated into
 2.4? I know some people are using hacky patches for this. Some patches
 have been submitted, but they have to be reworked.

 I can help with this if needed.
 
 If we can get a clean set of patches to support MRT then I'm for
 reviewing/merging them :-)

Mea culpa... I implemented JP's hack into my source and it worked for what I
needed it for. Then I submitted a half-baked patch which Robert was right to
refuse, but then I was dragged off to do other things. I'll have time to play
around with it over chrimbo in my spare time, so if you're around between
christmas day and new year JP, we could collaborate on a decent fix. We're most
of the way there really.

-JD


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Yaw angle

2007-12-10 Thread John Donovan
Pettersson Håkan wrote:
 Hello

 How do I calculate the yaw angle that my cameraManipulator is
 pointg at   (-PI to +PI) ???

 /Hakan

Hi Håkan,
Relative to what? If you want it relative to the +Z axis, then use
atan2(zdir.x, zdir.z), being careful to put in a special case where the camera
is looking straight up or down. But I suggest you be a bit more specific with
your question.
For general 2D and 3D maths questions, you could do worse than look at:
mathworld.wolfram.com or a slew of other 3D maths sites.

-JD



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Fade in fade out effect

2007-11-30 Thread John Donovan
Do you want to fade to black, change scene, then fade up? Or do you want to
fade from one to another?
The first option is easiest, just draw a full-screen quad over the top of your
scene, changing the alpha from 0 to 1. Then change scenes and reverse the alpha
fade.
If you want to blend between scenes, when you're ready to blend, you'll have to
render the first scene to a texture and draw it as a full-screen quad. Finally
fade the quad from 1 to 0 to reveal the new scene. This means you'll be
rendering both scenes concurrently during the fade, so check your scenes aren't
too big.

-JD

deepti g wrote:
 Hi everyone
  I want to implement a fade in fade out option where one
 scene fades out and another scene comes into view.. Is there any such option
 for scene as FADE TEXT for text..Iam dint find a direct functionality to do
 this.Can anybody suggest me as to how to solve this?
 
 Thank You
 Deepti



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to get an unclamped float color buffer?

2007-10-25 Thread John Donovan
Ralph Kern wrote:
 Hi,
 
 I now managed to get true float values out of the render buffer by
 specifying
 image = new osg::Image;
 image-allocateImage(width, height, 1, GL_RGB, GL_FLOAT);
 image-setInternalTextureFormat(GL_RGB32F_ARB);
 viewer-getCamera()-attach(osg::Camera::COLOR_BUFFER, image.get());
 
 But the values are still clamped to 1.0. Any idea to get around that?
 
 regards Ralph

A fragment shader is what you need I think. Make sure you write to gl_FragData
rather than gl_FragColor, otherwise it'll still be clamped.
I'm a bit busy at the moment, so I can't help you further, but I'm sure others
will be generous with their time :)

-J



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] rendering edges of an object

2007-10-12 Thread John Donovan

 Hi!
 I'd like to know whether hidden line removed (silhouette edges) 
 rendering can be achieved with OccluderGeometry class ?
 In addition, i have found Shi Yazheng's article 
 (http://www.cs.umu.se/education/examina/Rapporter/ShiYazheng.pdf) 
 implementing SEDGeode, which seems a good solution for us. So i'm asking 
 you which approach you suggest us to take and if there is some better 
 support in further releases to be expected.
 
 best regards, andrej

Hi,
I'm afraid I can't help you there. I don't know enough about your application,
and I'm not able to offer any more suggestions. If you're unsure as to which
method to use, then I'd suggest trying different methods and decide which you
like best.
Robert would be the man to ask about future support for any particular feature.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] rendering edges of an object

2007-10-11 Thread John Donovan
andrej spilak wrote:
 Hi!
 I've exported an object from SolidWorks and stored it in .osg format. 
 Now I'm trying to get rendered the edges of an object (without triangles 
 as are seen in wireframe in the osgviewer - only the edges wireframe). 
 What would be best possible solution(s) to achieve this? I'd like to 
 have those in my version of a viewer later as a separate view option (or 
 both at the same time)
 
 Thanks in advance, andrej

If you want a silhouette, then a neat trick is to render your mesh as normal.
Then set line thickness to some value, and depth-test to EQUAL, and render
back-faces instead of front-faces in wireframe.
An alternative would be to use RTT and apply an edge filter via a fragment 
shader.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] rendering edges of an object

2007-10-11 Thread John Donovan
andrej spilak wrote:
 I'd like to render a wireframe of an object with it's outer edges only. 
 Basically only outline of an object. Are there any osg solutions?

If you want to render _just_ the outline, then the method I suggested will
still work, but you've just got to switch off rendering to the colour buffer
for the front faces, but keep z-writes on. And also make sure you do it last,
so it doesn't obscure anything behind it.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Constructing normals for osg::DrawElements

2007-09-18 Thread John Donovan
Cervantes Pintor Pedro wrote:
 Hi,
 
 
 I'm constructing a geometric object by hand. The way I'm doing it, is vertex 
 by 
 vertex and then polygon by polygon.
 


Hi Cervantes,
normals are really just a property of vertices, not faces. The way to get flat
faces with the fixed-function pipeline is to duplicate the vertices and give
them different normals.
If you're using (or prepared to use) vertex shaders, you could attach your
second normals to another stream, and write a vertex shader to choose the right
normal. How you do this is application dependent, but to emulate the standard
lighting calculations is well documented.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Constructing normals for osg::DrawElements

2007-09-18 Thread John Donovan
Alberto Luaces wrote:
 Hi,
 
 I think you can specify a normal per polygon using Geometry::setNormalBinding 
 and the parameter BIND_PER_PRIMITIVE.
 

This is true, but OSG will fall back to using glBegin()/glEnd() to render the
primitives, rather than using vertex arrays or display lists. Not a problem if
you've got a few objects like this, but isn't the most efficient path when the
scenegraph gets large.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] FBO question

2007-09-17 Thread John Donovan
Igor Naigovzin wrote:
 Hello to all!
 I have a simple question.
 I want to render a two cameras (two different render surfaces) by exactly
 the same scene.

Hi Igor,
if I understand you correctly, you're doing the same sort of thing I am. I have
a few cameras rendering to the same texture.
This is the code I use:
ref_ptrGraphicsContext::Traits traits = new GraphicsContext::Traits;
traits-x = 500;
traits-y = 800;
traits-width = totalWidth;
traits-height = vpHeight;
traits-windowDecoration = true;
traits-doubleBuffer = true;
traits-sharedContext = 0;
ref_ptrGraphicsContext _gc =
GraphicsContext::createGraphicsContext(traits.get());

osgViewer::Viewer _viewer;

for (int i = 0; i  _numCameras; ++i) {
   rot.makeRotate(_startAng + (_angStep * i), 0.0, 1.0, 0.0);
   ref_ptrCamera cam = new Camera;
   cam-setViewport(new Viewport(_cameraWidth * i, 0.0, _cameraWidth,
_totalHeight));
   cam-setRenderOrder(osg::Camera::PRE_RENDER);
   cam-setGraphicsContext(_gc);
   cam-setAllowEventFocus(false);
   cam-setRenderTargetImplementation(Camera::FRAME_BUFFER_OBJECT);
   cam-attach(Camera::COLOR_BUFFER, _texture.get());
   cam-setDataVariance(Object::DYNAMIC);
   cam-addChild(group.get());

   _viewer.addSlave(cam.get(), Matrixd(), rot, false);
}

_viewer.getCamera()-setProjectionMatrixAsPerspective(_cameraFoVX /
_aspectRatio, _aspectRatio, 1.0, 1000.0);
_viewer.getCamera()-setViewMatrix(trans);
_viewer.getCamera()-setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
_viewer.getCamera()-setClearColor(Vec4(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX));
_viewer.setDataVariance(Object::DYNAMIC);

I'm using a floating-point texture, but it works just as well with a regular
8-bit RGB texture. Note I'm setting up the viewports for each camera. My
application is a piecewise linear approximation of a cylindrical projection.
I then set up another viewer and another scene graph to render the textured
quad to the screen, then call _both_ viewers in my render loop.

Hope this helps,
-J



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] multipass calculating with shaders

2007-09-17 Thread John Donovan
[EMAIL PROTECTED] wrote:
 thanks, I'll try that.
 
 more problems I'm facing is setting the image internal data type, I've seen
 in the examples setting the internal type to 3 or 4. what does it mean? how
 do I set it to float or int?

I use the following code for rendering to a floating-point texture:
_texture = new Texture2D;
_texture-setResizeNonPowerOfTwoHint(false);
_texture-setTextureSize(_totalWidth, _totalHeight);
_texture-setSourceType(GL_FLOAT);
_texture-setSourceFormat(GL_RGB);
_texture-setInternalFormat(GL_RGB32F_ARB);
_texture-setFilter(Texture2D::MIN_FILTER, Texture2D::NEAREST);
_texture-setFilter(Texture2D::MAG_FILTER, Texture2D::NEAREST);


 and I couldn't read from the image even that I used code very similar to
 osgprerender example :(, the image-data() return buffer filled with
 garbage.

If I understand it correctly, the Image associated with a Texture is used for
uploading the data into the texture. If you want to read from the texture,
you'll need to copy it to a buffer. I can't remember how to do that off-hand,
but it'll likely be fairly slow.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Multiple render targets

2007-09-14 Thread John Donovan
Hi,
is there anything else I need to do to render to two textures with the same
fragment shader? I have the following code:
cam-setRenderTargetImplementation(Camera::FRAME_BUFFER_OBJECT);
cam-attach(Camera::COLOR_BUFFER0, _texture.get());
cam-attach(Camera::COLOR_BUFFER1, _texture2.get());

And the following fragment shader:
void main(void)
{
gl_FragData[0] = vec4(1.0, 0.0, 0.0, 1.0);
gl_FragData[1] = vec4(0.4, 0.4, 0.0, 1.0);
}

The first texture comes out red as expected, but the second one (which is
identical in size and format as the first) comes out black.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Multiple render targets

2007-09-14 Thread John Donovan
Ah! That'd explain it :) Thanks JP.
It would be handy to have a look at what you've done; perhaps we can both faff
about with it to make it submittable.

-J

J.P. Delport wrote:
 Hi,
 
 as far as I know its not supported in current version of OSG, there is 
 no call to glDrawBuffers (as opposed to glDrawBuffer) which is needed 
 for MRT.
 
 I have a version of RenderStage.cpp that I modified to allow MRT for one 
 of our projects, but its a hack and I still need to properly organise it 
 before I can submit a patch.
 
 I can post it with instructions if you want it?
 
 regards
 jp
 
 
 John Donovan wrote:
 Hi,
 is there anything else I need to do to render to two textures with the same
 fragment shader? I have the following code:
  cam-setRenderTargetImplementation(Camera::FRAME_BUFFER_OBJECT);
 cam-attach(Camera::COLOR_BUFFER0, _texture.get());
 cam-attach(Camera::COLOR_BUFFER1, _texture2.get());

 And the following fragment shader:
 void main(void)
 {
 gl_FragData[0] = vec4(1.0, 0.0, 0.0, 1.0);
 gl_FragData[1] = vec4(0.4, 0.4, 0.0, 1.0);
 }

 The first texture comes out red as expected, but the second one (which is
 identical in size and format as the first) comes out black.

 -J


 __
 This email has been scanned by the MessageLabs Email Security System.
 For more information please visit http://www.messagelabs.com/email 
 __
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

 


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Multiple render targets

2007-09-14 Thread John Donovan
J.P. Delport wrote:
 Hi,
 
 OK, here goes.

Thanks JP, that worked a treat!

 We need some mechanism to store/assign more than one drawbuffer inside
 camera and possibly a flag to indicate we want MRT. RenderStage can
 then inherit/query these values to properly call glDrawBuffer(s).

Yeah, I can see it's a bit hacky, but not as bad as I was expecting!
Robert, do you have any plans for doing MRT stuff, or are you happy with JP and
me to come up with something workable and submit it? The changes JP has made
are fairly trivial, so it wouldn't take much to make it more robust.


 If you have time, give it a bash.

I won't have time to look any deeper until next week, but it does at least work 
:)

-JD


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Multiple GraphicsContexts

2007-09-11 Thread John Donovan
Is it possible to have a viewer with a RTT camera render with one
GraphicsContext, then to use that texture with another viewer and a different
GraphicsContext? It works ok if all the cameras use the same GC.
What I'm aiming for is to render to texture in a completely offscreen buffer,
then use that texture in a different scenegraph with a different 
GraphicsContext.
I'm just in the process of upgrading to the latest SVN, but do we have an
estimated release date for 2.2? I've been out of the OSG loop for a while, but
I'm really impressed with what's happened over the past 12 months or so. Keep
up the good work!

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Multiple GraphicsContexts

2007-09-11 Thread John Donovan

Robert Osfield wrote:
 If you wish to reuse texture objects generated by one context then you
 need to share the various contexts with each other.  You can set this
 via the GraphicsContext::Traits::sharedContext variable.


Ah! OK, that makes sense. But I am having problems with it...
I have the following:
ref_ptrGraphicsContext::Traits traits_rtt = new GraphicsContext::Traits;
traits_rtt-x = 500;
traits_rtt-y = 880;
traits_rtt-width = totalWidth;
traits_rtt-height = vpHeight;
traits_rtt-windowDecoration = false;
traits_rtt-doubleBuffer = true;
traits_rtt-sharedContext = 0;
ref_ptrGraphicsContext gc_rtt =
GraphicsContext::createGraphicsContext(traits_rtt.get());

ref_ptrGraphicsContext::Traits traits_view = new GraphicsContext::Traits;
traits_view-x = 500;
traits_view-y = 800;
traits_view-width = totalWidth;
traits_view-height = vpHeight;
traits_view-windowDecoration = true;
traits_view-doubleBuffer = true;
traits_view-sharedContext = gc_rtt.get();
ref_ptrGraphicsContext gc_view =
GraphicsContext::createGraphicsContext(traits_view.get());

Then I have a viewer with a camera rendering to a texture, and a viewer
rendering a textured quad to a window.
But when I call Viewer::frame() on the viewer that renders to the window, I get
the following error messages:

Windows Error #170: [Screen #0] GraphicsWindowWin32::realizeImplementation() -
Unable to share OpenGL context. Reason: The requested resource is in use.

Error: [Screen #0] GraphicsWindowWin32::makeCurrentImplementation() - Window
not realized; cannot do makeCurrent.

Are there any examples I can work off? I've tried a search for sharedContext in
the OSG project, but I just get the implementation code, not any example code.
Incidentally, I've upgraded to 2.1.9 without a hitch.

-J



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Multiple GraphicsContexts

2007-09-11 Thread John Donovan

Robert Osfield wrote:
 BTW, is there a reason why you aren't just using a single context and
 a FBO RTT Camera?
 


Not as such. But what I'm playing with is some GPGPU stuff where the results
won't necessarily be rendered anywhere. I'm really only using the textured quad
to check the results, eventually I'll just be reading them back to the CPU.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Multiple GraphicsContexts

2007-09-11 Thread John Donovan
John Donovan wrote:
 ...results won't necessarily be rendered anywhere.
On screen, that is.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RTT CompositeViewer

2007-09-10 Thread John Donovan
Hi Robert,
thanks for the quick reply. I've been playing around and it seems happy with
using the same texture to render into. I've since used just a osgViewer::Viewer
rather than the CompositeViewer, and it seems fairly happy.

-J


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] RTT CompositeViewer

2007-09-06 Thread John Donovan
Hi all,
I'm using OSG 2.0.0 and I have a osgViewer::CompositeViewer which is made up
of several cameras looking at the scene from different points of view, and all
rendering into a regular GraphicsContext.
How can I set up my scene to render this composite view into a single texture?
I have some code that I've culled from various samples but it just gives me a
grey texture.

Image* im = new Image();
im-allocateImage(totalWidth, vpHeight, 1, GL_RGB, GL_BYTE);

Texture2D* rtt = new Texture2D(im);
rtt-setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST);
rtt-setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST);
rtt-setResizeNonPowerOfTwoHint(false);

// Rinse and repeat for each camera.
Camera* rttcamera = viewer.getView(0)-getCamera();
rttcamera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
rttcamera-setClearColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
rttcamera-setRenderOrder(osg::Camera::PRE_RENDER);
rttcamera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
rttcamera-attach(osg::Camera::COLOR_BUFFER, rtt);
rttcamera-setViewport(new Viewport(0.0, 0.0, vpWidth, vpHeight));
rttcamera-setProjectionMatrixAsPerspective(fovy, aspect, 1.0, 1000.0);
// Set up view matrix, GraphicsContext and whatnot.

// Later on I call this code to save the texture.
Camera::Attachment foo = rttcamera-getBufferAttachmentMap().begin()-second;
Image* im = foo._texture-getImage(0);
if (im) {
   im-setFileName(c:\\temp\\test.png);
   osgDB::writeImageFile(*im, im-getFileName());
}

Is there a step that I'm missing?

-John Donovan


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org