View Full Version : which method is best for drawing panels?
I need to draw lots of text (each char a textured quad with alpha channel) and "panels" all 2D which is the fastest method in opengl? im using glortho for the projection thats ok but when I have about 100 characters ( a small phrase ) and some other textured quads (all with alpha channel) things gets very slow in no time and if I put more stuff the slower I have a 3ghz processor and geforce of the family 7 its not that bad but I play games at their max frame rate always but this thing im working on is very slow
i dont load anything while in the rendering loop so thats discarded
any special methods for rendering stuff like this in opengl? I really need help thanks
imagine that if here it runs slow what could happen on a 1ghz pc.. you see what I mean
sorry to bother again but I cant find anywhere how to render something top-most (on top of everything else) I believe this is possible but .. Dont know how.
09-07-2005, 12:33 AM
To make sure something is drawn over the current framebuffer content, simply disable depth testing.
Concerning your performance problem i don't have enough information, so i will just write down a few thoughts/suggestions:
Make sure you have one texture for the complete font, not one texture per character.
Draw the complete string in a single glBegin/glEnd pair
Disable unnecessary states (normalization, lighting, fog, depth test/write, etc)
Use GL_ALPHA_TEST (glAlphaFunc) to early discard transparent fragments
Don't use blending if you don't need it
I need quality for the fonts so each char is 128x128 I couldnt get arsed to put 5 chars or 10 in a big texture and so on as I didnt find a slow down on that part (I comment down the font loading and dont even call the routines that has something to do with the font system and the frames per second is the same as before) - the blending is not causing much slow down what it is, is having all this stuff close to the ortho..
oh and this is not for a game
09-07-2005, 04:56 AM
I comment down the font loading and dont even call the routines that has something to do with the font system and the frames per second is the same as beforeBut in your first post you said, that the framerate drops when you draw more than 100 characters. So what exactly did you remove for this test?
Try rendering the same character 100 times without changing/re-binding the texture, inside a single glBegin/glEnd pair, and compare the performance to your current implementation.
oh im using glNewList() - glEndList()
by the way
I did what you suggested same FPS
09-08-2005, 12:00 AM
What are you using the display lists for? Where are you doing the glNewList? Perhaps you could post the relevant parts of your code.
per each character I define texture and make a quad then make the list..
this is done after loading every image I have to load for the font system.
I dont define lists in the loop.
FYI: this question has come up about a zillion times or so in this and the advanced forums. I think probably everything there is to be said on the subject had been said already. Try a search if you don't believe me (you may be suprised by some of the ideas). But I'll just echo Memfrob's suggestion of the textured quad. It's a tried a true technique for most any occasion. Remember that all glyph images should be in the same texture (atlas) to avoid repetitive bindings.
Best of luck,
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.