rogue-like rendering

Started by thalador, October 28, 2007, 19:47:06

Previous topic - Next topic

thalador

Hi,

I want to write a rogue-like game and decided not to use any of the curses libraries and use ogl instead. Right now I want to represent a standart sized console window with 80x25 characters. This is how I draw the tiles at the moment:

1. I use vertex arrays with 2 triangles for every tile I want to draw as background.
2. Then I draw the same geometry again with textures and alphablending on and other colors(foreground color)

With that I can draw every letter with any background/foreground color combination. The letters are stored in the texture. This method is not very fast so I wanted to ask you what kind of improvement you would suggest. Vertex sharing was my first idea, but that would mean that every vertex has only one colorattribute and therefore the colors would mix over tile boundaries, which is bad..

Thanks
thala

ndhb

It should be fast unless you're using a texture for each individual letter. What does the the texture look like?

I made this font drawing stuff long ago: http://lwjgl.org/forum/index.php/topic,2013.0.html. Each letter is display list with texture coordinates for a single large texture (texture atlas). I found the approach fast enough to draw letters all over the screen with 100's of FPS...

kind regards,
Nicolai de Haan Brøgger

elias4444

I don't know, my implementation uses a hashtable of textures (one for each of the base 256 characters). Performance seems to be just fine. Of course, I don't go overboard on the texture sizes either.

=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

thalador

My texture is a single tga file 192x128 pixels and contains all the letters.
@elias4444: How do you draw the letters colored? Do you store precolored textures with all back/foreground combinations you'll need later in that hashtable?

thx for your answers!

elias4444

I just store each texture as a white-only RGBA. Then I color the quad when I draw it.

=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com