Problem with textures in a rectangle built with Tr

4879d0a5e33d4fc133525d9db45aa073
0
Arnau 101 Apr 03, 2004 at 22:23

Hi,

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
ok.
Does anybody know why does this happen? Maybe any presentParams of the
device???

Thanks in advance,

Arnau.

5 Replies

Please log in or register to post a reply.

22b3033832c5c699c856814b0cf80cb1
0
bladder 101 Apr 04, 2004 at 03:16

you might be using certain capabilities that other cards dont support. Maybe you are gorgetting some render states or texture states.

Could you paste some relevant code?

4879d0a5e33d4fc133525d9db45aa073
0
Arnau 101 Apr 05, 2004 at 13:53

Well, I’m not using anything strange… I’ve disabled all the rendering that doesn’t have anything to do with the rectangle drawing, and the code left is this:

//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,
CreateFlags.SoftwareVertexProcessing, presentParams);
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
loadVertices();
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!
Any ideas?

22b3033832c5c699c856814b0cf80cb1
0
bladder 101 Apr 06, 2004 at 07:59

have you tried setting texture states?

device.TextureState[0].ColorOperation = TextureOperation.SelectArg1;
device.TextureState[0].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.

4879d0a5e33d4fc133525d9db45aa073
0
Arnau 101 Apr 07, 2004 at 14:01

Hi

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!

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Apr 07, 2004 at 14:57

thank you very much for posting your solution here for others