direct3d - Why the texture blurred ? I need it keeps the same resolution of the source image -


the source image 1920x1200 px.

here render function:

void render() {     // clear backbuffer , zbuffer     g_pd3ddevice->clear( 0, null, d3dclear_target | d3dclear_zbuffer,                      d3dcolor_xrgb( 0, 0, 255 ), 1.0f, 0 );      // begin scene     if( succeeded( g_pd3ddevice->beginscene() ) )     {          g_pd3ddevice->setsamplerstate(0, d3dsamp_addressu, d3dtaddress_border);         g_pd3ddevice->setsamplerstate(0, d3dsamp_addressv, d3dtaddress_border);         g_pd3ddevice->setsamplerstate(0, d3dsamp_bordercolor, 0x000000ff);         g_pd3ddevice->settexture( 0, g_ptexture );          // render vertex buffer contents         g_pd3ddevice->setstreamsource( 0, g_pvb, 0, sizeof( customvertex ) );         g_pd3ddevice->setfvf( d3dfvf_customvertex );         g_pd3ddevice->drawprimitive( d3dpt_trianglelist, 0, 2);//2 * 50 - 2 );          // end scene         g_pd3ddevice->endscene();     }      // present backbuffer contents display     // show in 2 window     g_pd3ddevice->present( null, null, null, null );     hwnd hwnd = windowfromdc(g_hdc);     rect rc; rc.bottom = 600, rc.left = 100, rc.right = 600, rc.top = 100;     //rect rc; rc.bottom = in->height, rc.left = 0, rc.right = in->width, rc.top = 0;     g_pd3ddevice->present( null, &rc, hwnd, null ); } 

what seen shows in here: http://uploads.gamedev.net/monthly_08_2014/post-222996-0-85945200-1408348655.jpg

why image program displays blurred? how set texture better. source image 1920x1200 px !

maybe backbuffer isn't being resized when resize window?

where handle windows messages resizing window, make sure change d3d properties' settings height , width new ones, , reset device.

in old directx program of mine, msgproc function handles windows messages, using md3dpp d3d properties,

 case wm_size:     if( gd3ddevice )     {     mbtimereset = true;     md3dpp.backbufferwidth = loword(lparam);     md3dpp.backbufferheight = hiword(lparam); 

and when user done resizing, should send wm_exitsizemove message. then, reset device (my device called gd3ddevice)

    gd3ddevice->reset(&md3dpp); 

haven't done graphics programming in years, , dx9, might wrong/rusty.

hope helps though :)


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -