Is there a way to interact with video memory in FB?

General FreeBASIC programming questions.
Mentat
Posts: 332
Joined: Oct 27, 2007 15:23
Location: NC, US
Contact:

Is there a way to interact with video memory in FB?

Postby Mentat » Oct 18, 2008 13:09

Such as loading up data and doing operations? Is there some kind of direct way to access this, or do we have to work through a library?
dani.user
Posts: 284
Joined: Sep 30, 2006 10:41

Postby dani.user » Oct 18, 2008 16:05

Under what OS?
arenth
Posts: 511
Joined: Aug 30, 2005 6:22

Postby arenth » Oct 18, 2008 18:51

Under windows and linux use scrptr to get a pointer to the current screens buffer, its about as close to actual video memory as you'll get on windows/linux.
Mentat
Posts: 332
Joined: Oct 27, 2007 15:23
Location: NC, US
Contact:

Postby Mentat » Oct 18, 2008 20:05

dani.user wrote:Under what OS?



Windows.
counting_pine
Site Admin
Posts: 6190
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Oct 18, 2008 21:02

You can get a pointer to FB's graphics screen buffer using Screenptr, and you can use ScreenInfo to get useful information on accessing it, such as the dimensions, bit depth and pitch.
http://www.freebasic.net/wiki/KeyPgScreeninfo
http://www.freebasic.net/wiki/KeyPgScreenptr

Similarly, ImageInfo gives you the necessary details on FB's image buffers.
http://www.freebasic.net/wiki/KeyPgImageinfo

If you want to find out how to access the physical screen's memory, that's a much tougher question.
Mentat
Posts: 332
Joined: Oct 27, 2007 15:23
Location: NC, US
Contact:

Postby Mentat » Oct 18, 2008 21:40

Thanks, though I meant something like loading vertex data or textures into video memory. Would using in-line assembly work for this?
dani.user
Posts: 284
Joined: Sep 30, 2006 10:41

Postby dani.user » Oct 19, 2008 13:24

The OS does not allow you to access the video memory directly due to security reasons.
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Postby Merick » Oct 19, 2008 13:53

Are you using OpenGL? If you use a display list, GL basically compiles the commands inside the list into an optimized bytecode, which is then stored in video memory. (at least, with gfx cards that support it)
Mentat
Posts: 332
Joined: Oct 27, 2007 15:23
Location: NC, US
Contact:

Postby Mentat » Oct 19, 2008 13:56

Merick wrote:Are you using OpenGL? If you use a display list, GL basically compiles the commands inside the list into an optimized bytecode, which is then stored in video memory. (at least, with gfx cards that support it)


No, but that is what I was trying to do.

Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests