游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2282|回复: 4

Bitmap ID3D11Texture2D 显示问题

[复制链接]

1

主题

4

帖子

17

积分

新手上路

Rank: 1

积分
17
发表于 2013-6-14 10:25:51 | 显示全部楼层 |阅读模式
Directx11的窗口已经创建好,并且能正常显示了蓝色背景了,现在想在蓝色背景上刷一张图片,即把一个从bitmap转化好过来的ID3D11Texture2D* D3DTexture,显示到这个窗口当中,请问怎么显示?
const Texture* pTexture = GetTexture(textureId);
                        if(pTexture && pTexture->D3DTexture)
                        {
                                ID3D11DeviceContext* pImmediateContext = NULL;
                                m_pDevice->GetImmediateContext(&pImmediateContext);

                                static ID3D11ShaderResourceView* pResourceView = NULL;
                                D3D11_SHADER_RESOURCE_VIEW_DESC vdesc;
                                vdesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
                                vdesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
                                vdesc.Texture2D.MostDetailedMip = 0;
                                vdesc.Texture2D.MipLevels = 1;

                                LRESULT hr = S_OK;
//                                if (pResourceView == NULL)
                                {
                                        if (FAILED(hr = m_pDevice->CreateShaderResourceView(pTexture->D3DTexture, &vdesc, &pResourceView))) {
                                                return ;
                                        };
                                }
                                if (pTexture->D3DTexture)
                                {
// D3DTexture 能正常导出到bitmap,所以数据没有问题
                                        static int m_index = 0;
                                        wstring fstr = L"D:\\test\\" + StringHelper::ConvertFromIntW(m_index++) + L".bmp";
                                        SaveToBitmapFile(m_pDevice, pTexture->D3DTexture, fstr.c_str());
                                }
immediateDeviceContext->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );
immediateDeviceContext>PSSetShaderResources(0, 1, &pResourceView);

immediateDeviceContext->Draw(4, 0);显示不出图片,求大侠,指点指点

1

主题

4

帖子

17

积分

新手上路

Rank: 1

积分
17
 楼主| 发表于 2013-6-14 10:42:19 | 显示全部楼层
急,急,急,等大侠出现

1

主题

4

帖子

17

积分

新手上路

Rank: 1

积分
17
 楼主| 发表于 2013-6-14 12:22:46 | 显示全部楼层
坐等高手

1

主题

4

帖子

17

积分

新手上路

Rank: 1

积分
17
 楼主| 发表于 2013-6-14 13:19:29 | 显示全部楼层
???????????

11

主题

1238

帖子

1782

积分

金牌会员

Rank: 6Rank: 6

积分
1782
发表于 2013-6-15 14:06:18 | 显示全部楼层
初学DX11的人路过.........
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-2-26 19:01

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表