SDL OpenGL terrain bug

Hello!

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.

Code: http://pastebin.com/Azki70LN
Image: http://imgur.com/uJKCFRK
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.
Last edited on
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.
const int 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)];
Thanks!
I would never figure this out as it works in java.
what helped you?
Is your problem solved now? O.o
The "*1" had to be "-1"
Topic archived. No new replies allowed.