minigdx / tiny

Tiny is a lightweight 2D game engine that allows developers to easily create games using the Lua programming language.
https://minigdx.github.io/tiny/
MIT License
121 stars 6 forks source link

Opengl 2 support #14

Open MNAJIM75 opened 3 months ago

MNAJIM75 commented 3 months ago

Hi. I tried installing the tiny framework on an old laptop that I have, the laptop supports OpenGL up to 2.1, when I tried to run the game an error showed with a message related to GLFW, the error says "failed to initialize window", which is an error that pop up when you don't have the required OpenGL version, I wish that you make a build that uses OpenGL 2. Thanks.

dwursteisen commented 1 month ago

Hello,

thank you for you Interest in Tiny.

The library I'm using (KGL) is using by default OpenGL 3.

OpenGL 2.1 was released almost 20 years ago (see wikipedia) As OpenGL is also almost deprecated regarding the platform and alternatives arise (Vulkan, WebGPU, Metal...), I'm afraid that I'll not support OpenGL 2.1 but focus more about new APIs.

If you really need OpenGL 2.1, you can also implement it. If you getting the source code, the interface Render can be implemented. The purpose of this interface is to initiate the render context (ie: preparing the window) and drawing each frame on the screen that are passed to the method (ie: drawing the passed texture on the screen). You can check how it's done in the GLRender class, which is an implementation of the [Render] method using KGL.

By replacing KGL call to OpenGL 2.1, it might work as you would expect.