Skip to main content
gamedev.net
🔒 Locked

Drawing

Started by Newbie00 Mar 6, 2004 at 6:22 PM 2 replies 300+ views
Original Post
Newbie00
Newbie00
I am trying to draw a box on to the screen. It draws fine, but it flickers extremely fast. How would i stop it from flickering? [edited by - Newbie00 on March 6, 2004 7:43:03 PM]
brain21
brain21
Look-up "Double buffering" in the articles and resource. You can also use the vsync to stop the flickering, but I like double buffering better. basically, you draw to an off-screen bitmap and then copy this bitmap to the screen. You didn''t include your os/language/api so I can''t give you an example. Just check the articles on this site or google it.

Denny.
Newbie00
Newbie00
I am using C++. Here is the code I am using

f_pDirect3DDevice->BeginScene();
DrawBox();
f_pDirect3DDevice->EndScene();

f_pDirect3DDevice->Present(NULL, NULL, NULL, NULL);

Here is the DrawBox Function.

void DrawBox()
{
f_pDirect3DDevice->SetVertexShader(D3DFVF_PANELVERTEX);
f_pDirect3DDevice->SetStreamSource(0, g_pVertices, sizeof(PANELVERTEX));
f_pDirect3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);

}


The box draws fine, but it flickers. Any ideas?

[edited by - Newbie00 on March 6, 2004 9:10:25 PM]
CProgrammer
CProgrammer
Did you forget: f_pDirect3DDevice->Clear(...);

Or are you using MFC, if so you must tell MFC not to erase the background.
If its none of this, gives us more information.
-CProgrammer

Topic Locked

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

Sign in to reply to this topic.