#version 100
precision mediump float;
attribute vec3 in_position;
void main() {
gl_Position = vec4(in_position, 1);
}
#version 100
precision mediump float;
void main() {
gl_FragColor = vec4(0, 0, 1, 1);
}
GLuint gr_loadShader(const char* filePath, GLenum shaderType) {
FILE* file = resources::openFile(filePath, "rb");
if (!file) {
DLOG("Failed to open shader %s\n", filePath);
return 0;
}
fseek(file, 0, SEEK_END);
long fileSize = ftell(file);
fseek(file, 0, SEEK_SET);
char* shaderSource = (char*)malloc(fileSize + 1);
fread(shaderSource, fileSize, 1, file);
fclose(file);
shaderSource[fileSize] = '\0';
GLuint shaderID = glCreateShader(shaderType);
error("glCreateShader");
GLint result = GL_FALSE;
int InfoLogLength;
glShaderSource(shaderID, 1, (const GLchar**)&shaderSource, NULL);
glCompileShader(shaderID);
// Check the shader
glGetShaderiv(shaderID, GL_COMPILE_STATUS, &result);
glGetShaderiv(shaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
char errorMessage[InfoLogLength];
glGetShaderInfoLog(shaderID, InfoLogLength, NULL, errorMessage);
DLOG("%s\n", errorMessage);
return shaderID;
}
GLuint gr_createProgram(const char* vs, const char* fs) {
char vsFilePath[128];
char fsFilePath[128];
sprintf(vsFilePath, "assets/shaders/gles1/%s.vs", vs);
sprintf(fsFilePath, "assets/shaders/gles1/%s.fs", fs);
GLuint vsID = gr_loadShader(vsFilePath, GL_VERTEX_SHADER);
GLuint fsID = gr_loadShader(fsFilePath, GL_FRAGMENT_SHADER);
GLuint programID = glCreateProgram();
error("glCreateProgran");
glAttachShader(programID, vsID);
error("glAttachShader vs");
glAttachShader(programID, fsID);
error("glAttachShader fs");
glLinkProgram(programID);
error("glLinkProgram");
glDeleteShader(vsID);
glDeleteShader(fsID);
GLint result = GL_FALSE;
int InfoLogLength;
glGetProgramiv(programID, GL_LINK_STATUS, &result);
glGetProgramiv(programID, GL_INFO_LOG_LENGTH, &InfoLogLength);
char errorMessage[512]{'\0'};
glGetProgramInfoLog(programID, InfoLogLength, NULL, errorMessage);
DLOG("Program Info: %s\n", errorMessage);
return programID;
}
On Aug 12, 2016, at 8:06 AM, LJA <jahv...@gmail.com> wrote:
Hi,I have a very simple pair of shaders. After creating a program with them, glGetProgramInfoLog gives this warning:WARNING: Could not find vertex shader attribute 'webgl_178fd81400000002' to match BindAttributeLocation request.
…
Same code doesn't cause issues on desktop (OpenGL 2 at least)Why am I seeing this warning?
On Aug 13, 2016, at 2:28 AM, LJA <jahv...@gmail.com> wrote:Well the weird part is that I get the warning from the part of code I showed you: DLOG("Program Info: %s\n", errorMessage);
I get it without making calls to glBindAttributeLocation.
On Aug 15, 2016, at 4:48 AM, LJA <jahv...@gmail.com> wrote:I'm using osx and safari. Haven't had time to test other setups. Could ANGLE still be causing this?
On Aug 15, 2016, at 8:21 AM, LJA <jahv...@gmail.com> wrote:I now tested the same code in chrome. The attribute in question is "a_position". It's nothing I'm using in my shaders, but doing a search in my project reveals that SDL has some built in shader using it.Why am I seeing errors from a SDL shader after compiling my own shaders?
On Aug 16, 2016, at 12:20 AM, LJA <jahv...@gmail.com> wrote:Anyways, seems like the warning disappears when I remove the flag -s LEGACY_GL_EMULATION=1. I don't think I will need this flag so this issue isn't blocking me for now. I'll report back if I can find something else about this issue.
--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.