1
0

version, precison and rotate

This commit is contained in:
2025-09-18 07:37:25 +02:00
parent 95175afb5d
commit d7f0cb427d

View File

@ -1,12 +1,14 @@
#version 130
// RozK // RozK
// Fisheye removal for GoPro 11+, 8:7 ratio, without hypersmooth // Fisheye removal for GoPro 11+, 8:7 ratio, without hypersmooth
#extension GL_ARB_texture_rectangle: enable #extension GL_ARB_texture_rectangle: enable
// TODO: investigate #undef highp // defined by Qt-OpenGl
// precision highp float; #define rotate_180
//#define debug_borders
// #define debug_borders precision highp float;
// uniforms // uniforms
uniform sampler2DRect myTextureY; uniform sampler2DRect myTextureY;
@ -35,6 +37,9 @@ vec2 sensor_to_texture;
void initialize() { void initialize() {
texture_center = myResolution * 0.5; texture_center = myResolution * 0.5;
texture_to_sensor = (sensor_size / myResolution) * pixel_scale; texture_to_sensor = (sensor_size / myResolution) * pixel_scale;
#ifdef rotate_180
texture_to_sensor *= -1.0;
#endif
sensor_to_texture = (myResolution / sensor_size); sensor_to_texture = (myResolution / sensor_size);
} }
@ -53,7 +58,7 @@ vec4 unfish_pixel(const in vec2 coord) {
#ifdef debug_borders #ifdef debug_borders
if (y_coord.x < 0.0 || y_coord.y < 0.0 || y_coord.x > myResolution.x || y_coord.y > myResolution.y) { if (y_coord.x < 0.0 || y_coord.y < 0.0 || y_coord.x > myResolution.x || y_coord.y > myResolution.y) {
return vec4(1.0, 1.0, 1.0, 1.0); return vec4(1.0);
} }
#endif #endif
@ -70,7 +75,7 @@ void main() {
initialize(); initialize();
vec2 coord = gl_TexCoord[0].xy; vec2 coord = gl_TexCoord[0].xy;
vec4 pixel = vec4(0.0, 0.0, 0.0, 0.0); vec4 pixel = vec4(0.0);
for (int y = 0; y < subsampling; y++) { for (int y = 0; y < subsampling; y++) {
for (int x = 0; x < subsampling; x++) { for (int x = 0; x < subsampling; x++) {