Re: [osg-users] osgText::Text and screen
I had the exact same issue, but I tried to flip the view matrix as suggested, but I must be doing something wrong, because I don't see anything when I try this: Code: camera-setViewMatrix(camera-getViewMatrix() * osg::Matrixd::scale(1,-1.f,1)); Can anyone tell me the right way to flip the view matrix on the y? thanks! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60353#60353 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgText::Text and screen
Hi osgUsers, I'm trying to create a gui and would like to have my coordinates system 0, 0 at the upper, left of the screen. To do this I decided to create a matrix that has an ortho view as follows: osg::Matrix::ortho2D( 0, viewW, viewH, 0) where viewH is bottom and top has zero This works great when drawing my gui stuff.. but when I use osgText::Text as follows: m_rText = new osgText::Text; m_rText-setAxisAlignment( osgText::Text::SCREEN ); the text is at the correct position, but is upside down. I've searched the osgText if it was possible to set the drawing direction, but couldn't find anything. is there a way to solve this? I would really like to avoid having to use a osg::Matrix::ortho2D( 0, viewW, 0, viewH ), because this would mean that all my gui components would have to compensate for the viewH and reverse direction. any suggestions?, Peter Wraae Marino -- Bellinge Gymnasterne: http://www.bellingegymnasterne.dk Power Tumbling: http://www.powertumbling.dk OSG-Help: http://osghelp.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText::Text and screen
Hi Peter, If you are using an orthographic projection then you will just need to align the text to the XY plane, which is the default, there is no need to set the AxisAlignment to SCREEN. It's likely upside down as you've inverted the coordinates w.r.t OpenGL. Robert. On Tue, Jul 27, 2010 at 9:32 AM, Peter Wraae Marino marino.pe...@gmail.com wrote: Hi osgUsers, I'm trying to create a gui and would like to have my coordinates system 0, 0 at the upper, left of the screen. To do this I decided to create a matrix that has an ortho view as follows: osg::Matrix::ortho2D( 0, viewW, viewH, 0) where viewH is bottom and top has zero This works great when drawing my gui stuff.. but when I use osgText::Text as follows: m_rText = new osgText::Text; m_rText-setAxisAlignment( osgText::Text::SCREEN ); the text is at the correct position, but is upside down. I've searched the osgText if it was possible to set the drawing direction, but couldn't find anything. is there a way to solve this? I would really like to avoid having to use a osg::Matrix::ortho2D( 0, viewW, 0, viewH ), because this would mean that all my gui components would have to compensate for the viewH and reverse direction. any suggestions?, Peter Wraae Marino -- Bellinge Gymnasterne: http://www.bellingegymnasterne.dk Power Tumbling: http://www.powertumbling.dk OSG-Help: http://osghelp.com ___ 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] osgText::Text and screen
Hi Robert, I've removed the AxisAlignment... the text is the same. the reason for it being upside down is because of my ortho matrix.. I've set bottom to the pixel height of the view and top to zero. this way I get a coordinate system for the gui that is in the upper, left regards, Peter On Tue, Jul 27, 2010 at 11:27 AM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Peter, If you are using an orthographic projection then you will just need to align the text to the XY plane, which is the default, there is no need to set the AxisAlignment to SCREEN. It's likely upside down as you've inverted the coordinates w.r.t OpenGL. Robert. On Tue, Jul 27, 2010 at 9:32 AM, Peter Wraae Marino marino.pe...@gmail.com wrote: Hi osgUsers, I'm trying to create a gui and would like to have my coordinates system 0, 0 at the upper, left of the screen. To do this I decided to create a matrix that has an ortho view as follows: osg::Matrix::ortho2D( 0, viewW, viewH, 0) where viewH is bottom and top has zero This works great when drawing my gui stuff.. but when I use osgText::Text as follows: m_rText = new osgText::Text; m_rText-setAxisAlignment( osgText::Text::SCREEN ); the text is at the correct position, but is upside down. I've searched the osgText if it was possible to set the drawing direction, but couldn't find anything. is there a way to solve this? I would really like to avoid having to use a osg::Matrix::ortho2D( 0, viewW, 0, viewH ), because this would mean that all my gui components would have to compensate for the viewH and reverse direction. any suggestions?, Peter Wraae Marino -- Bellinge Gymnasterne: http://www.bellingegymnasterne.dk Power Tumbling: http://www.powertumbling.dk OSG-Help: http://osghelp.com ___ 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 -- Bellinge Gymnasterne: http://www.bellingegymnasterne.dk Power Tumbling: http://www.powertumbling.dk OSG-Help: http://osghelp.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText::Text and screen
Hi Peter, Try flipping the view matrix. Robert. On Tue, Jul 27, 2010 at 11:31 AM, Peter Wraae Marino marino.pe...@gmail.com wrote: Hi Robert, I've removed the AxisAlignment... the text is the same. the reason for it being upside down is because of my ortho matrix.. I've set bottom to the pixel height of the view and top to zero. this way I get a coordinate system for the gui that is in the upper, left regards, Peter On Tue, Jul 27, 2010 at 11:27 AM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Peter, If you are using an orthographic projection then you will just need to align the text to the XY plane, which is the default, there is no need to set the AxisAlignment to SCREEN. It's likely upside down as you've inverted the coordinates w.r.t OpenGL. Robert. On Tue, Jul 27, 2010 at 9:32 AM, Peter Wraae Marino marino.pe...@gmail.com wrote: Hi osgUsers, I'm trying to create a gui and would like to have my coordinates system 0, 0 at the upper, left of the screen. To do this I decided to create a matrix that has an ortho view as follows: osg::Matrix::ortho2D( 0, viewW, viewH, 0) where viewH is bottom and top has zero This works great when drawing my gui stuff.. but when I use osgText::Text as follows: m_rText = new osgText::Text; m_rText-setAxisAlignment( osgText::Text::SCREEN ); the text is at the correct position, but is upside down. I've searched the osgText if it was possible to set the drawing direction, but couldn't find anything. is there a way to solve this? I would really like to avoid having to use a osg::Matrix::ortho2D( 0, viewW, 0, viewH ), because this would mean that all my gui components would have to compensate for the viewH and reverse direction. any suggestions?, Peter Wraae Marino -- Bellinge Gymnasterne: http://www.bellingegymnasterne.dk Power Tumbling: http://www.powertumbling.dk OSG-Help: http://osghelp.com ___ 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 -- Bellinge Gymnasterne: http://www.bellingegymnasterne.dk Power Tumbling: http://www.powertumbling.dk OSG-Help: http://osghelp.com ___ 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] osgText::Text and screen
Hi Robert, yep.. did that .. .did a -1 scaling on the y-axis... works like a charm now. thanks, Peter On Tue, Jul 27, 2010 at 1:43 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Peter, Try flipping the view matrix. Robert. On Tue, Jul 27, 2010 at 11:31 AM, Peter Wraae Marino marino.pe...@gmail.com wrote: Hi Robert, I've removed the AxisAlignment... the text is the same. the reason for it being upside down is because of my ortho matrix.. I've set bottom to the pixel height of the view and top to zero. this way I get a coordinate system for the gui that is in the upper, left regards, Peter On Tue, Jul 27, 2010 at 11:27 AM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Peter, If you are using an orthographic projection then you will just need to align the text to the XY plane, which is the default, there is no need to set the AxisAlignment to SCREEN. It's likely upside down as you've inverted the coordinates w.r.t OpenGL. Robert. On Tue, Jul 27, 2010 at 9:32 AM, Peter Wraae Marino marino.pe...@gmail.com wrote: Hi osgUsers, I'm trying to create a gui and would like to have my coordinates system 0, 0 at the upper, left of the screen. To do this I decided to create a matrix that has an ortho view as follows: osg::Matrix::ortho2D( 0, viewW, viewH, 0) where viewH is bottom and top has zero This works great when drawing my gui stuff.. but when I use osgText::Text as follows: m_rText = new osgText::Text; m_rText-setAxisAlignment( osgText::Text::SCREEN ); the text is at the correct position, but is upside down. I've searched the osgText if it was possible to set the drawing direction, but couldn't find anything. is there a way to solve this? I would really like to avoid having to use a osg::Matrix::ortho2D( 0, viewW, 0, viewH ), because this would mean that all my gui components would have to compensate for the viewH and reverse direction. any suggestions?, Peter Wraae Marino -- Bellinge Gymnasterne: http://www.bellingegymnasterne.dk Power Tumbling: http://www.powertumbling.dk OSG-Help: http://osghelp.com ___ 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 -- Bellinge Gymnasterne: http://www.bellingegymnasterne.dk Power Tumbling: http://www.powertumbling.dk OSG-Help: http://osghelp.com ___ 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 -- Bellinge Gymnasterne: http://www.bellingegymnasterne.dk Power Tumbling: http://www.powertumbling.dk OSG-Help: http://osghelp.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org