Windows Phone 8 Custom shaders?

I don’t think my angle patch will work against the latest tree (used in 2.2.2). The glslprecompiler has been rewritten, and I would have to update the patch to make it work.

Hi
I am trying to compile my shader files by following the steps you define above. I am using cocosdx version that have glslprecompiler but facing a problem. when I run batch file it says:
Failed to compile due to
type FishLine.tmp.h 1>>precompiledshaders.h
The system cannot find the file specified…
Can you please help me in finding that what I am doing wrong?

waqas anwar wrote:

Hi
I am trying to compile my shader files by following the steps you define above. I am using cocosdx version that have glslprecompiler but facing a problem. when I run batch file it says:
Failed to compile due to
type FishLine.tmp.h 1>>precompiledshaders.h
The system cannot find the file specified…
Can you please help me in finding that what I am doing wrong?

That would mean the glslprecompiler failed, and didn’t create the .h file. It could be because your shader was broken, or some other reason. If you send it to me, I can try it.

Thankyou #adipose
These are the shader files.

Well, it worked fine for me. I can’t say what might be your issue, but maybe you could attach the output of the cmd file?

In the meantime, I attached my output for your shader:

Hey all
I’m using Cocos2d-x 3.0 and wp8-xaml. I implemented adipose’s changes to CCGLProgram.cpp and created the macro as described. As a test, I copied the SoftBrush shader posted above and applied it to the Hello World sprite in the template cocos2d-x project.

Unfortunately, it doesn’t work. None of the GL error checks report a problem, but the sprite doesn’t show up anymore.

Here’s my code:

    // add "HelloWorld" splash screen"
    auto sprite = Sprite::create("HelloWorld.png");

    // position the sprite on the center of the screen
    sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

    ///////////
    // SHADER TESTING
    auto shaderProgram = new GLProgram();
    initShader(shaderProgram, SoftBrush);
    CHECK_GL_ERROR_DEBUG();
    shaderProgram->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::VERTEX_ATTRIB_POSITION);
    CHECK_GL_ERROR_DEBUG();
    shaderProgram->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::VERTEX_ATTRIB_COLOR);
    CHECK_GL_ERROR_DEBUG();
    shaderProgram->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::VERTEX_ATTRIB_TEX_COORDS);
    CHECK_GL_ERROR_DEBUG();
    shaderProgram->link();
    CHECK_GL_ERROR_DEBUG();
    shaderProgram->updateUniforms();
    CHECK_GL_ERROR_DEBUG();
    sprite->setShaderProgram(shaderProgram);
    sprite->getShaderProgram()->use();
    ///////////////////

For those of you that have gotten this working, can you see what I might be doing wrong?

Thanks!

P.S. I’ve also tried the precompiled shaders that come with Cocos2d-x and the results, while different, don’t seem to be correct either. For example, this shader turns the sprite completely white but I’m not sure that’s what’s supposed to happen.

    // add "HelloWorld" splash screen"
    auto sprite = Sprite::create("HelloWorld.png");

    // position the sprite on the center of the screen
    sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

    ///////////
    // SHADER TESTING
    auto shaderProgram = new GLProgram();
    sprite->setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_COLOR_NO_MVP));
    sprite->getShaderProgram()->use();
    ///////////////////

Well, I compiled a very simple shader of my own using the changes to ANGLE above and it does work. So I’m going to chalk it up to just not understanding how to use the other shaders (i.e. what uniforms to use).

Hey guys, i have tried to build a custom shader to change HUE angles of the sprites, but I could not make it work in 3.2v
I have cloned the Angle project to be able to use the compilerrt, but after creating the new precompiled shader, added it to the .h and changed the number of precompiled shaders and added the sha1 resulted from that shader in particular I got no changes in my game.

Anyone has done that?