4

OpenGL has a few functions like glGetString and glGetShaderInfoLog that return strings. What form of text encoding is used for these?

I assume, given that they're returned as a GLchar*, that it is ASCII encoded text contained in the return value but is this specified anywhere?

As a second and related point, what text encoding is expected by functions such as glShaderSource and glBindAttribLocation. Do GLSL programs have to be encoded in ASCII or can it be UTF-8?

Milliams
  • 1,474
  • 3
  • 21
  • 30
  • Related: https://stackoverflow.com/questions/36241598/vertex-shader-not-compiling-due-to-a-non-ascii-character. Is seems `glShaderSource` does not handle anything other than plain ASCII well. – Suma Dec 01 '18 at 13:48

2 Answers2

3

OpenGL 4.3 Compatibility Profile Specification, section 22.2, page 627:

String queries return pointers to UTF-8 encoded, null-terminated static strings describing properties of the current GL context.

As far as I can see the spec doesn't mention the encoding of glGetShaderInfoLog().

genpfault
  • 51,148
  • 11
  • 85
  • 139
0

From the GLSL 4.40 language specification

The source character set used for the OpenGL shading languages is Unicode in the UTF-8 encoding scheme.

https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.40.pdf

That said, I doubt you have much luck puttying ÅÄÖ in variable names but you should be able to have comments with non ASCII data in them.

John Leidegren
  • 59,920
  • 20
  • 131
  • 152