• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
BlackJoker

Help me to make work D2D with D3D11

17 posts in this topic

Hello to all!

 

I have a problem with connecting D2D to D3D11. I read a lot of forum articles on that theme, but this interop a little bit hard to understand and more harder to use on practice. I tried to implement it as was saying in this article http://www.braynzarsoft.net/index.php?p=D3D11FONT#still but problem in that in the sample all the code is in 1 file and there is no OOP at all, and I make my engine from the rasterteck framework. 

I think during implementation of interop D2D and D3D11 I missed something, but I can`t find the problem because program work without errors, but just no text on the screen.

 

I uploaded my project here, so if you wish to help me, you can look into code and say where i have a mistake because I am completely confused with this problem.

 

P.S. I chose to implement D2D + D3D11 because the way to cut texture into pieces seems no so good way to make text output for me, besides it hard to make localization in that way.

 

Please, help me.

0

Share this post


Link to post
Share on other sites
Your LightShader::RenderText method doesn't appear to draw the contents of the shared texture to screen. It looks like it sets up for it but never actually does the draw call.
1

Share this post


Link to post
Share on other sites

Telanor

Thanks, I suspect that, but I don`t understand why. As I can see I implement it just as in example. Do you know where the problem could be?

Edited by BlackJoker
0

Share this post


Link to post
Share on other sites
Looks like d3d11DevCon->DrawIndexed( 6, 0, 0 ); is missing on the last line of the draw call from the sample
0

Share this post


Link to post
Share on other sites

Maybe I am stupid, but it doesn`t work. I add this call like in example, but still no text on the screen sad.png

 

Update

 

I updated my project and now it is not crashes, so you can start it without problems I hope. Pressing L button must inishiate render text, but it is not for now, unfortunately.

 

Updated project in my first post.

Edited by BlackJoker
0

Share this post


Link to post
Share on other sites

Just in case you're interested. One way of rendering text is to use SpriteFont from the DirectX Toolkit. This uses bitmaps, and includes a tool to create bitmap fonts from truetype fonts. 

 

http://directxtk.codeplex.com/wikipage?title=SpriteFont&referringTitle=DirectXTK

 

There's a little disclaimer on localization, which I copy-pasted below, but it probably won't be an issue for you. If you want to check it out further the documentation is pretty good.

 

Localization

This implementation supports sparse fonts, so if you are localizing into languages such as Chinese, Japanese, or Korean, you can build a spritefont including only the specific characters needed by your program. This is usually a good idea for CJK languages, as a complete CJK character set is too large to fit in a Direct3D texture! (if you need full CJK support, Direct2D or DirectWrite would be a better choice). SpriteFont does not support combining characters or right-to-left (RTL) layout, so it will not work for languages with complex layout requirements such as Arabic or Thai.

 

PS. You might have gotten more response if you posted this in "DirectX and XNA" and tagged it with DX11 or something.

Edited by Corvwyn
1

Share this post


Link to post
Share on other sites

Thanks, Corvwyn, but I want to make work D2D + D3D11. Sprite fonts doesn`t seems to be good decision for me.

 

If I post this topic in different thread, I won`t be a rool restriction that I create 2 same topics?

0

Share this post


Link to post
Share on other sites

I'm not a DirectX-expert and I can't read your comments or run your project(missing D3D11x.h because of Windows 8) but this line looks kinda wrong to me:

void LightShader::RenderText(std::wstring text)
{
...
d3d11_DeviceContext->IASetIndexBuffer(d2dVertBuffer, DXGI_FORMAT_R32_UINT, 0);
..
} 

 

Are you sure that you wanna pass your VertexBuffer to the Indexbuffer?

1

Share this post


Link to post
Share on other sites
I suggest you enable the directx debug runtimes and fix all the errors it reports. There are several of them
1

Share this post


Link to post
Share on other sites

Ok, but coul you explain how I can do this, please? If you mean D3D11_CREATE_DEVICE_DEBUG in CreateDeviceAnSwapChain, I have already activated debug, but I can`t see any error of DirectX

0

Share this post


Link to post
Share on other sites

OK, thanks. In output message I found 3 errors:

 

D3D11 ERROR: ID3D11DeviceContext::UpdateSubresource: Can only invoke UpdateSubresource when the destination Resource was created with D3D11_USAGE_DEFAULT and is not a multisampled Resource. The destination Resource has (1) samples. [ RESOURCE_MANIPULATION ERROR #289: UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE]

D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. Semantic 'NORMAL' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX]

D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. Semantic 'TEXCOORD' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX]

 

Could you please explain what does they mean? 

0

Share this post


Link to post
Share on other sites
Your matrix buffer needs to be created with D3D11_USAGE_DEFAULT instead of dynamic. The 2nd and 3rd are the same error. Your PixelInputType structs don't match in your two shaders
0

Share this post


Link to post
Share on other sites

After I set matrix buffer usage DEFAULT I get 2 different erros for DarwInexed method

 

D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: A Vertex Shader is always required when drawing, but none is currently bound. [ EXECUTION ERROR #341: DEVICE_DRAW_VERTEX_SHADER_NOT_SET]

 

D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: Rasterization Unit is enabled (PixelShader is not NULL or Depth/Stencil test is enabled and RasterizedStream is not

D3D11_SO_NO_RASTERIZED_STREAM) but position is not provided by the last shader before the Rasterization Unit. [ EXECUTION ERROR #362: DEVICE_DRAW_POSITION_NOT_PRESENT]

Edited by BlackJoker
0

Share this post


Link to post
Share on other sites

OK, I fixed almost all erors except one:

 

D3D11 ERROR: ID3D11DeviceContext::UpdateSubresource: Can only invoke UpdateSubresource when the destination Resource was created with D3D11_USAGE_DEFAULT and is not a multisampled Resource. The destination Resource has (1) samples. [ RESOURCE_MANIPULATION ERROR #289: UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE]

 

I have dynamic matrix buffer  when I initialize shaders and it is ok - no errors,

 

My vertex and index buffers are also dynamic by the way.

 

but if i make matrix buffer usage DEFAULT, during call Map function it returns error.

 

So, I can`t understand what I need to do to fix this error.

 

I forgot to mention that error apprears when executing this method:

d3d11_DeviceContext->UpdateSubresource(matrixBuffer, 0, NULL, &cbPerObj, 0, 0);

 

update:

I found out how to use D2D1_1 with D3D11 with help of jrh2365 and I think that this hack with creating 2 devices no longer needed.

If you want, look theme http://www.gamedev.net/topic/639578-d2d-d3d11-help-me-to-make-them-work-together/?p=5037982

Edited by BlackJoker
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0