SFML community forums

Bindings - other languages => Java => Topic started by: basmith on October 14, 2013, 09:48:46 pm

Title: SFMLNativeDrawer.MAX_VERTICES
Post by: basmith on October 14, 2013, 09:48:46 pm
I was playing around with JSFML (nice work btw), and was trying to draw a grid of quads (in a vertex array) to the screen.  The idea was to be a virtual terminal, where each quad's texture coordinates would index into the a font's texture using glyph texture-bounds.

Unfortunately, I can't draw very many quads due (from what I can tell) to the SFMLNativeDrawer.MAX_VERTICES limit of 1024.  I get an IndexOutOfBoundsException and the stack trace leads me there.

For example, about 12600 quads of 17x17 (size determined by font measurement) fit a 1280*720 display.  That's about 50k vertices.

That seems like a lot I guess; maybe there's a better way to do this.  I haven't tried RectangleShapes, but I imagine 12k draw calls is a rather bad idea.  Maybe I can use jogl/lwjgl?  I'm new to Java so I don't know the lay of the land yet.


Woops.  The example was off.  For 17x17, that's 3150 quads resulting in 12600 verts.  Still over the limit.  :P
Title: Re: SFMLNativeDrawer.MAX_VERTICES
Post by: pdinklag on October 15, 2013, 05:47:39 am
Gee, I could have sworn I lifted that limit, but it looks like I didn't! :-X I just pushed a commit that automatically enlarges the buffer as needed. Since no native code had to be changed, here's an updated jsfml.jar that should fix the problem, would be nice if you could give it a try: http://jsfml.org/files/jsfml-vertexlimit.zip

Thanks for reporting! This week I should be packing up another test release to contain another critical bugfix in native code.

By the way: I did not really get JOGL or LWJGL to work with JSFML yet, that topic is up for research. Groogy had it working with JOGL I think, this thread contains his log: http://en.sfml-dev.org/forums/index.php?topic=9223.0
Title: Re: SFMLNativeDrawer.MAX_VERTICES
Post by: basmith on October 15, 2013, 09:55:12 pm
Thanks, looks good!