VBGamer |
|
Re: Some dx 8 graphics questions Adam Hoult (0 replies, 0 views) (2001-Jan-2) Hey stuart,
Ok in answer to your first question, there are MANY reasons why your alpha blending code may not function correctly, D3D collects the alpha information from many different sources, either from the Diffuse vertex colour, the texture's alpha channel, the materials alpha level (if using UnLit vertices) and so on. There are different renderstates which let D3D know from which source it should obtain the alpha information. I suggest that you visit the tutorials section at
http://www.mr-gamemaker.com
and take a look at the three tutorials named "Transparency & Translucency", "2D Alpha Blending" and also "Texture Stage States". They are all for DX7, and are primarily aimed at C++, but the explanations they provide are excellent, and can be applied to DX8 in VB with no problems.
Re: Question #2
You have to set the texture coordinates within your Vertex structure, if you only wanted to use part of a texture. For example imagine you have your vertices set out in a square shape (quad) with a clockwise winding order. i.e Top Left is Vertex 1, Top Right is Vertex 2, Bottom RIGHT is Vertex 3 and Bottom LEFT is Vertex 4. Now lets say for example, that you wanted to only display the top right hand corner of your texture. For this, your TU / TV values would be as follows
Vertex1.tu = 0.5 : Vertex1.tv = 0.0
Vertex2.tu = 1.0 : Vertex2.tv = 0.0
Vertex3.tu = 1.0 : Vertex3.tv = 0.5
Vertex4.tu = 0.5 : Vertex4.tv = 0.5
A quick explanation, basically you can see that The top left vertex starts half the way along the texture, and right at the top (0.5 for tu and 0.0 for tv) then for Vertex2 the vertex sits right on the edge of the texture (1.0 for tu) and again at the top (0.0 for tv) and so on.
Hope this makes a little sense to you (it certainly didn't to me when I re-read it ;)
--
Adam Hoult
Lead Programmer
Atypical Interactive
http://www.atypical-interactive.com |