Re: [osg-users] Can i use MatrixTransform to transform a HUD node?
Well,Chris. Just as you assumed,my case is quite complicated. I have to make a growing up effect HUD, ie, dynamically scaled up one. Use Mt to scale the HUD node will never work since we set the camera ABSOLUTE_RF mode. Then i tried to use the setviewmatrix method to scale it up but this won't work,too. The only way I 've found working is to scale up the raw image passed to draw the pic. The drawable can be a texture or a drawpixels and i use the latter one. To enable dynamic effect, I have to use a custom NodeCallBack class to handle it. Each callback time I have to set and scale the image to the drawpixels to show a growing up scaled size. But since I saw the HUD content of your github link, I guess the SnapImage struct the author creates may be a new way to handle this job.I 'll try it in the next following days. Thank you,guy!|-) Chris Hanson wrote: > > > I was just trying to be thorough and complete because I wasn't clear on the > situation, so I was throwing all possibilities out there to see if that was > the reason I wasn't getting it. > > > Normally making a HUD is pretty straightforward ( > https://github.com/openscenegraph/OpenSceneGraph/tree/master/examples/osghud > (https://github.com/openscenegraph/OpenSceneGraph/tree/master/examples/osghud) > ) so I assumed this must be a more complex case. > -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75429#75429 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can i use MatrixTransform to transform a HUD node?
Yeah,Terry. #1 is the exactly the right way to use HUD. I've been trying these days to use MT transformation method to operate the child HUD node but it will never be able to control it because i found that I've used the following line of code: camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); When I looked up the detailed explanation of this code on the net,I realized that MT will never be working on it.If we want to control its position, we only have to and only need to use the camera node itself.That will be Ok. I haven't tried to delete this line code and then use MT to control the camera node, but I guess that will result in a bad effect and I haven't seen anyone on the net to use HUD this way. So |-) just don't care about it. Terry Welsh wrote: > I have only done #1, where the HUD node is derived from osg::Camera. I > set the view matrix and projection matrix to provide a simple box in > which to render all HUD elements. The individual elements can be > positioned within that box with MatrixTransforms. > > It's not very hard to get this working. Try prototyping it with one > osgText::Text element and one simple box or sphere under a > MatrixTransform. > > - Terry > ___ > osg-users mailing list > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- > Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75428#75428 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can i use MatrixTransform to transform a HUD node?
Chris Hanson wrote: > > > I'm afraid I didn't understand this explanation very well myself. My first > question would be, do the HUD elements (the 2d pics) stay stuck to the screen > space (as if they were part of a game scoreboard overlaid onto the screen) or > do the move around the screen as the main view camera rotates, tilts, moves, > etc like an Augment Reality environment? > > > -- > > > Chris 'Xenon' Hanson, omo sanza lettere. http://www.alphapixel.com/ > (http://www.alphapixel.com/) > Training • Consulting • Contracting > 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • > GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL > Legal/IP • Forensics • Imaging • UAVs • GIS • GPS • osgEarth • Terrain • > Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • > Android > @alphapixel (https://twitter.com/alphapixel) facebook.com/alphapixel > (http://facebook.com/alphapixel) (775) 623-PIXL [7495] > > -- > Post generated by Mail2Forum Thank you for your reply. If you feel confused by my unprofessional explanation:), you can think it this way as below: Can I use a MT node to add the Hud node and then transform the hud on the screen by the MT parent node.This should be clear. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75417#75417 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can i use MatrixTransform to transform a HUD node?
Thank you Terry! So you mean that if i want to move or scale these hud nodes on the main screen, i have to use the camera's setviewmatrix method to do this? Add the hud nodes to a new MT and use the Mt transform methods won't work,right? The node structure instruction is like the following: 1. Root->hud node->Mt node->geode node->geometries; 2. Root->Mt node-> hud node->geode node->geometries; So the first one will work and the second won't,right? Terry Welsh wrote: > I have made plenty of HUD classes derived from osg::Camera. It's easy > to set it up as an orthographic or perspective projection, depending > on what look you're going for. Then I compute some simple coordinates > for the screen corners like this: > > mHUDLRBT[0] = -mAspectRatio; > mHUDLRBT[1] = mAspectRatio; > mHUDLRBT[2] = -1.0f; > mHUDLRBT[3] = 1.0f; > if(mAspectRatio < 1.0f){ > mHUDLRBT[0] = -1.0f; > mHUDLRBT[1] = 1.0f; > mHUDLRBT[2] = -1.0f / mAspectRatio; > mHUDLRBT[3] = 1.0f / mAspectRatio; > } > > All your HUD nodes (such as osgText::Text or something derived from > MatrixTransform) can be positioned relative to those screen corners. > Every time you resize your window you should call your HUD nodes > positioning method. > - Terry > -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75398#75398 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Can i use MatrixTransform to transform a HUD node?
Hi,guys Well,as the subject notes,The software in my dev job has to use a HUD to show 2d pics. Generally using a camera to create a new viewport to show the pic will be OK. But the 'Entity' base class for the software system uses a MT (matrixtransform) to add the detailed entity node(such as basic geometry,text with a geode) and then add this MT node to the root by the datacontainer manager class. If I create the hud entity class derived from the base class, ie, add the camera node to the MT node,does it work if I operate the move, scale commands to this hud entity by using MT,not the camera? If it doesn't work, how can I change the node structure to make the Hud entity responsive to the transform operations which is generated by MT.Or do I only have to use the camera node itself to do these transformation jobs? Please do me a favor!Thank you,guys! :) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75379#75379 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org