Problem with textures in a rectangle built with Tr
Posted 03 April 2004 - 10:23 PM
In my application (written in C# and Managed direct X9 I have drawn several rectangles with some textures, using
TransformedTextures vertices. In my card, everything works fine, the
textures are ok.
But I've executed the application in another computer, with the same
directory tree, and the textures don't appear.
My card is a ATI Radeon 9600 and the other one is a Radeon 7500.
The rectangles appear solid, painted with different colours, although the
textures that apply to meshes or cubes with positionTextured vertices appear
Does anybody know why does this happen? Maybe any presentParams of the
Thanks in advance,
Posted 05 April 2004 - 01:53 PM
//Initialization of the device
presentParams.Windowed = true;
presentParams.BackBufferWidth = 800;
presentParams.BackBufferHeight = 600;
presentParams.BackBufferFormat = Format.X8R8G8B8; presentParams.FullScreenRefreshRateInHz = 0; presentParams.PresentationInterval = PresentInterval.Immediate;
presentParams.DeviceWindow = formPrincipal;
presentParams.SwapEffect = SwapEffect.Copy;
presentParams.EnableAutoDepthStencil = true;
presentParams.AutoDepthStencilFormat = DepthFormat.D24S8;
// Create the D3DDevice
Device3D = new Device(0, DeviceType.Hardware, formPrincipal,
Device3D.DeviceReset += new System.EventHandler(OnResetDevice);
Device3D.RenderState.Ambient = Color.FromArgb(0x40, 0x40, 0x40);
Device3D.RenderState.ZBufferEnable = true;
Then, when rendering the vertices:
//Loading the vertices
vertexBuffer.SetData(vertexData, 0, 0);
Device3D.SetStreamSource( 0, vertexBuffer, 0 );
Device3D.VertexFormat = CustomVertex.TransformedTextured.Format;
// Set the texture
Device3D.SetTexture(0, texturaFons );
// Render the face
Device3D.DrawPrimitives( PrimitiveType.TriangleStrip, 0, 2 );
And there's nothing more!
Posted 06 April 2004 - 07:59 AM
device.TextureState.ColorOperation = TextureOperation.SelectArg1;
device.TextureState.ColorArgument1 = TextureArgument.TextureColor;
The above tells d3d to take the color from the texture. From the looks of your problem, it seems that the color is being taken from the vertices (ie: diffuse). Try the above.
Also if that dosnt work, try running the debugger on the other PC and see if d3d gives you any warnings or errors at runtime.
Posted 07 April 2004 - 02:01 PM
In another forum have answered the question.
The problem was that I forgot to add the vertex.Rhw = 1.0f; in each vertex.
Thanks for your help!
Posted 07 April 2004 - 02:57 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users