5.71LTS OpenGL Gadget back colour lost on Window Restore

Just starting out? Need help? Post your questions and find answers here.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

5.71LTS OpenGL Gadget back colour lost on Window Restore

Post by IdeasVacuum »

Windows 7/10 x64

If a Window containing an OpenGL Gadget is minimised, on restore the OpenGL Gadget back colour becomes that of the Window back colour. :?

Work around is to apply glClearColor, glClear and SetGadgetAttribute #PB_OpenGL_FlipBuffers (e.g. using a Macro)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Fred
Administrator
Administrator
Posts: 16684
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: 5.71LTS OpenGL Gadget back colour lost on Window Restore

Post by Fred »

An OpenGLGadget() is not double buffered and can't redraw automatically its last buffer (unless I miss something in OpenGL API), so you need to redraw it when the window size change on Windows. I updated the doc.
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: 5.71LTS OpenGL Gadget back colour lost on Window Restore

Post by Olli »

(lots of communication attacks... no links with the forum)

I confirm the "redraw". I suggest grab from draw to video memory (gl function).

I have a small example about resizing glGadget, I must refind.
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: 5.71LTS OpenGL Gadget back colour lost on Window Restore

Post by Mijikai »

Mby we can test it like this:

Code: Select all

Procedure.i HasDoubleBuffer()
  Protected hdc.i
  Protected pfd.PIXELFORMATDESCRIPTOR
  hdc = wglGetCurrentDC_()
  If DescribePixelFormat_(hdc,GetPixelFormat_(hdc),SizeOf(PIXELFORMATDESCRIPTOR),@pfd)
    ProcedureReturn Bool(pfd\dwFlags & #PFD_DOUBLEBUFFER)
  EndIf
  ProcedureReturn #False
EndProcedure
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: 5.71LTS OpenGL Gadget back colour lost on Window Restore

Post by Olli »

@mijikai

I am not sure it is useful in the way where a window (a view gadget) is resizing.

-> How could the API adapt a new set of dimension through two buffers ?
-> In the way where the scale is kept (that was my way), the matrix changes.
Post Reply