OpenGL: Drawing a Texture onto Another Texture

Started by
3 comments, last by EnigmaticCoder 14 years, 1 month ago
I just switched from rendering with SDL to rendering with OpenGL and using SDL for creating the window. With SDL I could call SDL_BlitSurface(source, clip region, destination, position) and blit one surface onto another. Is this possible with OpenGL?
--------------------Enigmatic Coding
Advertisement
If you want to overlay an image over your scene, you need to create a textured quad with your RGBA sprite, and then draw that primitive on top of your other scene geometry with blending enabled. There's no simple blit function.

Something like:

//Draw Scene
....
//End Scene

glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); (assumes black=transparent)

//Draw Textured Quad
...
//End Quad

glDisable(GL_BLEND);
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
Not directly, but thing work differently in OpenGL, just draw textures to the screen. If you need to get this rendering into another texture, you can use Framebuffer Objects (FBOs) to draw to textures instead to the default framebuffer.
You should explain what you are trying to do.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

I'm working on a game that allows the player to dig through dirt. I want to store the tunnels on a surface that's bigger than the width and height of the screen. Then, every frame, I want to render that surface to the screen (only what fits on the screen). When ever I dig more tunnels, I will add to the tunnel surface, opposed to drawing all the tunnels to the screen every frame.

[Edited by - EnigmaticCoder on March 9, 2010 1:50:07 PM]
--------------------Enigmatic Coding

This topic is closed to new replies.

Advertisement