PDA

View Full Version : rectangle texture and paletted texture problem



ysatou
12-04-2002, 04:03 PM
Hello.

I have a question for rectangle texture and paletted texture.

I can draw 64x64 texture using EXT_paletted_texture and EXT_shared_texture_palette.

Then, I want to draw none-power-of-two-texutre.

When I use GL_TEXTURE_RECTANGLE_NV instead of GL_TEXTURE_2D and change tex-coord from [0,1] to [0,width(height)] , I can't draw any Texture.

Please teach me EXT_texture_rectangle support Paletted Texture , or not?




const int w = 64;
const int h = 64;

GLubyte TexImage[ w * h ];
GLubyte TexPalette[ 256 * 4 ];
GLuint TexID;

( Create Texture Data )
glGenTextures( 1 , &TexID );
glEnable( GL_TEXTURE_RECTANGLE_NV );
glBindTexture( GL_TEXTURE_RECTANGLE_NV , TexID );
glTexImage2D( GL_TEXTURE_RECTANGLE_NV , 0 , GL_COLOR_INDEX8_EXT , w , h , 0 , GL_COLOR_INDEX , GL_UNSIGNED_BYTE , TexImage );

( Create Palette Data )
glEnable( GL_SHARED_TEXTURE_PALETTE_EXT );
glEnable( GL_TEXTURE_RECTANGLE_NV );
glColorTableEXT( GL_SHARED_TEXTURE_PALETTE_EXT , GL_RGBA , 256 , GL_RGBA , GL_UNSIGNED_BYTE , TexPalette );

glEnable( GL_TEXTURE_RECTANGLE_NV );
glBindTexture( GL_TEXTURE_RECTANGLE_NV , TexID );
glBegin( GL_QUADS );
glTexCoord2f( 0,0 );
glVertex2f( -1,-1 );
glTexCoord2f( w,0 );
glVertex2f( 1,-1 );
glTexCoord2f( w,h );
glVertex2f( 1,1 );
glTexCoord2f( 0,h );
glVertex2f( -1,1 );
glEnd();

cass
12-04-2002, 04:30 PM
Does this code work if you're not using a paletted texture? Paletted non-pow2 textures should work fine.

Thanks -
Cass

bakery2k
12-05-2002, 09:46 AM
Sorry Cass, but:

Quote from NV_texture_rectangle specs:

Do paletted textures work with rectangular textures?

RESOLUTION: No. Similar (but not identical) functionality can
be accomplished using dependent texture shader operations (see
NV_texture_shader).
The difference between paletted texture accesses and dependent
texture accesses is that paletted texture lookups are
"pre-filtering" while dependent texture shader operations are
"post-filtering".



[This message has been edited by bakery2k (edited 12-05-2002).]

ysatou
12-05-2002, 03:00 PM
Thanks cass and bakery2k for the reply.

I use texture shader instead of using paletted texture.

cass
12-06-2002, 06:11 AM
I sit corrected. http://www.opengl.org/discussion_boards/ubb/smile.gif

Thanks, bakery2k.

Cass