View Full Version : texture compression
now ive 'mastered' texture compression tears ago but ive forgotten,
now for GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, why am i getting invalid operations for the following 2 calls (the spec aint much good since it doesnt talk about specific compression types)
the numbers are width height + size
weapons/railgun.dds 128 16 2048
weapons/railgun.dds 64 8 512
weapons/railgun.dds 32 4 128
weapons/railgun.dds 16 2 32 glError = invalid operation
weapons/railgun.dds 8 1 16 glError = invalid operation
weapons/railgun.dds 4 1 16
weapons/railgun.dds 2 1 16
weapons/railgun.dds 1 1 16
09-19-2006, 08:54 PM
Where are you getting your size parmeters from? DXT5 compresses in blocks 4x4 so in the 16x2 case it should be:
16/4 = 4
2/4 = 1
Now 4x4 by 4x1 blocks is = 64 bytes not 32.
saved me again i dont know what ild do without you sqrt(-1)
i was using the formula from ARB_texture_compression.pdf
ImageSize = blockSize * ceil(width / 4) * ceil(height / 4)
the problem was a beginner one of types ie
1 / 4 == 0 + not 1.0 / 4.0 = 0.25
ceil( 0 ) = 0 ceil( 0.25 ) = 1
btw theres a mistake at the end of the pdf
'Figure 5: On the left, an uncompressed 64x64 texture; on the right a compressed RGB_DXT1
128x128 sibling (Minification and magnification filter set to GL_LINEAR). One should notice that
those two textures take the same amount of memory, but the compressed version appears much
actually the compressed RGB_DXT1 will use 1/2 the memory
09-20-2006, 04:57 PM
Slightly offtopic, but why do you need to do the calculation of DXT5 yourself? I can't image any place where you would need to.
If you are uploading uncompressed data and letting the driver compress it (don't do this as the driver does bad compression) - you can get the size back from OpenGL when you get the compressed data.
If you do the compression yourself, you would have calculated the size when compressing the 4x4 blocks. (all the tools I have seen on the Nvidia site return the size)
09-20-2006, 05:03 PM
Originally posted by sqrt[-1]:
Slightly offtopic, but why do you need to do the calculation of DXT5 yourself? I can't image any place where you would need to.Compressing textures does take time, and you may want to generate your own mipmaps rather than leave it to the indeterminate quality of an unknown driver.
09-20-2006, 08:38 PM
Originally posted by Kyeotr:
Originally posted by sqrt[-1]:
Slightly offtopic, but why do you need to do the calculation of DXT5 yourself? I can't image any place where you would need to.Compressing textures does take time, and you may want to generate your own mipmaps rather than leave it to the indeterminate quality of an unknown driver. I was asking why he was doing the DXT5 size calculation himself.(I do also say that I don't recommend letting the driver do the compression)
the simple reason is cause im a masochist
im loading already compressed dds mipmapped textures, + as far as i can see only the whole images size is stored in the header as well as the highest quality width/height. thus all the smaller mipmaps u have to do the calculations yourself.
the funny thing is even though i was sending invalid mipmap level data to gl, the texture still got drawn. i thought all levels had to be conformant or else it would be invalid + u would get the opengl default texture.
ok solved that now solve this :) (true hair pulling out problem that im working at present, ive seen one like this before years ago)
if i delete the "float the_carrot" line then the app will crash (somewhere totally unrelated), if i move the carrot to the top it still works, if i rename the_carrot to the incredible shrinking man it still works, i can do everything but not remove it, + i want cause im not wanting carrots anymore in the options file. oh well i think im stuck with the carrot
09-23-2006, 07:42 PM
How can I create a pleasing negative stereo with OpenGL.
Now, I create a pleasing positive stereo,but for negative,objects of scene are not pop out the screen,why?
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.