I am wondering how to perform a 2D image blit with openGL. I used to use SDL and it was easy, but with opengl I end up making a rectangle with texture coords that is sunk a little into the screen. Is there any way to perform a 'real' blit?

void blitImage(unsigned int glTex, int top, int left)
{
    //what do I do?
}

Recommended Answers

All 3 Replies

Framebuffer Object—I believe you can load your image into a texture, attach it to a framebuffer object, then use it as the 'read' FBO and the front or back buffer as the 'write' FBO. I haven't tried this myself; perhaps someone with direct experience can validate the idea.

[stupid em dash, it showed up okay in the preview]

I have tried framebuffers and can never get them to work. I have tried many different versions of test code for them and every single one either fails to compile or fails to link. Could you maybe post source code for a test example? Also I was wondering if, since I am using windows API to begin with, I can use some Windows API function to blit a texture (I do have the data stored in a variable along with its openGL texture index).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.