XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

Shaders and pre processor macros

Last post 7/3/2009 8:11 PM by siferion. 4 replies.
  • 6/29/2009 10:27 AM

    Shaders and pre processor macros

    Hi,

    I saw in the instanced model sample, that stuff like this
    #ifdef WINDOWS
        output.Color = 1;
    #else
        output.Color = 0;
    #endif
    should actually work, but unfortunately, in our project it seems to not be the case.

    I've searched the forums a bit, and stumpled over a thread where it says that one must write your own content processor.
    Is this true?
    If so, why does the instanced model sample work? Or doesn't it? (havent tried it on the xbox yet)

    In my case, I am a 100% sure that WINDOWS is defined, but the color returned is still black.
    Any clues?

    Thanks!
    Christian
  • 6/29/2009 12:01 PM In reply to

    Re: Shaders and pre processor macros

    As far as I'm aware, the 'XBOX360' macro should be defined....
    However, I don't use the effect system (so get a second opinion first!)

    Xen: Graphics API for XNA
    www.codeplex.com/xen
  • 6/29/2009 2:44 PM In reply to
    • (2334)
    • premium membership MVP
    • Posts 1,222

    Re: Shaders and pre processor macros

    The only preprocessor defines that are automatically set by the Effect Processor are "XBOX" and "XBOX360", and those are only set when the 360 is the target platform (obviously).  "WINDOWS" is not defined for you.

    The InstancedModel sample just uses the "XBOX360" macro, which is why it works.
    Matt Pettineo | DirectX/XNA MVP


    Ride into The Danger Zone | PIX With XNA Tutorial
  • 7/2/2009 1:52 PM In reply to

    Re: Shaders and pre processor macros

    Sorry for the late reply, was busy with some exams and celebrating afterwards ^^

    That's great news, thanks!
  • 7/3/2009 8:11 PM In reply to

    Re: Shaders and pre processor macros

    #if !XBOX
    #define WINDOWS
    #endif

    /giggle
Page 1 of 1 (5 items) Previous Next