Need new gfxlib driver for Windows 7, 8, 10

Windows specific questions.
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Need new gfxlib driver for Windows 7, 8, 10

Post by coderJeff »

Does anyone seen fbc's gfxlib2 DirectX driver working on Win7+ 64-bit with fbc 64-bit program?

Code: Select all

#include once "fbgfx.bi"
screen 19 
dim x as string
screencontrol( fb.GET_DRIVER_NAME, x )
print x
sleep
On Win7-64bit, fbc-32bit, I get "DirectX"
On Win7-64bit, fbc-64bit, I get "GDI"

I was messing around with graphics in thread viewtopic.php?f=15&t=26419

What I found was that existing gfxlib2 DirectX driver:
- always fails for me under win7-64bit, fbc-64bit. I see the gfx window create/destory a couple of times while gfxlib2 tries to create a working screen mode
- and Win7-64bit provides enough emulation that running a fbc-32bit program DirectX succeeds.

gfxlib2 uses DirectDraw interface, which Microsoft has deprecated. I tried using DirectDraw7 interface but it's the same.

If no one sees DirectX working on Win7-64bit, fbc-64 bit, then, we need a new driver.

The driver could be prototyped in FreeBASIC. To be used for the driver (written in C), need to show:
- window & full screen
- copy from memory to display memory
- wait for vertical blanking interrupt
- I'm kind of assuming that the general message loop can be reused from existing windows gfxlib drivers

Can anyone help? My knowledge of windows API's is kind of out of date now.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by VANYA »

Hi!

DIRECTDRAW has long been out of date. In my opinion, the best solution would be to rewrite the fbgfx library under OpenGL. Obvious advantages:

1) unloading the processor due to the fact that a considerable part of the work will take over the video card. Today, FbGFX uses only the power of the processor.
2) the potential of OpenGL for new functions (resize, rotate ...)
3) independence from Microsoft. Who knows what they will declare tomorrow obsolete ...
marcov
Posts: 3454
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by marcov »

VANYA wrote: DIRECTDRAW has long been out of date.
Directdraw has been integrated into DirectX. DirectX does break compatibility more often though.
In my opinion, the best solution would be to rewrite the fbgfx library under OpenGL. Obvious advantages:
This would be a perfectly valid opinion a few years ago, but you are writing this a week after Apple announced it would drop OpenGL, and the last year Vulkan slowly is getting more relevant for new development
1) unloading the processor due to the fact that a considerable part of the work will take over the video card. Today, FbGFX uses only the power of the processor.
Usually this requires a redesign of the library and its API.
3) independence from Microsoft. Who knows what they will declare tomorrow obsolete ...
Well, of all the graphics apis, OpenGL has the biggest chance.
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by coderJeff »

angros47 worked on this Patch - Rendering of FreeBasic graphic on OpenGL. I'm not sure if anyone has taken much notice of it. I think the feature just needs a little more polish to finish. If it works really well, maybe this could be the alternative for win7, I don't know.
Imortis
Moderator
Posts: 1923
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by Imortis »

coderJeff wrote:angros47 worked on this Patch - Rendering of FreeBasic graphic on OpenGL. I'm not sure if anyone has taken much notice of it. I think the feature just needs a little more polish to finish. If it works really well, maybe this could be the alternative for win7, I don't know.
It is already in the unofficial builds. It works pretty well with my testing.
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by dkl »

SDL backend!
St_W
Posts: 1618
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by St_W »

dkl wrote:SDL backend!
Sounds quite heavyweight (at least compared to the existing gfxlib backends), yet would allow easy/easier portability, also to new systems like OSX or Android.
sean_vn
Posts: 283
Joined: Aug 06, 2012 8:26

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by sean_vn »

The gfxlib doesn't work on some versions of Linux now. Lack of maintenance? I'm using java and javafx gui instead. Oracle though are looking for ways to commercially exploit java to the maximum, which is a big negative. For all the programming languages out there, there aren't too many light weight, low level ones with built in graphics.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by lizard »

sean_vn wrote:The gfxlib doesn't work on some versions of Linux now.
Do you know which ones these are?
sean_vn
Posts: 283
Joined: Aug 06, 2012 8:26

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by sean_vn »

I'm using XenialPup, where you are permanently administrator! Obviously I don't care very much about security.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by lizard »

You cant expect the gfxlib becomes rewritten only for XenialPup which is a minimal distro intended for outdated hardware ( > 1 GHZ processor and 768 MB ram).
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by coderJeff »

DirectX/DirectDraw, I suppose the most recent interface would be DirectX/Direct2D. I know nothing about that interface. It looks like have to create a dozen objects to construct a working interface.

SDL backend: Can it be loaded dynamically at runtime? i.e. use it if it is available, but don't require that it be installed, distributed, etc. Another interface I know nothing about.

Design of fbgfx is a main memory drawing "surface". The driver part only needs to copy from memory to display using whatever API is available. I know, I'm over simplifying.
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by speedfixer »

having gfxlib work with SDL or Vulcan?

now THIS is an exciting topic!
macko17
Posts: 8
Joined: Jun 04, 2017 0:22

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by macko17 »

coderJeff wrote:Does anyone seen fbc's gfxlib2 DirectX driver working on Win7+ 64-bit with fbc 64-bit program?
This is broken because somebody hardcoded the size of the DIDATAFORMAT rather than using sizeof, and since it contains pointers, isn't the same for 32 and 64. Changing this line
https://github.com/freebasic/fbc/blob/m ... draw.c#L72
to something like this

Code: Select all

static const DIDATAFORMAT __c_dfDIKeyboard = {sizeof(__c_dfDIKeyboard), sizeof(*__c_rgodfDIKeyboard), DIDF_RELAXIS, 256, ARRAYSIZE(__c_rgodfDIKeyboard), __c_rgodfDIKeyboard };
Fixes it, for me at least.

Also, this (and the CreateThread a few lines below) leak the returned thread handle
https://github.com/freebasic/fbc/blob/m ... ngl.c#L431

This is a potential buffer overflow, since it doesn't respect maxsize
https://github.com/freebasic/fbc/blob/m ... tpath.c#L7

Truncating the process handle here is also technically broken on Win64, but it'll probably be fine.
https://github.com/freebasic/fbc/blob/m ... ecex.c#L95

I cba setting up everything on github to just change five lines of code - gimme 5 years to fix the Direct2D headers for C and write a driver for that, then I'll do it.
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Need new gfxlib driver for Windows 7, 8, 10

Post by coderJeff »

@macko17, that's excellent!

fb gfxlib's DirectX driver now initializes for me on Win7 64-bit. Nice!

For DirectX, maybe you or some one else can answer: Is there any advantage to using the IDIRECTDRAW7 interface. To change the driver, it's not much more complicated than a find/replace to update (or clone) the driver source code replacing all IDIRECTDRAW2 related names with IDIRECTDRAW7 related names. Or because we are using only a few functions that IDIRECTDRAW2 is good enough, it doesn't matter?. Both seem to initialize correctly on my win7-64bit.

I bookmarked your post. I may follow-up with actual bug reports; even if just for myself, it's nice to have a ticket to track. I think we can work in the changes sometime soon.
Post Reply