eugene.litvinov Posted February 24, 2011 Share Posted February 24, 2011 I try realize next logic: I have two gui elements, two WidgetSpriteVideo - I need place one over next, and set to next widget alpha 0.5f. So I need blend to WidgetSpriteVideo (see screenshot) I have question: is it possible to change alpha of one gui element? I try to arrange WidgetSpriteVideo one over second: WidgetVBox mainPanel = new WidgetVBox(gui); gui.addChild(mainPanel, 0); WidgetSpriteVideo facePanel_1 = new WidgetSpriteVideo(gui, "samples/widgets/videos/winter.ogv"); mainPanel.addChild(facePanel_1, GUI_ALIGN_BACKGROUND); WidgetSpriteVideo facePanel_2 = new WidgetSpriteVideo(gui, "samples/widgets/videos/sanctuary.ogv"); mainPanel.addChild(facePanel_2, GUI_ALIGN_OVERLAP); This is work fine when added to engine.getGui(). Then I try to add this on skinned mesh: Node facePanelNode = engine.editor.getNodeByName("robotFacePanel"); ObjectGuiMesh objectGuiMesh = node_cast(facePanelNode); Gui gui = objectGuiMesh.getGui(); WidgetVBox mainPanel = new WidgetVBox(gui); gui.addChild(mainPanel, 0); facePanel_1 = new WidgetSpriteVideo(gui, "samples/widgets/videos/winter.ogv"); mainPanel.addChild(facePanel_1, GUI_ALIGN_BACKGROUND); facePanel_2 = new WidgetSpriteVideo(gui, "samples/widgets/videos/sanctuary.ogv"); mainPanel.addChild(facePanel_2, GUI_ALIGN_OVERLAP); But in this case one WidgetSpriteVideo not cover second, see screenshot: Is it some another technique when we work with ObjectGuiMesh instead of Gui? Link to comment
frustum Posted February 24, 2011 Share Posted February 24, 2011 Try to set alpha-blending on sprite: sprite.setBlendFunc(GUI_BLEND_SRC_ALPHA,GUI_BLEND_ONE_MINUS_SRC_ALPHA); sprite.setColor(vec4(1.0f,1.0f,1.0f,0.5f)); Link to comment
Recommended Posts