Skip to content

Hlms generates shaders with locale aware numbers. #556

Description

@przemir

System Information

  • Ogre Version: 4.0.0 (unstable)
  • Operating System / Platform: OpenSuse Slowroll
  • RenderSystem: OpenGL, Vulkan

Detailled description

LwString::a(Float) may convert number with commas instead of dots:

Image

Later it goes to pieces:

Image

and this generate glsl shader

	***	hlms_shadowmap2_uv_max_y	0,428571
	***	hlms_shadowmap1_uv_min_x	0,000000
	***	hlms_shadowmap0_uv_min_y	0,000000
	***	hlms_shadowmap2_uv_min_y	0,285714
	***	hlms_shadowmap1_uv_max_x	0,500000
	***	hlms_shadowmap0_uv_min_x	0,000000
	***	hlms_shadowmap1_uv_min_y	0,285714
	***	hlms_shadowmap0_uv_max_x	1,000000
	***	hlms_shadowmap2_uv_max_x	1,000000
	***	hlms_shadowmap1_uv_max_y	0,428571
	***	hlms_shadowmap2_uv_min_x	0,500000
	***	hlms_shadowmap0_uv_max_y	0,285714

and

#define hlms_shadowmap0_uv_min float2( 0,000000, 0,000000 )
#define hlms_shadowmap0_uv_max float2( 1,000000, 0,285714 )

which causes shader compilation error.

Why it happened

In my case QApplication constructor changed locale settings.
std::setlocale(LC_NUMERIC, "") returns "pl_PL.utf8" and for Polish language commas are used instead of dots. Don't know why it affects linux but not windows.

Workaround

Placing
setlocale(LC_NUMERIC, "C");
after QApplication constructor helps (it is global setting though).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions