Re: DX10 tutor7 Texture question
  Home FAQ Contact Sign in
microsoft.public.win32.programmer.directx.graphics only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: DX10 tutor7 Texture question         

Group: microsoft.public.win32.programmer.directx.graphics · Group Profile
Author: Anton Roth
Date: Sep 19, 2008 01:53

> i've solved it :D . yes, i did wrong in Render() code.
> http://www.pastebin.us/d4d456d8a
>
> so, do we should modify all g_pEffect before calling this code?
>
> D3D10_TECHNIQUE_DESC techDesc;
> g_pTechnique->GetDesc( &techDesc );
> for( UINT p = 0; p < techDesc.Passes; ++p )
> {
> g_pTechnique->GetPassByIndex( p )->Apply(0);
> g_pd3dDevice->DrawIndexed( 36, 0, 0 );
> }
>
> and also i have question, if i follow your .fx file code and call the code
> above. will it draw twice? both of non-textured and textured. I wonder.
>

if you used my fx file and that code, yes, it would draw twice, but you'd
only see the second draw as there is no alpha component in it and you would
just draw over the already drawn cube.

What you did in your code, you set the technique handler to an existing
handler, but you were already in the render mode, which just doesnt work.
Your technique is set, and the call within doesn't change anything. Your
//should be like this
works fine, but i'd not change the pointer too much and instead do another
technique handler called g_ptechnique_notex for example. There's a lot of
code there the compiler will just optimize out as its just not needed.

Following lines:

effectDiffuseVariable->SetResource(texture2D);
g_pd3dDevice->IASetInputLayout(vertexLayout);
g_pd3dDevice->IASetVertexBuffers(0,1,&vertexBuffer,&stride,&offset);
g_pd3dDevice->IASetIndexBuffer(indexBuffer,DXGI_FORMAT_R32_UINT,
0);
g_pd3dDevice->IASetPrimitiveTopology(tropologyMode);

are pretty much the same in both codes (why on earth do you call it
effectDiffuseVariable if it is a pointer to a 2D texture?), i'd call it just
once outside the switch. Your DrawLight technique doesnt bother about the
texture. Unneeded code.
no comments
diggit! del.icio.us! reddit!

RELATED THREADS
SubjectArticles qty Group
Re: Challenge 13 - Textures - JoeB #2 - two texturescorel.PaintShopPro_Photography ·