Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

-Moxie-

Interrogating screen size

This topic is 5740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How can I get the screen height and width from a IDirect3DDevice pointer? Or is it something I need to get from the HWND that I use to create the device? How about textures attached to ID3DXSPRITEs? Is there a way to get their height and width after they are created? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Hey - I may not be understanding your first question, but can''t you use IDirect3DDevice8::GetViewport? This will fill a viewport structure with, among other things, the width and height of the render target surface.

As for your second question, can''t you call IDirect3DTexture8::GetLevelDesc? This should fill a D3DSURFACE_DESC structure with, among other things, the width and height, of the texture.

All of the above is in the sdk documentation, but maybe I''m misunderstanding your question, and you''re trying to do something more complex.

Good luck.

bmoberly

Share this post


Link to post
Share on other sites
Thanks for the response.

When I try to use GetViewport with the following code:


D3DVIEWPORT8 vp;
hr = m_pd3dDevice->GetViewport(&vp)



I get a status back for "Invalid Call" which the docs says "D3DERR_INVALIDCALL is returned if the pViewport parameter is invalid."

Is there something I need to do to initialize the structure?

Share this post


Link to post
Share on other sites
I don''t have the documentation with me, but my best guess would be to zero the structure, and possibly see if there is a ''size'' member.

Share this post


Link to post
Share on other sites
I don''t think I can use GetSystemMetrics because I''m using a framework that sets up D3d for me based on optimum screen size. So if the desktop size is different from the d3ddevice size, won''t that cause a problem?

I tried to zero it out. Both by setting all the members to 0 and also using ZeroMemory(&vp, sizeof(D3DVIEWPORT8)). There is no size member.

Share this post


Link to post
Share on other sites
Try this :

D3DDISPLAYMODE modeInfo;
m_pd3dDevice->GetDisplayMode( &modeInfo );


This should get you width, height, refresh rate & pixel format info.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!