diff --git a/src/functions.c b/src/functions.c index 4f4f2b8..d10f74a 100644 --- a/src/functions.c +++ b/src/functions.c @@ -241,7 +241,7 @@ static const ProcMap s_proc_map[] = { PROC(glPixelStorei), //PROC(glPixelTransferf), //PROC(glPixelTransferi), - //PROC(glPixelZoom), + PROC(glPixelZoom), PROC(glPointSize), PROC(glPolygonMode), PROC(glPolygonOffset), diff --git a/src/gc_gl.c b/src/gc_gl.c index 92908c2..bb08cfc 100644 --- a/src/gc_gl.c +++ b/src/gc_gl.c @@ -283,6 +283,8 @@ void ogx_initialize() glparamstate.raster_pos[2] = 0.0f; glparamstate.raster_pos[3] = 1.0f; glparamstate.raster_pos_valid = true; + glparamstate.pixel_zoom_x = 1.0f; + glparamstate.pixel_zoom_y = 1.0f; glparamstate.depth_near = 0.0f; glparamstate.depth_far = 1.0f; diff --git a/src/getters.c b/src/getters.c index abe0e24..b2ae37f 100644 --- a/src/getters.c +++ b/src/getters.c @@ -296,6 +296,12 @@ void glGetIntegerv(GLenum pname, GLint *params) case GL_RENDER_MODE: *params = glparamstate.render_mode; return; + case GL_ZOOM_X: + *params = glparamstate.pixel_zoom_x; + break; + case GL_ZOOM_Y: + *params = glparamstate.pixel_zoom_y; + break; default: return; }; diff --git a/src/raster.cpp b/src/raster.cpp index e009ee9..5022be9 100644 --- a/src/raster.cpp +++ b/src/raster.cpp @@ -39,6 +39,12 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +void glPixelZoom(GLfloat xfactor, GLfloat yfactor) +{ + glparamstate.pixel_zoom_x = xfactor; + glparamstate.pixel_zoom_y = yfactor; +} + static void set_current_raster_pos(const guVector *pos) { guVector pos_mv; @@ -226,22 +232,22 @@ static void draw_raster_texture(GXTexObj *texture, int width, int height, int y0, y1; if (height < 0) { - y0 = screen_y + height; + y0 = screen_y + height * glparamstate.pixel_zoom_y; y1 = screen_y; } else { /* The first row we read from the bitmap is the bottom row, so let's take * this into account and flip the image vertically */ y0 = screen_y; - y1 = screen_y - height; + y1 = screen_y - height * glparamstate.pixel_zoom_y; } GX_Begin(GX_QUADS, GX_VTXFMT0, 4); GX_Position3f32(screen_x, y0, screen_z); GX_TexCoord2u8(0, 0); GX_Position3f32(screen_x, y1, screen_z); GX_TexCoord2u8(0, 1); - GX_Position3f32(screen_x + width, y1, screen_z); + GX_Position3f32(screen_x + width * glparamstate.pixel_zoom_x, y1, screen_z); GX_TexCoord2u8(1, 1); - GX_Position3f32(screen_x + width, y0, screen_z); + GX_Position3f32(screen_x + width * glparamstate.pixel_zoom_x, y0, screen_z); GX_TexCoord2u8(1, 0); GX_End(); } diff --git a/src/state.h b/src/state.h index b3dc45c..50dace5 100644 --- a/src/state.h +++ b/src/state.h @@ -99,6 +99,8 @@ typedef struct glparams_ float texture_object_plane_s[4]; float texture_object_plane_t[4]; float raster_pos[4]; + float pixel_zoom_x; + float pixel_zoom_y; float depth_near; float depth_far; int cur_modv_mat, cur_proj_mat;