Drawing a Texture

Started by
37 comments, last by falcon93 12 years, 9 months ago
Yes, I tried scaling my image to 512x512 and it worked just fine. I also noticed, using D3DX_DEFAULT_NONPOW2 for the width and height, will not scale the image. Thanks very much for the help :)


May I also ask you; You game me these render settings before, what are they actually doing?


d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
d3ddev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
d3ddev->SetRenderState(D3DRS_SRCBLENDALPHA, D3DRS_DESTBLENDALPHA);
d3ddev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
d3ddev->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );


I noticed they didn't do any difference on just an ordinary image, but maybe they can give some cool results with other types of textures?

Thanks for helping :)
Advertisement
d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
this turns off direct3d lighting because we are doing it manually.

d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
This enables the alpha channel, so if you have multiple overlapping textures if you change the alpha it will make one of them transparent/

d3ddev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
This inverts the source alpha value, and tells us to use destination for blending, im not 100% on these

d3ddev->SetRenderState(D3DRS_SRCBLENDALPHA, D3DRS_DESTBLENDALPHA);
This I think tells directx to use the alpha of the source and destion on a blend, im not 100% on these

d3ddev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
d3ddev->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
Not sure on these but I did need them for some reason

Here is a link to to an explantion on some of these:
http://www.toymaker.info/Games/html/texture_states.html

or even better:

http://msdn.microsoft.com/en-us/library/bb172599%28v=vs.85%29.aspx
Ok, thanks very much for the explanation, and I'll take a closer look at the links you gave me :)


I'm renaming this thread from "I'm stuck" to "Drawing a texture" as it fits better from the purpose of this thread. I'll continue on with some keyboard input, 2D animations (sprite sheets) and sounds, lets see how that goes. Anyway, thanks so very much for all help :)
Good luck, happy programming!

I still havn't learned what a pointer is, and specially all these signs: * , **, &, -> and if I don't remember wrong, there's even a '?'. What do all these do? When I worked with classes in C#, it was so much easier.


I would strenuously advise that Direct3D API is a bad place to try to learn about these things and that you spend a small amount of time with some simpler examples to get your head around C++ pointers. Due to the COM nature of the DX APIs (they can work with multiple languages, including C sadly) an understanding of pointers is quite important.


The MSDN Documentation, is that something I have on my computer or is it the webpages I find when I search for methods, variables etc on google?

So, to move on to the correct track. I use the MSDN Documentation (where do I find it?) when I already know what I'm going to use. But what if I want to start with something totaly new, will the documentation help me there too or should I use google then?


MSDN is online. But just Googling "GetLevelDesc" has the relevant link as the first choice.
Do you know any good tutorials that covers mostly about pointers and maybe even provide some exersizes so I can check if I've understood it well?

Thanks for the MSDN link smile.gif I can't find the navigation path to DirectX though. Any ideas?
Thanks for the MSDN link smile.gif I can't find the navigation path to DirectX though. Any ideas?


I start from here:
http://msdn.microsoft.com/en-us/library/bb174336%28VS.85%29.aspx

I start from here:
http://msdn.microsof...28VS.85%29.aspx




Thanks so much. I just noticed that the MSDN is like a gold cave full of information!

What about the pointers? [color=#1C2837][size=2]Do you know any good tutorials that covers mostly about pointers? Exersizes would be great too wink.gif

Thanks so much. I just noticed that the MSDN is like a gold cave full of information!

What about the pointers? [color="#1c2837"]Do you know any good tutorials that covers mostly about pointers? Exersizes would be great too wink.gif


http://www.cplusplus.com/doc/tutorial/pointers/

Cplusplus.com has some really detailed infromation.
Thanks a lot for that link, I'll read it and do some pointer exersizes in a console app.

Thanks very much! smile.gif

This topic is closed to new replies.

Advertisement