when i replace this line:
if(lp_device->BeginScene())
with this:
if(SECCEEDED(lp_device->BeginScene()))
it almost not blinking , but still there is some blinking in some parts of the image , dunno why...
blinking triangle in D3DIM :(
If you have z-buffering enabled, then you are not clearing the z-buffer...
instead of
That clears your render target AND the z-buffer, setting all z-buffer values to 1.0 (farthest from the viewer).
instead of
lp_device->Clear(0,NULL,D3DCLEAR_TARGET,RGB_MAKE(128,128,128),0.0f,0);[/source]try[source]lp_device->Clear(0,NULL,D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, RGB_MAKE(128,128,128),1.0f,0);
That clears your render target AND the z-buffer, setting all z-buffer values to 1.0 (farthest from the viewer).
I''m almost certain it has to do with how you''re updating the screen. It looks like you are only drawing it every other frame. Could you post your screen update code?
----------------------------------------
"Before criticizing someone, walk a mile in their shoes.
Then, when you do criticize them, you will be a mile away and have their shoes." -- Deep Thoughts
"If you have any trouble sounding condescending, find a Unix user to show you how it's done." - Scott Adams
----------------------------------------
"Before criticizing someone, walk a mile in their shoes.
Then, when you do criticize them, you will be a mile away and have their shoes." -- Deep Thoughts
"If you have any trouble sounding condescending, find a Unix user to show you how it's done." - Scott Adams
void Render(D3DTLVERTEX *vrtx,int num_of_vrtx){ lp_device->Clear(0,NULL,D3DCLEAR_TARGET,RGB_MAKE(128,128,128),0.0f,0); lp_device->SetTexture(0,lp_tex); if(SUCCEEDED(lp_device->BeginScene())) { lp_device->DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_TLVERTEX,vrtx,num_of_vrtx,0); lp_device->SetTexture(0,NULL); lp_device->EndScene(); }}void UpdateFrame(void){ HRESULT hRet; while(TRUE) { hRet = lp_primary->Flip(0,DDFLIP_WAIT); if(hRet == DD_OK) break; if(hRet == DDERR_SURFACELOST) { hRet = RestoreAll(); if(hRet != DD_OK) break; } if(hRet != DDERR_WASSTILLDRAWING) break; }}[/source][source] int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow){ MSG msg; HWND hWnd; WNDCLASS wc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.hCursor = LoadCursor(hInstance,IDC_ARROW); wc.hIcon = NULL; wc.hInstance = hInstance; wc.lpfnWndProc = (WNDPROC) WndProc; wc.lpszClassName = app_name; wc.lpszMenuName = app_name; wc.style = CS_VREDRAW | CS_HREDRAW; RegisterClass(&wc); hWnd = CreateWindowEx(NULL,app_name,app_title,WS_POPUP, 0,0,0,0,NULL,NULL,hInstance,NULL); if(!hWnd) return 0; ShowWindow(hWnd,nCmdShow); UpdateWindow(hWnd); SetFocus(hWnd); while(1) { if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE)) { if(!GetMessage(&msg,NULL,0,0)) return msg.wParam; TranslateMessage(&msg); DispatchMessage(&msg); } else if(ready) { d3d_vrtx[0] = D3DTLVERTEX(D3DVECTOR(0,0,0),1.0,RGBA_MAKE(255,255,255,0),0,0,0); d3d_vrtx[1] = D3DTLVERTEX(D3DVECTOR(256,0,0),1.0,RGBA_MAKE(255,255,255,0),0,1,0); d3d_vrtx[2] = D3DTLVERTEX(D3DVECTOR(0,128,0),1.0,RGBA_MAKE(255,255,255,0),0,0,1); d3d_vrtx[3] = D3DTLVERTEX(D3DVECTOR(256,128,0),1.0,RGBA_MAKE(255,255,255,0),0,1,1); Render(d3d_vrtx,4); UpdateFrame(); } else { WaitMessage(); } }}
thats how im updating the screen
Edited by - xeno on September 2, 2000 11:54:01 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement