Binding 16Bit textures?

Member
Posts: 110
Joined: 2002.04
Post: #1
Binding 16Bit tesxtures?

Basically how to do I load a texture in... 16 bits and or compressed formates etc to the video card using AGL.

Right now I have RGBA formate textures working just fine..

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Member
Posts: 177
Joined: 2002.08
Post: #2
Change the internalFormat parameter of glTexImage2D to cause OpenGL to store the texture differently.

However, hardware texture compression is a whole other ball of wax and has to be enabled manually as an extension, AFAIK.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #3
Internal formats...

16bit = GL_RGB5 / GL_RGB5_A1 (or GL_RGBA4)
24/32bit = GL_RGB8 / GL_RGBA8
Compressed = GL_COMPRESSED_RGB / GL_COMPRESSED_RGBA

That's ARB compression - the hardware will use it's native compression, but this has nothing to do with the image format on disk, it's just compressed in memory, so load times may get longer. Texture swaps can be way faster with this simple compression enabled, but the image quality will suffer a bit.
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #4
tes

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #5
Quote:Originally posted by Frank C.
[b]Internal formats...

16bit = GL_RGB5 / GL_RGB5_A1 (or GL_RGBA4)
24/32bit = GL_RGB8 / GL_RGBA8
Compressed = GL_COMPRESSED_RGB / GL_COMPRESSED_RGBA

Second try to reply here... browsers keep giving me errors...

Ok there are what I am looking for...
Could not find directions on how to use them.

So now...

1. what is 24/32?

2. In RAVE I could do things like ... IIRC...

a. 16 bit RGB + 1 bit A
b. 16 bit RGB + 8 bit A

How can I do those formats if even possible?

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #6
Quote:1. what is 24/32?
24bit (8bits per channel, no alpha) or 32bit (8bits per channel, plus 8bit alpha)

Quote:2. In RAVE I could do things like ... IIRC...

a. 16 bit RGB + 1 bit A
b. 16 bit RGB + 8 bit A

How can I do those formats if even possible?
GL_RGB5 will give you 16bit RGB with no alpha (R5G5B5A0 not sure where that extra bit goes), GL_RGB5_A1 gives you 16bit RGB with 1bit alpha (R5G5B5A1), and GL_RGBA4 gives you 16bit with 4bit alpha, but the colour channels take a hit (R4G4B4A4). GL_RGB5_A1 usually looks better than GL_RGBA4, but it depends on the texture.

I don't think 16 bit RGB + 8 bit A is possible though (?)

Quote:Could not find directions on how to use them.
Here's a glTexImage2D breakdown...

[SOURCECODE]glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);[/SOURCECODE]
target: GL_TEXTURE_2D normally, 1D or 3D if ya get fancy.

level: mip map level (0 for full res mip)

internalformat: This is where the one of formats posted earlier would go.

width, height, border: texture dimensions and border size.

format: GL_RGB, or GL_RGBA - My GF3 seems to like GL_BGR(A)

type: usually GL_UNSIGNED_BYTE or one of apple's packed pixel types (eg. GL_UNSIGNED_INT_8_8_8_8_REV)

*pixels: pointer to your texture buffer
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #7
First off Thanx...

Second when you say...

My GF3 seems to like GL_BGR(A)

How do you know?

Did you read this?
Or does FPS go up?
etc...

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #8
The fastest settings on my GF3 seem to be GL_BGR(A) format with GL_COMPRESSED_RGB(A) internal format, and GL_UNSIGNED_BYTE type (packed pixels makes no difference). This is in a test project of mine swapping 3-5 big (1Kx1K) textures every frame. I haven't done any comparisons recently though...

Using the rectangle extension, with client storage and AGP hint is really fast on OSX, but there needs to be a separate path for other OS's or cards that don't support the rectangle extension - check Apple's developer site for the "OpenGLFastTexDemo"
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #9
Quote:Originally posted by Frank C.
The fastest settings on my GF3 seem to be GL_BGR(A) format with GL_COMPRESSED_RGB(A) internal format, and GL_UNSIGNED_BYTE type (packed pixels makes no difference). This is in a test project of mine swapping 3-5 big (1Kx1K) textures every frame. I haven't done any comparisons recently though...

Using the rectangle extension, with client storage and AGP hint is really fast on OSX, but there needs to be a separate path for other OS's or cards that don't support the rectangle extension - check Apple's developer site for the "OpenGLFastTexDemo"


Ok so far so good.
Got the 16bot modes working Smile
Got the client storage working.

Questions...

Hmm whats he AGP hint... not seeing in the apple ext docs etc.

And Oh yeah.. THANKs for all the help...
One day I promise this will ship... Smile

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
The 'AGP hint' is setting the texture's priority to zero. As of Mac OS X 10.1, and only on Mac OS X, the driver treats this as a hint that the texture should reside in AGP memory rather than in VRAM.
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #11
Quote:Originally posted by OneSadCookie
The 'AGP hint' is setting the texture's priority to zero. As of Mac OS X 10.1, and only on Mac OS X, the driver treats this as a hint that the texture should reside in AGP memory rather than in VRAM.


Ok now someone needs to tell me.

Whats the differences between AGP mem and Vram
since I have never heard of AGP mem before...

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #12
AGP memory is a section of the main memory of the computer which has been 'mapped' so that transfers from that memory to VRAM are particularly fast. This means it has all of the properties of main memory and many of the properties of VRAM Smile
Quote this message in a reply
Member
Posts: 110
Joined: 2002.04
Post: #13
Quote:Originally posted by OneSadCookie
AGP memory is a section of the main memory of the computer which has been 'mapped' so that transfers from that memory to VRAM are particularly fast. This means it has all of the properties of main memory and many of the properties of VRAM Smile


Any idea HOW much of it there is on any machine?

- Mac Lead ZeniMax Online Studios
- Owner Plaid World Studios
- Resume: http://www.chrisdillman.com
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #14
It's probably capped at the amount of the VRAM the card has, but I don't actually know.
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #15
GL allows to specify lots of formats, but you will get better performance by sticking to a few formats.

I use RGB and RGBA in my project.
Also may help to look at:

http://developer.apple.com/samplecode/Sa...exDemo.htm
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Binding multiple textures NitroPye 8 3,968 Apr 27, 2005 11:22 PM
Last Post: Fenris
  Problems Binding textures kodex 1 2,356 Apr 4, 2005 01:45 PM
Last Post: kodex
  Texture binding. LongJumper 2 2,248 Oct 19, 2003 08:59 PM
Last Post: LongJumper
  GL, 16bit, 32bit, ChrisD 6 3,426 Aug 2, 2002 09:53 PM
Last Post: OneSadCookie