PDA

View Full Version : 16 bit bitmaps as texutres



09-03-2004, 04:34 AM
iz it possible and what parameters should I pass to gluBuild2dMipmaps? Thanks.

09-03-2004, 07:36 PM
gluBuild2dMipmaps doesnt accept the 16 bit pixel format tokens. read the spec on it:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glufnc01_406r.asp

you could use one of the compressed formats (some of which are 16 bit)
http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt

in conjunction with auto-mipmap generation
http://oss.sgi.com/projects/ogl-sample/registry/SGIS/generate_mipmap.txt

otherwise, just convert your image data to one of the accepted pixel formats (pretty darn easy, but a slight pain in the butt):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glufnc01_406r.asp

09-07-2004, 12:23 AM
10x for answering me. Could you give an example of using compressed textures. I searched the net for tutorials or demos but I couldn't find. If you have any links or sample sources I would beg you for posting them.

-NiCo-
09-07-2004, 01:36 AM
http://developer.nvidia.com/object/OpenGL_S3TC_tutorial.html

09-07-2004, 04:58 AM
Thanks Nico I checked the link and it really works but is it linux portable? GCC gives DDSURFACEDESC2 undeclared. I know that the problem comes from the fact that I don't have direct X under linux. Any suggestions or .DDS format is windows specific?

-NiCo-
09-07-2004, 07:10 AM
Read this documentation

http://developer.nvidia.com/object/texture_compression_OpenGL.html

They use a utility from the directx sdk to compress cube maps with mipmaps into a single dds file. You can most likely write your own function in linux for that.

Nico

09-07-2004, 01:54 PM
unfortunately, this isnt a trivial task, nor is it a joyous one.

heres another demo that loads a dds (skip down a bit in the list):
http://www.codesampler.com/oglsrc.htm

i havnt tried it, but it looks ok. the only caveat is the need to include ddraw.h for the DDSURFACEDESC2 definition. you can try to create this structure yourself from the docs (MSDN):
http://msdn.microsoft.com/library/default.asp?url=/nhp/default.asp?contentid=28000410

or, just download the monster sdk (~230 megs):
http://www.microsoft.com/downloads/detai...&displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=fd044a42-9912-42a3-9a9e-d857199f888e&languageid=f49e8428-7071-4979-8a67-3cffcb0c2524&displaylang=en)

this took me 14 hours with my "tin cans connected by a string" connection.

09-07-2004, 02:15 PM
rats, heres the link to the structures (*sigh*):
http://www.microsoft.com/downloads/detai...&displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=fd044a42-9912-42a3-9a9e-d857199f888e&languageid=f49e8428-7071-4979-8a67-3cffcb0c2524&displaylang=en)

09-07-2004, 02:19 PM
well, on the other hand, there's the link to the structures:
http://msdn.microsoft.com/library/en-us/....asp?frame=true (http://msdn.microsoft.com/library/en-us/graphics/hh/graphics/ddstrcts_0189032a-8282-4ea7-b87d-90476b6f328d.xml.asp?frame=true)

(head is extra boney today)

09-09-2004, 04:16 AM
Unfortunately questioning continues... :( All went very well till the moment I found that DRI drivers for Ati Radeon Mobility 7500 from dri.sf.net does not support the S3TC extension, nor any other TC extension. In fact how many TC extensions are there? I know only for the S3 and FX extensions.

Why RLE compressed TGAs aren't supported for real time decoding? I might be wrong but from what I have read and what I have seen, makes me think that it is true. I have never read somebody saying it is not possible but all TGA loaders I've found in the net first decompress and then pass image data to the GL functions.As a final approach I am thinking about adding the S3TC extension to the ICD but for doing it right I need some open source video driver which supports it(I know that's not an easy task but go prove I'm not wrong to the project manager...). Thanks once again.