Это мой вершинный шейдер и фрагментный шейдер:
static const char skybox_shader_vs[] =
"#version 330 core\n"
"\n"
"layout (location = 0) in vec3 in_position;\n"
"layout (location = 3) in vec2 in_texcoord;\n"
"\n"
"out vec2 tex_coord;\n"
"\n"
"uniform mat4 tc_rotate;\n"
"\n"
"void main(void)\n"
"{\n"
" gl_Position = tc_rotate * vec4(in_position, 1.0);\n"
" tex_coord = in_texcoord;\n"
"}\n"
;
----------------------------------------------------------------------
static const char skybox_shader_fs[] =
"#version 330 core\n"
"\n"
"in vec2 tex_coord;\n"
"\n"
"layout (location = 0) out vec4 color;\n"
"\n"
"uniform sampler2D tex;\n"
"uniform float lod;\n"
"\n"
"void main(void)\n"
"{\n"
" color = textureLod(tex, tex_coord,lod);\n"
"}\n"
;
После успешного связывания и использования программы я могу получить местоположение любой формы:
GLint location = glGetUniformLocation(mipmap_prog, "lod");
glUniform1f(location, 1);
, но когда я задаю местоположение таких форм:
static const char skybox_shader_fs[] =
"#version 330 core\n"
"\n"
"in vec2 tex_coord;\n"
"\n"
"layout (location = 0) out vec4 color;\n"
"\n"
"uniform sampler2D tex;\n"
"layout (location = 4)uniform float lod;\n"
"\n"
"void main(void)\n"
"{\n"
" color = textureLod(tex, tex_coord,lod);\n"
"}\n"
;
значение расслоения равно 0xffffffff, где моя ошибка?