Re: [osg-users] 139.com Spam

2012-06-07 Thread Gio
I have the same problem. 
On Jun 8, 2012, at 12:29 AM, Preet wrote:

 me three... gmail does a decent job of filtering it out once you mark
 it as spam though
 
 On Thu, Jun 7, 2012 at 4:49 PM, Jordi Torres jtorresfa...@gmail.com wrote:
 Me too.
 
 El 07/06/2012 21:43, rocco martino martinoro...@gmail.com escribió:
 
 Idem
 
 2012/6/7 Kim Bale kcb...@googlemail.com
 
 Is anyone else getting these Chinese emails quoting the subject of a post
 made to osg-users?
 
 I've had a few now and I have no idea where they're coming from.
 
 K.
 
 ___
 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

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


Re: [osg-users] Set Viewport background color as transparent

2012-06-06 Thread Gio
Hi Vishwa,
the only way I can help you is giving you my code of initialization:
Try to adapt it for non your platform.
variables of instance:
osg::ref_ptrosgViewer::Viewer _viewer;
osg::ref_ptrosg::MatrixTransform _root;


- (osg::ref_ptrosg::GraphicsContext)createGraphicContext
{
//create our graphics context directly so we can pass our own window 
osg::ref_ptrosg::GraphicsContext::Traits traits = new 
osg::GraphicsContext::Traits;

// probably you need to change this because it is for iOS
osg::ref_ptrosg::Referenced windata = new 
osgViewer::GraphicsWindowIOS::WindowData(self.view, 
osgViewer::GraphicsWindowIOS::WindowData::IGNORE_ORIENTATION);

// Setup the traits parameters
traits-x = 0;
traits-y = 0;
traits-width = //put here the width of the window view
traits-height = //put here the height of the window view
traits-depth = 24; //keep memory down, you can put 16
traits-windowDecoration = false;
traits-alpha = 1;
traits-doubleBuffer = true;
traits-sharedContext = 0;
traits-setInheritedWindowPixelFormat = true;
//traits-windowName = osgViewer;

traits-inheritedWindowData = windata;

// Create the Graphics Context
osg::ref_ptrosg::GraphicsContext graphicsContext = 
osg::GraphicsContext::createGraphicsContext(traits.get());

osg::setNotifyLevel(osg::INFO);

return graphicsContext;


}

This is the function that initialize everything:
//here I call the function I previously defined to create graphics context 
osg::ref_ptrosg::GraphicsContext graphicsContext = [self 
createGraphicContext];

//create the viewer
_viewer = new osgViewer::Viewer();
//if the context was created correctly then attach to our viewer
if(graphicsContext)
{
//suppress annoying opengl warnings //attention please, you can comment 
the lines to debug

graphicsContext-getState()-setCheckForGLErrors(osg::State::NEVER_CHECK_GL_ERRORS);
_viewer-getCamera()-setGraphicsContext(graphicsContext);
_viewer-getCamera()-setViewport(new osg::Viewport(0, 0, 
graphicsContext-getTraits()-width, graphicsContext-getTraits()-height));
}
else
{
std::cout  ERROR: I can't create graphic context std::endl;
}

//create root of the scenegraph tree
_root = new osg::MatrixTransform();

//what I do here is simply create new nodes representing what i want to 
draw and add them as child of _root
[self initModels];

//YOU PROBABLY DON'T NEED TO DO THIS part about shaders
std::cout  initing shaders std::endl;
//initialize the shaders and attach them to _root
[self initShaders];


std::cout  setting scene data to root std::endl;
//create scene and attach it to _viewer
_viewer-setSceneData(_root.get());


//Set the threading model for the viewer,
//Possible options are: SingleThreaded || DrawThreadPerContext
_viewer-setThreadingModel(osgViewer::Viewer::SingleThreaded);

std::cout  setup camera std::endl;
//I setup the camera parameters such as clear color, clear mask, render 
order ...
[self setupCamera];

_viewer-frame();


Then you call back _viewer-frame in a way I think you know.

The function [self setupCamera] is this:

- (void)setupCamera
{
//set the clear color of the camera to be semitransparent
_viewer-getCamera()-setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.75f)); 
//set the clear mask for the camera
_viewer-getCamera()-setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

_viewer-getCamera()-setRenderOrder(osg::CameraNode::PRE_RENDER);

_viewer-getCamera()-setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR);


}


I personally tried the semi-transparency (with that value of 0.75) and it is 
working.

I hope this helps.
Just remember to attach a Camera manipulator or manually set ViewMatrix and 
ProjectionMatrix

Cheers,
John


On Jun 6, 2012, at 10:58 AM, Robert Osfield wrote:

 Hi Vishwa,
 
 On 6 June 2012 05:46, shekhar vishwa vishwa.shek...@gmail.com wrote:
 I am trying to implement the multiple views in same window. Each view render
 the diffrent models.User can set the view position at run time by mouse
 dragging. If dragged view is overlapped with any view then dragged view
 backgroud should be semi-trasparent.
 
 Please suggest me to resolve this.
 
 When you say background of the view being moved do you simply mean the
 clear colour that provides the normal background colour of a viewport
 needs to be disabled?  This is an important point as there isn't
 really any concept of background in OpenGL or the OSG.  Also be
 specific about what you mean by semi-transparent.  I'm guessing that
 you want to see the underlying views being the viewport, but what
 blending do you intend between the view at the front and the back?
 
 Robert.
 ___
 osg-users mailing list
 

Re: [osg-users] Set Viewport background color as transparent

2012-06-05 Thread Gio

I thin you can try to set the clear mask alpha channel to a value of 0.5
cheers,
John



On Jun 4, 2012, at 9:49 PM, shekhar vishwa vishwa.shek...@gmail.com wrote:

 Hi,
  
 Thanks for help. Now I can make the camera background as transparent. What 
 parameters need to set the camera background as semi-transparent.
  
 Please help me.
  
 Thanks
 Vishwa 
 ___
 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] Set Viewport background color as transparent

2012-06-05 Thread Gio
I think Vishwa wants to do something similar to what I am currently doing in 
iOS. I set transparent background in order to see some layer that is below, 
which in my case is the image coming from the videocamera. Anyway it would be 
helpful if Vishwa you can explain us better the purpose of your application and 
the platform where you are running. 
Cheers,
John


On Jun 5, 2012, at 12:01 PM, Robert Osfield robert.osfi...@gmail.com wrote:

 Hi Vishwa,
 
 You still don't explain what you mean by a semi-transparent background
 colour, given what replies you've already had and you've tried it
 suggest to me that you really are talking about something different as
 what you are asking really doesn't make sense in an normal graphics
 application.
 
 In a normal graphics application objects can be drawn semi-transparent
 on top of the background, and multiple Camera's can be layered on top
 of each one can have the front Camera's disable the clear of the
 colour buffer so they are rendered on top (see osghud), one can even
 set the an RGBA colour buffer when doing render to texture as this can
 be of use when reusing the texture to do appropriate blending.
 However it really doesn't seem like you are asking to do any of these
 scenario's, or perhaps you are.
 
 The only way I can make sense of what you are asking is that perhaps
 you might be wanting to render window that is transparent so you can
 see the desktop below it.  Is this correct?
 
 Robert.
 
 On 5 June 2012 05:01, shekhar vishwa vishwa.shek...@gmail.com wrote:
 Hi,
 
 I want to show the models on semi-transparent backgroud color.  I have
 implemented following code
 
 camera1-setViewport( 0, 0, 200, 200 );
 
 camera1-setClearColor( osg::Vec4(0.0f, 1.0f, 1.0f, 0.5f) );
 
 camera1-setRenderOrder( osg::Camera::POST_RENDER );
 
 camera1-setAllowEventFocus(
 
 true );
 
 camera1-setClearMask(GL_DEPTH_BUFFER_BIT );
 
 //| GL_DEPTH_BUFFER_BIT
 
 camera1-setReferenceFrame( osg::Transform::ABSOLUTE_RF );
 
 But above code is set the background as complete transparent.
 
 Please help me to make the camera background as semi-transparent.
 
 Thanks
 Vishwa
 
 
 ___
 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] Set Viewport background color as transparent

2012-06-04 Thread Gio
Hi Shekhar,

to set a transparent background you have to enable alpha when you set your 
traits 

When you set the graphic context traits 
osg::ref_ptrosg::GraphicsContext::Traits traits = new 
osg::GraphicsContext::Traits;
you can just add the line to your configuration:
traits-alpha = 1;
after you create a graphiccontext and associate your traits
osg::ref_ptrosg::GraphicsContext graphicsContext = 
osg::GraphicsContext::createGraphicsContext(traits.get());
you can set it in your camera like this
_viewer = new osgViewer::Viewer();
_viewer-getCamera()-setGraphicsContext(graphicsContext);


On Jun 4, 2012, at 8:21 AM, shekhar vishwa wrote:

 Hi,
  
 I am trying to implement the 3D overlay above current view. I am trying to 
 set the camera background color as transparent. I am using following code.
  
 osg::Node* node= osgDB::readNodeFile( Models/cessna.osg); 
 osg::Camera* camera = new osg::Camera;
 camera-setViewport( 0, 0, 200, 200 );
 camera-setClearColor(osg::Vec4(1.0f,1.0,0.8f,0.2f));
 osg::StateSet* stateset = camera1-getOrCreateStateSet();
 stateset-setMode(GL_BLEND,osg::StateAttribute::ON);
 stateset-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
 camera-setStateSet(stateset);
 camera-setRenderOrder( osg::Camera::POST_RENDER );
 camera-setAllowEventFocus( true );
 camera-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
 camera-setReferenceFrame( osg::Transform::ABSOLUTE_RF );
 camera-addChild( node1 );
  
  
 Above code only set the white background. Please help to set the camera 
 backgroud color as transparent.
  
 Thanks
 Vishwa
 -- Forwarded message --
 From: shekhar vishwa vishwa.shek...@gmail.com
 Date: Sat, Jun 2, 2012 at 5:00 PM
 Subject: Set Viewport background color as transparent
 To: osg-users@lists.openscenegraph.org
 
 
 Hi,
  
 I am using the OSG, but I unable to set the viewport or view backgraund color 
 as transparent.
  
 Please help me to resolve this issue.
  
 Thanks
 Vishwa
 
 ___
 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] accessing data structures of objects

2012-05-31 Thread Gio
Hi,
When you load data from a file like an obj using the function 
osgDB::readNodeFile is there any way to access the arrays containing vertex 
coordinates, normal coordinates and texture coordinates associated to the 
object? I want to design a way to detect which rendered object user is touching 
in the screen.

Thank you,
John

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


Re: [osg-users] Improving performance of OBJ rendering by back face culling

2012-05-30 Thread Gio
Thank you for your precious advice Robert.

Cheers,
John
On May 30, 2012, at 10:23 AM, Robert Osfield wrote:

 Hi John,
 
 On 30 May 2012 00:16, Gio kahar...@gmail.com wrote:
 So... your suggestion is to optimize the 3d model reducing the number of 
 vertices because face culling will not improve performance?
 Can you argue more about why is like that?
 
 Paul explained... if you are fill limited then back face culling can
 help, if not then it make little difference.
 
 Fill limited is when the GPU has saturated it's ability to deliver
 pixels to the frame buffer.  One way to find out whether you are fill
 limited or not is to change the size of the window you are rendering
 to so that it's smaller, if performance goes up then you are fill
 limited.
 
 There are many potential bottlenecks that can occur when doing
 graphics, fill limit is only one of them.  Paul suggestion of being
 vertex limited is one of them.  The way to test this is to render a
 series of models with increase number of vertices by a constant fill
 load and constant number of objects.  You can use the osgsimplifer
 example to illustrate how to cut the number of vertices down on a
 model.
 
 As for the many other different types of bottlenecks, well there is
 are simply too many to expand upon in my message, but the topic of
 optimization has been covered many times on the mailing list/forum,
 and plenty of books and online resources on optimization of graphics.
 It's a huge topic, I'm twenty years into my exposure to computer
 graphics and am still learning new things.  It's a topic that you
 should be prepared to invest time and energy into.
 
 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] Improving performance of OBJ rendering by back face culling

2012-05-29 Thread Gio
Hello, 
I am developing an application for iphone and ipod touch using openscenegraph. 
It is an augmented reality application and I have to load a very complex model. 
The original 3d model has 5 million vertices. 
Since I am using a mobile platform which is limited in computational power I 
simplified the model using 3d studio max. I reduced the size of the model from 
500Mb to 4.2 Mb using proOptimizer.
The model now has in total about 36,000 vertices and about 53,000 faces.

I am able to render it but frame rate is slow. I'd like to improve performance 
using back face culling. The point is I don't know how to activate it (if it is 
possible):
I tried with these lines of code but frame rate is still low:

[code]
osg::StateSet* ss = _root-getOrCreateStateSet();
osg::CullFace* cf = new osg::CullFace(osg::CullFace::BACK ); 
ss-setAttribute( cf );
[/code]

I am using OpenGL ES 2.0 and shaders.

I setup the camera in this way:

[code]
//set the clear color of the camera to be transparent
_viewer-getCamera()-setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.0f)); 
//set the clear mask for the camera
_viewer-getCamera()-setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
_viewer-getCamera()-setRenderOrder(osg::CameraNode::PRE_RENDER);
_viewer-getCamera()-setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR);
[/code]

I use DO_NOT_COMPUTE_NEAR_FAR because I need to set manually projection and 
viewMatrix at every drawing cycle.

I also initially set viewport like this:

[code]
_viewer-getCamera()-setViewport(new osg::Viewport(0, 0, 
graphicsContext-getTraits()-width, graphicsContext-getTraits()-height));
[/code]

The hierarchy of my object is structured as:
 
_root is a osg::MatrixTransform

my 3d model is divided in subparts.
all the subparts of my 3d model are direct child of _root and are of type 
osg::Node

I hope you can give me some tips to improve performance. If you need some other 
information about my setup I will be glad to give it.

Thank you.

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


Re: [osg-users] Improving performance of OBJ rendering by back face culling

2012-05-29 Thread Gio
So... your suggestion is to optimize the 3d model reducing the number of 
vertices because face culling will not improve performance? 
Can you argue more about why is like that?
Thank you.
John

On May 29, 2012, at 11:26 PM, Paul Martz wrote:

 Enabling face culling will improve performance only when rendering is 
 fill-limited. If you're vertex-limited, face culling will not affect 
 performance.
   -Paul
 
 
 
 On 5/29/2012 2:48 PM, Gio wrote:
 Hello,
 I am developing an application for iphone and ipod touch using 
 openscenegraph. It is an augmented reality application and I have to load a 
 very complex model. The original 3d model has 5 million vertices.
 Since I am using a mobile platform which is limited in computational power I 
 simplified the model using 3d studio max. I reduced the size of the model 
 from 500Mb to 4.2 Mb using proOptimizer.
 The model now has in total about 36,000 vertices and about 53,000 faces.
 
 I am able to render it but frame rate is slow. I'd like to improve 
 performance using back face culling. The point is I don't know how to 
 activate it (if it is possible):
 I tried with these lines of code but frame rate is still low:
 
 [code]
 osg::StateSet* ss = _root-getOrCreateStateSet();
 osg::CullFace* cf = new osg::CullFace(osg::CullFace::BACK );
 ss-setAttribute( cf );
 [/code]
 
 I am using OpenGL ES 2.0 and shaders.
 
 I setup the camera in this way:
 
 [code]
 //set the clear color of the camera to be transparent
 _viewer-getCamera()-setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.0f));
 //set the clear mask for the camera
 _viewer-getCamera()-setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
 _viewer-getCamera()-setRenderOrder(osg::CameraNode::PRE_RENDER);
 _viewer-getCamera()-setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR);
 [/code]
 
 I use DO_NOT_COMPUTE_NEAR_FAR because I need to set manually projection and 
 viewMatrix at every drawing cycle.
 
 I also initially set viewport like this:
 
 [code]
 _viewer-getCamera()-setViewport(new osg::Viewport(0, 0, 
 graphicsContext-getTraits()-width, graphicsContext-getTraits()-height));
 [/code]
 
 The hierarchy of my object is structured as:
 
 _root is a osg::MatrixTransform
 
 my 3d model is divided in subparts.
 all the subparts of my 3d model are direct child of _root and are of type 
 osg::Node
 
 I hope you can give me some tips to improve performance. If you need some 
 other information about my setup I will be glad to give it.
 
 Thank you.
 
 Greetings,
 John Moore
 ___
 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