how would i go about capturing my computer's screen with SDL? is this possible with SDL? i wanted to try something like applying a surface to the main renderer (if that makes any sense either) and then call:
SDL_SaveBMP(back_buffer, "screen.png");
how would i do what i want to do if it is possible? has anyone done this before?
This cannot be done. What you are describing is a platform dependent operation which is not implemented by SDL.
I hope this helps: Try to create a new surface by combining all the surfaces you want to render into one( by using getpixel() and putpixel() functions -you man need to make them yourself- ), then SDL_SaveBMP( newsurface,"name.bmp") ( I personally don't know if SaveBMP can save .png files )
Related
Is there a way to create a ID2D1BitmapRenderTarget without calling CreateCompatibleRenderTarget on a "parent" render target?
MSDN shows the way how I can do it with WIC, but I am not sure, will the drawing operations be accelerated by GPU, so not sure to go this way.
Thank you.
I have been looking to an answer to this for a while now but I can't really find one.
I'm not using glut so please no glut only answer.
What I am trying to do is send variables and text to the in game screen so I can make an UI with a little feedback for the player, like the amount of money they are carrying at that moment. (So not the debug screen)
I'm using c++ with opengl.
If I need to provide anyone with more information, please ask and I will do my best to provide you with it.
Thank you in advance.
If you can live with GL1.x, use the classic reference on bitmap fonts: http://nehe.gamedev.net/tutorial/bitmap_fonts/17002/
If you need something relevant, modify the sample above to use Vertex Arrays / Vertex Buffer Objects and not the glRasterPos functions.
Advanced way is to use the FreeType to render truetype fonts. Here's a sample.
Im trying to make a simple 2D application, and our image processing professor has told us to use opengl. Im working with c++ and QT.
I want to open a simple window that holds a place where I can draw points of different colors. All by code, there is no user interaction. I cant use any other library, can anyone tell me how to do this?
check out :
http://www.digitalfanatics.org/projects/qt_tutorial/chapter14.html
2D Painting Example using QGLWidget.
OpenGL is a library to render. You need at least one or two more (at least to create a window).
Since that is a homework, take a look at this example on how to do your assignment.
Qt comes with numerous examples of using QGLWidget.
I have an application that I want add some cool animations to show state changes. However, wxwidgets would be difficult because I'd have to program these animations in straight gdi. What's the best way to add these effect windows? Should I open a flash window and run a flash sequence or is maybe some other technology? Does .net have something I could code into a dll and run from my wxwidgets binary? I need something that is super easy to draw and set up the animation.
It's hard to say what the best approach would be to achieve "cool effects", but in most cases you would want a double-buffered drawing surface. That's what I've used in similar-sounding situations.
In wxWidgets, you would want wxBufferedDC.
You could prepare animation as a bunch of images (wxImage loaded from PNG, GIF, JPG or whatever files), and then use a timer and paint them on a control. Maybe it sounds like too much, you I believe you could do it in 50-70 lines of code.
Perhaps you just could make a single widget that has a custom paint-event that hand-draws the various widgets inside it? Then you could draw them at the appropriate locations/sizes without having to involve wxwidgets at all, it would just be a bunch of line-draw/rectangle-draw/text-draw commands to update the display for each frame of animation.
I'm wondering how to make a window transparent, not cutout holes or the same transparency overall.
Well, just say I want to slap a PNG image of a rose or something and have it blend nicely with stuff behind and allow stuff behind to redraw and have their changes shine through the transparent parts of the picture/window.
I could (or would like to) use something like wxWidgets or OpenGL. But rather not Qt or GTK.
I found out that it's actually pretty simple to throw up a transparent picture on the screen using wxW:
wxScreenDC dc;
wxBitmap bmp(wxT("test.png"), wxBITMAP_TYPE_PNG);
dc.DrawBitmap(bmp, 250, 100, true);
Now I has to find out how to handle updates and such, it has to be ( maybe partially redrawn ) when something beneath updates.
As it is right now it just redraws itself ontop of itself, making it become fully opacue in a while.
There was another version of wxScreenDC::DrawBitmap that took a window as an argument, maybe it's that one solves this?
How about using shaped frames?
wxBitmap m_bmp = wxBitmap(_T("redroseonwhite.png"), wxBITMAP_TYPE_PNG);
SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()));
wxRegion region(m_bmp, *wxWHITE);
bool m_hasShape = SetShape(region);
Look *wxWidgets-2.9.0\samples\shaped* for the full example.
See wxTopLevelWindow::SetTransparent.
If the platform supports it will set the window to be translucent.
So I guess wxWidgets can do it.
If you are willing to do something other than C++, there may be other cross platform options like JavaFx and Adobe AIR.