[solved] OpenGLgadget() n DPI : Big bug

Just starting out? Need help? Post your questions and find answers here.
Olli
Enthusiast
Enthusiast
Posts: 581
Joined: Wed May 27, 2020 12:26 pm

[solved] OpenGLgadget() n DPI : Big bug

Post by Olli »

Hello,

The horizontal draw inside the OGL is undisplayable if the DPI swith option is on (ASM and C backend).

The OGL background is okay, but a virtual limit appears on the right side. All the draws are truncated.

However, the vertical aspect is okay. This only concerns the horizontal aspect.

Consequently, OGL draw is unable if DPI switch is on.

Is it possible to restore the horizontal aspect as the vertical one is ?
Last edited by Olli on Sun Aug 07, 2022 1:15 am, edited 1 time in total.
Thank you Google search
User avatar
StarBootics
Addict
Addict
Posts: 847
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: OpenGLgadget() n DPI : Big bug

Post by StarBootics »

Hello ,

This problem might be related to pixel density on different DPI settings and the Framebuffer need to be updated accordingly. If you use the GadgetSize to set the viewport you will experience a problem similar to what you describe.

If you add the following lines of code does it help ?

Code: Select all

glGetFramebufferParameteriv(0, #GL_FRAMEBUFFER_DEFAULT_WIDTH, @Width.l)
glGetFramebufferParameteriv(0, #GL_FRAMEBUFFER_DEFAULT_HEIGHT, @Height.l)
glViewport(0,0, Width, Height)
Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Olli
Enthusiast
Enthusiast
Posts: 581
Joined: Wed May 27, 2020 12:26 pm

Re: OpenGLgadget() n DPI : Big bug

Post by Olli »

Hello Starbootics,

I thank you for the interest you bring about this bug. I will try these functions.

But, however these functions are useful, I doubt the bug will solve by this way.

When I switch the dpi on, I must multiply the x by the result of DesktopResolutionX() but I must not treat the y which stay unchanged (and good).
Thank you Google search
Olli
Enthusiast
Enthusiast
Posts: 581
Joined: Wed May 27, 2020 12:26 pm

Re: OpenGLgadget() n DPI : Big bug

Post by Olli »

@Starbootics

I did not find this function in the main library file.

The x vs y internal treatment difference is due to a security of opengl which does a saturation of an overflown value. This causes a strange behaviour I took for a bug.

I solved the problem by adding any scale values everywhere (x as y) and by doing the good choice of math operations (divisions as products). This resulted not to change anything in the opengl draw, what I wanted.

I forcome kiffy to move the subject on coding questions.
Thank you Google search
User avatar
Kiffi
Addict
Addict
Posts: 1237
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: OpenGLgadget() n DPI : Big bug

Post by Kiffi »

Olli wrote: Sun Aug 07, 2022 1:14 amI forcome kiffy to move the subject on coding questions.
[X] Done
Hygge
Olli
Enthusiast
Enthusiast
Posts: 581
Joined: Wed May 27, 2020 12:26 pm

Re: [solved] OpenGLgadget() n DPI : Big bug

Post by Olli »

Yes, thank you !
Thank you Google search
Post Reply