Skip to main content
gamedev.net
🔒 Locked

8-bit texture problem

Started by zul_i_malik 5 replies 600+ views
Original Post
zul_i_malik
zul_i_malik
Hi, i have been using DirectX for quite some time now and have recently started working on opengl. getting back to the problem, i have 8bit texture and i want to use in opengl. now, i load the data of the image using a 3rd party library and it loads it correctly (checked that!). the data is a bitmap with 8 bits per pixel for RGB. now when i try to generate the texture using glTexImage2D(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, info.Width, info.Height, 0, GL_RGB8, GL_UNSIGNED_BYTE, info.Data); it doesn''t load the texture. i have tried passing different parameters to and <format> parameters of glTexImage2D(...) but none has worked. i am in the middle of a major deadline, so can someone please help me out. and yes, the image width and height are multiple of 2. any help will be greatly appreciated!
Slash
MazyNoc
MazyNoc
glTexImage2D(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, info.Width,
info.Height, 0, GL_RGB, GL_UNSIGNED_BYTE, info.Data);

the second GL_RGB shouldnt have a size specifyer since the GL_UNSIGNED_BYTE is the specifyer for this.
zul_i_malik
zul_i_malik
not working. get a crash! need help desperately
Slash
Sneftel
Sneftel
what''s the crash? What does glError report? Do you really mean 8 bits per pixel, or 8 bits per channel? How many channels does it have? What are the dimensions?


"Sneftel is correct, if rather vulgar." --Flarelocke
zul_i_malik
zul_i_malik
glTexImage2D(...) crashes. glError reports "Invalid Enumerant". basically i am loading half life bsp file. the images in it are contained in WADs (WAD is a file format). i have a WAD loader that gives me raw image data. there are three channels (R, G and B) and the raw data i get has RGB values for each pixel in 8 bits (3 for R, 3 for G and 2 for B). glaux loads the image properly but it converts the data in 24 bits (inflates the data) and i don''t want that because if i were to keep 24 bpp data in memory i would just have 24bpp detailed image right? . neverthless, these are all the answers to ur question. if anyone else has a question then feel free to ask . if someone has already written an 8 bit texture loader (which does not contain pallete indices but actual RGB data in 8 bits) then please help me out. thanks again. its great to know such supporting ppl in the community.
Slash
GamerSg
GamerSg
What you probably have to do is, inflate it to R3G3B2 format(means not dependant on the indexed color format), then use a GL_R3G3B2 like enum(Check MSDN) and pass that in to glTexImage2D.

Edit: the constant is GL_R3_G3_B2

[edited by - GamerSg on April 2, 2004 6:52:12 AM]

[edited by - GamerSg on April 2, 2004 6:53:00 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.