nev9n Posted November 24, 2017 Share Posted November 24, 2017 I'm working on getting QtWebkit working with the development branch of Torque3D. The webkit code works by drawing to a texture that can then be rendered on an object in game. I'm currently having problems getting the render to texture working.This is the code that is creating the textures: mTextureObjectA.set(mTexSize, mTexSize, GFXFormatR8G8B8X8, &GFXDynamicTextureProfile, avar("%s() - (line %d)", __FUNCTION__, __LINE__), 0); // was GFXDefaultStaticDiffuseProfile mTextureObjectB.set(mTexSize, mTexSize, GFXFormatR8G8B8X8, &GFXDynamicTextureProfile, avar("%s() - (line %d)", __FUNCTION__, __LINE__), 0); // was GFXDefaultStaticDiffuseProfile The previous working webkit code used 'GFXDefaultStaticDiffuseProfile', which has been renamed in development to'GFXStaticTextureProfile'. However when I try to use that I get a crash when the code tries to lock the texture. Locking the texture calls ID3D11DeviceContext::Map, which throws this error:D3D11 ERROR: ID3D11DeviceContext::Map: Map cannot be called with MAP_WRITE_DISCARD access, because the Resource was not created with the D3D11_CPU_ACCESS_WRITE flag. [ RESOURCE_MANIPULATION ERROR #2097210: RESOURCE_MAP_INVALIDMAPTYPE] D:\Torque\Torque3D\Engine\source\gfx\D3D11\gfxD3D11TextureObject.cpp(114,0): {Fatal} - GFXD3D11TextureObject::lock - Failed to map subresource. Having had a look through the D3D11 documentation I think I need the texture to be dynamic since webkit will be updating it. Hence why I've updated the texture profile to GFXDynamicTextureProfile.In GFXD3D11TextureManager::_innerCreateTexture() I'm now getting these errors when the texture is created:E_INVALIDARG One or more arguments are invalidD3D11 ERROR: ID3D11Device::CreateTexture2D: A D3D11_USAGE_DYNAMIC Resource must have MipLevels equal to 1. [ STATE_CREATION ERROR #102: CREATETEXTURE2D_INVALIDMIPLEVELS]D3D11 ERROR: ID3D11Device::CreateTexture2D: A D3D11_USAGE_DYNAMIC Resource cannot be bound to certain parts of the graphics pipeline, but must have at least one BindFlags bit set. The following BindFlags bits (0x28) cannot be set in this case: D3D11_BIND_STREAM_OUTPUT (0), D3D11_BIND_RENDER_TARGET (1), D3D11_BIND_DEPTH_STENCIL (0), D3D11_BIND_UNORDERED_ACCESS (0). [ STATE_CREATION ERROR #99: CREATETEXTURE2D_INVALIDBINDFLAGS] This is the D3D11_TEXTURE3D_DESC that has been created: Quote Link to comment Share on other sites More sharing options...
nev9n Posted November 24, 2017 Author Share Posted November 24, 2017 OK I have render to texture drawing to the texture now, but the draw updates aren't being made to the right part of the texture. You can see here how it's loaded the google homepage and redrawn a rectangle in the top left...I fixed the previous render to texture issue by using the following texture profile: GFX_ImplementTextureProfile(GFXWebTextureProfile, GFXTextureProfile::DiffuseMap, GFXTextureProfile::NoMipmap | GFXTextureProfile::Dynamic, GFXTextureProfile::NONE); Quote Link to comment Share on other sites More sharing options...
nev9n Posted December 4, 2017 Author Share Posted December 4, 2017 The problem with updating the wrong part of the texture is related to the code that is handling dirty rectangle updating between webkit and the texture. Since this code hasn't changed since the original release of webkit for Torque3D I'm not sure why it's broken.We are mainly using webkit for showing video, so I've just bypassed the dirty rectangle code and am redrawing the whole texture each frame. Quote Link to comment Share on other sites More sharing options...
chriscalef Posted December 7, 2017 Share Posted December 7, 2017 Cool, glad you're working on this! I was an awesomium user back in the day, would still love to have a solid T3D browser to texture solution. Great work! Quote Link to comment Share on other sites More sharing options...
OTHGMars Posted April 8, 2018 Share Posted April 8, 2018 Congratulations on getting it integrated in the development branch. Two Questions: Is this something you are still working on? Are you willing to share the code on github? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.