Simon.Anderson Posted March 2, 2016 Posted March 2, 2016 Hi, I'm trying to draw a line in a WidgetSpriteViewport. The line is appearing in the main viewport underneath but not when the widget is active (sitting on top of the main viewport area). Can this be done? Here's the code: m_viewportSprite.setModelview( player.getIWorldTransform() );m_viewportSprite.setProjection( player.getProjection() ); .... ... ... vec3 start = vec3( 0,0, 0 );vec3 end = vec3( 1,1, 0 ); engine.visualizer.setProjection( player.getProjection() );engine.visualizer.setModelview( player.getIWorldTransform() ); engine.visualizer.renderLine2D( start, end, colors::Grey( 0.6f, 0.6f ) ); Any help would be appreciated. Thanks, Simon
Simon.Anderson Posted March 2, 2016 Author Posted March 2, 2016 ok, realised I should be using a canvas on top of the viewport - for some reason I still can't see anything though.: // Draw the shadow cursor m_Canvas.setPosition( posx, posy ); m_Canvas.setWidth( viewportWidth ); m_Canvas.setHeight( viewportHeight ); m_Canvas.clear(); // Yellow line around region int id = m_Canvas.addLine(); m_Canvas.setLineColor( id, colors::Grey( 0.6f, 0.6f ) ); m_Canvas.addLinePoint( id, vec3( 0, 0, 0 ) ); m_Canvas.addLinePoint( id, vec3( 500, 500, 0 ) ); Any Ideas?
Simon.Anderson Posted March 3, 2016 Author Posted March 3, 2016 ok sorted it - simple mistake at my end.
Recommended Posts