FreeBASIC Screensaver Kit
You actually don't get a GDI context, you have to make one. All you're given is an HWND that is either screen-sized or about 150x120.
Turns out I don't know anything about opengl, but if you can get something in a tiny child window, you'll be set.
EDIT: Okay, apparently there are some Win32 OpenGL functions that go by the prefix monaker "wgl", that let you set up OpenGL into Window:
http://msdn.microsoft.com/library/defau ... o_4v3m.asp
This would allow you set up OpenGL into a screensaver child window, but you would probably be cut off from GfxLib unless you figure out a way to map OpenGL commands to a GfxLib surface (ARGB memory buffer). If there was a way to get OpenGL to that surface, and then use OpenGL to copy it to the DC, then you'd be set.
But if you don't care about GfxLib, then it would be a much simpler matter to convert the kit.
EDIT AGAIN: It looks like OpenGl can play nice with GfxLib and draw to ScreenPtr. I'll try and port the library next chance I get, but it may take awhile for me to find the time.
EDIT ONCE AGAIN: Apparently, I was mistaken. OpenGL can copy to a screenbuffer with any pixel format, much like GDI can, but it can't draw to that buffer using that buffer's pixel format.... unless I wanted to forego hardware accelleration. So you couldn't PUT a pixel down and then slap a polygon on it without doing two screen copies per frame.
Soo... I can write an OpenGL driver, but much like GfxLib's openGL driver, it won't be able to use PUT/LINE/PSET.
Turns out I don't know anything about opengl, but if you can get something in a tiny child window, you'll be set.
EDIT: Okay, apparently there are some Win32 OpenGL functions that go by the prefix monaker "wgl", that let you set up OpenGL into Window:
http://msdn.microsoft.com/library/defau ... o_4v3m.asp
This would allow you set up OpenGL into a screensaver child window, but you would probably be cut off from GfxLib unless you figure out a way to map OpenGL commands to a GfxLib surface (ARGB memory buffer). If there was a way to get OpenGL to that surface, and then use OpenGL to copy it to the DC, then you'd be set.
But if you don't care about GfxLib, then it would be a much simpler matter to convert the kit.
EDIT AGAIN: It looks like OpenGl can play nice with GfxLib and draw to ScreenPtr. I'll try and port the library next chance I get, but it may take awhile for me to find the time.
EDIT ONCE AGAIN: Apparently, I was mistaken. OpenGL can copy to a screenbuffer with any pixel format, much like GDI can, but it can't draw to that buffer using that buffer's pixel format.... unless I wanted to forego hardware accelleration. So you couldn't PUT a pixel down and then slap a polygon on it without doing two screen copies per frame.
Soo... I can write an OpenGL driver, but much like GfxLib's openGL driver, it won't be able to use PUT/LINE/PSET.
-
- Posts: 1706
- Joined: May 27, 2005 6:34
- Location: Cambodia, Thailand, Lao, Ireland etc.
- Contact:
Hi:
I looked at this code to see how it works and I am no wiser for my efforts. Actually I started out looking at the screen saver code (which I understand), but got distracted by the graphics (which I don’t understand). What logic is this based on? References? How could anybody possibly dream this up unless it was based on some mathematical principal or some such?
This is the only screensaver I ever liked.
Garvan
I looked at this code to see how it works and I am no wiser for my efforts. Actually I started out looking at the screen saver code (which I understand), but got distracted by the graphics (which I don’t understand). What logic is this based on? References? How could anybody possibly dream this up unless it was based on some mathematical principal or some such?
This is the only screensaver I ever liked.
Garvan
-
- Posts: 124
- Joined: Aug 24, 2005 1:55
- Contact:
General Protection Fault - A program tried to write in an area of memory that was reserved (protected). The operation is refused (I believe) but Windows gets confused because it has no idea what to do next, so it just forces the program responsible to close and comes up with a <sarcasm>lovely, easy-to understand </sarcasm> error message.jofers wrote:What does GPF mean? I suck at acronyms.
I really shouldn't have ordered those Intel manuals!
-
- Posts: 1706
- Joined: May 27, 2005 6:34
- Location: Cambodia, Thailand, Lao, Ireland etc.
- Contact:
Hi jofers
The screensaver kit runs well with the “Mambazo Doodle.bas” sample, but for some reason it crashes on exit if you comment out the lines starting with
StartScreenSaver
And compile it as a stand alone app.
I spent 20 minutes looking for the reason, and could not find any.
I have WinXP SP2
Garvan
Correction:
“Mambazo Doodle.bas” also crashes on exit when I recompile it. The original scr file does not crash.
Garvan
The screensaver kit runs well with the “Mambazo Doodle.bas” sample, but for some reason it crashes on exit if you comment out the lines starting with
StartScreenSaver
And compile it as a stand alone app.
I spent 20 minutes looking for the reason, and could not find any.
I have WinXP SP2
Garvan
Correction:
“Mambazo Doodle.bas” also crashes on exit when I recompile it. The original scr file does not crash.
Garvan
Well, StartScreenSaver is necessary, it sets everything up and rolling so your screensaver will work. Don't take that one out.
Does this crash?
Does this crash?
Code: Select all
#include "FB_ScreenSaverKit.bas"
Dim As Integer sw, sh
'Start the Screen Saver
StartScreenSaver
ScreenInfo sw, sh
Do Until SaverInfo.IsClosing = TRUE
Pset (Rnd * sw, Rnd * sh), Rgb(Rnd * 255, Rnd * 255, Rnd * 255)
Loop
-
- Posts: 1706
- Joined: May 27, 2005 6:34
- Location: Cambodia, Thailand, Lao, Ireland etc.
- Contact:
-
- Posts: 385
- Joined: Oct 16, 2005 0:15
- Location: USA
- Contact:
"windows.bi" (and about 10 other files) are a direct translation of the Windows API headers from C. They wil be packaged with FreeBASIC 0.15b, but you can grab 'em here or off the CVS:
http://www.betterwebber.com/stuff/win32headers.zip
Remember, they can only be used with the testing versions of FreeBASIC 0.15b, available in the download section, because they use some new features.
http://www.betterwebber.com/stuff/win32headers.zip
Remember, they can only be used with the testing versions of FreeBASIC 0.15b, available in the download section, because they use some new features.
-
- Posts: 58
- Joined: Nov 02, 2005 19:49