Sign in to follow this  
tonymontana

instant help required LPD3DXFONT

Recommended Posts

tonymontana    100
i have a problem.i am making a program in which texts (that are written by LPD3DXFONT ) are moving 5 pixels to right or left (24 frame per second what makes 120 pixel in a second). My Texts were flickering.I couldn't realize the reason of this first.Therefore i have tried the correct the correct codes:) without touching the matter.But at last i have realized that cause of the flickering is LPD3DXFONT->DrawText(..) function draws itself to the screen (primary buffer-monitor) it is not drawing texts to backbuffer.isn't it? So in my program Device->BeginScene().. //MyGui widgets->DrawYourself(..) ====>These are drawing themselves to backbuffer MyText->DrawYourself(..) ==> this gui draws its texture to backbuffer //but the text on it is written to frontbuffer so //flickering occurs because there is no double_bufferin Device->EndScene(); Device->Present() ; Now my question is İs there a way to force d3dxfont for drawing its texts on backbuffer or on any texture/surface.. Plz help PS : if you ask how did you realize d3dxfont->DrawTExt(..) draws itself to frontbuffer? i did this.. ( an idiot double buffering:) ) Device->BeginScene().. //START FİRST DRAWİNG //MyGui widgets->DrawYourself(..) ====>These are drawing themselves to backbuffer MyText->DrawYourself(..) ==> Device->EndScene(); Device->Present() ; static int cntr1=0; if(++cntr1==2) { cntr1=0; Device->BeginScene().. //START SECOND DRAWİNG Device->Clear( clear back buffer with black color ); Device->EndScene(); Device->Present() ; return 1 ; }; so in 2 frames first frame draws whole gui widgets.in second frame draws blank black screen ( in a second 12 times gui widgets, 12 times black screen is being drawn ) .But this cleans the text flickering .but causes whole screen to flicker:):) i did this to clear whole screen once with black after a text is written and it worked.. SO this is all about the idea.İs there a way to force d3dxfont for drawing its texts on backbuffer or on any texture/surface. Or am i completely wrong.LPD3DXFont->DrawText(...) draws itself on backbuffer. then what causes this flickering? thanks for your help & replys

Share this post


Link to post
Share on other sites
HopeDagger    970
I'm not entirely sure what you're asking. The font drawing routines do defaultly draw onto the backbuffer (or screen, if you have no backbuffer). I'm not sure if there is a way to make it draw onto another surface -- but it sounds like it's probably possible. (A good question for a more experienced DXer on here :P)

As for the flickering, are you sure you configured your backbuffer properly when you set up the D3D_PRESENTPARAMETERS? Specifically, the BackBufferWidth/Height, BackBufferFormat, and BackBufferCount. If there's no backbuffer, then yes, I'd imagine you'd get some serious flickering going on. :)

Share this post


Link to post
Share on other sites
tonymontana    100
i have one backbuffer.i have tried with 3 backbuffers also .nothing changed.i dont think lpd3dxfont is drawing it self to backbuffer because.if so there wont be
any flickering.MyWidget background is not flickering ...my widget texts' are flickering..
i meant in my first post that to change flickering in one drawing i drawed the whole widgets.in second drawing i drawed black blank screen .So i assured that there will be a blank screen drawn after the gui texts and gui backbuffer is drawn.Of course this caused whole screen to flicker (because our eyse can determine in second turn program draws only blank screen).But with that i also assured that there will be a cleaning after the text is drawn (a lazy double buffering..i used the front buffer as a backbuffer i mean .)that solved the problem about text.Because blank screen is drawn in second render after text is drawn in first render.
My question is still there ..i dont think that LPD3DXFONT is drawing itself to backbuffer ..it is drawing it self directly to the front buffer...and there must be a way to force it for drawing backbufer...

if anyone wants i can send you the .exe to understand what i've tried to say.
(send me your emails serdarosman@gmail.com )

Share this post


Link to post
Share on other sites
DrunkenHyena    805
All rendering is done to the current render target, which is typically the back buffer. You cannot set the front buffer as a render target, so D3DXFont is not rendering to the front buffer.

Try downloading this d3dx demo:
http://www.drunkenhyena.com/cgi-bin/view_cpp_article.pl?chapter=3;article=17

Run the exe and see if you see the same flickering. If not, then you can look at the code to see what it does differently.

If that doesn't help you'll need to give us more detail to help you with your problem.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this