Transform points from Layer local coordinates into RenderTexture local coordinates

Hi,

I’m trying to render some debug primitives onto a render target (RTT) that covers the whole screen, but I have some problems:

The points are taken from a layer(Layer), so if I’m right, I should transform these points from Layer local coords into worls coords, and then transform them from world coordinates to RTT local coords.

since I use OGL to render the data, I need to create a matrix for transform the modelview matrix. I use this transformations:

void RTT::draw()
{
@ beginWithClear(.0f, .0f, .0f);@
@ kmGLPushMatrix();@
@ transform();@
@ AffineTransform transGameToWorld = m_layer~~>getNodeToWorldTransform;@
// AffineTransform transWorldToNode = getWorldToNodeTransform();
@ AffineTransform transWorldToNode = *sprite~~>getWorldToNodeTransform;@
//AffineTransform trans = AffineTransformConcat(transGameToWorld, transWorldToNode);
@ AffineTransform trans = AffineTransformConcat;@
@ kmMat4 transfrom4x4;@
@ CGAffineToGL;@
@ kmGLMultMatrix;@
@ // render the debug data @
@ kmGLPopMatrix;@
@ end;@
}

This approach does not work, so I tried other solution: attach a secondary auxiliary node in the RTT. Now I position the aux node in the same position of the Layer and the data is painted inside this aux. node. To place the node I use this:
@
Point p = m_layer~~>convertToWorldSpace/*m_layer->getPosition*/);
p =*parent~~>convertToNodeSpace§; // _parent is the rtt
setPosition§;
@

This solution is wrong too.

Any advice?

Thanks.