Build a texture with a screenshot of my desktop
Hello,
I want to build a texture with a screenshot of my Windows desktop.
Someone can tell me how to make a screenshot of my desktop and how to use it to build a texture with OpenGL ?
Press SHIFT PrintScreen, open Paint and press CTRL-V. Boom screenshot. Make sure that you trim it to make both width and height a power of 2. Save it as a .bmp file and then you can load it as a texture.
Make it work.
Make it fast.
"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
Make it work.
Make it fast.
"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
hehe could it be that you want to make a virtual gl windows? (virtual because you actually couldnt do things but move mouse, etc.)
I''ve saw screensavers that do this but I have no idea of what code actually takes place.
cANaBiTz:
Actually, it''s plenty possible. You can project snapshots of the windows into 3D space quite easily.
You can also quite trivially work out where the user has clicked to find input focus, and pass any input to the window with focus before updating the snapshot.
The slow bit is generating the texture from the window. On a fast machine though, you can have a few updates per sec, and it gets quite usable.
Keep yourself at the top of the z-order and they''ll never see bits you don''t want them to.
Bug System, I can''t give you any code as I have ownership issues with the project I''d have to grab it from (I''m sure you can guess which one from my site
)...
But I can tell you this: Get a handle onto the window you wish to use to make the texture (in this case the desktop). Read pixels from the window into an array using the fastest block transfer mode you can find. Then, feed that data into gluBuild2DMipmaps.
I hope this is enough to help you.
www.coldcity.com
code, pics, life
Actually, it''s plenty possible. You can project snapshots of the windows into 3D space quite easily.
You can also quite trivially work out where the user has clicked to find input focus, and pass any input to the window with focus before updating the snapshot.
The slow bit is generating the texture from the window. On a fast machine though, you can have a few updates per sec, and it gets quite usable.
Keep yourself at the top of the z-order and they''ll never see bits you don''t want them to.
Bug System, I can''t give you any code as I have ownership issues with the project I''d have to grab it from (I''m sure you can guess which one from my site

But I can tell you this: Get a handle onto the window you wish to use to make the texture (in this case the desktop). Read pixels from the window into an array using the fastest block transfer mode you can find. Then, feed that data into gluBuild2DMipmaps.
I hope this is enough to help you.
www.coldcity.com
code, pics, life
[size="2"]www.coldcity.com code, art, life
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement