2020-10-13 09:20:52 +02:00
|
|
|
#ifndef RENDER_OGL_H
|
|
|
|
#define RENDER_OGL_H
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include "opengl_utils.h"
|
|
|
|
|
|
|
|
#define TEXTURE_COUNT 4
|
2024-05-18 05:19:55 +02:00
|
|
|
#define FBO_COUNT 2
|
2020-10-13 09:20:52 +02:00
|
|
|
|
2024-07-26 08:17:56 +02:00
|
|
|
#ifdef _DEBUG
|
|
|
|
#define GL_CHECK(stmt) do { \
|
|
|
|
stmt; \
|
|
|
|
ogl_check_error(#stmt); \
|
|
|
|
} while (0)
|
|
|
|
#else
|
|
|
|
#define GL_CHECK(stmt) stmt
|
|
|
|
#endif
|
|
|
|
|
2021-06-11 20:30:43 +02:00
|
|
|
typedef struct OGLRENDERER
|
2020-10-13 09:20:52 +02:00
|
|
|
{
|
2024-07-22 09:02:31 +02:00
|
|
|
HWND hwnd;
|
|
|
|
HDC hdc;
|
2020-10-13 09:20:52 +02:00
|
|
|
HGLRC context;
|
|
|
|
GLuint main_program;
|
2024-05-18 05:19:55 +02:00
|
|
|
GLuint shader1_program;
|
|
|
|
GLuint shader2_program;
|
2020-10-13 09:20:52 +02:00
|
|
|
BOOL got_error;
|
|
|
|
int surface_tex_width;
|
|
|
|
int surface_tex_height;
|
|
|
|
GLenum surface_format;
|
|
|
|
GLenum surface_type;
|
|
|
|
GLuint surface_tex_ids[TEXTURE_COUNT];
|
|
|
|
GLuint palette_tex_ids[TEXTURE_COUNT];
|
|
|
|
float scale_w;
|
|
|
|
float scale_h;
|
|
|
|
GLint main_tex_coord_attr_loc;
|
|
|
|
GLint main_vertex_coord_attr_loc;
|
|
|
|
GLuint main_vbos[3];
|
|
|
|
GLuint main_vao;
|
2024-05-18 06:20:13 +02:00
|
|
|
GLint shader1_frame_count_uni_loc;
|
|
|
|
GLint shader2_frame_count_uni_loc;
|
2024-05-16 01:20:13 +02:00
|
|
|
GLuint frame_buffer_id[FBO_COUNT];
|
|
|
|
GLuint frame_buffer_tex_id[FBO_COUNT];
|
2024-05-18 05:19:55 +02:00
|
|
|
GLint shader1_tex_coord_attr_loc;
|
|
|
|
GLint shader2_tex_coord_attr_loc;
|
|
|
|
GLuint shader1_vbos[3];
|
|
|
|
GLuint shader2_vbos[3];
|
|
|
|
GLuint shader1_vao;
|
|
|
|
GLuint shader2_vao;
|
2020-10-13 09:20:52 +02:00
|
|
|
BOOL use_opengl;
|
|
|
|
BOOL filter_bilinear;
|
2024-05-18 05:19:55 +02:00
|
|
|
BOOL shader2_upscale;
|
2021-06-11 20:30:43 +02:00
|
|
|
} OGLRENDERER;
|
2020-10-13 09:20:52 +02:00
|
|
|
|
|
|
|
DWORD WINAPI ogl_render_main(void);
|
2024-07-22 09:02:31 +02:00
|
|
|
BOOL ogl_create();
|
|
|
|
BOOL ogl_release();
|
2020-10-13 09:20:52 +02:00
|
|
|
|
|
|
|
#endif
|