Original Post
Happy new year!!! I'm just trying to display a texture on screen with StretchRect, but failed miserably in any attempt till now. some related code: .... I tried loading a dds file, but moved to a simpler 24 bits bmp done with paint. The image is 512x512, the correct size is received from FS_GetBinaryFile, but D3DLoadSurfaceFromFileInMemory always fail. What is wrong here ? :(
....
int len= FS_GetBinaryFile(filename, buf, buflen);
surfaceid=VIDTEXTURE_CreateSurface(size, cachetype);
LPDIRECT3DSURFACE9 surface=VIDTEX_GetSurface(surfaceid);
if(FAILED(D3DXLoadSurfaceFromFileInMemory(surface,
NULL, NULL, buf, len, NULL, D3DX_DEFAULT, 0, NULL))){
throw(ERR_VIDLOADSURFACE);
}
int VIDTEXTURE_CreateSurface(unsigned int size, int type){
...
get a pointer to a surface cache
...
if(FAILED(device->CreateOffScreenPlainSurface(size, size, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surfacecache[type][index], NULL)))
throw(ERR_VIDCREATESURFACE);
return index+type * CACHE_ROW_SIZE;
}