   Loading S3 compressed textures from memory (DXT1- DXT5)
  HiIn the OpenGL side of my engine i load in bianry blocks containing S3 Compressed textures in the folloding way:    glCompressedTexImage2D(GL_TEXTURE_2D, currentMipMapLevel, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, width, height, 0, compressedWidth * compressedHeight * 8, data);on the directx side for non-compressed textures i do this:d3DDevice->CreateTexture(width,height,numLevels,usage,format,D3DPOOL_MANAGED,currentTextureReference,NULL)(*currentTextureReference)->LockRect(0U,&rect,0, 0)));  switch(format) {case(D3DFMT_A8R8G8B8):case(D3DFMT_A8B8G8R8):case(D3DFMT_R8G8B8):{// Change the pointer received from LockRect into a 32bit pointerDWORD* pData=(DWORD*)(rect.pBits);Uint pixelIndex(0U);if(width >= height) {for(int x=0; x < width; ++x) {for(int y=0; y < height; ++y) {// Get Pixel dataByte red(*(data + pixelIndex));Byte green(*(data + pixelIndex + (sizeof(cyan::Byte))));Byte blue(*(data + pixelIndex + (sizeof(cyan::Byte)*2U)));if(D3DFMT_R8G8B8 == format) { // 24 bit texturespData[(((rect.Pitch/bytesPerPixel) * (y)) + x)] = D3DCOLOR_XRGB(red,green,blue);}else{ // 32 bit texturescyan::Byte alpha(*(data + pixelIndex + (sizeof(cyan::Byte)*3U)));pData[(((rect.Pitch/bytesPerPixel) * (y)) + x)] = D3DCOLOR_ARGB(alpha,red,green,blue);}pixelIndex += bytesPerPixel;}}}....(*currentTextureReference)->UnlockRect(0U)This loads uncompressed textures from binary but i have to manually fill each pixel of the texture to avoid problems with pitch. What would be the equivalent for loading dxt1-5 compressed textures? i know that each dxt format has a  pitch so cant do a memcpy directly from the binary into the texture. Does anyone know how i can load dxt1=5 textures in from memory?thanks.[Edited by - treeway on September 2, 2010 3:38:23 AM]
  D3D is capable of loading DXT texture data directly without needing to decode the format, so just use D3DXCreateTextureFromFileInMemory (or D3DXCreateTextureFromFileInMemoryEx) or memcpy the full thing into your locked rect.   ;  fantastic, this is the answer I was looking for.   ;  Glad to help. :)   