Jump to content
  • Advertisement
Sign in to follow this  
thedodgeruk

weird problem when iniliseing pointers directx

This topic is 2511 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

below is bit of the funtion i use to create ID3D10Texture2D* and others ect


<div>void &nbsp;CRenderPostManager::Create(UINT width , UINT height , ID3D10Texture2D* texture, ID3D10RenderTargetView* targetview, ID3D10ShaderResourceView* resourseView)</div><div>{</div><div>// Create the "scene texture" - the texture into which the scene will be rendered in the first pass</div><div>D3D10_TEXTURE2D_DESC textureDesc;</div><div>textureDesc.Width &nbsp;<span class="Apple-tab-span" style="white-space:pre"> </span> &nbsp; = width; &nbsp;// Match views to viewport size</div><div>textureDesc.Height <span class="Apple-tab-span" style="white-space:pre"> </span> &nbsp; = height;</div><div>textureDesc.MipLevels <span class="Apple-tab-span" style="white-space:pre"> </span> &nbsp; = 1; // No mip-maps when rendering to textures (or we will have to render every level)</div><div>textureDesc.ArraySize <span class="Apple-tab-span" style="white-space:pre"> </span> &nbsp; = 1;</div><div>textureDesc.Format <span class="Apple-tab-span" style="white-space:pre"> </span> &nbsp; = DXGI_FORMAT_R8G8B8A8_UNORM; // RGBA texture (8-bits each)</div><div>textureDesc.SampleDesc.Count &nbsp; = 1;</div><div>textureDesc.SampleDesc.Quality = 0;</div><div>textureDesc.Usage <span class="Apple-tab-span" style="white-space:pre"> </span> &nbsp; = D3D10_USAGE_DEFAULT;</div><div>textureDesc.BindFlags <span class="Apple-tab-span" style="white-space:pre"> </span> &nbsp; = D3D10_BIND_RENDER_TARGET &nbsp;| D3D10_BIND_SHADER_RESOURCE; // Indicate we will use texture as render target, and pass it to shaders</div><div>textureDesc.CPUAccessFlags <span class="Apple-tab-span" style="white-space:pre"> </span> &nbsp; = 0;</div><div>textureDesc.MiscFlags <span class="Apple-tab-span" style="white-space:pre"> </span> &nbsp; = 0;</div><div>g_pd3dDevice-&gt;CreateTexture2D( &amp;textureDesc, NULL, &amp;texture );</div><div>g_pd3dDevice-&gt;CreateRenderTargetView( texture, &nbsp; &nbsp; &nbsp; NULL, &amp;targetview );</div><div>}</div>

i use this line to activate it
Create (width , height , m_pSceneTexture, m_pSceneRenderTarget, m_pSceneShaderResource);

now when i step though the main code the variables are created and are legit
but once that method has been done, the variables are not valid , its like they were copyed opver , not by reference , were am i going wrong

Share this post


Link to post
Share on other sites
Advertisement
I think you want Create(UINT width , UINT height , ID3D10Texture2D* (&texture), ID3D10RenderTargetView* (&targetview), ID3D10ShaderResourceView* (&resourseView)), so the pointers are passed by reference. Though I can't tell exactly what you need to be passed by reference, since the formatting of your code seems to be broken.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!