- Modifié
Help with SDL Runtime.
I am writing a Spine runtime for SDL(willing to open-source if it works), and until now everything went smoothly (Using SFML Runtime as reference). However i'am having a hard time getting the correct UV coordinates... everything else is working.
I am pretty sure the problem is here, this is from the sfml-runtime:
texture = (Texture * )((AtlasRegion * )regionAttachment->rendererObject)->page->rendererObject;
auto size = texture.getSize();
vertices[0].texCoords.x = regionAttachment->uvs[VERTEX_X1] * size.x;
vertices[0].texCoords.y = regionAttachment->uvs[VERTEX_Y1] * size.y;
I am doing this:
texture = (GLTexture * )((AtlasRegion * )regionAttachment->rendererObject)->page->rendererObject;
auto size = {hardCodedSizeForTesting, hardCodedSizeForTesting};
vertices[0].setUv(regionAttachment->uvs[VERTEX_X1] * size.x, regionAttachment->uvs[VERTEX_Y1] * size.y);
The texture pointer here returns invalid, i cant see any special conversion in the sfml runtime. My texture class/struct needs a specific memory layout or something? Does the c runtime change the struct values?
Thank you!
Ok guys we got it.
Thanks anyway.
Sorry I didn't get to your post in time. If the texture was null, likely your _AtlasPage_createTexture
wasn't putting in the right rendererObject
value.
Check my repo.
https://github.com/GerogeChong/spine-sdl