dynamic_resolution_ratio != 1.0
# Draw the dynamic screen to the real screen if `dynamic_resolution_ratio != 1.0`
protected fun frame_core_dynamic_resolution_after(display: GamnitDisplay)
do
if dynamic_resolution_ratio == 1.0 then return
perf_clock_dynamic_resolution.lapse
var ratio = dynamic_resolution_ratio
ratio = ratio.clamp(min_dynamic_resolution_ratio, max_dynamic_resolution_ratio)
bind_screen_framebuffer screen_framebuffer
glBindBuffer(gl_ARRAY_BUFFER, dynamic_context.buffer_array)
glViewport(0, 0, display.width, display.height)
glClear gl_COLOR_BUFFER_BIT | gl_DEPTH_BUFFER_BIT
dynres_program.use
# Uniforms
glActiveTexture gl_TEXTURE0
glBindTexture(gl_TEXTURE_2D, dynamic_context.texture)
dynres_program.texture.uniform 0
dynres_program.ratio.uniform ratio
# Attributes
var sizeof_gl_float = 4
var n_floats = 3
glEnableVertexAttribArray dynres_program.coord.location
glVertexAttribPointeri(dynres_program.coord.location, n_floats, gl_FLOAT, false, 0, 0)
var offset = 4 * n_floats * sizeof_gl_float
n_floats = 2
glEnableVertexAttribArray dynres_program.tex_coord.location
glVertexAttribPointeri(dynres_program.tex_coord.location, n_floats, gl_FLOAT, false, 0, offset)
assert glGetError == gl_NO_ERROR
# Draw
glDrawArrays(gl_TRIANGLE_STRIP, 0, 4)
assert glGetError == gl_NO_ERROR
# Take down
glBindBuffer(gl_ARRAY_BUFFER, 0)
assert glGetError == gl_NO_ERROR
sys.perfs["gamnit flat dyn res"].add app.perf_clock_dynamic_resolution.lapse
end
lib/gamnit/dynamic_resolution.nit:117,2--159,4