From 1ff3793322585443909d11284457811c461f8de4 Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Thu, 14 Sep 2017 18:57:05 +0900 Subject: pacc: add viewport --- pacc/pacc-gl-procs.inc | 1 + pacc/pacc-gl.c | 5 +++++ pacc/pacc.h | 1 + 3 files changed, 7 insertions(+) (limited to 'pacc') diff --git a/pacc/pacc-gl-procs.inc b/pacc/pacc-gl-procs.inc index cd991e0..1984273 100644 --- a/pacc/pacc-gl-procs.inc +++ b/pacc/pacc-gl-procs.inc @@ -9,6 +9,7 @@ PROC(GENTEXTURES, GenTextures) PROC(TEXPARAMETERI, TexParameteri) PROC(PIXELSTOREI, PixelStorei) PROC(DRAWARRAYS, DrawArrays) +PROC(VIEWPORT, Viewport) #endif // PROC_NO_GL_1_1 PROC(ACTIVETEXTURE, ActiveTexture) #endif // PROC_NO_GL_1_3 diff --git a/pacc/pacc-gl.c b/pacc/pacc-gl.c index e1463b8..ada045e 100644 --- a/pacc/pacc-gl.c +++ b/pacc/pacc-gl.c @@ -468,6 +468,10 @@ err: return 0; } +static void pacc_viewport_scale(struct pacc_ctx *pc, int scale) { + glViewport(0, 0, pc->w*scale, pc->h*scale); +} + static struct pacc_vtable pacc_gl_vtable = { .pacc_delete = pacc_delete, .gen_buf = pacc_gen_buf, @@ -485,6 +489,7 @@ static struct pacc_vtable pacc_gl_vtable = { .color = pacc_color, .begin_clear = pacc_begin_clear, .draw = pacc_draw, + .viewport_scale = pacc_viewport_scale, }; struct pacc_ctx *pacc_init_gl(int w, int h, struct pacc_vtable *vt) { diff --git a/pacc/pacc.h b/pacc/pacc.h index b3387ac..30e7ab2 100644 --- a/pacc/pacc.h +++ b/pacc/pacc.h @@ -46,6 +46,7 @@ struct pacc_vtable { void (*color)(struct pacc_ctx *ctx, uint8_t pal); void (*begin_clear)(struct pacc_ctx *ctx); void (*draw)(struct pacc_ctx *ctx, struct pacc_buf *buf, enum pacc_mode mode); + void (*viewport_scale)(struct pacc_ctx *ctx, int scale); }; struct pacc_ctx *pacc_init_gl(int w, int h, struct pacc_vtable *vt); -- cgit v1.2.3