Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
127 user(s) are online (117 user(s) are browsing Forums)

Members: 0
Guests: 127

more...

Support us!

Headlines

 
  Register To Post  

(1) 2 »
Libraries: GLEW / GLFW
Quite a regular
Quite a regular


See User information
Hi,

do we have support for these libraries or is there a work around?

If liberty means anything at all, it means the right to tell people what they do not want to hear.
George Orwell.
Go to top
Re: Libraries: GLEW / GLFW
Home away from home
Home away from home


See User information
Andrea (Afxgroup) did some work on glfw and glwf2 already :
https://github.com/afxgroup/glfw
https://github.com/afxgroup/glfw2

I made a gl4es adaptation of his glfw port, and it were working (through wasn't in good shape, and i were in hope to made it together with another public gl4es update if Andrea doens't mind).

As for Glew , it just some set of headers, you can use the casual / usual one

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Libraries: GLEW / GLFW
Home away from home
Home away from home


See User information
@kas1e

Looks like afxgroup never got round to doing anything with GLFW2 beyond clone the repository. I don't see any commits.

If GLFW3 were ported, then we'd have a good chance of getting libraries like Raylib working.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Libraries: GLEW / GLFW
Quite a regular
Quite a regular


See User information
Why is there not a single location with a prioritised list of 'requested ports'. That way, anyone could put anything there. Or, we could have a separate list for Hans or whoever so that we know that if the community helped do that port, we may see great benefits.

I also want glfw3 for porting something. I don't know anything about it other than I think I just need to get it to use ogles.

If liberty means anything at all, it means the right to tell people what they do not want to hear.
George Orwell.
Go to top
Re: Libraries: GLEW / GLFW
Amigans Defender
Amigans Defender


See User information
GLFW2 is almost complete (IIRC..) while GLFW3 has only the window/gl working IIRC (thanks SDL2 port was really easy to reuse code).

F.e.
https://github.com/afxgroup/glfw/blob/master/src/os4_window.c
https://github.com/afxgroup/glfw/blob/master/src/os4_context.c

I have also a working version of GLEW somewhere but porting GLEW is really easy

i'm really tired...
Go to top
Re: Libraries: GLEW / GLFW
Quite a regular
Quite a regular


See User information
@kas1e
Where is the casual/usual GLEW. I do not see it on Os4Depot, and - at least on my linux machine:
apt-file show libglew-dev
libglew
-dev: /usr/include/GL/glew.h       
libglew
-dev: /usr/include/GL/glxew.h
libglew
-dev: /usr/include/GL/wglew.h
libglew
-dev: /usr/lib/x86_64-linux-gnu/libGLEW.a
libglew
-dev: /usr/lib/x86_64-linux-gnu/libGLEW.so
libglew
-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/glew.pc
libglew
-dev: /usr/share/doc/libglew-dev/changelog.Debian.gz
libglew
-dev: /usr/share/doc/libglew-dev/copyright

It also contains a built library.


Edited by rjd324 on 2023/6/3 9:51:11
Edited by rjd324 on 2023/6/3 9:52:16
Edited by rjd324 on 2023/6/3 9:54:02
If liberty means anything at all, it means the right to tell people what they do not want to hear.
George Orwell.
Go to top
Re: Libraries: GLEW / GLFW
Just popping in
Just popping in


See User information
@rjd324

Quote:
Why is there not a single location with a prioritised list of 'requested ports'.


Openamiga maybe?

Regards,

Go to top
Re: Libraries: GLEW / GLFW
Amigans Defender
Amigans Defender


See User information
I've made some changes to glfw3. I've added partial joystick support (not tested at all) and I've started to implement some missing cursors functions I have to finish. There is a lot of work to do but it is in an usable state if you want to give it a try

i'm really tired...
Go to top
Re: Libraries: GLEW / GLFW
Not too shy to talk
Not too shy to talk


See User information
@afxgroup

Is there any information anywhere on what environment you used to build glfw? I assume I need to build it from source since I didn't find it precompiled when I looked.

I know you said you cross-compiled it, but that still leaves a lot of scope. Did you use gcc? vbcc? some other? I was with a friend Friday night and we managed to get it to build but the resulting binary wouldn't work. I'm in the process of recreating what we did.

So far I've checkout out your master (glfw) and run cmake with -D AMIGAOS4=1 from within a walkero gcc container..

On Make I get an error that stdarg.h is not included so I include it.

Then I get an error that MAXPATHLEN is not known so I include amiga_platform.h

Then I get an error that ogles2/ogles2_defs.h does not exist so I zip it up from the 2.2 Enhancer CD and add it to the docker environment.

Then I get multiple warnings about implicit declarations and the fact the linker cannot find libdl. This is the point I'm stopping for tonight but from memory, after that's solved we then run into syntax errors because there are variable declarations inside case statements which GCC doesn't allow. It's simple enough to modify the code to fix that of course, so eventually the library will build. But it isn't going to run because of all the implicit declarations it guessed.

So as you can see I'm beginning to question not only my sanity but whether this was even built with GCC in the first place. I did add cmake to Walkero's vbcc container but I didn't get anywhere because I had no clue how to use vbcc with cmake. I am of course making the assumption that the commit I checked out from master was a working commit but reading the commit history looks like it should at least build.


Amiga x5040 ı 16GB ı RX580
GB-A1000 060@100,
A1200 PiStorm32-Lite CM4
Go to top
Re: Libraries: GLEW / GLFW
Amigans Defender
Amigans Defender


See User information
You are using newlib. I've compiled it using my clib2 version. However with some small changes it must work also with newlib since most of the code is OS4 code.

I've cross compiled it using gcc11 and cmake as usual.
I've created in my machine a tool chain file that I use every time I want to use cmake so I have less ptoblems

i'm really tired...
Go to top
Re: Libraries: GLEW / GLFW
Not too shy to talk
Not too shy to talk


See User information
OK, thanks for the info. I'll see about creating a toolchain file tonight and switching to your clib2. If it works, it works.


Amiga x5040 ı 16GB ı RX580
GB-A1000 060@100,
A1200 PiStorm32-Lite CM4
Go to top
Re: Libraries: GLEW / GLFW
Not too shy to talk
Not too shy to talk


See User information
[edit] Never mind. I've built it. I don't have a lot of confidence it's built correctly given some of the warnings it spat out along the way but time will tell.


Edited by MartinW on 2023/8/2 1:31:45

Amiga x5040 ı 16GB ı RX580
GB-A1000 060@100,
A1200 PiStorm32-Lite CM4
Go to top
Re: Libraries: GLEW / GLFW
Amigans Defender
Amigans Defender


See User information
Great. Of course if you fix problems or add something feel free to push your changes

i'm really tired...
Go to top
Re: Libraries: GLEW / GLFW
Not too shy to talk
Not too shy to talk


See User information
It looks like the resulting gears program from the examples does run for someone on real hardware with an RX GPU. For me, under emulation I get no window - which honestly is OK, I was pretty much expecting this but the application crashes on exit. That's not OK.

It would be really useful if you could share your toolchain file. At this point I still don't really have any clue how to indicate to make that I want to use clib2. If I add -mcrt=clib2 then make just dies and cites that it can't build an application. I can get round that, but the deeper I get into it, the more missing libs I seem to have.

Under newlib I had to add ogles2 from Enhancer SDK and also GL4ES SDK by Kase1 (think the user name is correct) before I could build. Along with 3 or 4 other additional options.


Amiga x5040 ı 16GB ı RX580
GB-A1000 060@100,
A1200 PiStorm32-Lite CM4
Go to top
Re: Libraries: GLEW / GLFW
Not too shy to talk
Not too shy to talk


See User information
@afxgroup

I think I'm stuck now - but by no means sure.

I used one of Walkero's containers to build GLFW that uses your version of clib2. I don't have a toolchain file so I used the following command(s) to build:

mkdir build && cd build
cmake 
-E env LDFLAGS="-mcrt=clib2 -use-dynld -athread=native -lauto" cmake -DAMIGAOS4=-DCMAKE_C_FLAGS="-mcrt=clib2 -I$OGL_INC-DCMAKE_LIBRARY_PATH=-L$OGL_INC/../../newlib/lib ..


So I'm basically telling it to use clib2 runtime in both compile and link, setting a couple of options and pointing it to where I put ogles2 from the enhancer install. Note that although this lives in the newlib folder, that's just where I put it. I don't actually know if it is runtime agnostic or whether it is newlib or clib2.

At this point all of GLFW builds. There are two redefinition warnings on GL_VERSION and GL_EXTENSIONS but the values are the save between redeclaration so I think that's harmless. What is probably not so harmless is this:

/opt/code/glfw/src/os4_context.cIn function ‘swapBuffersGL’:
/
opt/code/glfw/src/os4_context.c:70:5warningimplicit declaration of function ‘glFinish’ [-Wimplicit-function-declaration]
   
70 |     glFinish();
      |     ^~~~~~~~
/
opt/code/glfw/src/os4_context.cIn function ‘_glfwCreateContextGL’:
/
opt/code/glfw/src/os4_context.c:162:9warningimplicit declaration of function ‘glClear’ [-Wimplicit-function-declaration]
  
162 |         glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
      |         ^~~~~~~
/
opt/code/glfw/src/os4_context.c:164:9warningimplicit declaration of function ‘glViewport’ [-Wimplicit-function-declaration]
  
164 |         glViewport(00window->os4.widthwindow->os4.height);
      |         ^~~~~~~~~~


But i really don't know what to include to solve that.

At this point the examples fail. So I just turned them off.

I then went to compile one of the examples (gears) on the Amiga. Of course this doesn't work and I assume it's because the Amiga doesn't have your version of clib2. But I wouldn't have a clue how to replace the SDK one or if that is even sensible, so back to the docker container.

The farthest I can get so far is this (I split the compile and link so I could be sure of what I was doing):
/opt/ppc-amigaos/bin/ppc-amigaos-gcc -c gears.-mcrt=clib2 -I../deps -I../include
(
that works)

/
opt/ppc-amigaos/bin/ppc-amigaos-gcc gears.-mcrt=clib2 -../build/src -lglfw3 -lpthread -logles2 -L/opt/code/ogles2/local/newlib/lib 
/opt/code/ogles2/local/newlib/lib/libogles2.a(Clear.o): In function `glClear':
Clear.c:(.text+0x2): undefined reference to 
`IOGLES2'
Clear.c:(.text+0xa): undefined reference to `IOGLES2'
/opt/code/ogles2/local/newlib/lib/libogles2.a(CreateCtx.o): In function `aglCreateContext_AVOID':
CreateCtx.c:(.text+0x2): undefined reference to 
`IOGLES2'
CreateCtx.c:(.text+0xa): undefined reference to `IOGLES2'
/opt/code/ogles2/local/newlib/lib/libogles2.a(CreateCtx.o): In function `aglCreateContext2':
CreateCtx.c:(.text+0x22): undefined reference to 
`IOGLES2'
/opt/code/ogles2/local/newlib/lib/libogles2.a(CreateCtx.o):CreateCtx.c:(.text+0x2a): more undefined references to `IOGLES2' 
follow
collect2
errorld returned 1 exit status


I really don't know how to resolve those last references or how close I am! It feels like I'm close but I could just as easily be way off here.

[edit] IOGLES2 looks like it's an interface definition which suggests to me that libogles2 indeed is shared and newlib. So is there a different ogles2 I should be using rather than the one in Enhancer? Maybe that's the bit I'm missing?


Amiga x5040 ı 16GB ı RX580
GB-A1000 060@100,
A1200 PiStorm32-Lite CM4
Go to top
Re: Libraries: GLEW / GLFW
Home away from home
Home away from home


See User information
@MartinW

IOGLES2 is the ogles2.library interface pointer. You clearly haven't opened the ogles2.library and got its "main" interface. Ideally, there would be an autoinit static library that would do it all for you, but I don't think one exists. Maybe that could be added to the glfw3 port for convenience?

Anyway, you need to do something like the following:
#include <proto/exec.h>
#include <proto/ogles2.h>

#define MIN_OGLES2_VERSION 3

struct Library *OGLES2Base NULL;
struct OGLES2IFace *IOGLES2 NULL;

BOOL openLibs() {
    const 
char *libName "ogles2.librbary";
    
unsigned minLibVer MIN_OGLES2_VERSION;
    
OGLES2Base OpenLibrary(libNameminLibVer);
    if(!
OGLES2Base) {
        
printf("Couldn't open %s version %u or higher.\n"libNameminLibVer);
        return 
FALSE;
    }
    
IOGLES2 GetInterface(OGLES2Base"main"1NULL);
    if(!
OGLES2) {
        
printf("Couldn't get %s's main interface.\n");
        return 
FALSE;
    }
    return 
TRUE;
}

void closeLibs() {
    if(
OGLES2) {
        
DropInterface(IOGLES2);
        
IOGLES2 NULL;
    }
    if(
OGLES2Base) {
        
CloseLibrary(OGLES2Base);
        
OGLES2Base NULL;
    }
}


NOTE: I'm assuming you're compiling with __USE_INLINE__ defined. Otherwise you need to add IExec-> in front of the OpenLibrary() and other exec.library calls.

Your code should call openLibs() at the start of main(), and closeLibs() on exit.

Hans

P.S., The ogles2.library isn't newlib or clib2 specific.

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Libraries: GLEW / GLFW
Not too shy to talk
Not too shy to talk


See User information
@Hans

Note that I’m not doing anything except trying to compile afxgroups code. I’ve not be able to get started on mine yet.


Amiga x5040 ı 16GB ı RX580
GB-A1000 060@100,
A1200 PiStorm32-Lite CM4
Go to top
Re: Libraries: GLEW / GLFW
Home away from home
Home away from home


See User information
@MartinW

Quote:
Note that I’m not doing anything except trying to compile afxgroups code. I’ve not be able to get started on mine yet.

It doesn't matter. The reason for those errors remains the same. Either you have an autoinit stub library that sets up ogles2.library for you, or you have to write that code yourself.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Libraries: GLEW / GLFW
Amigans Defender
Amigans Defender


See User information
Did you see -L/opt/code/ogles2/local/newlib/lib?
You are pointing to newlib lib folder and not clib2 one and you have the error:

/opt/code/ogles2/local/newlib/lib/libogles2.a(Clear.o): In function `glClear':

That show you are using newlib version

i'm really tired...
Go to top
Re: Libraries: GLEW / GLFW
Amigans Defender
Amigans Defender


See User information
@MartinW

https://gist.github.com/afxgroup/864bf7d87e96ee0e2be25295f52a4a86

Of course it is a dirty toolchain file i'm using. And sometime I play with it but it should work for any project

i'm really tired...
Go to top

  Register To Post
(1) 2 »

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project