No longer pushing and poping state for each button drawn
This commit is contained in:
@@ -118,8 +118,7 @@ void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouse
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rd->pushState();
|
|
||||||
rd->beforePrimitive();
|
|
||||||
glEnable( GL_TEXTURE_2D );
|
glEnable( GL_TEXTURE_2D );
|
||||||
glEnable(GL_BLEND);// you enable blending function
|
glEnable(GL_BLEND);// you enable blending function
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
@@ -135,8 +134,7 @@ void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouse
|
|||||||
glVertex2f( positionRelative.x, positionRelative.y + size.y );
|
glVertex2f( positionRelative.x, positionRelative.y + size.y );
|
||||||
glEnd();
|
glEnd();
|
||||||
glDisable( GL_TEXTURE_2D );
|
glDisable( GL_TEXTURE_2D );
|
||||||
rd->afterPrimitive();
|
|
||||||
rd->popState();
|
|
||||||
if(drawDisabledBox)
|
if(drawDisabledBox)
|
||||||
{
|
{
|
||||||
Draw::box(Box(Vector3(positionRelative.x, positionRelative.y, 0), Vector3(positionRelative.x+size.x, positionRelative.y+size.y, 0)), rd, Color4(0.7F,0.7F,0.7F,0.3F), Color4::clear());
|
Draw::box(Box(Vector3(positionRelative.x, positionRelative.y, 0), Vector3(positionRelative.x+size.x, positionRelative.y+size.y, 0)), rd, Color4(0.7F,0.7F,0.7F,0.3F), Color4::clear());
|
||||||
|
|||||||
4
main.cpp
4
main.cpp
@@ -901,7 +901,11 @@ bool mouseInArea(float point1x, float point1y, float point2x, float point2y)
|
|||||||
|
|
||||||
void drawButtons(RenderDevice* rd)
|
void drawButtons(RenderDevice* rd)
|
||||||
{
|
{
|
||||||
|
rd->pushState();
|
||||||
|
rd->beforePrimitive();
|
||||||
dataModel->getGuiRoot()->render(rd);
|
dataModel->getGuiRoot()->render(rd);
|
||||||
|
rd->afterPrimitive();
|
||||||
|
rd->popState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c)
|
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c)
|
||||||
|
|||||||
Reference in New Issue
Block a user