1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus-core - m64p_vidext.h *
3 * Mupen64Plus homepage: https://mupen64plus.org/ *
4 * Copyright (C) 2009 Richard Goedeken *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21
22/* This header file defines typedefs for function pointers to the core's
23 * video extension functions.
24 */
25
26#if !defined(M64P_VIDEXT_H)
27#define M64P_VIDEXT_H
28
29#include "m64p_types.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/* VidExt_Init()
36 *
37 * This function should be called from within the InitiateGFX() video plugin
38 * function call. The default SDL implementation of this function simply calls
39 * SDL_InitSubSystem(SDL_INIT_VIDEO). It does not open a rendering window or
40 * switch video modes.
41 */
42typedef m64p_error (*ptr_VidExt_Init)(void);
43#if defined(M64P_CORE_PROTOTYPES)
44EXPORT m64p_error CALL VidExt_Init(void);
45#endif
46
47/* VidExt_Quit()
48 *
49 * This function closes any open rendering window and shuts down the video
50 * system. The default SDL implementation of this function calls
51 * SDL_QuitSubSystem(SDL_INIT_VIDEO). This function should be called from
52 * within the RomClose() video plugin function.
53 */
54typedef m64p_error (*ptr_VidExt_Quit)(void);
55#if defined(M64P_CORE_PROTOTYPES)
56EXPORT m64p_error CALL VidExt_Quit(void);
57#endif
58
59/* VidExt_ListFullscreenModes()
60 *
61 * This function is used to enumerate the available resolutions for fullscreen
62 * video modes. A pointer to an array is passed into the function, which is
63 * then filled with resolution sizes.
64 */
65typedef m64p_error (*ptr_VidExt_ListFullscreenModes)(m64p_2d_size *, int *);
66#if defined(M64P_CORE_PROTOTYPES)
67EXPORT m64p_error CALL VidExt_ListFullscreenModes(m64p_2d_size *, int *);
68#endif
69
70/* VidExt_SetVideoMode()
71 *
72 * This function creates a rendering window or switches into a fullscreen
73 * video mode. Any desired OpenGL attributes should be set before calling
74 * this function.
75 */
76typedef m64p_error (*ptr_VidExt_SetVideoMode)(int, int, int, m64p_video_mode, m64p_video_flags);
77#if defined(M64P_CORE_PROTOTYPES)
78EXPORT m64p_error CALL VidExt_SetVideoMode(int, int, int, m64p_video_mode, m64p_video_flags);
79#endif
80
81/* VidExt_ResizeWindow()
82 *
83 * This function resizes the opengl rendering window to match the given size.
84 */
85typedef m64p_error (*ptr_VidExt_ResizeWindow)(int, int);
86#if defined(M64P_CORE_PROTOTYPES)
87EXPORT m64p_error CALL VidExt_ResizeWindow(int, int);
88#endif
89
90/* VidExt_SetCaption()
91 *
92 * This function sets the caption text of the emulator rendering window.
93 */
94typedef m64p_error (*ptr_VidExt_SetCaption)(const char *);
95#if defined(M64P_CORE_PROTOTYPES)
96EXPORT m64p_error CALL VidExt_SetCaption(const char *);
97#endif
98
99/* VidExt_ToggleFullScreen()
100 *
101 * This function toggles between fullscreen and windowed rendering modes.
102 */
103typedef m64p_error (*ptr_VidExt_ToggleFullScreen)(void);
104#if defined(M64P_CORE_PROTOTYPES)
105EXPORT m64p_error CALL VidExt_ToggleFullScreen(void);
106#endif
107
108/* VidExt_GL_GetProcAddress()
109 *
110 * This function is used to get a pointer to an OpenGL extension function. This
111 * is only necessary on the Windows platform, because the OpenGL implementation
112 * shipped with Windows only supports OpenGL version 1.1.
113 */
114typedef m64p_function (*ptr_VidExt_GL_GetProcAddress)(const char *);
115#if defined(M64P_CORE_PROTOTYPES)
116EXPORT m64p_function CALL VidExt_GL_GetProcAddress(const char *);
117#endif
118
119/* VidExt_GL_SetAttribute()
120 *
121 * This function is used to set certain OpenGL attributes which must be
122 * specified before creating the rendering window with VidExt_SetVideoMode.
123 */
124typedef m64p_error (*ptr_VidExt_GL_SetAttribute)(m64p_GLattr, int);
125#if defined(M64P_CORE_PROTOTYPES)
126EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr, int);
127#endif
128
129/* VidExt_GL_GetAttribute()
130 *
131 * This function is used to get the value of OpenGL attributes. These values may
132 * be changed when calling VidExt_SetVideoMode.
133 */
134typedef m64p_error (*ptr_VidExt_GL_GetAttribute)(m64p_GLattr, int *);
135#if defined(M64P_CORE_PROTOTYPES)
136EXPORT m64p_error CALL VidExt_GL_GetAttribute(m64p_GLattr, int *);
137#endif
138
139/* VidExt_GL_SwapBuffers()
140 *
141 * This function is used to swap the front/back buffers after rendering an
142 * output video frame.
143 */
144typedef m64p_error (*ptr_VidExt_GL_SwapBuffers)(void);
145#if defined(M64P_CORE_PROTOTYPES)
146EXPORT m64p_error CALL VidExt_GL_SwapBuffers(void);
147#endif
148
149/* VidExt_GL_GetDefaultFramebuffer()
150 *
151 * On some platforms (for instance, iOS) the default framebuffer object
152 * depends on the surface being rendered to, and might be different from 0.
153 * This function should be called after VidExt_SetVideoMode to retrieve the
154 * name of the default FBO.
155 * Calling this function may have performance implications
156 * and it should not be called every time the default FBO is bound.
157 */
158typedef uint32_t (*ptr_VidExt_GL_GetDefaultFramebuffer)(void);
159#if defined(M64P_CORE_PROTOTYPES)
160EXPORT uint32_t CALL VidExt_GL_GetDefaultFramebuffer(void);
161#endif
162
163#ifdef __cplusplus
164}
165#endif
166
167#endif /* #define M64P_VIDEXT_H */
168
169