HLSL - vs with fixed pipe texture problem

Started by
6 comments, last by deffer 18 years, 8 months ago
Hello again ;-) Im trying to force my app to run on some old hardware without ps. All i need is to use my vertex shader and render model with texture. I create effect file with only vertex shader - all works ok. struct VS_OUTPUT { float4 Pos : POSITION; float2 Tex0 : TEXCOORD0; }; VS_OUTPUT VShade(VS_INPUT In) { VS_OUTPUT Out = (VS_OUTPUT) 0; Out.Pos = In.Pos; Out.Tex0 = In.Tex0; return Out; } And i get black model. Texture is set this way: effect->SetTexture("Texture1",tex); What could go wrong? Should i set some render extra states to make fixed pipe texture my models? I tried ColorArg0[0] = DIFFUSE; but with no effect... any ideas?
Advertisement
Hiya Uriel,
Refer to
HLSL Texturing? (Simple)
ehehe
Hello Armadon!

Thanks but i dont want to use ps - i want to use vs with fixed pipeline. I want this to run on hardware that doesnt support ps at all - only vs_1_1.. any other ideas?
In the vertex shader output white color.
"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
Thanks vNistelrooy, but that was not the case.. i was able to figure out whats wrong - when i set texture in the effect i cant specify stage, like i do when setting it with device (lpD3DDevice->SetTexture(0,tex) )
Texture set with effect has random stage - how can i avoid this? Is there a method of forcing effect file to load specific texture to specific stage?

[edit]

Nope, i was wrong - still doesnt work. It was rendered textured because there was pixel shader loaded from previous model.
No one ever tried to use vertexshader without ixel shader and render a textured model?

[Edited by - Uriel on August 15, 2005 6:52:14 AM]
In your effect file set pixel shader to null, forcing usage of fixed pipeline:
technique MyTechnique{   pass P0   {      vertexshader = compile vs_1_1 VShade();      pixelshader = NULL;   }}


Also, when you set texture with effect interface (using whatever name, like "Texture1"), you got to have a texture variable withing the effect with that name. Then you can use it with pixel shader.
To use fixed pipeline, use standard pDevice->SetTexture(stage, pTex);

Well, I'm relatively new to shaders, so hope I'm right ;)
~def
You are right, but it still doesnt work. I set texture usig device way, i set ps to null, and i get black model.
Ok, post:
- vertex declaration,
- texture setting,
- texture stages

This topic is closed to new replies.

Advertisement