Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFMLNativeDrawer.MAX_VERTICES  (Read 5609 times)

0 Members and 1 Guest are viewing this topic.

basmith

  • Newbie
  • *
  • Posts: 3
    • View Profile
SFMLNativeDrawer.MAX_VERTICES
« 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.

Edit:

Woops.  The example was off.  For 17x17, that's 3150 quads resulting in 12600 verts.  Still over the limit.  :P
« Last Edit: October 14, 2013, 09:55:28 pm by basmith »

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: SFMLNativeDrawer.MAX_VERTICES
« Reply #1 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
JSFML - The Java binding to SFML.

basmith

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFMLNativeDrawer.MAX_VERTICES
« Reply #2 on: October 15, 2013, 09:55:12 pm »
Thanks, looks good!