• Advertisement

devronious

Member
  • Content count

    834
  • Joined

  • Last visited

Community Reputation

108 Neutral

About devronious

  • Rank
    Advanced Member
  1. Please help. I need to unproject something from screen coordinates into world coordinates, but the Vector3.Unproject does not seem to operate properly. I just get NAN. But I did use the same data in the Project and it worked fine changing the other way. Any ideas? -Devin
  2. zbuffer problems?

    I think I found the problem. Its in the shader. It calcs on a float4 which is causing trouble with the w coordinate in the vertex. Can anyone help me figure out how to work on only a float3 instead of a float4, I just get errors. float4x4 wvp; float4x4 w; float4x4 v; float3 eyedir; float3 lightdir; float4 ambient; float4 linecolor; texture tex; sampler samp = sampler_state { texture = (tex); }; struct vmI { float4 p : POSITION0; float3 n : NORMAL0; float4 c : COLOR0; float2 t : TEXCOORD0; }; struct vmO { float4 p : POSITION0; float3 n : TEXCOORD1; float4 c : COLOR0; float2 t : TEXCOORD0; }; struct pmI { float3 n : TEXCOORD1; float4 c : COLOR0; float2 t : TEXCOORD0; }; vmO VShader(vmI i) { vmO o; o.p = mul(i.p, wvp);//position o.n = mul(i.n, w);//mul(i.n0, view);//normal o.c = i.c;//material diffuse o.t = i.t;//texture coordinate return o; } float4 PShader(pmI i) : COLOR { //normalize input float3 ld = normalize(lightdir); float3 nd = normalize(i.n); float3 ed = normalize(eyedir); //calc diffuse component //float3 ref = ld - nd + nd; //float4 litpow = dot(ref, ed); float4 litpow = dot(nd, ld); float4 spec = litpow;// * i.c;// spec += ambient; //return the color composition float4 o = spec; o.a = 1; //float4 s = tex2D(samp, i.t); //o *= s; return o; } technique Shader{ pass p0{ //BlendOp=Subtract; //SrcBlend=ONE; //DestBlend=DESTCOLOR; //CullMode = CCW; //ZEnable = true; //ZWriteEnable = true; //Lighting = true; VertexShader = compile vs_2_0 VShader(); PixelShader = compile ps_2_0 PShader(); } }
  3. zbuffer problems?

    Thanks, I'll check that now.
  4. zbuffer problems?

    I'm running slimdx and I have a shader that runs. And for some reason the zbuffer is not appearing to work. I have set zenable to true. Is there some inherint problem in slimdx that stops it from performing standard zbuffer testing? So do I need to perform zbuffer testing in my hlsl program?
  5. list of shader render states?

    Figured out the blending problem, my surfaces didn't match, but is there a reference for these as they are named in the shader?
  6. Adding a renderstate to an fx file in the technique seems like there is no reference data on what the renderstate keywords are. For example, if I want to set ZEnable to true in the FX file, where is the guide spelling out all the different renderstate keyword names? I'm not getting alpha blending to work for some reason and it did, here is my shader area that controls that: technique Master{ pass p0{ ZEnable = true; AlphaBlendEnable = true; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; Lighting = false; VertexShader = compile vs_2_0 vsMaster(); PixelShader = compile ps_2_0 psMaster(); } } Thanks for any help.
  7. Promit, You're really kind, but the project is huge and I wouldn't want to put you thru digging thru all that code. I think it may be my video card anyways.
  8. exception when program closing

    Are you overclocked? If so back down the overclocking. Otherwise I get this also when my driver is bad. So it may be driver. Switching drivers in that case would be in order, can you say what graphics card and which driver your using?
  9. Yes, I do and it gives me no more information than that, even with enable managed code debugging. Just that and its the same error in different places.
  10. Is there something special in SlimDX as opposed to MDX? When I set a rendertarget, or begin an effect or draw with a vertex buffer I keep getting this error: D3DERR_INVALIDCALL: Invalid call (-2005530516) Is it my driver, video card or is my device setup wrong or what. They seem to work one minute and then fail the next randomly. But so far its been only these statements: this.Device.SetRenderTarget(0, nrt); int passes = se.Effect.Begin(0); this.Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0,0,this.modelEngine.VertexManager.DefaultTriangleEngine.NumberOfVertices,0,this.modelEngine.VertexManager.DefaultTriangleEngine.NumberOfPrimitives); Always the same error code. It's driving me crazy trying to figure it out, any help would be super. -Devin
  11. NO_PRESHADER flag [SlimDX]

    Got it, thanks.
  12. Where do I set the NO_PRESHADER flag? is it in the present params, render states, fx file? Thanks, Devin
  13. [SlimDX, C#] React on mouse click

    Mind you this is for a Form but I would think the code is similar. So what is best is to override the OnMouseUp event method like this: [source lang = "c#"] protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); switch (e.Button) { case MouseButtons.Left: //do code here for left button break; case MouseButtons.Right: //do code here for right button break; case MouseButtons.Middle: //do code here for middle button break; } }
  14. [SlimDX, C#] React on mouse click

    The MouseUp event fires after the mouse button has been pressed and is released. You can check which button with the arguments passed to the event method. MouseArgs I think. it should work. -Devin
  • Advertisement