[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OpenGL texturing
Francesco Orsenigo wrote:
The textures are about 50x50, but i have thousands, and i'd have to store
precalculated textures for about 16 different patterns: it may need some
How big are the textures you are using for this? Is there a pattern to the
changes? If so, could you precalculate a set of textures in main memory and
use glTexSubImage2D to update the texture in video memory?
Don't make each unit be a separate texture. You'll get MUCH better performance
if you can pack lots of little images into one larger texture and change the
texture coordinates on the unit to select which piece of the texture to use.
I've really no idea on the average size of a texture buffer, but i suppose
that it may fit....
Modern 3D cards have 64 to 128Megs of memory - depending on what graphics
modes you use (FSAA is expensive), you should have 50 to 100 megs free
for textures. Each texel is probably 2 bytes (if you use 16 bit textures -
which is probably OK). On most cards, you can use texture compression
to save a ton of space - but texture compression only works well on
large images (another reason to pack LOTS of those little 50x50 maps
into a single, larger texture).
Even if it doesn't fit, OpenGL automatically moves textures from main
memory into the graphics card if it doesn't have enough space. This
is relatively time consuming - but may not be unbearable in some applications.
Sorting your units so you draw all of them that use texture map A before
you switch to using texture map B - will make a MASSIVE difference to
performance if you do run out of texture space on the graphics card.
Are there run-time color transformations available for OpenGL (except
lightning or reflection...)
There are a lot of possibilities - too many to discuss in email.
Is there a way i could set an alpha value on my texture and then apply a
particular lightning/reflection effect, so that it is applyied only to that
patches with a convenient alpha?
Try the techniques I described in my last post.
---------------------------- Steve Baker -------------------------
HomeEmail: <firstname.lastname@example.org> WorkEmail: <email@example.com>
HomePage : http://www.sjbaker.org
Projects : http://plib.sf.net http://tuxaqfh.sf.net
-----BEGIN GEEK CODE BLOCK-----
GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++
-----END GEEK CODE BLOCK-----