Feb 7, 2009

Using Custom Shader for XNA in MacBook with Paralles.

I have tried to use Pixel Shader in my MacBook, but it didn't work.
I hope anybody has same problem can get some help from this page.First I tried to use some example from a book. But it didn't work. It turned out GameStudio 3.0 has changed some interfaces.

I tried another example "How to: Use BasicEffect". The example in the page uses pixel shader and it worked well, but it wasn't a custom pixel shader.

Next I tried another example, "How to: Create and Apply Custom Effect." The example in the page uses a custom pixel shader, but it didn't work. It thrown an exception, "InvalidOperationException." It complained that I didn't use valid vertext and pixel shader. Man, it is an example from MS...
Finally I changed the custom Effect file, which is pixel shader code.
I already knew that MacBook support only one type of vertex and pixel shader among severals. Thus I tried to use older version than the one in the example, and finally it worked out.

The original code is here:
technique TransformTechnique
{
pass P0
{
vertexShader = compile vs_2_0 Transform();
pixelShader = compile ps_1_1 PixelShader();
}
}
The version number of "vs_2_0" should be "vs_1_1" for MacBook.

No comments: