more fixes for retina + glfw + opengl2 fallback
This commit is contained in:
@@ -153,7 +153,9 @@ namespace Gwen
|
||||
{
|
||||
namespace Renderer
|
||||
{
|
||||
OpenGL_DebugFont::OpenGL_DebugFont()
|
||||
|
||||
OpenGL_DebugFont::OpenGL_DebugFont(float retinaScale)
|
||||
:m_retinaScale(retinaScale)
|
||||
{
|
||||
m_iVertNum = 0;
|
||||
|
||||
@@ -260,8 +262,8 @@ namespace Gwen
|
||||
Flush();
|
||||
}
|
||||
|
||||
m_Vertices[ m_iVertNum ].x = (float)x;
|
||||
m_Vertices[ m_iVertNum ].y = (float)y;
|
||||
m_Vertices[ m_iVertNum ].x = (float)x*m_retinaScale;
|
||||
m_Vertices[ m_iVertNum ].y = (float)y*m_retinaScale;
|
||||
m_Vertices[ m_iVertNum ].u = u;
|
||||
m_Vertices[ m_iVertNum ].v = v;
|
||||
|
||||
@@ -306,16 +308,19 @@ namespace Gwen
|
||||
Flush();
|
||||
Gwen::Rect rect = ClipRegion();
|
||||
|
||||
// OpenGL's coords are from the bottom left
|
||||
// so we need to translate them here.
|
||||
{
|
||||
GLint view[4];
|
||||
glGetIntegerv( GL_VIEWPORT, &view[0] );
|
||||
rect.y = view[3] - (rect.y + rect.h);
|
||||
}
|
||||
|
||||
glScissor( rect.x * Scale(), rect.y * Scale(), rect.w * Scale(), rect.h * Scale() );
|
||||
glEnable( GL_SCISSOR_TEST );
|
||||
float retinaScale = m_retinaScale;
|
||||
// OpenGL's coords are from the bottom left
|
||||
// so we need to translate them here.
|
||||
{
|
||||
GLint view[4];
|
||||
glGetIntegerv( GL_VIEWPORT, &view[0] );
|
||||
rect.y = view[3]/retinaScale - (rect.y + rect.h);
|
||||
}
|
||||
|
||||
glScissor( retinaScale * rect.x * Scale(), retinaScale * rect.y * Scale(), retinaScale * rect.w * Scale(), retinaScale * rect.h * Scale() );
|
||||
glEnable( GL_SCISSOR_TEST );
|
||||
//glDisable( GL_SCISSOR_TEST );
|
||||
|
||||
};
|
||||
|
||||
void OpenGL_DebugFont::EndClip()
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace Gwen
|
||||
|
||||
class OpenGL_DebugFont : public Gwen::Renderer::Base
|
||||
{
|
||||
float m_retinaScale;
|
||||
|
||||
public:
|
||||
|
||||
struct Vertex
|
||||
@@ -32,8 +34,8 @@ namespace Gwen
|
||||
|
||||
|
||||
static const int MaxVerts = 1024;
|
||||
|
||||
OpenGL_DebugFont();
|
||||
|
||||
OpenGL_DebugFont(float retinaScale);
|
||||
~OpenGL_DebugFont();
|
||||
|
||||
void RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text );
|
||||
|
||||
Reference in New Issue
Block a user