Click here to Skip to main content
16,017,788 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C++ Template question Pin
Stuart Dootson6-May-09 23:49
professionalStuart Dootson6-May-09 23:49 
GeneralRe: C++ Template question Pin
rrrado7-May-09 0:42
rrrado7-May-09 0:42 
GeneralRe: C++ Template question Pin
Stuart Dootson7-May-09 0:46
professionalStuart Dootson7-May-09 0:46 
QuestionPlease help me!! it's urgent!! Pin
erenakman6-May-09 21:29
erenakman6-May-09 21:29 
AnswerRe: Please help me!! it's urgent!! Pin
Chandrasekharan P6-May-09 21:35
Chandrasekharan P6-May-09 21:35 
AnswerRe: Please help me!! it's urgent!! Pin
CPallini6-May-09 21:36
mveCPallini6-May-09 21:36 
AnswerRe: Please help me!! it's urgent!! Pin
_AnsHUMAN_ 6-May-09 21:44
_AnsHUMAN_ 6-May-09 21:44 
QuestionDirectX: "render to surface" or "render to device" (unmanaged) Pin
Pixinger776-May-09 21:01
Pixinger776-May-09 21:01 
Hi,
I googled around a lot and found basically two ways to render contents to a directX device.
The first way is to render directly to the device (that's what I call it Unsure | :~ ):

<br />
IDirect3DDevice9* pDevice; //for simplicity no initialization code here<br />
pDevice->Clear();<br />
pDevice->BeginScene();<br />
<br />
HRESULT hResult = pDevice->DrawPrimitiveUP( /* ... */ );<br />
<br />
pDevice->EndScene();<br />
pDevice->Present();<br />


The second way I found is to render first to a surface and then the complete surface at once to the device:
<br />
IDirect3DDevice9* pDevice; //for simplicity no initialization code here<br />
<br />
// now comes the new part of the code: I will first render to surface...<br />
CSurface* pBackBuffer; // created by D3DXCreateTexture() and GetSurfaceLevel();<br />
ID3DXRenderToSurface* pRenderTarget; // created by D3DXCreateRenderToSurface();<br />
pRenderTarget->BeginScene(pSurface, 0);<br />
pDevice->SetTexture(0); <br />
pDevice->DrawPrimitiveUP( /* ... */ );<br />
pRenderTarget->EndScene(D3DTEXF_NONE);<br />
<br />
// ... and then to the device: the whole surface at once.<br />
pDevice->Clear();<br />
pDevice->BeginScene();<br />
pDevice->SetTexture(pTexture);<br />
pDevice->DrawPrimitiveUP( /* ... */ ); //Rendering now the Texture to the device.<br />
pDevice->EndScene();<br />
pDevice->Present();<br />


---------------------

My question now is:
What benefits do I get from the second approach? Is it faster? For me it looks like I just put one more step in the row. Is there less flickering? Do I have more possibilities with the second approach?

My second question is:
I found a forum-thread where they told that it is no advised to render directly into a surface, because it would destroy performance. The thread applied to managed directx. Is this true? Does it apply to unmanaged DirectX also? Is it slower to render to surfaces?

Thanks in advance
Snowprog
AnswerRe: DirectX: "render to surface" or "render to device" (unmanaged) Pin
CPallini6-May-09 21:29
mveCPallini6-May-09 21:29 
AnswerRe: DirectX: "render to surface" or "render to device" (unmanaged) Pin
Stuart Dootson6-May-09 23:41
professionalStuart Dootson6-May-09 23:41 
Questionexception about 0x000006BA: RPC can not used (服务器不可用) Pin
fresh8888886-May-09 20:52
fresh8888886-May-09 20:52 
QuestionHow to realize the two aggressive color scale Pin
songhunhun6-May-09 20:47
songhunhun6-May-09 20:47 
AnswerRe: How to realize the two aggressive color scale Pin
KarstenK6-May-09 21:17
mveKarstenK6-May-09 21:17 
GeneralRe: How to realize the two aggressive color scale Pin
songhunhun6-May-09 22:18
songhunhun6-May-09 22:18 
QuestionRe: How to realize the two aggressive color scale Pin
CPallini6-May-09 21:27
mveCPallini6-May-09 21:27 
AnswerRe: How to realize the two aggressive color scale Pin
songhunhun6-May-09 22:15
songhunhun6-May-09 22:15 
AnswerRe: How to realize the two aggressive color scale Pin
Alan Balkany7-May-09 4:05
Alan Balkany7-May-09 4:05 
QuestionReg:scrolling views. Pin
coding_ram6-May-09 20:44
coding_ram6-May-09 20:44 
AnswerRe: Reg:scrolling views. Pin
Stuart Dootson6-May-09 23:37
professionalStuart Dootson6-May-09 23:37 
Questionerror C2143: syntax error : missing ',' before '*' Pin
subramanyeswari6-May-09 20:31
subramanyeswari6-May-09 20:31 
AnswerRe: error C2143: syntax error : missing ',' before '*' Pin
Stuart Dootson6-May-09 20:43
professionalStuart Dootson6-May-09 20:43 
GeneralRe: error C2143: syntax error : missing ',' before '*' Pin
subramanyeswari6-May-09 20:52
subramanyeswari6-May-09 20:52 
GeneralRe: error C2143: syntax error : missing ',' before '*' Pin
Stuart Dootson6-May-09 23:00
professionalStuart Dootson6-May-09 23:00 
AnswerRe: error C2143: syntax error : missing ',' before '*' Pin
KarstenK6-May-09 21:21
mveKarstenK6-May-09 21:21 
AnswerRe: error C2143: syntax error : missing ',' before '*' Pin
Member 802752223-Jun-11 5:04
Member 802752223-Jun-11 5:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.