Well that's your subjective opinion and obviously I won't argue against that. I find myself fully comfortable with a combination of C/C++ and Python and that too is a subjective opinion, I do like to peek outside my comfort zone from time to time though as I think it's fun and out of the last four or so languages I've tried (OCaml, C#, Go and D) I'd say Go was the only one I'd see myself spending real time learning mainly due to it's concurrency properties which I find interesting and to a lesser extent other things in the language syntax/command repertoire which clicks with me. That said I've been holding off trying something 'serious' with it until the first stable release is out.
Haven't tried Go yet, but I've read its samples and I wasn't too impressed (like I was with Ocaml and its F# offspring, for instance). What is its "killer" feature that would convert people?
Code:
C/C++ float data[] = {1,2,3}; glBufferData(GL_ARRAY_BUFFER, data, GL_STATIC_DRAW); glCreateShader(GL_FRAGMENT_SHADER); glBegin(GL_TRIANGLES); glVertex(0.0f, 0.0f, 0.0f); Go var data = [...]float32 {1,2,3} gl.BufferData(gl.ARRAY_BUFFER, gl.STATIC_DRAW) gl.CreateShader(gl.FRAGMENT_SHADER) gl.Begin(gl.TRIANGLES) gl.Vertex(0.0, 0.0, 0.0)
Code:
glBufferData(GL_ARRAY_BUFFER, data, GL_STATIC_DRAW); glBufferData(GL_FRAGMENT_SHADER, data, GL_STATIC_DRAW);
That's not the case in the C# version (OpenTK):
Code:
GL.BufferData(BufferTarget.ArrayBuffer, data, BufferUsageHint.StaticDraw); GL.BufferData(ShaderType.FragmentShader, data, BufferUsageHint.StaticDraw); // compiler error, cannot convert ShaderType to BufferTarget implicitly
A proper C++ version would look like this:
Code:
GL::BufferData(BufferTarget::ArrayBuffer, data, BufferUsageHint::StaticDraw); GL::BufferData(ShaderType::FragmentShader, data, BufferUsageHint::StaticDraw); // compiler error
This is actually a case where C# is strictly superior to C++ both in performance and functionality. OpenGL code is a joy to ride in C# (just try it!), which is kind of important for game programming.
Leave a comment: