To answer your first question, try pulling the latest code and use one of these two functions:
- (BOOL) buildWithDisplayObject:(PXDisplayObject *)obj; - (BOOL) build:(PXGLMatrix)matrix; |
These functions may change in the future, however they will build/ink your object if it has never built before, or if something has changed.
It unfortunately needs a matrix, which can be defined by the display object, however it doesn't have a reference to it's parent, so for now you need to give it ex:
[self.graphics build:self]; |
As for the second question, the TextureData must work in pixels, as it has a 1 and 1 understanding with gl textures which only work in pixels. You can set the content scale factor of the texture data that you are creating to PXGLGetContentScaleFactor(), this would give it whatever scale factor you are working with, and thus should have the correct quantity of pixels.
Ex.
float f = PXGLGetContentScaleFactor(); float w = self.stage.stageWidth * f; float h = self.stage.stageHeight * f; PXTextureData *td = [[PXTextureData alloc] initWithWidth:w height:h transparency:YES fillColor:0x00FFFFFF contentScaleFactor:f]; |
Let me know if this helps,
Update: You no longer need to call build, it will just work now when using render to texture. It should have built for you prior to calling renderToTexture, and now it will! :-)
It looks like you're new here. If you want to get involved, click one of these buttons!