Hold compressed textures in video memory that gives GPU to work fast with it...

Started by
4 comments, last by FXACE 13 years, 2 months ago
  

Hi, anybody!

I'm implementing a terrain editor. The terrain mesh consist of segments (sizes 50x50 of vertices). Each segment uses 1500x1500 rgb (diffuse, normal) texture. When I creating only 8-9 segments the (OS's) memory usage counter (in "task manager") shows over 800 MB. I think that's a large size for it. 

Here is my situation:

I have uncompressed textures to load it.

I need to load it to GL (must hold a compressed data).

It must be uncompressed when I saving a texture data to file... (I calling glGetTexImage for it)...

Any ideas? Is it posiible to do by "shortest" way?



Advertisement
A 1500x1500 RGB image will only take up about 6.5MB of memory, even when it's uncompressed, and mipmaps wouldn't add enough to that to get anywhere near the 800MB you mention. Check to make sure you're not reloading the textures (or the terrain segments) every frame.
http://www.opengl.org/sdk/docs/man/

you can give GL_COMPRESSED_RGBA to glTexImage2D but I have never used it.

http://www.opengl.org/registry/
I have used http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt
which uses precompressed Direct3D texture (DXT).
I dont know if glGetTexImage works on them.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

A 1500x1500 RGB image will only take up about 6.5MB of memory, even when it's uncompressed, and mipmaps wouldn't add enough to that to get anywhere near the 800MB you mention. Check to make sure you're not reloading the textures (or the terrain segments) every frame.


Oh... I did a mistake (1500x1500 -> 4000x4000)....






http://www.opengl.org/sdk/docs/man/

you can give GL_COMPRESSED_RGBA to glTexImage2D but I have never used it.

http://www.opengl.org/registry/
I have used http://www.opengl.or...ession_s3tc.txt
which  uses precompressed Direct3D texture (DXT).
I dont know if glGetTexImage works on them.

Any help can be useful)


Well once you upload to the gpu, delete them out of ram. If your painting on the images either height or splat data, then process that painting on the gpu. Only call back the images when you click Save and grab them from memory. If you glTexImage2d with GL_COMPRESSED or so (dont have my code here), then it will compress for you. You can then call it back later uncompressed.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

while my scene loading (with textures) ram jumps in range 60 - 280 MB.

when done loading ram stands by  35 MB.

So, I don't forget to free data from ram and I never load the data every frame... (every texture loads only once) 

This topic is closed to new replies.

Advertisement