LCL + OpenGL. lazarus / 31-LCL ---------------------------------------------------------------------- Seenkao · 2022-03-11 00:18 Windows 7 - 32/64. Я создал LCL-приложение и с помощью dglOpenGL.pas создал контекст на панели формы. Приложение выводит треугольник на панель (контекст OpenGL). При запуске приложения, панель очищается, но треугольник не выводится!!! Все события для вывода треугольника прописаны заранее. Буфер VAO уже заполнен и готов к выводу. Но приложение LCL не выводит данные из буфера (помним, код срабатывает, панель очищается). Если на форму бросить button (я указывал в buttonclick FormPaint), то даже нажимать на кнопку не надо, в течении секунды треугольник будет выведен. На Delphi 7 работает нормально всё. И сразу. Приложение прикладываю. Gogle translate: I created an LCL application and using dglOpenGL.pas created a context on the form panel. The application draws a triangle to the panel (OpenGL context). When the application starts, the panel is cleared, but the triangle is not displayed!!! All events for the output of the triangle are written in advance. The VAO buffer is already full and ready for output. But the LCL application does not output data from the buffer (remember, the code works, the panel is cleared). If you throw button on the form (I indicated in buttonclick FormPaint), then you don’t even need to click on the button, within a second the triangle will be displayed. Everything works fine on Delphi 7. And right away. I am attaching the application. ---------------------------------------------------------------------- Red_prig · 2022-03-11 06:45 Вопрос в том что происходит быстрее очистка окна или событие paint. (Да есть отличия от делфи) В данном случае работает так: The question is what happens faster window clearing or the paint event. (Yes, there are differences from Delphi) In this case it works like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormActivate(Sender: TObject);begin FormResize(Sender); FormPaint(Sender);end;Кроме того на будущее лафхаки если будете бороться с мерцанием перерисовки: Отключение двойной буферизации: In addition, future life hacks if you fight redraw flicker: Disable double buffering: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Form1.DoubleBuffered:=false;    и отключение закрашивание фона перед рисованием: and disable erase background before painting: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  ...  LMessages,  LCLType,  ... type TForm1 = class(TForm)   ...   procedure WMEraseBkgnd(var Message:TLMEraseBkgnd); message LM_ERASEBKGND;   ... private  public  end; procedure TForm1.WMEraseBkgnd(var Message:TLMEraseBkgnd);begin Message.Result:=1;end; ---------------------------------------------------------------------- Seenkao · 2022-03-11 12:23 Я посмотрю ваше решение. Но это означает, что при работе с LCL: FormResize срабатывает позже FormPaint, что в принципе неправильно. И это означает, что реализация LCL требует корректировки. google translate: I will look into your solution. But this means that when working with LCL: FormResize works later than FormPaint, which is basically wrong. And this means that the implementation of the LCL needs to be adjusted. ---------------------------------------------------------------------- Red_prig · 2022-03-11 12:33 Rather, the problem is somewhere in the bowels of the form initialization, since during normal operation the order of calls is correct ---------------------------------------------------------------------- Seenkao · 2022-03-12 14:33 Я проверил. При запуске LCL-приложения оно проходит два раза через Paint и лишь потом через Resize. Почему так? Если Resize должно срабатывать до вызова Paint. Google translate: I checked. When an LCL application is launched, it goes through Paint twice and only then through Resize. Why is that? If Resize should fire before calling Paint. ---------------------------------------------------------------------- marcov · 2022-03-12 15:00 .Invalidate() the relevant components in the resize event? ---------------------------------------------------------------------- Seenkao · 2022-03-12 15:13 событие Resize приходит после создания формы практически следом. Форма должна изначально получить размеры (изменённые размеры). И после этого только прорисовываться. Это так происходит, когда пользуешься WinAPI. Про LCL я не знаю. Потому и задаю вопросы. По сути ответ (вопрос) один, а почему мы должны дополнительно вызывать прорисовку окна, после процедуры, которая отвечает за изменение размеров окна? Google translate: event Resize comes after form creation practically next. The form must initially receive dimensions (resized). And after that, just draw. This is how it happens when you use WinAPI. I don't know about LCL. That's why I'm asking questions. In fact, there is only one answer (question), why should we additionally call the window drawing after the procedure that is responsible for resizing the window? ---------------------------------------------------------------------- Seenkao · 2022-03-12 17:25 Quote from: jamie on March 12, 2022, 04:28:23 pm https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-size Please read and study. Благодарю, но для меня это достаточно "бесполезная" информация. Я занимаюсь нативными приложениями, если вы не обратили на это внимание. И ShowWindow отправляет изначально сообщение WM_SIZE окну. Я задаю вопрос по LCL. Потому что для людей, работающих с окном "вручную", вполне нормально, когда раньше будет запрашиваться событие Resize а не Paint. google translate: Thank you, but for me this is quite "useless" information. I'm doing native apps in case you haven't noticed. And ShowWindow initially sends a WM_SIZE message to the window. I'm asking a question about LCL. Because for people who work with the window "manually", it is quite normal when the Resize event will be requested earlier and not Paint. ---------------------------------------------------------------------- Seenkao · 2022-03-12 22:55 Благодарю за информацию!  Thanks for the information!