Skip to main content
GameDev.net gamedev.net
🔒 Locked

blinking triangle in D3DIM :(

Started by Xeno Sep 2, 2000 at 6:58 AM 15 replies 950+ views
Original Post
Xeno
Xeno
hi! i just started my new game project , and for the start i just initialized ddraw & d3dim and tried to render a rectangle with texture on him to see if everything goes well, and for my supraise it (the rectange) started to blink with the background color , its so strange it never happened to me , u can see how it looks like: its just 32KB Download it (if u cant download it with getright or program liek that download it with your own browser , in IE: right click and "save target as...") umm... can u think on the problem? what am i doing wrong? "Everything you know is wrong" - Bono Edited by - xeno on 9/2/00 7:07:10 AM Edited by - xeno on 9/2/00 8:28:37 AM
------------------------------- Goblineye Entertainment------------------------------
Xeno
Xeno
anyone?
------------------------------- Goblineye Entertainment------------------------------
Quantum
Quantum
Forbidden
Host: [myip] myhostname
You do not have permission to access http://vsoft.20m.com/test.zip
Data files must be stored on the same site they are linked from.

Thank you for using 20m Free Web Space™


Xeno
Xeno
ok , now try to download it again , please!

download it with your own browser:
with IE: right click - and then "save target as..."

thanks a lot!
------------------------------- Goblineye Entertainment------------------------------
MatsG
MatsG
Forgot the D3Ddevice->BeginScene(); and D3Ddevice->EndScene()?
Xeno
Xeno
no i didnt
how could i render this without it?
------------------------------- Goblineye Entertainment------------------------------
MatsG
MatsG
Usally blinks alot when you forgot that, done that several times =) Post your render loop
Xeno
Xeno
this is my render function:

    
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(lp_device->BeginScene())
{
lp_device->DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_TLVERTEX,vrtx,num_of_vrtx,0);
lp_device->SetTexture(0,NULL);
lp_device->EndScene();
}
}




------------------------------- Goblineye Entertainment------------------------------
X-Man
X-Man
Back buf not updated for each flip?
Xeno
Xeno
sure it does , im doing flipping in the UpdateFrame() procedure
------------------------------- Goblineye Entertainment------------------------------
Xeno
Xeno
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...
------------------------------- Goblineye Entertainment------------------------------
Xeno
Xeno
anyone have more idea?
------------------------------- Goblineye Entertainment------------------------------
Xeno
Xeno
i have no Z-Buffer
thanks anyway
------------------------------- Goblineye Entertainment------------------------------
Facehat
Facehat
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
Xeno
Xeno
    
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
------------------------------- Goblineye Entertainment------------------------------
Xeno
Xeno
nevermind guys , tornado helped me and its working great , thanks anyway
the problem was because i create my primary surface as the render target instead of the back buffer (ops )

Edited by - xeno on September 2, 2000 12:48:34 PM
------------------------------- Goblineye Entertainment------------------------------

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.