Open MasseGuillaume opened 10 years ago
You need OpenGL 4.1 to run the game.
@MasseGuillaume I ported the game to OpenGL 3.1 https://github.com/osa1/hcraft
Graphics looks a bit buggy though. I'm not sure if the original version is also like this. @nandor could you try and tell me if something's wrong in my port?
Do you have an ATI card? There's a chance I'm doing something stupid that NVIDIA drivers don't care about, but the OpenGL spec forbids it.
No, I'm trying on onboard Intel.
What I'm seeing may not be a buggy rendering, I'm just saying it doesn't look great but I'm not sure if this is because I messed with stuff while working on porting to OpenGL 3.1.
I've used cube map arrays & 3D textures, maybe those are not supported on Intel GPUs.
I'll post a screenshot tonight.
I've just tested it on my computer, it works fine, although in my opinion it's not correct. In order to port it, you should change the algorithm.
I have used OpenGL 4.0+ features in order to minimize the amount of data transferred between the CPU and the GPU. I have a large global mesh containing all the vertex, normal and UV data (3Mb) and a cube map array containing the textures for the cubes. Individual chunks only have an index array and small 16x16x16 texture which contains the IDs of the blocks. When I render a face, I look up the ID of the cube in the 3D texture and select the corresponding cube map from the array. I'm not sure how efficient this algorithm is. In terms of bandwidth, I think it's okay (when a chunk is modified, only a new IBO and a 3D texture have to be uploaded).
To correctly port the game to OpenGL 3.1, you'd have to remove everything related to cube map arrays (they were introduced in OpenGL 4.0).
I also compared my port with original version on a computer that supports GL 4 and results looked pretty similar. I think I'm doing what you describe using an extension https://github.com/osa1/hcraft/commit/0d081c846cd53133c9dde2262583c975ed619209#diff-f96787e0aa93b3ae45a62013d85097f1R5 so it's not necessary to rewrite the whole rendering algorithm.
after
Unable to create OpenGL context Cannot create window