Descent3/lib/rend_opengl.h

34 lines
978 B
C
Raw Permalink Normal View History

/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2024-04-16 03:43:29 +00:00
#ifndef REND_OPENGL_H
#define REND_OPENGL_H
#include "renderer.h"
#include "3d.h"
class oeApplication;
// Starts up opengl
2024-04-16 18:56:40 +00:00
int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state);
2024-04-16 03:43:29 +00:00
// Closes down opengl
opengl: use SDL_WINDOW_FULLSCREEN_DESKTOP and an FBO. This now renders to an OpenGL Framebuffer Object at the game's resolution, and blits it to the window at whatever resolution it is currently using, scaling and letterboxing if necessary. Which is to say: display resolutions are now imaginary, and we never change the physical display mode now. A smaller resolution is simply drawing less pixels and scaling them up with the GPU for display. This solves a few problems: no more resizing background windows or desktop icons shuffling around, no more being stuck in a weird resolution when debugging or if the game crashes, no more waiting on monitors to click over to a new mode, and no more weird rendering when the display didn't exactly support the requested mode. This also means the game doesn't have to drop down to 640x480 for the config menu screen when it was otherwise using some other resolution. Some caveats: - This _requires_ OpenGL Framebuffer Object support; there is currently no fallback if it's missing and the game will refuse to start. But any desktop hardware of the last ~20 years should support it. For weird embedded things or whatnot, it will be possible to add a fallback. - This currently requires SDL. The OpenGL pieces should work on Windows, but someone would need to adjust the existing win32 code to create a fullscreen window and not change the physical display mode. It should still compile on windows and work as before (untested by me, though). - This is only OpenGL; it does not touch the Direct3D renderer, which should continue to work as before (again, untested by me).
2024-06-14 07:35:54 +00:00
void opengl_Close(const bool just_resizing=false);
2024-04-16 03:43:29 +00:00
#endif