Better fix for CanvasWidget transparency
Use osg GLExtensions to retrieve glBlendFuncSeperate on Win32
This commit is contained in:
parent
89ca665bfb
commit
e090427591
1 changed files with 6 additions and 3 deletions
|
@ -26,6 +26,8 @@
|
||||||
#include <Main/fg_os.hxx> // fgGetKeyModifiers()
|
#include <Main/fg_os.hxx> // fgGetKeyModifiers()
|
||||||
#include <Scripting/NasalSys.hxx>
|
#include <Scripting/NasalSys.hxx>
|
||||||
|
|
||||||
|
#include <osg/GLExtensions>
|
||||||
|
|
||||||
#include <simgear/canvas/Canvas.hxx>
|
#include <simgear/canvas/Canvas.hxx>
|
||||||
#include <simgear/canvas/events/MouseEvent.hxx>
|
#include <simgear/canvas/events/MouseEvent.hxx>
|
||||||
|
|
||||||
|
@ -196,9 +198,10 @@ void CanvasWidget::setSize(int w, int h)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void CanvasWidget::draw(int dx, int dy)
|
void CanvasWidget::draw(int dx, int dy)
|
||||||
{
|
{
|
||||||
|
osg::GLExtensions* extensions = osg::GLExtensions::Get(0, true);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
// glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
// glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ZERO, GL_ONE);
|
extensions->glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ZERO, GL_ONE);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, _canvas_mgr->getCanvasTexId(_canvas));
|
glBindTexture(GL_TEXTURE_2D, _canvas_mgr->getCanvasTexId(_canvas));
|
||||||
glBegin( GL_QUADS );
|
glBegin( GL_QUADS );
|
||||||
|
@ -209,5 +212,5 @@ void CanvasWidget::draw(int dx, int dy)
|
||||||
glTexCoord2f(0,1); glVertex2f(dx + abox.min[0], dy + abox.max[1]);
|
glTexCoord2f(0,1); glVertex2f(dx + abox.min[0], dy + abox.max[1]);
|
||||||
glEnd();
|
glEnd();
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
// glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue