I load a 24Bit bmp image with glTexImage2D and gluBuildmipmap2D withiot any problem.
But I want that my Image have less size with same resolution, then I save my image in 8Bit bmp format and my image have 1/3 size, I load it in memory but have problem in create texture from it.
I couldn’t use this with glu, and with gl I only use it with glTexImage2D(…,GL_R3_G3_B2,…,GL_RED…) and I only could see my image in red or green or blue color.
A 8-bit BMP image uses indexed color. What you are seeing right now (only red or green or blue) is probably the index. There is no support for indexed texture in OpenGL. Yes, the FAQ talks about GL_EXT_paletted_texture but it probably does not exist in 2009 (al least not on my nVidia Quadro FX 3600M)
Is the size of your image really an issue? Is this an issue for the RAM or the VRAM?
If you want to save memory on the VRAM, load your 24-bit image into a compressed texture format: GL_COMPRESSED_RGB. Just use glTexImage2D with format GL_COMPRESSED_RGB instead of GL_RGB. OpenGL will compress the image on the fly for you.
It actually has the benefit of rendering faster than non-compressed textures.
(don’t use glCompressedTexImage2D(), this function is made for images already compressed in RAM in a known format)
Thanks overlay,
My Image size is very large,9k*9k. I don’t want to resize my image.
I convert my bmp to dxt1 (.dds) and try to load it ddsviewr but it couldn’t open it and say that is larger from your texture memory.
My texMem is 4K.
I need a method that have better performance.
What’s your Suggestion?
Cf. make a surface of 9x9 patchs of 1024x1024 pixels is certainly more “hardware friendly” that the use of an big 9k*9k pixels image that the hardware can certainly not handle.
Or you can make your texture in realtime and only store the data in a definition that is “raisonnable” for to display it on the screen (I don’t think that you have a 9x*9k display screen …)
Yes I couldn’t load texture biger than 8K8k pixel.
I change my imageto 8K8k, but it is slow.
If i want to make 512*512 pixel block of image, do you think that it works better, assume that in runtime i should load some block and in any time i should have more than one block in memory.
Is there a good algorithm for load image block at run time?
Yes I couldn’t load texture biger than 8K8k pixel.
I change my imageto 8K8k, but it is slow.
If i want to make 512*512 pixel block of image, do you think that it works better, assume that in runtime i should load some block and in any time i should have more than one block in memory.
Is there a good algorithm for load image block at run time?
Yes I couldn’t load texture biger than 8K8k pixel.
I change my imageto 8K8k, but it is slow.
If i want to make 512*512 pixel block of image, do you think that it works better, assume that in runtime i should load some block and in any time i should have more than one block in memory.
Is there a good algorithm for load image block at run time?
You can divide your world into 512x512 blocs and only create 2 or 3 textures in real time that you map to the only 2 or 3 blocs that are visible on the display for example (you can compute what blocs are visible by a fustrum test by example).