diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 9d27d57e974d056eb6910c4e71abea088d66d9d5..a8c6b6a7b3c3bf8302e95d712e2a2b875750359a 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
-{$MODE DELPHI}
+{$INCLUDE g_amodes.inc}
unit g_window;
interface
var
gwin_dump_extensions: Boolean = false;
+ gwin_has_stencil: Boolean = false;
+ gwin_k8_enable_light_experiments: Boolean = false;
implementation
e_SoundUpdate();
if NetMode = NET_SERVER then
- g_Net_Host_Update
- else
- if (NetMode = NET_CLIENT) and (NetState <> NET_STATE_AUTH) then
- g_Net_Client_UpdateWhileLoading;
+ begin
+ g_Net_Host_Update();
+ g_Net_Flush();
+ end
+ else if NetMode = NET_CLIENT then
+ if (NetState <> NET_STATE_AUTH) then
+ begin
+ g_Net_Client_UpdateWhileLoading();
+ g_Net_Flush();
+ end;
+
wLoadingProgress := False;
end;
if NetMode = NET_SERVER then g_Net_Host_Update()
else if NetMode = NET_CLIENT then g_Net_Client_Update();
Update();
+ if NetMode <> NET_NONE then g_Net_Flush();
end;
end
- else
+ else if NetMode <> NET_NONE then
begin
if NetMode = NET_SERVER then g_Net_Host_Update()
else if NetMode = NET_CLIENT then g_Net_Client_Update();
+ g_Net_Flush();
end;
if wLoadingQuit then
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ if gwin_k8_enable_light_experiments then
+ begin
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1); // lights; it is enough to have 1-bit stencil buffer for lighting
+ end;
SDL_GL_SetSwapInterval(v);
end;
function SDLMain(): Integer;
var
idx: Integer;
+ ltmp: Integer;
begin
{$IFDEF HEADLESS}
e_NoGraphics := True;
{$ENDIF}
+ for idx := 1 to ParamCount do
+ begin
+ if ParamStr(idx) = '--opengl-dump-exts' then gwin_dump_extensions := true;
+ if ParamStr(idx) = '--twinkletwinkle' then gwin_k8_enable_light_experiments := true;
+ end;
+
e_WriteLog('Initializing OpenGL', MSG_NOTIFY);
InitOpenGL(gVSync);
{EnumDisplayModes();}
- for idx := 1 to ParamCount do
+ if gwin_k8_enable_light_experiments then
begin
- if ParamStr(idx) = '--opengl-dump-exts' then gwin_dump_extensions := true;
+ SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, @ltmp);
+ e_WriteLog(Format('stencil buffer size: %d', [ltmp]), MSG_WARNING);
+ gwin_has_stencil := (ltmp > 0);
+ end
+ else
+ begin
+ gwin_has_stencil := false;
end;
if not glHasExtension('GL_ARB_texture_non_power_of_two') then