Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libgdx]TwoColorPolygonBatch vertex format differs from other Batches #1121

Closed
piotr-j opened this issue Jun 5, 2018 · 5 comments
Closed
Assignees

Comments

@piotr-j
Copy link
Contributor

piotr-j commented Jun 5, 2018

Looks like i didnt quite get it right in #1057, missed one corner case. Drawing text. BitmapFontCache uses TwoColorPolygonBatch#draw (Texture texture, float[] vertices, int offset, int count) and if theres more then 1 character it breaks the batch. Current solution cant be easily extended. Perhaps a flag for automatic conversion enabled by default?

Something like this might do the trick https://gist.github.com/piotr-j/669d77fc9b385d12a9a40c7258bc8b58

@badlogic
Copy link
Collaborator

badlogic commented Jun 6, 2018

I'm a little slow today, could you tell me how this is breaking the batch with BitmapFontCache?

@badlogic badlogic self-assigned this Jun 6, 2018
@piotr-j
Copy link
Contributor Author

piotr-j commented Jun 6, 2018

BitmapFontCache passes in vertices for a bunch of glyphs at once, but it doesnt know about additional float thats required for dark color. That makes it fail to render properly and all further draw calls until batch ends.

@NathanSweet
Copy link
Member

Does it make sense to render text using a TwoColorPolygonBatch? It's not just BitmapFontCache, it's any code that assumes the vertex data is the same as SpriteBatch.

@piotr-j
Copy link
Contributor Author

piotr-j commented Sep 3, 2018

While its clearly not needed, it makes it easier when you have one batch for everything. And the two color part is useful for gui, tho its somewhat out of scope for spine.

@NathanSweet
Copy link
Member

I guess if we decide to do it, the most reasonable way is to have draw (Texture texture, float[] vertices, int offset, int count) accept the standard SpriteBatch format and do a copy, then we'd have a separate TwoColorPolygonBatch-specific method for the two color format.

@NathanSweet NathanSweet changed the title [libgdx]TwoColorPolygonBatch draw bug [libgdx]TwoColorPolygonBatch vertex format differs from other Batches Sep 23, 2018
NathanSweet added a commit that referenced this issue Oct 18, 2018
… Batch format (5 attribute/vertex), new methods are provided to accept float[] vertex data containing two colors.

closes #1121
@NathanSweet NathanSweet removed the bug label Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants