August 10, 2020, 11:38:08 PM

Author Topic: Any chance of a GLFW port?  (Read 5955 times)

Offline medi71

  • Jr. Member
  • **
  • Posts: 28
Re: Any chance of a GLFW port?
« Reply #75 on: April 28, 2020, 04:36:14 AM »
I will look at what you have done.

Offline degac

  • Full Member
  • ***
  • Posts: 158
    • graphio.net
Re: Any chance of a GLFW port?
« Reply #76 on: May 02, 2020, 02:09:33 PM »
Dumbest question of all the time.
With so much different 'drivers' and 'engines' (SDL and GLFW are 'duplication' of many things already present in BlitzMax - events, keyboard, sounds etc) it will be useful or not having a 'mega wrapper' at the top of them?

The idea is like in BlitzMax, just to setup a 'driver' (OpenGL, DirectX) to compile for that 'engine'.
(I know that sound so easy writing on the keyboard!!! but a sort of hell to realize! - maybe impossible!)
If there's a problem, there's at least one solution.
www.blitzmax.org

Offline DruggedBunny

  • Jr. Member
  • **
  • Posts: 60
Re: Any chance of a GLFW port?
« Reply #77 on: May 05, 2020, 01:19:14 AM »
@degac: makes sense, though a lot of work for Brucey! Not that that seems to stop him...

Just posting an update with my latest efforts -- LOTS of hackery involved, but I started putting stuff into classes again and a few Blitz3D-like wrapper functions, been fun this evening... it's a mess, but it's my mess, and I'm gradually tidying while also trying things out. Keeping single-file for now.

I can do around 10,000 cubes without any slowdown (after some pausing at startup), even with zero optimisation on my part!

There's also optional PS1-style texture warping (see LoadShaders to enable the alternative .glsl files, and if you edit resources\vertex-shader-affine-warping.glsl, you can even have wobbling vertices!).

The rotation is a quick hack, there's only (global) translation at present.

Controls are in the title-bar! C culls backfaces (not culled by default), but it's hard to tell here, and W does wireframe, but this is driver-dependent so don't be surprised if it doesn't do anything...

I've left the .exe in there for quick testing -- run through VirusTotal with no detections, but use normal precautions.

Thanks to Brucey for getting GLFW going... I've got a couple of OpenGL 3.3 books on order now as well, so I'm using it!

Offline Derron

  • Hero Member
  • *****
  • Posts: 3093
Re: Any chance of a GLFW port?
« Reply #78 on: May 05, 2020, 08:06:46 AM »
The idea is like in BlitzMax, just to setup a 'driver' (OpenGL, DirectX) to compile for that 'engine'.
(I know that sound so easy writing on the keyboard!!! but a sort of hell to realize! - maybe impossible!)

What might work is some kind of "meta package". So you would do

Framework Brl.SDLBackend
or
Framework Brl.DefaultBackend

and these both modules import DefaultSystem / SDLSystem / .... for you.
The SDLBackend would also provide GLMax2DDriver() etc - so "drivers" which simply extend the SDL drivers to return the same stuff as the default drivers do. Dunno if they should identify themselves as "SDL DirectX Drivers" or not (so that your app eg. can display properly what driver it _really_ uses).



bye
Ron

Offline degac

  • Full Member
  • ***
  • Posts: 158
    • graphio.net
Re: Any chance of a GLFW port?
« Reply #79 on: May 05, 2020, 09:09:53 AM »
Thanks both.

I suspected that it isnt' an easy solution.... maybe a 'source' of new problems or limitations.
But I just imagined you write a game for SDL. And it works.
Then if you want to 'port' using GLFW, you need to rewrite it for some/big part...
Not a great motivation to jump.

ps: I know that SDL provides better 'coverage' (PC, Android, NX etc) so - at this point - should be the 'basic render' in NG.

At this point should be interesting thinking if a possible 'relifting' of the BlitzMax NG module (gfx/event) could/should be possibile or if necessary.
If there's a problem, there's at least one solution.
www.blitzmax.org

Offline DruggedBunny

  • Jr. Member
  • **
  • Posts: 60
Re: Any chance of a GLFW port?
« Reply #80 on: May 30, 2020, 02:33:43 PM »
Hi all,

Just a little update, mainly to let Brucey know I'm still putting his efforts to good use! NB. Very, very WIP indeed.

1) Unzip the attached mod so it sits at: BlitzMaxNG\mod\hitoro.mod
2) Open the hitoro.mod\retro3d.mod\wip folder and run the demos. (Cursors + A/Z.)

I just got a little excited, as my first attempt to use quaternions to rotate my cube worked first time!

This very basic example (demo5.bmx) shows how simple it can be to use quaternions for rotation -- see excerpt below from entity.bmx:

Code: [Select]

Type Entity

Field position_matrix:SMat4F
Field position:SVec3F

Field rotation_matrix:SMat4F
Field rotation:SVec3F
Field rotation_quat:SQuatF

Method New ()

position_matrix = SMat4F.Identity ()

rotation = New SVec3F (0.0, 0.0, 0.0) ' Euler angles
rotation_quat = New SQuatF (0.0, 0.0, 0.0, 0.0).EulerXYZ (rotation) ' Quaternion creation from angles
rotation_matrix = SQuatF.ToMat4 (rotation_quat) ' Matrix used for rendering

EndMethod

...

No idea if I'm doing it right, but I'm sure I can work from this anyway.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal