When I start my 3D engine and load scene etc., I output text on the Window to show progres.

- scene file loaded
- d3d device initialized
etc.

Before I enabled the debug version of D3D (instead of retail) version, everything worked fine. Now in debug, I get notes about 'present' cannot we between beginscene and endscene. I've read that this might have to do that my graphic card supports it (retail mode) but some others might not.
I figured, let's solve it so it works always.

Can anyone give me some pointers on what I might be doing wrong?
(by the way, my print function counts the line number in the object, goes one up after each call)

You don't have to (or better said - you shouldn't) call BeginScene, EndScene and Present for every single draw call, but only once per render target. If you render only to the default backbuffer, you just call BeginScene at the beginning, then do all drawing (including text), then at the end call EndScene followed by Present.

Hi, thanks for the reply.
I'll try that, but I wonder if it will solve my problem, because what I'm trying to do is give a progress update on things being loaded, meaning I want to 'present'/draw each line as soon as a stap has finished. In your example/ reply I believe all text is rendered in the end, when I exectute 'present'? (or am I overseeing something).

As suggested, you should only call Present once per frame. I don't believe you will need to have "load progress" updates faster than once per frame, but if you do, I suggest piping them to OutputDebugStream, a log file or a special console window instead of to the screen.

In your example/ reply I believe all text is rendered in the end, when I exectute 'present'? (or am I overseeing something).

Yes, that's correct, when you call present, the content of backbuffer is swapped with frontbuffer and thus displayed on the screen.

The code you posted is executed in your main loop (every frame) or is it just "linear" code, something like:- print something on the screen- do something- add some other text on the screen- do something- add some other text on the screen- end

If the later, then I'm afraid it won't be so easy. In DirectX you normally do your drawing every frame (for example 60 times per second), even if nothing changed on the screen. If you want to display some text, like a console (dos window), you could add the text to some buffer (for example std::vector<string> where each entry is one line or one message) whenever you want to add a new line on the screen, and display this whole vector every frame.

What I'm trying to do here is 'one time' execution, not for each frame.
The order is:
1. initialize direct3d
=> print a line of text in window/ fullscreen with LPD3DXFONT
(including making it visible)
2. initialize directinput
=> print a line of text in window/ fullscreen with LPD3DXFONT
(including making it visible)
3. load scene file
etc. etc.

So it's not something which I do for each frame (it's the initialisation phase, before rendering the scene frame by frame). With frame by frame rendering, I have no issues with printing text in each frame.

With the reactions I now think I would have two options.
One being:
1. clear buffers, begin scene, print text, end scene, present
2. don't clear buffers, begin scene, print text, end scene, present
3. etc..
that way I keep the 'normal frame rendering' in place, without clearing the frontbuffer.

If you don't render your scene each frame, you'll have problems everytime the window or its part needs to be redrawn. That means for example:- in windowed mode when you move the window partly behind the edge of the screen- in windowed mode when another window is displayed over your application window- in windowed mode when you minimize the window- in fullscreen mode when you alt-tab away

In this cases the part of the window (or the whole window) will be white until you swap buffers by calling present again.Normally you call present frequently so you don't notice it, or you call present also as a reaction to the WM_PAINT windows message which tells you that the window needs to be redrawn. Neither is possible in your case.

2 - print text to frontbuffer directly

I don't think you can do this in DirectX, but I never even thought about it so who knows

Thanks.
I think I'll go for a simple 'buffer'/ string array then, during the initialization process.
Just draw the new succeeded step in loading, including the earlier ones, and then render all lines at once
(and delete the array after last progress update).