Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

CCRenderTexture: fetching Texture not working #116

Closed
rtabbara opened this issue Jan 27, 2015 · 2 comments
Closed

CCRenderTexture: fetching Texture not working #116

rtabbara opened this issue Jan 27, 2015 · 2 comments
Labels

Comments

@rtabbara
Copy link
Member

From the forums: http://forums.xamarin.com/discussion/31704/problem-creating-a-ccsprite-out-of-a-ccdrawnode#latest

@rtabbara rtabbara added the bug label Jan 27, 2015
@kjpou1
Copy link
Contributor

kjpou1 commented Jan 30, 2015

This should be a non issue. The user example was trying to draw to a render texture using a CCDrawNode which is actually part of the Scene Graph and follows flow of the Scene Graph.

To actually draw to the RenderTarget that is created you will need to use the CCDrawingPrimitives which draws to the GraphicsDevice which the RenderTarget is attached to example following:

        // create render texture containing draw node
        CCRenderTexture rtm = new CCRenderTexture(new CCSize(200.0f, 200.0f), new CCSize(200.0f, 200.0f), CCSurfaceFormat.Color, CCDepthFormat.Depth24Stencil8);

        rtm.Begin();

        CCDrawingPrimitives.Begin();

        CCDrawingPrimitives.DrawColor = new CCColor4B(255, 255, 255, 255);
        CCDrawingPrimitives.DrawSolidCircle(new CCPoint(100.0f, 100.0f), 75.0f, 0, 20);

        CCDrawingPrimitives.End();

        rtm.End();

        // create sprite from render texture
        CCSprite circleSprite = new CCSprite(rtm.Texture);
        circleSprite.Position = new CCPoint(200.0f, 200.0f);

        AddChild(circleSprite);

We will wait to hear back from the user before closing this but to me this works as designed.

@kjpou1
Copy link
Contributor

kjpou1 commented Feb 1, 2015

closed via f1eb03c

@kjpou1 kjpou1 closed this as completed Feb 1, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants