Change default window size and aspect to 640*474.

Fixes vertical stretching issues when the N64 framebuffer
has 240 or 480 lines.
This commit is contained in:
Simon Eriksson 2016-03-03 17:21:29 +01:00 committed by Tyler J. Stachecki
parent 3565a05f30
commit 135a6cab5e
5 changed files with 6 additions and 6 deletions

View file

@ -128,7 +128,7 @@ cen64_gl_window cen64_gl_window_create(
window_rect.left = 0;
window_rect.right = 640;
window_rect.top = 0;
window_rect.bottom = 480;
window_rect.bottom = 474;
window->hinstance = GetModuleHandle(NULL);
window->pixel_format = config->pixel_format;

View file

@ -18,7 +18,7 @@
#include "thread.h"
#include <windows.h>
#define FRAMEBUF_SZ (640 * 480 * 4)
#define FRAMEBUF_SZ (640 * 474 * 4)
#define CEN64_GL_WINDOW_BAD (NULL)
struct cen64_gl_window {
HINSTANCE hinstance;

View file

@ -59,7 +59,7 @@ cen64_gl_window cen64_gl_window_create(
ButtonPressMask | StructureNotifyMask;
window->window = XCreateWindow(display, XRootWindow(display, screen),
0, 0, 640, 480, 0, window->visual_info->depth, InputOutput,
0, 0, 640, 474, 0, window->visual_info->depth, InputOutput,
window->visual_info->visual, CWBorderPixel | CWColormap | CWEventMask,
&window->attr);

View file

@ -19,7 +19,7 @@
#include <unistd.h>
#include <X11/Xlib.h>
#define FRAMEBUF_SZ (640 * 480 * 4)
#define FRAMEBUF_SZ (640 * 474 * 4)
#define CEN64_GL_WINDOW_BAD (NULL)
struct cen64_gl_window {
cen64_gl_display display;

View file

@ -76,7 +76,7 @@ void gl_window_render_frame(struct vi_controller *vi, const uint8_t *buffer,
// Called when the window was resized.
void gl_window_resize_cb(int width, int height) {
float aspect = 4.0 / 3.0;
float aspect = 640.0 / 474.0;
if (height <= 0)
height = 1;
@ -86,7 +86,7 @@ void gl_window_resize_cb(int width, int height) {
glLoadIdentity();
if((float) width / (float) height > aspect) {
aspect = 3.0 / 4.0;
aspect = 474.0 / 640.0;
aspect *= (float)width / (float)height;
glOrtho(-aspect, aspect, -1, 1, -1, 1);
}