more opengl graphics fixes

master
Eduardo Bart 12 years ago
parent cde81666b8
commit 257f652bb7

@ -181,8 +181,6 @@ function Terminal.addLine(text, color)
local numLines = terminalBuffer:getChildCount() + 1
if numLines > MaxLogLines then
terminalBuffer:getChildByIndex(1):destroy()
else
terminalBuffer:setHeight(terminalBuffer:getHeight() + LabelHeight)
end
-- create new line label

@ -14,7 +14,7 @@ UIWindow
id: terminalBuffer
layout:
type: verticalBox
align-bottom: true
fit-children: true
focusable: false
anchors.left: parent.left
anchors.right: parent.right

@ -70,8 +70,8 @@ TopPanel
anchors.right: parent.right
UILabel
size: 68 16
text-align: right
text-auto-resize: true
color: white
id: frameCounter
anchors.top: parent.top

@ -201,6 +201,9 @@ void Application::run()
if(redraw) {
g_graphics.beginRender();
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
Rect viewportRect(0, 0, g_graphics.getViewportSize());
// draw the foreground into a texture
@ -214,8 +217,8 @@ void Application::run()
m_foreground->copyFromScreen(viewportRect);
}
//glClearColor(0,0,0,0);
//glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
// draw background (animated stuff)
m_backgroundFrameCounter.processNextFrame();
@ -223,6 +226,7 @@ void Application::run()
// draw the foreground (steady stuff)
g_painter->setColor(Color::white);
g_painter->setOpacity(1.0);
g_painter->drawTexturedRect(viewportRect, m_foreground, viewportRect);
g_graphics.endRender();

@ -80,8 +80,9 @@ void Logger::fireOldMessages()
{
if(m_onLog) {
auto backup = m_logMessages;
for(const LogMessage& logMessage : backup)
for(const LogMessage& logMessage : backup) {
m_onLog(logMessage.level, logMessage.message, logMessage.when);
}
}
}

@ -48,7 +48,7 @@ public:
void info(const std::string& what) { log(Fw::LogInfo, what); }
void warning(const std::string& what) { log(Fw::LogWarning, what); }
void error(const std::string& what) { log(Fw::LogError, what); }
void fatal(const std::string& what) { log(Fw::LogError, what); }
void fatal(const std::string& what) { log(Fw::LogFatal, what); }
void fireOldMessages();
void setLogFile(const std::string& file);

@ -87,12 +87,17 @@ void Graphics::init()
*/
// determine max texture size
static GLint maxTextureSize = -1;
if(maxTextureSize == -1)
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
GLint maxTextureSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
if(m_maxTextureSize == -1 || m_maxTextureSize > maxTextureSize)
m_maxTextureSize = maxTextureSize;
// check if we have alpha channel in the color buffer, because we need alpha channel for glCopyTexSubImage2D
GLint alphaBits = 0;
glGetIntegerv(GL_ALPHA_BITS, &alphaBits);
if(alphaBits <= 0)
g_logger.fatal("OpenGL visual doesn't have an alpha buffer");
selectPainterEngine(m_prefferedPainterEngine);
m_emptyTexture = TexturePtr(new Texture);
}

@ -34,7 +34,7 @@ static const std::string glslMainWithTexCoordsVertexShader = "\n\
void main()\n\
{\n\
gl_Position = calculatePosition();\n\
texCoord = textureMatrix * vec3(a_texCoord,1);\n\
texCoord = (textureMatrix * vec3(a_texCoord,1)).xy;\n\
}\n";
static std::string glslPositionOnlyVertexShader = "\n\

@ -302,7 +302,7 @@ void WIN32Window::internalChooseGLVisual()
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
24, // Select Our Color Depth
32, // Select Our Color Depth
8, 0, 8, 0, 8, 0, // Color Bits Ignored
8, // Alpha Buffer Bits
0, // Shift Bit Ignored

@ -387,7 +387,10 @@ void X11Window::internalChooseGLVisual()
static int attrList[] = {
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DOUBLEBUFFER, True,
GLX_ALPHA_SIZE, 1,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_ALPHA_SIZE, 8,
None
};

@ -26,6 +26,7 @@
#include <framework/platform/platformwindow.h>
#include <framework/core/clock.h>
#include <framework/otml/otmlnode.h>
#include <framework/application.h>
UITextEdit::UITextEdit()
{
@ -252,6 +253,7 @@ void UITextEdit::setCursorPos(int pos)
else
m_cursorPos = pos;
update();
g_app->repaint();
}
}
@ -514,4 +516,5 @@ bool UITextEdit::onMousePress(const Point& mousePos, Fw::MouseButton button)
void UITextEdit::blinkCursor()
{
m_cursorTicks = g_clock.millis();
g_app->repaint();
}

@ -811,7 +811,6 @@ bool UIWidget::setRect(const Rect& rect)
if(rect == oldRect)
return false;
g_app->repaint();
m_rect = rect;
// updates own layout
@ -1353,6 +1352,8 @@ void UIWidget::onStyleApply(const std::string& styleName, const OTMLNodePtr& sty
parseBaseStyle(styleNode);
parseImageStyle(styleNode);
parseTextStyle(styleNode);
g_app->repaint();
}
void UIWidget::onGeometryChange(const Rect& oldRect, const Rect& newRect)
@ -1367,6 +1368,8 @@ void UIWidget::onGeometryChange(const Rect& oldRect, const Rect& newRect)
}
callLuaField("onGeometryChange", oldRect, newRect);
g_app->repaint();
}
void UIWidget::onLayoutUpdate()

@ -25,6 +25,7 @@
#include <framework/graphics/fontmanager.h>
#include <framework/graphics/painter.h>
#include <framework/graphics/framebuffer.h>
#include <framework/application.h>
void UIWidget::initText()
{
@ -93,6 +94,7 @@ void UIWidget::drawText(const Rect& screenCoords)
void UIWidget::onTextChange(const std::string& text, const std::string& oldText)
{
g_app->repaint();
callLuaField("onTextChange", text, oldText);
}

Loading…
Cancel
Save