Skip to content

Commit 17f48c6

Browse files
committed
color
1 parent b19b248 commit 17f48c6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/engine/renderer/gl_shader.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3063,14 +3063,19 @@ class u_Color :
30633063
};
30643064

30653065
class u_ColorGlobal :
3066-
GLUniform1ui {
3066+
GLUniform1i {
30673067
public:
30683068
u_ColorGlobal( GLShader* shader ) :
3069-
GLUniform1ui( shader, "u_ColorGlobal", true ) {
3069+
GLUniform1i( shader, "u_ColorGlobal", true ) {
30703070
}
30713071

30723072
void SetUniform_ColorGlobal( const Color::Color& color ) {
3073-
this->SetValue( packUnorm4x8( color.ToArray() ) );
3073+
/* HACK: Store uint32_t as int32_t to be compatible with GLSL 1.20,
3074+
the GLSL code will convert back to uint32_t. */
3075+
uint32_t uColor = packUnorm4x8( color.ToArray() );
3076+
int32_t iColor;
3077+
memcpy( &iColor, &uColor, sizeof( iColor ) );
3078+
this->SetValue( iColor );
30743079
}
30753080
};
30763081

0 commit comments

Comments
 (0)