Minor graphics fixes

master
Eduardo Bart 12 years ago
parent cb58d2dcfa
commit 5a048eb7ea

@ -40,10 +40,10 @@ function Client.init()
scheduleEvent(function()
g_window.show()
-- play startup music
--g_sounds.playMusic("startup.ogg", 3)
--connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
--connect(g_game, { onGameEnd= function() g_sounds.playMusic("startup.ogg", 3) end })
-- Play startup music (The Silver Tree, by Mattias Westlund)
g_sounds.playMusic("startup.ogg", 3)
connect(g_game, { onGameStart = function() g_sounds.stopMusic(3) end })
connect(g_game, { onGameEnd= function() g_sounds.playMusic("startup.ogg", 3) end })
end, 0)
end, 0)
end

@ -1,6 +1,6 @@
local skin = {
name = 'Example',
styles = {
'topmenu.otui'
}

@ -25,7 +25,6 @@ local shadersPanel
function Shaders.init()
importStyle 'shaders.otui'
Keyboard.bindKeyDown(HOTKEY, Shaders.toggle)
shadersPanel = createWidget('ShadersPanel', GameInterface.getMapPanel())
@ -37,6 +36,8 @@ function Shaders.init()
map:setMapShader(g_shaders.getShader(option))
end
if not g_graphics.canUseShaders() then return end
for _i,opts in pairs(MAP_SHADERS) do
local shader = g_shaders.createFragmentShader(opts.name, opts.frag)

@ -7,9 +7,6 @@ const float sampleStrength = 2.2;
void main(void)
{
// some sample positions
float samples[] = { -0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08 };
// 0.5,0.5 is the center of the screen
// so substracting v_TexCoord from it will result in
// a vector pointing to the middle of the screen
@ -29,8 +26,16 @@ void main(void)
// take 10 additional blur samples in the direction towards
// the center of the screen
for(int i = 0; i < 10; i++)
sum += texture2D(u_Tex0, v_TexCoord + dir * samples[i] * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord - 0.08 * dir * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord - 0.05 * dir * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord - 0.03 * dir * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord - 0.02 * dir * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord - 0.01 * dir * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord + 0.01 * dir * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord + 0.02 * dir * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord + 0.03 * dir * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord + 0.05 * dir * sampleDist);
sum += texture2D(u_Tex0, v_TexCoord + 0.08 * dir * sampleDist);
// we have taken eleven samples
sum *= 1.0/11.0;
@ -42,4 +47,4 @@ void main(void)
//Blend the original color with the averaged pixels
gl_FragColor = mix(color, sum, t);
}
}

@ -23,6 +23,8 @@
#include "painter.h"
#include "graphics.h"
#include <framework/platform/platformwindow.h>
Painter *g_painter = nullptr;
Painter::Painter()
@ -35,6 +37,7 @@ Painter::Painter()
m_shaderProgram = nullptr;
m_texture = nullptr;
m_alphaWriting = false;
setResolution(g_window.getSize());
}
void Painter::resetState()
@ -50,11 +53,11 @@ void Painter::resetState()
void Painter::refreshState()
{
updateGlViewport();
updateGlCompositionMode();
updateGlClipRect();
updateGlTexture();
updateGlAlphaWriting();
updateGlViewport();
}
void Painter::saveState()

@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
#ifndef OPENGL_ES
#if !defined(OPENGL_ES) || OPENGL_ES==1
#include "painterogl1.h"
#include "graphics.h"

@ -562,6 +562,7 @@ void Application::registerLuaFunctions()
g_lua.bindSingletonFunction("g_graphics", "isPainterEngineAvailable", &Graphics::isPainterEngineAvailable, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "selectPainterEngine", &Graphics::selectPainterEngine, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "canCacheBackbuffer", &Graphics::canCacheBackbuffer, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "canUseShaders", &Graphics::canUseShaders, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "getPainterEngine", &Graphics::getPainterEngine, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "getViewportSize", &Graphics::getViewportSize, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "getVendor", &Graphics::getVendor, &g_graphics);

Loading…
Cancel
Save