How to calculate IntBuffer?

I referred the same tutorial. but it’s not mentioned how to calculate intbuffer…

You can’t calculate it automatically.

its sad… is there any other way to do it?

Create the vertices line by line and then set your indexes array?

Or what exactly do you want to have calculated

you should find the tesselation function that match your need.
=> create triangle
=> list vertices index into your Index (IntBuffer)

to complete the tutorial (wiki)
eg of cone + tesselation:

Actually i think we should define what you mean for automatically.

Because if you mean like a generateIndexes(mesh) method, that works for every mesh, this is not possible.

If you want to fill a 2d shape of which you have only the external edges, this is possible, search for triangulation algorithms.

If you know the order of your vertices, ie. you generated them from a known function, then you can calculate the index as well… you just need to join the points… for instance in your specific case (first screenshot), you can find the central vertex, and then join any group of two adjacent vertices with the central one.

BTW why do you want to do this?
Is it just to have more vertices (for eg. Lighting or a terrain) or do you have some special plan for it like a triangle based strategy map, because then you should use different meshes instead of one

yes, basically I am planing to make hax grid based terrain system.

A, B or C - Yes ^^

B :slight_smile:

So you need some way to store height information

probably in future, yes. my current target is make hex tile only.

Then what is a flat terrain system ?
I’m a bit confused right now

Edit: or do you mean something like

I am not going to make exactly “flat terrain system” but as of now in its initial stage it will be flat terrain only.
My Idea for Hex terrain system is like below.
Hex terrain will have many hex tiles.
The tiles can be added and removed or hide as per users preference. Idea is at a time 7 tiles will be on screen.
Each tile will have reference of its neighbors.
Each tile will have logical hex grid. The logical grid is basically virtually divided area of surface.
The logical grid will keep track of any assets on surface. e.g. trees grass, water, surface type, weather, characters and part of story line.
Event listeners and notification system will be implemented on tile and its logical grid.
Tile will be relatively small so that more better graphics can be presented.

Till now this is the idea.

So one tile is this huge hexagon from above?
So you can only see the “active” tile and its neighbours at a time?
Strange game idea I think XD

I do something like my picture above and for everey field I have a node which holds the ground, the objects etc for this position, you could not do that with one big mesh

Yes, its strange. I want to make plugable design. New story line and tile set can be added later as extension and will be co-relate with main story line.

Sounds cool, I hope we’ll see something from you
Now, have you solved your problem ?

Yes… I’ll share screenshots in some time.


Here is video.

now I can subdivide hex without manually indexing it.