[PyOpenGL-Users] Drawing a bitmap at "native" resolution
Brought to you by:
mcfletch
|
From: Christopher B. <Chr...@no...> - 2011-05-02 21:18:57
|
Hi folks, Anyone know of a performant way to draw a bitmap at its "native" resolution -- i.e. one pixel in the bitmap is one pixel on screen, regardless of zoom level, etc. I think I've heard this referred to as "billboard" view, but that may be a term specific to one visualization lib (VTK, maybe)? Anyway, the task at hand is using bitmaps fonts as textures to do simple text labels, lot of them, in a scientific visualization app. For each data point ( up to 100s of thousands ) we need a little text label. But we want the text to not change size as the user zooms in or out. Our current solution is something like this: Each label is a texture (actually, I think a piece of a big texture). When rendering, we calculate where the corners of the label should be in world coordinates, so that it scales to one pixel per pixel. This does produce the desired result. The problem with this is that with each draw call, those coordinates need to be re-calculated. This can be pretty slow, particularly in python. We've got numpy doing it now, but that requires some pretty big arrays of coordinates to be kept around, which take up memory, and is still a bit pokey. Is there any way to do this directly in OpenGL? Or, if not, it seems that we may be able to use a shader to do that coordinate calculation -- should that be doable? I have no idea where to even start with that. (this a 2D app, but I think the principle is the same either way) Any suggestions would be appreciated. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |