Jump to content

  • Log In with Google      Sign In   
  • Create Account


Getting a DXGI Surface from a Texture2D


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 cephalo   Members   -  Reputation: 528

Like
0Likes
Like

Posted 07 May 2014 - 01:30 PM

Ok, I am using SharpDX with DirectX 11.1. 

 

I need to draw some text onto some textures for use on some 3D objects, not every frame, just upon initialization. I currently have debugging text (FPS counter etc.) working in my app that obtains a dxgi surface from my swap chain like so:

            surface = swapChain.GetBackBuffer<dxgi.Surface>(0);
 

Now, to get a surface from a blank texture for text drawing, as far as I can tell I would do this:

            surface = texture.QueryInterface<dxgi.Surface>();
 

However, since Texture2Ds can have mip levels and even texture arrays this seems rather ambiguous. Does QueryInterface merely assume the top level mip and top index of the array? I don't even know if I'm on the right track here.

 



Sponsor:

#2 MJP   Moderators   -  Reputation: 10231

Like
1Likes
Like

Posted 07 May 2014 - 03:44 PM

Why are you using a DXGI surface? You shouldn't need to access DXGI interfaces just to draw onto a texture.



#3 Buckeye   Crossbones+   -  Reputation: 3799

Like
2Likes
Like

Posted 07 May 2014 - 04:00 PM


I currently have debugging text..

Are you talking about using GDI?

 


However, since Texture2Ds can have mip levels and even texture arrays this seems rather ambiguous. Does QueryInterface merely assume the top level mip and top index of the array?

 

Read the docs. They're your friend (sometimes).

 

If the 2D texture has only a single MIP-map level and does not consist of an array of textures, QueryInterface succeeds and returns a pointer to the IDXGISurface1 interface pointer. Otherwise, QueryInterface fails and does not return the pointer to IDXGISurface1.

Edited by Buckeye, 07 May 2014 - 07:12 PM.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.


#4 cephalo   Members   -  Reputation: 528

Like
0Likes
Like

Posted 08 May 2014 - 06:33 AM

Why are you using a DXGI surface? You shouldn't need to access DXGI interfaces just to draw onto a texture.

 

Oh, I forgot to say that I am using DirectWrite.

 

 


I currently have debugging text..

Are you talking about using GDI?

 

 

 


However, since Texture2Ds can have mip levels and even texture arrays this seems rather ambiguous. Does QueryInterface merely assume the top level mip and top index of the array?

 

Read the docs. They're your friend (sometimes).

 

If the 2D texture has only a single MIP-map level and does not consist of an array of textures, QueryInterface succeeds and returns a pointer to the IDXGISurface1 interface pointer. Otherwise, QueryInterface fails and does not return the pointer to IDXGISurface1.

 

 

Thanks Buckeye! For my debugging text, I am using DirectWrite directly on the back buffer, for which there is a handy surface getting function. Wow, the docs had my answer! That's never happened to me... tongue.png






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS