Finding Zen GL C libraries to compile them lazarus / 70-OpenGL ---------------------------------------------------------------------- matthius · 2023-11-13 10:02 I use New Zen GL 4.3. https://sourceforge.net/p/new-zengl I have found Zen GL libraries. Here is Andorra 2D compatibility : https://sourceforge.net/p/multi- briques/code/ci/default/tree/zengl_sprite_image.pas ---------------------------------------------------------------------- Seenkao · 2023-11-13 10:50 Необходимые библиотеки скомпилированы и идут сразу с ZenGL. Если вы создаёте новый проект, то вам нужно указать путь до данных библиотек. Вы можете указать полный путь до библиотеки или короткий путь (подобные пути предоставлены в демо-версиях). Находятся данные библиотеки в папке "lib/namelib/cpu-OS", например библиотека ogg для Linux x86_64 находится по пути: "lib/ogg/x86_64-Linux".   Есть так же библиотеки которые идут вместе с вашим Linux. В данном случае это будут библиотеки заканчивающиеся на "dev", например "libgl- dev". Они должны быть установлены вашей системе.   Извиняюсь, у меня ни как руки не дойдут создать установочный пакет ZenGL. Чтоб люди не мучались с его настройкой при создании нового проекта. -------------------------- Google translate:   The necessary libraries are compiled and come directly with ZenGL. If you create a new project, then you need to specify the path to these libraries. You can specify the full path to the library or a short path (similar paths are provided in demo versions). The library data is located in the folder "lib/namelib/cpu-OS", for example the ogg library for Linux x86_64 is located at the path: "lib/ogg/x86_64-Linux".   There are also libraries that come with your Linux. In this case, these will be libraries ending in "dev", for example "libgl-dev". They must be installed on your system.   I apologize, I just can’t get around to creating a ZenGL installation package. So that people don’t have to worry about setting it up when creating a new project. ---------------------------------------------------------------------- matthius · 2023-11-13 15:42 I can start the game multi-briques. But the full screen resolution is not 640 * 400. It seems to be 800 * 600. ---------------------------------------------------------------------- Seenkao · 2023-11-13 16:11 Посмотрите демку 4.   Причин почему не создаётся полноэкранное приложение 640*400 может быть несколько. Самые важные из них, это: - не верно заданы параметры при создании окна; - пытаетесь создать окно с неподдерживаемым разрешением.   И, обратите внимание! Наиболее верное решение - это создавать полноэкранное окно с текущим разрешением и делать его корректировку под данное окно (если вы конечно не увеличиваете разрешение, но и там дисплеем должно поддерживаться данное разрешение). Это же самое написано в 4-й демке. --------------------------------------- Google translate:   Watch demo 4.   There may be several reasons why a full-screen 640*400 application is not created. The most important of them are: - the parameters were not set correctly when creating the window; - trying to create a window with an unsupported resolution.   And, pay attention! The most correct solution is to create a full- screen window with the current resolution and adjust it to fit this window (unless, of course, you increase the resolution, but even there the display must support this resolution). The same thing is written in the 4th demo. ---------------------------------------------------------------------- Seenkao · 2023-11-13 16:26 Quote from: matthius on November 13, 2023, 11:02:38 amHere is Andorra 2D compatibility : https://sourceforge.net/p/multi- briques/code/ci/default/tree/zengl_sprite_image.pas   Будьте аккуратны, пожалуйста с использованием старых решений! Новая версия ZenGL претерпела много изменений и код, который использовал версию 3.12 и ранее вернее всего надо подгонять под новую версию ZenGL. ------------------------------------ Google translate:   Please be careful when using old solutions! The new version of ZenGL has undergone many changes and the code that used version 3.12 and previously most likely needs to be adjusted to the new version of ZenGL. ---------------------------------------------------------------------- matthius · 2023-11-13 16:27 Yes Collision it not the same as i thought it was. Collision seems to not test the width and height of sprite. There is Y and X that are real. ---------------------------------------------------------------------- Seenkao · 2023-11-13 16:39 Это зависит от того, какие параметры вы задаёте на проверку. Если вы создали объект, а размеры спрайта больше объекта и при этом вы проверяете сам объект на столкновение, то спрайт на столкновение проверяться не будет. Я думаю вы сами это понимаете.   И, если в самом деле есть проблемы, то было бы неплохо показать их. Потому что я не могу полностью гарантировать правильность работы кода ZenGL. Слишком мало тестировался код, и в основном мной самим. ------------------------ Google translate: It depends on what parameters you specify for verification. If you created an object, and the sprite is larger than the object, and you check the object itself for collision, then the sprite will not be checked for collision. I think you understand this yourself.    And, if there really are problems, then it would be nice to show them. Because I cannot fully guarantee that the ZenGL code will work correctly. The code was tested too little, and mostly by myself. ---------------------------------------------------------------------- matthius · 2023-11-15 13:25 What is the variable that transfer X and Y real to integer coordinates ? ---------------------------------------------------------------------- Seenkao · 2023-11-15 18:32 x := Round(n) ??? ---------------------------------------------------------------------- matthius · 2023-11-21 13:46 There was some bug into this function. Here is the correct function : function col2d_RectVsCircle(const Rect: zglTRect2D; const Circle: zglTCircle2D): Boolean; var   closestX, closestY, distanceX, distanceY: Single; begin   with Circle , Rect do    Begin     closestX := cX;     if cX - Radius <= X Then       closestX := X     else       if cX + Radius > X + W Then         closestX := X + W;     closestY := cY;     if cY - Radius <= Y Then       closestY := Y     else       if cY + Radius > Y + H Then         closestY := Y + H;     distanceX := Abs (cX - closestX);     distanceY := Abs (cY - closestY);     Result := sqr(distanceX) + sqr(distanceY) < sqr(Radius);    end; end; ---------------------------------------------------------------------- Seenkao · 2023-11-21 14:24 Благодарю! Есть тестируемый код? Чтоб мне заново его не создавать?  Я протестирую и сразу внесу правки в код. Google translate: Thank you Do you have testable code? So that I don’t have to create it again? I will test and immediately make changes to the code. ---------------------------------------------------------------------- matthius · 2023-11-21 14:36 You can add this unit to your engine : https://sourceforge.net/p/multi- briques/code/ci/default/tree/zengl_sprite_image.pas You can test here : https://sourceforge.net/p/multi-briques/ I use linux. ---------------------------------------------------------------------- Seenkao · 2023-11-21 14:46 Quote from: matthius on November 21, 2023, 03:36:10 pmYou can add this unit to your engine : Хорошо, я подумаю над вашим предложением! Это ни в коем случае не отказ! Мне в любом случае надо тестировать код и проверять его на разных платформах. Google translate: Okay, I'll think about your suggestion! This is by no means a refusal! In any case, I need to test the code and check it on different platforms. QuoteYou can test here : https://sourceforge.net/p/multi-briques/ Thanks! ---------------------------------------------------------------------- matthius · 2023-11-21 15:06 I am testing on windows. It demands sin and ceil. Where it is ? ---------------------------------------------------------------------- Seenkao · 2023-11-21 15:34 Многие математические (и не только) функции не входят в состав ZenGL. Если в этом есть острая необходимость, то можно создать самим. Но лучше воспользоваться соответствующими модулями FPC, например "Math". Google translate: Many mathematical (and other) functions are not included in ZenGL. If there is an urgent need for this, then you can create it yourself. But it is better to use the appropriate FPC modules, for example "Math". ---------------------------------------------------------------------- matthius · 2023-11-21 15:45 How can i link Math to Zen GL windows sources ? I use Math unit but it do not works. ---------------------------------------------------------------------- Seenkao · 2023-11-21 15:55 Странно, я не прописывая модуль "Math" получаю нужные функции. Sin - работает, вместо ceil нужно использовать соответствующие функции: Trunc или Round - вам выбирать какие из них необходимы. Google translate: It's strange, without registering the "Math" module I get the functions I need. Sin - works, instead of ceil you need to use the appropriate functions: Trunc or Round - you choose which of them are needed. ---------------------------------------------------------------------- Seenkao · 2023-11-26 23:04 matthius, если вы хотите свой проект общедоступным, то на SourceForge лучше всего выкладывать весь проект архивом. На закладку "Files". В данном варианте удобно просматривать, но не скачивать... Google translate: matthius, if you want your project to be publicly available, then it is best to upload the entire project as an archive on SourceForge. Go to the "Files" tab. This option is convenient for viewing, but not downloading... ---------------------------------------------------------------------- matthius · 2023-12-01 14:41 Please prefer this function : function col2d_RectVsCircle(const Rect: zglTRect2D; const Circle: zglTCircle2D): Boolean; var   closestX, closestY, distanceX, distanceY: Single; begin   with Circle , Rect do    Begin     closestX := cX;     if cX <= X Then       closestX := X     else       if cX > X + W Then         closestX := X + W;     closestY := cY;     if cY <= Y Then       closestY := Y     else       if cY > Y + H Then         closestY := Y + H;     distanceX := Abs (cX - closestX);     distanceY := Abs (cY - closestY);     Result := sqr(distanceX) + sqr(distanceY) < sqr(Radius);    end; end; ---------------------------------------------------------------------- Seenkao · 2023-12-01 19:30 Да, теперь я вижу свою ошибку. Видимо поспешил немного и перепутал данные. Благодарю! Google translate: Yes, now I see my mistake. Apparently I was in a bit of a hurry and got the data mixed up. Thank you!