max quads / verts

16 views
Skip to first unread message

LouisB

unread,
Jun 14, 2010, 11:12:18 AM6/14/10
to ReplicaIsland Coding Community
Chris, I hit the limit of quads / verts in the code. Is that there
because of hardware limitation? Can it be increased?

Grid.java:

if (vertsAcross < 0 || vertsAcross >= 65536) {
throw new IllegalArgumentException("quadsAcross");
}
if (vertsDown < 0 || vertsDown >= 65536) {
throw new IllegalArgumentException("quadsDown");
}
if (vertsAcross * vertsDown >= 65536) {
throw new IllegalArgumentException("quadsAcross * quadsDown >=
32768");
}

thanks,
Bart

James Luzwick

unread,
Jun 14, 2010, 1:51:30 PM6/14/10
to replica-island-...@googlegroups.com
It looks like this is due to the index buffer being allocated based on the size of a char which is 16 bits in Java. When we look at the limits the max index of a char index array they are 65535 and therefore we have those imposed limitations.  I'm assuming this was done so the code was more efficient and used less memory.  I'm betting you could retrofit this class and change the size of the buffer to an int which would give you 4294967295 indices, probably a lot more than you need. 

You might also be able to chain the Grids.  I'm not sure what you are making but you could have 3 Grids total for a map. 2 Grids side by side but 1 Grid in the middle to connect the tiles that would cross over.  Then implement code for Grid transitions during play.  This might be too complicated or it might create game lag as well. 

Anyways, my 2c.  If I am wrong, please tell me.

-Jim

Bart Hirst

unread,
Jun 14, 2010, 2:49:00 PM6/14/10
to replica-island-...@googlegroups.com
Jim, thanks for the insight.  Great help.  I'm definitely going to have to do one or the other (either expand the index array data type, or implement grid transitions) because 65535 for a side-scrolling type driving game isn't enough to work with.  I've never solved the "grid transition" problem so it might be fun to try.  On the other hand it might be laggy (as you say) or a waste of time?  I certainly don't need any extra work at this point.

James Luzwick

unread,
Jun 14, 2010, 4:53:59 PM6/14/10
to replica-island-...@googlegroups.com
Yeah, I would probably follow whatever Chris says.  I'm still fairly new to game development and learning the best I can.  Chris might have better suggestions since he has probably run into a problem like this before.  Glad I could help

-Jim

Chris Pruett

unread,
Jun 14, 2010, 6:38:13 PM6/14/10
to replica-island-...@googlegroups.com
This is indeed the size of the 16-bit GL_SHORT.  I'm not sure if OpenGL supports 32-bit indicies, but if so that'd be the way to go.

Chris

vecima

unread,
Aug 29, 2015, 4:43:13 PM8/29/15
to ReplicaIsland Coding Community
So, How would one go about supporting 32 bit indices?  I notice the draw and drawStrip methods are use GL10.GL_UNSIGNED_SHORT and GL11.GL_UNSIGNED_SHORT.  GL10 and GL11 don't have static vars for GL_UNSIGNED_INT, but GLES20 does.
I take it that means that all of the GL code for this game would have to be re-written to utilize GLES 2?  What would that effort look like?  I'm willing to take it on if it's "worth it", as 2 is supported on android 2.2 & later, and I might not even go below 4.0 for my game.

Chris Pruett

unread,
Aug 29, 2015, 5:19:11 PM8/29/15
to ReplicaIsland Coding Community

In theory the GLES2 API is very similar to GLES1, so it shouldn't be a tough transition, but I've not tired it myself so I'm not sure how much work it actually would be.


--
You received this message because you are subscribed to the Google Groups "ReplicaIsland Coding Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to replica-island-coding...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages