Help with ETC1 alpha GLSL

Hey,

I want to support etc1 in my game, but somehow it doesn’t work

C++

 GLProgram* glp = new GLProgram();

glp->initWithVertexShaderFilename("testv.vsh", "test.fsh");
glp->addAttribute(GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::VERTEX_ATTRIB_POSITION);
glp->addAttribute(GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::VERTEX_ATTRIB_COLOR);
glp->addAttribute(GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::VERTEX_ATTRIB_TEX_COORD);
glp->link();
glp->updateUniforms();

Texture2D* tex = Director::getInstance()->getTextureCache()->addImage("MenuButton_alpha.pkm");

GL::bindTexture2DN(1, tex->getName());    
GLuint t1Location = glGetUniformLocation(glp->getProgram(), "tex1");
glp->setUniformLocationWith1i(t1Location, 1);

MySprite->setShaderProgram(glp);

.vsh

attribute vec4 a_position;
attribute vec2 a_texCoord;
attribute vec4 a_color;
					

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec2 v_texCoord2;


uniform sampler2D tex1;

void main()
{
    gl_Position = CC_MVPMatrix * a_position;
	v_fragmentColor = a_color;
	v_texCoord = a_texCoord;
    v_texCoord2 = v_texCoord;

}

.fsh

varying vec4 v_fragmentColor;	
varying vec2 v_texCoord;
varying vec2 v_texCoord2;

uniform sampler2D tex1;


void main()
{
    vec3 tex = texture2D(CC_Texture0, v_texCoord).rgb;
    
    float alpha = texture2D(CC_Texture1, v_texCoord2).a;
    
    gl_FragColor = vec4(tex.rgb,alpha);
}				

Somehow it shows my sprite in the middle but the transparent part is black.
can anyone help me?

 float alpha = texture2D(CC_Texture1, v_texCoord2).a;

instead of this
float alpha = texture2D(CC_Texture1, v_texCoord2).r; works!

hmm something is strange, I’ve copied all etc1 alpha channel textures of my rbg textures inside my search path folder, and now some of my textures are automaticall displayed correctly, without GLSL

anyone know whats going on?

Luckily for you I’ve spent a whole lot of time figuring out how to do this so I can help you out, private message me.