Merging textures for faster rendering?

Started by
4 comments, last by mathieuxxxx 16 years, 8 months ago
I will explain my situation before asking for the solution.... I have to draw, in OpenGl, a large grid with a value showed at each point of the grid. The problem is my grid can have as much as 250 000 dots. So when I render 250 000 dots with, on each one a text value(Texture mapped font) my render time is very slow (6 seconds per render) I was wondering if it would be possible to merge all those font texture into a single big bitmap to make it a lot faster? Or if you have any kind of suggestions I'm willing to hear it. Thanks Mat
Advertisement
How are you rendering the whole thing at this point?
I assume all the dots are in a static VBO / DL and rendered using a single draw call? (that is, assuming your dots are statically placed)
How about the text? I hope it's not by using wgl.
Do you use different fonts?
If not why do you have separate textures?
Or do you mean the strings rendered to textures?

Anyway it should be possible to store several images in a single texture. The constraint should usually be the maximum texture size your system supports. [google]: texture atlas
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
The render is done with CallList. I have a list containing all the dots(GL_POINT) and a list containing all the strings;

About the strings: I have 128 textures representing each character of a font in a list. When I write a string I call each character needed in the character list.

I don't know anything about VBO/DL.. would it be better using it?

BTW I program in C# in case....
OpenGL: Store all characters in one texture, and use texture coordinates to shift between them - you should see a tremendous speed increase.

Are all 250K points in your viewport? If not, you could use some kind of hierarchical structure (i.e. tree) to quickly discard invisible points. If they all are visible, a display list would probably be the fastest way to render them - but 250K points are quite a lot, so don't expect great performance.

How quickly are you moving? If a lot of points stay at the same place for a significant length of time, consider using an imposter instead of actual points: a texture which contains an image of these points, updated less frequently than once per frame.

There are also some things to keep in mind since you are using C#: a) make sure you are not overloading the garbage collector by creating thousands of items every frame. b) If you are using Tao, download the latest Tao.OpenGl beta (clicky), you should see a 10x call speed increase when using some functions.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

Thank a lot Fiddler!

I think the imposter will do the job because the grid does'nt change once created

I'll try to google for it

Mat

This topic is closed to new replies.

Advertisement