The map() success, but all the data is zero! So, I'm wandering why mapping would be affected by resolution.Then I try to find the threshold of resolution.For up to Genesis 2 figures, the work-around for saving DAZ Studio figures for use in Poser is fairly easy. I tried to print out mapped pixel data, and I'm the problem is on map/unmap method. Dialog show image with top-left square.Ģ, when the dialog is windowed, divided into two:Ģ.1, if resolution is high, codes work rightĢ.2, if resolution is low, dialog still shows top-left square, but background image becomes black!ģ, when the dialog is on full-screen,then I lower the display resolution, the result like 2.2, blackscreen The codes in hooking area simply draw an square on dialog top-left, but the output is weird:ġ, when the dialog is on full-screen, everything is right. TestDbgPrint(L"DxWin32: g_pSwapChain->Present()") G_pImmediateContext->CopyResource(pBackBuffer, pCopiedTexDynamic) G_pImmediateContext->Unmap(pCopiedTexDynamic, 0) //D3D11CalcSubresource(0, 0, 1)) TestDbgPrint(L"swTextureDesc.Width=%d swTextureDesc.Height=%d", swTextureDesc.Width, swTextureDesc.Height) įor (UINT y = 0 y Map() hResult =0x%x pPixel=0x%x size=%d", hResult, mapped.pData, swTextureDesc.Height*swTextureDesc.Width * 4) TestDbgPrint(L"DxWin32: Map()failed hResult=0x%x", hResult) ZeroMemory(&mapped, sizeof(D3D11_MAPPED_SUBRESOURCE)) G_pImmediateContext->CopyResource(pCopiedTexDynamic, pBackBuffer) TestDbgPrint(L"DxWin32: CreateTexture2D() pCopiedTexDynamic=0x%x", pCopiedTexDynamic) HResult = g_pd3dDevice->CreateTexture2D(&swTextureDesc,NULL,&pCopiedTexDynamic) SwTextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE SwTextureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE SwTextureDesc.Usage = D3D11_USAGE_DYNAMIC TestDbgPrint(L"DxWin32: g_pSwapChain->GetBuffer() pBackBuffer=0x%x", pBackBuffer) HResult = g_pSwapChain->GetBuffer(0, _uuidof(ID3D11Texture2D), reinterpret_cast(&pBackBuffer)) ZeroMemory(&swTextureDesc, sizeof(swTextureDesc)) ID3D11Texture2D* pCopiedTexDynamic = nullptr G_pImmediateContext->PSSetSamplers(0, 1, &pColorMapSampler) G_pImmediateContext->PSSetShaderResources(0, 1, &pColorMap) G_pImmediateContext->PSSetShader(pSolidColorPS, 0, 0) G_pImmediateContext->VSSetShader(pSolidColorVS, 0, 0) G_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST) G_pImmediateContext->IASetVertexBuffers(0,1,&pVertexBuffer,&stride,&offset) G_pImmediateContext->IASetInputLayout(pInputLayout) G_pImmediateContext->ClearRenderTargetView(g_pRenderTargetView, clearColor) TestDbgPrint(L"DxWin32:create Vertex Shader failed!") ĭ3D11_INPUT_ELEMENT_DESC solidColorLayout = HWnd = CreateWindow(szModalessClass, _T("Modaless"), WS_OVERLAPPEDWINDOW,posX, posY, screenWidth, screenHeight, NULL, NULL, hInstance, NULL) Ĭreate vertex/pixel shader and load image:īool compileResult = CompileD3DShader(_T("TextureMap.fx"),"VS_Main","vs_4_0", &vsBuffer) ĭ3dResult = g_pd3dDevice->CreateVertexShader(vsBuffer->GetBufferPointer(),vsBuffer->GetBufferSize(),0,&pSolidColorVS) PosY = (GetSystemMetrics(SM_CYSCREEN) - screenHeight) / 2 PosX = (GetSystemMetrics(SM_CXSCREEN) - screenWidth) / 2 HWnd = CreateWindow(szModalessClass, _T("Modaless"), WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP,posX, posY, screenWidth, screenHeight, NULL, NULL, hInstance, NULL) Memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)) ĭmScreenSettings.dmSize = sizeof(dmScreenSettings) ĭmScreenSettings.dmPelsWidth = (unsigned long)screenWidth ĭmScreenSettings.dmPelsHeight = (unsigned long)screenHeight ĭmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT ĬhangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) ScreenHeight = GetSystemMetrics(SM_CYSCREEN) ScreenWidth = GetSystemMetrics(SM_CXSCREEN) Code: BOOL CreateModalessDlg(HINSTANCE hInstance, int nCmdShow)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |