Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenGL texture vs FBO
    text
    copied!<p>I am pretty new to OpenGL and just want some quick advice. I want to draw a tiled background for a game. I guess this means drawing a whole bunch of sprite like objects to the screen. I have about 48 columns to 30 rows, therefore 1440 tiles (tiles change depending on the game, so I can't pre-render the entire grid).</p> <p>Currently on start up I create 6 different FBO (using the <a href="http://ofxfenster.undef.ch/doc/classofFbo.html" rel="nofollow noreferrer">ofFbo</a> class from OpenFrameworks) that act as 6 different tiles. I then draw these buffers, up to a maximum of 1400 times, selecting one for each tile. So there are only ever 6 fbos, just being draw a lot of times. (The buffers are drawn to on start up, and are never changed once created).</p> <pre><code>for (int x=0; x&lt;columns; x++) { for (int y=0; y&lt;rows; y++) { // Get tile type and rotation from tile struct. tileNum = tile.form rotNum = tile.rot // Draw image/texture/fbo that's stored in a std vector. tileSet-&gt;draw(x*TILESIZE, y*TILESIZE, TILESIZE, TILESIZE); } } </code></pre> <p>I think I am going about this the wrong way, and was wondering if anyone new the best / optimal way to do this. Think something like an old school 8 bit video game background. Here is an image of my work in progress. </p> <p><img src="https://i.stack.imgur.com/KIQ8n.png" alt="work in progress"></p> <p>The structures in the background are the sprites i'm talking about, the different pieces are the inny corner, outty (concave) corner, square fill, and straight edge. Sorry for messing around with question.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload