1. RGFW Wrapper and Partial OpenGL Wrapper

Hi all,

Yesterday I started work on a wrapper for RGFW.

[https://github.com/ColleagueRiley/RGFW] - An alternative to GLFW

In order to make the example work I had to wrap some of OpenGL. I haven't completed the openGL wrapper, but a handful of functions are wrapped. The RGFW wrapper is finished. If anyone is interested let me know and I can post it.

--Sample clipping from wrapper 
public constant RGFW_monitor = define_c_struct({ 
	C_INT32, 		 --x 
	C_INT32,         --y 
	{C_CHAR,128},    --name[128] 
	C_FLOAT,	     --scaleX 
	C_FLOAT,	     --scaleY 
	C_FLOAT,	     --physW 
	C_FLOAT,	     --physH 
	RGFW_monitorMode --mode 
}) 
 
public constant xRGFW_getMonitors = define_c_func(rgfw,"+RGFW_getMonitors",{C_POINTER},C_POINTER) 
 
public function RGFW_getMonitors(atom len) 
 
	atom plen = allocate_data(sizeof(C_SIZE_T)) 
	 
	if c_func(xRGFW_getMonitors,{plen}) then 
		len = peek_type(plen,C_SIZE_T)	 
	end if 
	 
	free(plen) 
	 
	return {len} 
	 
end function 
 
public constant xRGFW_createWindow = define_c_func(rgfw,"+RGFW_createWindow",{C_STRING,RGFW_rect,C_INT},C_POINTER) 
 
public function RGFW_createWindow(sequence name,sequence rect,atom flags) 
	return c_func(xRGFW_createWindow,{name,rect,flags}) 
end function 
 
include std/ffi.e 
include std/machine.e 
 
include rgfw.e 
include opengl.e 
 
--RGFW_setClassName("Example") 
 
atom win = RGFW_createWindow("Test Win",{100,100,640,480},RGFW_windowCenter) 
 
while not RGFW_window_shouldClose(win) do 
 
	while RGFW_window_checkEvent(win) do 
		if win = RGFW_quit then 
			exit 
		end if 
		if RGFW_isPressed(win,RGFW_escape) then 
			exit 
		end if 
	end while 
	 
	glClearColor(0.1,0.1,0.1,1.0) 
	glClear(GL_COLOR_BUFFER_BIT) 
	 
	glBegin(GL_TRIANGLES) 
	glColor3f(1.0,0.0,0.0) glVertex2f(-0.6,-0.75) 
	glColor3f(0.0,1.0,0.0) glVertex2f(0.6,-0.75) 
	glColor3f(0.0,0.0,1.0) glVertex2f(0.0,0.75) 
	glEnd() 
	 
	RGFW_window_swapBuffers(win) 
	 
end while 
 
RGFW_window_close(win) 
 
new topic     » topic index » view message » categorize

2. Re: RGFW Wrapper and Partial OpenGL Wrapper

Always interested in your wrappers. Can barely keep up, but interested.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

3. Re: RGFW Wrapper and Partial OpenGL Wrapper

ChrisB said...

Always interested in your wrappers. Can barely keep up, but interested.

Cheers

Chris

Hi Chris, thanks for showing interest. I'll post it in a bit.

You'll need 64-bit version of Euphoria

[https://github.com/gAndy50/EuRGFW]

new topic     » goto parent     » topic index » view message » categorize

4. Re: RGFW Wrapper and Partial OpenGL Wrapper

Hi Icy

64 bit - oh - that would be more work than I want to do at the moment, I have a nice stable set of libs and utils, but all 32 bit. I know this makes me behind the times, but what I have works atm.

What someone needs to do is a definitive 'how to' on moving a 32 bit install of eu, to 64 bit, possibly even automating the process. Sadly my Eu has a bit of disuse atrophy, so I almost have to relearn a bunch of stuff after being away for a few months (damn work, the motorbike, the grandkids and the wife's Vallais Blacknose sheep).

I may get round to it, when I finish a large part of the other projects going on at the moment.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

5. Re: RGFW Wrapper and Partial OpenGL Wrapper

ChrisB said...

Hi Icy

64 bit - oh - that would be more work than I want to do at the moment, I have a nice stable set of libs and utils, but all 32 bit. I know this makes me behind the times, but what I have works atm.

What someone needs to do is a definitive 'how to' on moving a 32 bit install of eu, to 64 bit, possibly even automating the process. Sadly my Eu has a bit of disuse atrophy, so I almost have to relearn a bunch of stuff after being away for a few months (damn work, the motorbike, the grandkids and the wife's Vallais Blacknose sheep).

I may get round to it, when I finish a large part of the other projects going on at the moment.

Cheers

Chris

I have both 32 and 64-bit Eu installed on my machine. When I want run 32-bit, I use eui program.ex when I want to use 64-bit, I use eui64 program.ex I have slightly changed the names to make it easier for me to distinguish between 32 and 64-bit. I also have paths set on my machine (I use Windows mainly, with WSL installed).

UPDATE: I built a 32-bit version of the DLL rgfw32.dll

You'll have to change it from rgfw.dll to rgfw32.dll in the code, but its easy.

new topic     » goto parent     » topic index » view message » categorize

6. Re: RGFW Wrapper and Partial OpenGL Wrapper

Ah, great, thanks, I'll give it a try.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

7. Re: RGFW Wrapper and Partial OpenGL Wrapper

ChrisB said...

64 bit - oh - that would be more work than I want to do at the moment, I have a nice stable set of libs and utils, but all 32 bit.

The issue isn't the libraries themselves, it's the structures -- offset counting gets messy when it's all four-or-eight bytes aligned.

That's why Win32Lib in particular is so challenging to port to 64-bit: hundreds of places where pointers are assumed to be four bytes wide.

The good news is, adding structure support with libffi helps that immensely. It's not perfect but it significantly reduces the complexity.

I'm getting pretty close to having std/ffi.e complete enough to release it for testing.

ChrisB said...

What someone needs to do is a definitive 'how to' on moving a 32 bit install of eu, to 64 bit, possibly even automating the process.

That depends on what you're trying to do. Which libraries do you use that don't yet work on 64-bit? (Aside from the aforementioned Win32Lib.)

-Greg

new topic     » goto parent     » topic index » view message » categorize

8. Re: RGFW Wrapper and Partial OpenGL Wrapper

ghaberek said...
ChrisB said...

64 bit - oh - that would be more work than I want to do at the moment, I have a nice stable set of libs and utils, but all 32 bit.

The issue isn't the libraries themselves, it's the structures -- offset counting gets messy when it's all four-or-eight bytes aligned.

That's why Win32Lib in particular is so challenging to port to 64-bit: hundreds of places where pointers are assumed to be four bytes wide.

The good news is, adding structure support with libffi helps that immensely. It's not perfect but it significantly reduces the complexity.

I'm getting pretty close to having std/ffi.e complete enough to release it for testing.

ChrisB said...

What someone needs to do is a definitive 'how to' on moving a 32 bit install of eu, to 64 bit, possibly even automating the process.

That depends on what you're trying to do. Which libraries do you use that don't yet work on 64-bit? (Aside from the aforementioned Win32Lib.)

-Greg

That's awesome that std/ffi.e is coming close to completion. I've looked into starting a new win32lib, but the windows API is huge.

new topic     » goto parent     » topic index » view message » categorize

9. Re: RGFW Wrapper and Partial OpenGL Wrapper

Icy_Viking said...

That's awesome that std/ffi.e is coming close to completion. I've looked into starting a new win32lib, but the windows API is huge.

My first though is that we should probably wrap Win32 API first, keeping as close to the original design as possible.

However, it's so structure-heavy that we might be better off waiting until we implement actual structs (and classes).

-Greg

new topic     » goto parent     » topic index » view message » categorize

10. Re: RGFW Wrapper and Partial OpenGL Wrapper

ghaberek said...
Icy_Viking said...

That's awesome that std/ffi.e is coming close to completion. I've looked into starting a new win32lib, but the windows API is huge.

My first though is that we should probably wrap Win32 API first, keeping as close to the original design as possible.

However, it's so structure-heavy that we might be better off waiting until we implement actual structs (and classes).

-Greg

Having struct in Euphoria would be amazing. It'd also make wrapping libraries easier. FFI has proven pretty useful. Though it would be much nicer to have struct support built into Euphoria.

include std/ffi.e 
 
public constant public constant Vector2 = define_c_struct({ 
	C_FLOAT, --x [1] 
	C_FLOAT  --y [2] 
}) 
 
sequence Pos = {50,10} x is [1], y is [2] 
 
--Let's say Eu has a built in struct member 
--My idea would be something like 
--Basically something very similar to C structs 
 
Struct myStruct { 
 atom x 
 atom y 
} 
 
--You could access members as 
 
myStruct.x = 10  
 
--Or 
 
myStruct:x = 10 
new topic     » goto parent     » topic index » view message » categorize

11. Re: RGFW Wrapper and Partial OpenGL Wrapper

Icy_Viking said...

That's awesome that std/ffi.e is coming close to completion. I've looked into starting a new win32lib, but the windows API is huge.

I have a list of more than 4300 windows routines described as here:

"wtsapi32", "WTSQuerySessionInformationA", {pointer, uint32, pointer, pointer, pointer}, int32 
"wtsapi32", "WTSQuerySessionInformationW", {pointer, uint32, pointer, pointer, pointer}, int32 
"wtsapi32", "WTSQueryUserToken", {ulong, pointer}, int32 
"wtsapi32", "WTSRegisterSessionNotification", {pointer, uint32}, int32 
"wtsapi32", "WTSUnRegisterSessionNotification", {pointer}, int32 
"wtsapi32", "WTSWaitSystemEvent", {pointer, uint32, pointer}, int32 

It could help. If needed I can provide it by private mail because of its size.

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

12. Re: RGFW Wrapper and Partial OpenGL Wrapper

Windows constants and errors are available in an Euphoria format too.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu