Rendering to the Windows Desktop?

Blitz3D Forums/Blitz3D Programming/Rendering to the Windows Desktop?

Adam Novagen(Posted 2009) [#1]
Hey all,

I had an interesting idea recently, one that might change my way of using my desktop. Picture this: all the desktop shortcuts arranged on the faces of a 3D cube, which can be "spun" by rolling the mouse over it. Shortcuts to programs can be added using drag-and-drop, and so on; you get the picture.

So, to do this, I need to copy 3D renderings onto the desktop, preferably using CopyRect(). Obviouosly there's no way to do this with straight B3D, so WinAPI calls are necessary. Unfortunately, I don't really know a thing about them. What should I use to draw to the desktop?

Also, is it possible to draw ONLY on the actual Windows Desktop, as opposed to the "desktop" screen buffer?


Warner(Posted 2009) [#2]
Maybe this can help to get you started? http://www.blitzbasic.com/codearcs/codearcs.php?code=2046


Kryzon(Posted 2009) [#3]
You're probably going to need a Direct3D 7 DLL to enable render-to-texture (or in this case, setting the render target to be the Desktop screen or whatever), as CopyRect() might not be ideally fast enough.


Adam Novagen(Posted 2009) [#4]
@Warner, that looks good, but the one problem is that it only loads images from disk, not from memory, which makes for slooow going. Can I edit the loaded images using ImageBuffer()?

@Kryzon, I'll be fine using CopyRect(), because the render size will be adjustable, and shouldn't need to get too big. Let's say 1024x1024 max, for people who are nuts about uber-sized screens. ;P


Guy Fawkes(Posted 2009) [#5]
no. make it 1280x1024 :P for ppl who are crazy

ur the creator. YOU control the gfxsize :P


Ross C(Posted 2009) [#6]
1280 will cause an upscale to 2048, which should be avoided.


Warner(Posted 2009) [#7]
I think you can't directly pass blitz images/imagebuffers to a dc. A quick google search also gave me these results. Maybe they provide some additional info:
http://www.blitzbasic.com/codearcs/codearcs.php?code=628
http://www.blitzbasic.com/codearcs/codearcs.php?code=1752


Adam Novagen(Posted 2009) [#8]
1280 will cause an upscale to 2048, which should be avoided.

You've got me there, Ross... An upscale?? So... a 1280 3D render is actually rendered at 2048?? HUH???

Warner, thanks for those links, they might help a lot.

Um... Hey, slightly different tactic. I know that B+ lets you create a window that has no border, buttons or title bar, which is useful for splash screens and the like. Is it possible to do this with Api or WinB3D? I've tried WinB3D already, but I seem to be doing something wrong, because unless I create a window with the default style (0) it never shows up.


GIB3D(Posted 2009) [#9]
It must be to the power of 2. 1024x1024, 2048x2048, 1x1, 2x2...


Ross C(Posted 2009) [#10]
Yeah. If you go over the last power of 2, it upscales to the next, which would be 2048. You can double check by calling texture width/height.

You can have different power of 2 textures though - 128 x 512 etc etc


GIB3D(Posted 2009) [#11]
Woah really? I didn't know that one. One thing I noticed though is that you can LoadTexture and size image but in the program it's actually 2 the power of 2.


Adam Novagen(Posted 2009) [#12]
No, nonononono. XD That's not what I meant. I wasn't talking about texture size, I was talking about screen area. No, the cube would probably be 512 on all sides. The AREA of screen that cube was RENDERED INTO though, as determined by CameraViewPort(), would be allowed to go up to 1024. Rendered in windowed mode, of course.

So, basically, the cube gets rendered in the blitz window, then CopyRect() would be called to get the pixel data from the backbuffer and paste it on the screen. Or on a borderless window.

Hey, anyone know what Api function to use to get the mouse speed/position when it's outside the Blitz window?


Warner(Posted 2009) [#13]
api_GetCursorPos.


Adam Novagen(Posted 2009) [#14]
:D thanks Warner.