c++ - DirectX9 texture shows up distorted -


for reason on machines conditionally (d3dptexturecaps_nonpow2conditional) supports "non power of two" (nonpow2) textures i'm getting kind of image distortion:

enter image description here

(on machines supports nonpow2 textures works fine.)

this 1280x720 resolution rgb24 (d3dfmt_x8r8g8b8).

i know there 4 rules when dealing conditionally supported textures:

1.the texture addressing mode texture stage set d3dtaddress_clamp.

mpdevice->setsamplerstate(0, d3dsamp_addressu, d3dtaddress_clamp);

mpdevice->setsamplerstate(0, d3dsamp_addressv, d3dtaddress_clamp);

mpdevice->setsamplerstate(0, d3dsamp_addressw, d3dtaddress_clamp);

2.texture wrapping texture stage disabled (d3drs_wrap n set 0).

mpdevice->setrenderstate(d3drs_wrap0, 0);

3.mipmapping not in use (use magnification filter only).

mpdevice->setsamplerstate(0, d3dsamp_mipfilter, d3dtexf_none);

4.texture formats must not d3dfmt_dxt1 through d3dfmt_dxt5.

i'm using d3dfmt_x8r8g8b8...

texture created this:

mpdevice->createtexture(width, height, 1, d3dusage_dynamic, d3dfmt_x8r8g8b8, d3dpool_default, &ptexture, nullptr);

and updated this:

d3dlocked_rect lockedrect;  ptexture->lockrect(0, &lockedrect, nullptr, d3dlock_discard);  // const ippisize roisize = { width, height };  // ippicopy_8u_c3ac4r((ipp8u*) ppixels, width * 3, (ipp8u*) lockedrect.pbits, width * 4, roisize);  // rgb rgba // ippicopy_8u_ac4c3r((ipp8u*) ppixels, width * 4, (ipp8u*) lockedrect.pbits, width * 3, roisize);  // rgba rgb  // temp.       unsigned char* pdst = (unsigned char*) lockedrect.pbits; const unsigned char* psrc = ppixels;  (int k = 0; k < width; k++) {    (int j = 0; j < height; j++)    {       pdst[0] = psrc[0];       pdst[1] = psrc[1];       pdst[2] = psrc[2];       pdst[3] = 255;        pdst += 4;       psrc += 3;    } }  ptexture->unlockrect(0); 

does had similar problem? or have idea on going on?

maybe there's wrong rgb data itself?

thanks.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -