So I've been trying to port my java game engine to c++ and I tried to make terrain generation. My code works well in java but in c++ it generates a plus point on y=0 and then connects some other to it and ruins my terrain.
Terrain creation is a specific subject and there are more than one way to create terrain. I have no idea what you are doing there because you didn't add enough comments.
Add more comments and try to explain it more.
My guess is, it is probably a miscalculation. Look carefully how many times loops run and calculations you made. This is all i can say until you give further info.
EDIT: Also it could be a comparison mistake. Check those also.
first of all make count a const variable, I wonder why this compiles without giving a warning for the arrays.
the size of an array has to be determined at compile-time but non-const ints can only be deduced at runtime so just make it const. constint count = TERRAIN_VERTICES * TERRAIN_VERTICES;
secondly did you want the last part of this to be *1 and not -1? int indices[6 * (TERRAIN_VERTICES-1) * (TERRAIN_VERTICES*1)];