two devices rendering the same scene

Win32 Programming

    Next

  • 1. settime
    Hi I'd like to know from which version on; d3d still used settime as major animation function? dx8? dx9b? dx9c summer 2003? etc Thanks
  • 2. Getting D3D9 code to work under Vista
    I just started porting our app that uses D3D9 to Windows Vista. Are there any "tricks" or issues (with UAC, etc.) to keep in mind to have this work? Basically, the code we have works fine to query the hardware caps and and create the initial D3D9 object, but after that everything that worked under XP seems to fail under Vista. For example the call below reports D3DERR_NOTAVAILABLE but in XP works file. (note: we are currently running "as administrator" under vista). m_pD3D->CheckDeviceMultiSampleType( D3DADAPTER_DEFAULT,3DDEVTYPE_HAL,D3DFMT_A8R8G8B8,TRUE, D3DMULTISAMPLE_NONMASKABLE,&dwQlevels); Also, when we try to create the device using if (FAILED(m_pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, 0,D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_FPU_PRESERVE, &m_d3dpp, &m_pD3DDevice))) return -1; It also always fails under Vista. Is there something simple I am missing? We are running under Windows Vista Business with the Aero Glass interface using native C++ dlls accessed from a .NET 2.0 front end app/gui. Any guidance is appreciated. Thanks. -David
  • 3. Optimizing X file with frame hierarchy
    I'm looking for the way to optimize x file with frame hierarchy. I was exported my 3d-map to DirectX X-File. and when I loading those map in my game client, it was quiet slow to play a game. So I optimize the map-mesh using OptimizeInplace function in DirectX API. it is quiet so fast better than non-optimized mesh. but there's a disadvantages to this solution. I'm using the map's frame hierarchy properties in my game client, such as frame(object) name or object's position, but I can't getting those kinds of data when I optimize map- mesh using "OptimizeInplace" function. OptimizeInplace function smashed all frames into one frame and deletes all frame hierarchy properties(object name, etc..). So, I want to know there is any way that I can optimize mesh pertaining frame hierarchy properties. Thanks in advance.
  • 4. DirectX dotnet version will run in Win95, Win98, WinNT,
    Hi, If i develop 3D Application using Visual C++ with DirectX 9 Dotnet version will run on Windows 95 , Windows 98, Windows NT? Pl. anyone give some suggestion. If i develop 3D Application using Visual C# with Managed DirectX Dotnet version will run on windows 95, Windows 98, Windows NT ? Pl. anyone give some suggesionl
  • 5. D3DXCreateTexture returns E_OUTOFMEMORY
    D3DXCreateTexture returns E_OUTOFMEMORY . I run my program. it consumes 700Mb system memory,when loading. I calculated this using windows task manager [ctrl+alt+del]. total system mem is 1 Gyga Bytes. so after loading my program, almost 1 GBytes used, and very few available memory. my program runs for a while. and D3DXCreateTexture returns E_OUTOFMEMORY. D3DXCreateTexture fails. so I retried using while( ) { // until D3DXCreateTexture returns ok .. Sleep(200); call .. D3DXCreateTexture } but .. it never returns ok. so I can't create texture anymore. of course, I just put another 1G memory card the problem will be solved (70% ? possibility) I want to know why D3DXCreateTexture fails often ? even when more memory can be allocated using virtual memory . that is .. page file swaping ..

two devices rendering the same scene

Postby Jakob Nielsen » Thu, 19 May 2005 03:54:34 GMT

I want to render the same scene with the same objects, as seen from two 
perspectives.
Since a device takes a window, it seems I mush have a device pr view (pr. 
window), but since vertexarrays are created relative to a devgice, does this 
mean that i must dumplicate my scene data? One copy for each device?

How can i have scene data which is common to the two devices? 



Re: two devices rendering the same scene

Postby Eyal Teler » Thu, 19 May 2005 06:52:36 GMT



The easy way is to use one window, and render into two different 
viewports on it.

	Eyal

Re: two devices rendering the same scene

Postby Jakob Nielsen » Thu, 19 May 2005 13:23:02 GMT

> The easy way is to use one window, and render into two different viewports 

That would be an idea. Didn't consider that.
What would be the not-easy way? 



Re: two devices rendering the same scene

Postby Wessam Bahnassi » Thu, 19 May 2005 14:32:51 GMT

Playing multi-monitor. And here, you too have an easy way and a hard way..
The easy way is to use multi-head capabilities :)

Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez








Re: two devices rendering the same scene

Postby Jakob Nielsen » Thu, 19 May 2005 15:13:56 GMT

> Playing multi-monitor. And here, you too have an easy way and a hard way..

Ok, so in reality the solution is to actually create two devices and 
duplicate the objects to both devices.
I have no great need for speed, so I guess it will work ok.
Was meerly wondering if I was overlooking some feature in dx which made it 
easy to have to views of the same scene. 



Re: two devices rendering the same scene

Postby Robert Dunlop [MS MVP] » Fri, 20 May 2005 01:34:55 GMT





Just to be sure, since you haven't explicitly stated such, are you going to 
be rendering the two views on separate monitors?  Otherwise there shouldn't 
be a need for two devices to render to separate windows on the same monitor.

To render multiple views to separate windows you can use 
IDirect3DDevice9::CreateAdditionalSwapChain to create additional back buffer 
chains attached to different windows.  To render each view you would get the 
back buffer from the swap chain, set it as the device's render target, 
render the scene, and call IDirect3DSwapChain9::Present() to present the 
scene to the associated window.

-- 
Robert Dunlop
The X-Zone
 http://www.**--****.com/ 
Microsoft DirectX MVP
-------------
The opinions expressed in this message are my own personal views and do not 
reflect the official views of the Microsoft Corporation.
The MVP program does not constitute employment or contractual obligation 
with Microsoft. 



Re: two devices rendering the same scene

Postby Jakob Nielsen » Fri, 20 May 2005 03:37:20 GMT

> Just to be sure, since you haven't explicitly stated such, are you going 

One monitor. As many modelling tools have four views: x,y,z and perspective.
Currently I only need two views.




Re: two devices rendering the same scene

Postby Wessam Bahnassi » Fri, 20 May 2005 14:17:12 GMT

Mutiple swap chains will be preferred here (as Robert said). You can also 
have one big window that you draw to its different parts by using 
SetViewport() to limit your output to different rects. But here, you need to 
render to all views before you can present the next frame, whilst in 
separate swap chains you can present wach one independently.

Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez








Re: two devices rendering the same scene

Postby Jakob Nielsen » Fri, 20 May 2005 16:48:23 GMT

> Mutiple swap chains will be preferred here (as Robert said). You can also 

I will look at swap chains. For now I will just go with the change of 
viewports. It will work for now.
Thanks for the help. 



Re: two devices rendering the same scene

Postby Callum Winter » Fri, 20 May 2005 20:47:48 GMT

You can render to a second window by putting the window handle in the
present call.
Just use 2 cameras, use one for the default device window and the other for
the other window so they can have different views.

You dont need another device, and another viewport is optional, depending on
the size of area you want to see in the other window.

pDevice->SetTransform(D3DTS_VIEW, &m_mCamera2);
pDevice->Clear(blah blah bla);
pDevice->BeginScene();
pStuff->Render();
pDevice->EndScene;
pDevice->Present(NULL, NULL, g_hWnd2, NULL);

Works for me anyway.
Callum.





also
need



Re: two devices rendering the same scene

Postby Jakob Nielsen » Fri, 20 May 2005 23:23:24 GMT

> You dont need another device, and another viewport is optional, depending 

That was easy. I simply didn't realize that the present method took a window 
handle to override the one given to the device.
That was really all I needed. One scene, one device, two cameras each with a 
window and viola!
Thanks a lot. Now I just wonder if I should consider starting lines with 
something other than "Tha" :-) 



Re: two devices rendering the same scene

Postby Wessam Bahnassi » Fri, 20 May 2005 23:30:33 GMT

This way, all windows should have the same client area size, otherwise 
StretchRect()s will be involved (unless you fix things up with 
SetViewport()).

Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez











Re: two devices rendering the same scene

Postby Jakob Nielsen » Sat, 21 May 2005 03:05:10 GMT

"Wessam Bahnassi" < XXXX@XXXXX.COM >

What do you mean by "StretchRect will be involved"? I use .net and threw in 
two pictureboxes and renderes to them. One was smaller and more elongated 
that the other, and both showed what was expected.
That is.. The one box with i had measured my aspect ration (in perspective) 
relative to, was perfect. The other had a faulty aspectratio, but that is 
something that the matrix stack will handle.

Is there a problem, I need to know about? 



Re: two devices rendering the same scene

Postby Jakob Nielsen » Sat, 21 May 2005 05:25:25 GMT

> What do you mean by "StretchRect will be involved"? I use .net and threw 

I think i know the problem now. It didn't turn up before, but now I tried 
creating a device with null as window handle. It should be valid for a 
windowed device, but it will not allow it(?), so i created a dummy panel to 
pass to it. The first panel had a tiny size, and when i later presented the 
graphics to another window, which was larger, it was abvious that the 
rendering had been done in low resolution and it was not stretched to fit 
the larger window. That is what you ment, I guess.

Why can i not pass null to the createDevice? 



Re: two devices rendering the same scene

Postby Wessam Bahnassi » Sat, 21 May 2005 15:06:02 GMT

You should be able to pass a null HWND for CreateDevice, but then, you're 
forced to pass the HWND each time at present.
You can get rid of the stretching by adjust your viewport dimensions prior 
to rendering to that window.

Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez








Similar Threads:

1.Two Mice In a OpenGL scene

Hi,

I've plugged two USB mice (mouses) in my computer in order to have two 
INDEPENDENT data flows in my OpenGL context. I've seen that some guys have 
done that for a 2-players game where each player controls a mouse but they 
haven't said how they've made that.

Does anyone know how to do it?

Thanks, Rodrigo 


2.Two handed input device alternatives

Has anyone tried any of the new input devices that use a two handed
technique? Several are now found when searching Google for "two handed
input device".

Some are futuristic, expensive, simple, etc.

Having suffered CTS type symptoms from heavy mouse use myself, I
discovered that using both hands for sending point and click commands
with my own method has allowed me to continue working more comfortably.

3.Write graphics to two devices simultaneously?

Dear all,

Is there any way to print to an X11 window and simultaneously dump the
X11 output to a postscript file?

Of course, I could just copy paste the plot information for a new
device, but it would make the procedure annoyingly long. Is there a
command to take the contents of an X11 device and save it to the
postscript device, or a command to write to postscript at the same
time as X11?

Many thanks,

Stef

4.Dualhead device and render to texture

I am trying to do a render to texture on a dual head (adaptergroupdevice) 
device with no luck.
My code works fine for windowed mode and for a mode with only one full 
screen, butwhen I try it with two displays nothing happens when clearing the 
texture or rendering to it. I know this because I have tried initializing it 
with graphics and then using it. The initial graphics stay on the texture 
even though I call clear on it. If it is uninitialized then it is just 
black.

To simply clear the texture to red I do the folowing code.
I have tried setting rendertarget1 rather than 0 but that changes nothing.
I do get the surface of the texture and I do set it as rendertarget and then 
call clear on target, so I would expect it to work, but it just will not 
when I have two displays.



create the texture initially
textureColor = new Texture(device, width, height, 1, Usage.RenderTarget, 
Format.A8R8G8B8, Pool.Default);

renderTargetSurface = textureColor.GetSurfaceLevel(0);



then I try to clear it and do some rendering to it before using it elsewhere



using(Surface prevRenderTarget = device.GetRenderTarget(0))

{

device.SetRenderTarget(0, renderTargetSurface);

device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Red.ToArgb(), 1, 
0);

deviceAbstraction.Device.SetRenderTarget(0, prevRenderTarget);

}

5.R32F render target texture format and device->Clear()

Hello,
I have this problem:
I use R32F render target texture format for shadowmap, when i call
device->Clear() I need to sets all texture pixels R32F values to the max
float value (so everthing I don't rend is at max distance from light):
3.402823466e+38.
How can I do this?

Thank you and excuse me for my bad english.
Bye
Toni

6. Creating a device for non-rendering

7. Rendering a Texture Created on a different device

8. Stripes in my rendered scene



Return to Win32 Programming

 

Who is online

Users browsing this forum: No registered users and 6 guest