PDA

View Full Version : glCompressedTexSubImage2DARB - non power of two?



cru
06-16-2005, 07:12 AM
Moderators, I yanked the me previous thread on the same subject because the system wouldn't let me reply. Kept saying my account was unregistered.

Can anyone point me to an example of how to load a non power of two compressed texture (DDS in my case) using glCompressedTexImage2DARB and glCompressedTexSubImage2DARB?

My code is as follows:


glCompressedTexImage2DARB(GL_TEXTURE_2D,
0,
format,
pow2width,
pow2height,
0,
0,
NULL);

glCompressedTexSubImage2DARB(GL_TEXTURE_2D,
0,
0,
0,
width,
height,
format,
size,
pixels);
I'm trying to mimic a method I use to load uncompressed non-power of two textures like so:

</font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">void loadTexture( void )
{
//lena.bmp is a 257x255 image
TextureObject *pObject = loadtexture( "C:\\lena.bmp" );

if(!pObject)
return;

glGenTextures( 1, &g_textureID );

glBindTexture( GL_TEXTURE_2D, g_textureID );

glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR );

if(!IsPowerOfTwo(pObject->width)

cru
06-16-2005, 07:15 AM
mods, please delete this thread

For some reason when I post it is saying my account is 'unregistered' and is also mangling the code section of my post.

I'll try to post the topic again later.