1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../../shared/a_modes.inc}
20 procedure r_Render_Initialize
;
21 procedure r_Render_Finalize
;
22 procedure r_Render_Resize (w
, h
: Integer);
27 {$INCLUDE ../../nogl/noGLuses.inc}
30 g_game
, g_options
, r_window
, r_graphics
, r_console
, r_playermodel
34 LoadedGL
: Boolean = false;
38 if LoadedGL
= false then
42 if glRenderToFBO
and (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) then
44 e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering');
45 glRenderToFBO
:= false
48 if glRenderToFBO
and (not Load_GL_ARB_framebuffer_object
) then
50 e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering');
51 glRenderToFBO
:= false
60 if LoadedGL
= true then
69 procedure r_Render_Initialize
;
71 if sys_SetDisplayMode(gRC_Width
, gRC_Height
, gBPP
, gRC_FullScreen
, gRC_Maximized
) = False then
72 raise Exception
.Create('Failed to set videomode on startup.');
76 r_PlayerModel_Initialize
;
79 procedure r_Render_Finalize
;
82 r_PlayerModel_Finalize
;
86 procedure r_Render_Resize (w
, h
: Integer);
95 // store real window size in gWinSize, downscale resolution now
96 w
:= round(w
/ r_pixel_scale
);
97 h
:= round(h
/ r_pixel_scale
);
98 if not e_ResizeFramebuffer(w
, h
) then
100 e_LogWriteln('GL: could not create framebuffer, falling back to --no-fbo');
101 glRenderToFBO
:= False;
108 e_ResizeWindow(w
, h
);