hidpi compiling on Windows
Fix OpenGL backend for multiple windows
This commit is contained in:
parent
056d419a10
commit
9e3704b96c
@ -203,6 +203,18 @@ init_GL(SWindowData *window_data) {
|
|||||||
void
|
void
|
||||||
resize_GL(SWindowData *window_data) {
|
resize_GL(SWindowData *window_data) {
|
||||||
if(window_data->is_initialized) {
|
if(window_data->is_initialized) {
|
||||||
|
#if defined(_WIN32) || defined(WIN32)
|
||||||
|
|
||||||
|
SWindowData_Win *window_data_ex = (SWindowData_Win *) window_data->specific;
|
||||||
|
wglMakeCurrent(window_data_ex->hdc, window_data_ex->hGLRC);
|
||||||
|
|
||||||
|
#elif defined(linux)
|
||||||
|
|
||||||
|
SWindowData_X11 *window_data_ex = (SWindowData_X11 *) window_data->specific;
|
||||||
|
glXMakeCurrent(window_data_ex->display, window_data_ex->window, window_data_ex->context);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
glViewport(0, 0, window_data->window_width, window_data->window_height);
|
glViewport(0, 0, window_data->window_width, window_data->window_height);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
@ -221,11 +233,15 @@ redraw_GL(SWindowData *window_data, const void *pixels) {
|
|||||||
SWindowData_Win *window_data_ex = (SWindowData_Win *) window_data->specific;
|
SWindowData_Win *window_data_ex = (SWindowData_Win *) window_data->specific;
|
||||||
GLenum format = BGRA;
|
GLenum format = BGRA;
|
||||||
|
|
||||||
|
wglMakeCurrent(window_data_ex->hdc, window_data_ex->hGLRC);
|
||||||
|
|
||||||
#elif defined(linux)
|
#elif defined(linux)
|
||||||
|
|
||||||
SWindowData_X11 *window_data_ex = (SWindowData_X11 *) window_data->specific;
|
SWindowData_X11 *window_data_ex = (SWindowData_X11 *) window_data->specific;
|
||||||
GLenum format = BGRA;
|
GLenum format = BGRA;
|
||||||
|
|
||||||
|
glXMakeCurrent(window_data_ex->display, window_data_ex->window, window_data_ex->context);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float x, y, w, h;
|
float x, y, w, h;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <MiniFB.h>
|
#include <MiniFB.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define DIMEN_LOW 512
|
#define DIMEN_LOW 512
|
||||||
@ -11,8 +10,7 @@ static unsigned int g_buffer_low[DIMEN_LOW * DIMEN_LOW];
|
|||||||
static unsigned int g_buffer_high[DIMEN_HIGH * DIMEN_HIGH];
|
static unsigned int g_buffer_high[DIMEN_HIGH * DIMEN_HIGH];
|
||||||
|
|
||||||
void
|
void
|
||||||
pretty_square(unsigned int *p, int dimen)
|
pretty_square(unsigned int *p, int dimen) {
|
||||||
{
|
|
||||||
memset(p, 127, dimen * dimen * 4);
|
memset(p, 127, dimen * dimen * 4);
|
||||||
const int one_half_dimen = dimen / 2;
|
const int one_half_dimen = dimen / 2;
|
||||||
const int one_quarter_dimen = one_half_dimen / 2;
|
const int one_quarter_dimen = one_half_dimen / 2;
|
||||||
@ -23,16 +21,14 @@ pretty_square(unsigned int *p, int dimen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main() {
|
||||||
{
|
|
||||||
pretty_square(g_buffer_low, DIMEN_LOW);
|
pretty_square(g_buffer_low, DIMEN_LOW);
|
||||||
pretty_square(g_buffer_high, DIMEN_HIGH);
|
pretty_square(g_buffer_high, DIMEN_HIGH);
|
||||||
|
|
||||||
struct mfb_window *window_low = mfb_open("LowRes", DIMEN_LOW, DIMEN_LOW);
|
struct mfb_window *window_low = mfb_open("LowRes", DIMEN_LOW, DIMEN_LOW);
|
||||||
struct mfb_window *window_high = mfb_open("HighRes", DIMEN_HIGH / 2, DIMEN_HIGH / 2);
|
struct mfb_window *window_high = mfb_open("HighRes", DIMEN_HIGH / 2, DIMEN_HIGH / 2);
|
||||||
|
|
||||||
while (window_high || window_low)
|
while (window_high || window_low) {
|
||||||
{
|
|
||||||
if (window_low)
|
if (window_low)
|
||||||
if (mfb_update_ex(window_low, g_buffer_low, DIMEN_LOW, DIMEN_LOW) != STATE_OK
|
if (mfb_update_ex(window_low, g_buffer_low, DIMEN_LOW, DIMEN_LOW) != STATE_OK
|
||||||
|| !mfb_wait_sync(window_low))
|
|| !mfb_wait_sync(window_low))
|
||||||
|
Loading…
Reference in New Issue
Block a user