Advertisement

Can't compile a shader (0:1(1): error: syntax error, unexpected NEW_IDENTIFIER)

Started by March 14, 2020 10:12 PM
4 comments, last by _WeirdCat_ 4 years, 10 months ago

I am trying to port android application to linux, i am stuck at shader compilation during runtime

0:1(1): error: syntax error, unexpected NEW_IDENTIFIER

precision highp float;
attribute vec3 Vpos;
varying highp vec2 vert;

void main()
{
vert = Vpos.xy;
gl_Position = vec4(Vpos.xy, 0.0, 1.0);
}

I tried to log this shader to see if i get some weird characters during reading

function goes like ALOG("$"+VertexShaderData);

Loading vertex shader /mnt/ext_sdcard/com.example.wirednavalbattle/files/shaders/fullscreen2d_vp.shader
$precision highp float;
attribute vec3 Vpos;
varying highp vec2 vert;

void main()
{
vert = Vpos.xy;
gl_Position = vec4(Vpos.xy, 0.0, 1.0);
}

0:1(1): error: syntax error, unexpected NEW_IDENTIFIER

x_X

Anyone?

What's the dollar doing up there ?

Advertisement

problem reports firs character is wrong? or at least at this position theres a problem so i decided to print loaded shader and add $ before it so i can verify if first character is the same as in the file ALOG("$"+VertexShaderData);

i believe it has something with the shader itself.

Wrong GLSL version maybe?

Someone here had a similar problem: https://stackoverflow.com/questions/21354301/glsl-syntax-problems-unexpected-new-identifier

Why are you compiling during runtime? You're supposed to compile shaders at… well… compile time.

yes seems adding #version 130 solved the errors thanks, ill take it from now

This topic is closed to new replies.

Advertisement