light source

hi! im trying to make work a project i found here: http://www.supersuraccoon-cocos2d.com/2011/09/17/sticky-demo-resource-list-keep-updating/ . Project’s name is “GameLighting Demo”. But light in my project spreading in rect. I am noob in OpenGL ES 2.0 and cannot figure out what is wrong with my code. Maybe someone could help me to make spread light in circle. I just replaced Objective-C calls with equivalent c*+ methods and added to CCTexture2D class one method:
<pre>
void CCTexture2D::drawFlippedAtPoint
{
GLfloat coordinates = { point.x, point.y,
width* point.x, point.y,
point.x, height + point.y,
width + point.x, height + point.y };

ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_TexCoords );
// ccGLUseProgram( shaderProgram_>program_ );
// ccGLUniformModelViewProjectionMatrix;
m_pShaderProgram
>use();
m_pShaderProgram->setUniformForModelViewProjectionMatrix();

ccGLBindTexture2D( m_uName );

glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, coordinates);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

here is their Objective-C project: http://dl.dropbox.com/u/30871449/Website/Resource/2012/01/GameLightingDemo/GameLightingDemo.zip

and my converted project: http://www.sendspace.com/file/bwn2k9

hi,

that shader is so cool, did you get it working with cocos2d-x?

JB

hi,
i have done the same work as you. And got the same issue. Have you fix it?
thanks

hoho, I have fix it. There is two Shaders directory in this project, when I copy the one in “GameLighting” directory I got the issue as you. But today I copy the one in “GameLightingiOS” the issue gone. :slight_smile:

Maybe you made the same mistake like me.

Mikhail Zinkovsky wrote:

hi! im trying to make work a project i found here: http://www.supersuraccoon-cocos2d.com/2011/09/17/sticky-demo-resource-list-keep-updating/ . Project’s name is “GameLighting Demo”. But light in my project spreading in rect. I am noob in OpenGL ES 2.0 and cannot figure out what is wrong with my code. Maybe someone could help me to make spread light in circle. I just replaced Objective-C calls with equivalent c++ methods and added to CCTexture2D class one method:
>
[…]
>
here is their Objective-C project: http://dl.dropbox.com/u/30871449/Website/Resource/2012/01/GameLightingDemo/GameLightingDemo.zip
>
and my converted project: http://www.sendspace.com/file/bwn2k9

hi, sorry for delay.

to Jesus Bosh: no i din’n get it working, but i figure out how to write and use shaders with cocos2d-x

to Ryan wu: this is good news from you) i will try it on weekend

hi… i tried replacing the shaders folders… still doesnt work for me … like nothing works