opengles3-book
opengles3-book copied to clipboard
example Hello_Triangle. glCreateShader() = 0
The example of Hello_Triangle. `GLuint LoadShader ( GLenum type, const char *shaderSrc ) { GLuint shader; GLint compiled;
// Create the shader object shader = glCreateShader ( type ); if (shader == 0) { return 0; }
// Load the shader source glShaderSource ( shader, 1, &shaderSrc, NULL );
// Compile the shader glCompileShader ( shader );
// Check the compile status glGetShaderiv ( shader, GL_COMPILE_STATUS, &compiled );
if ( !compiled ) { GLint infoLen = 0;
glGetShaderiv ( shader, GL_INFO_LOG_LENGTH, &infoLen );
if ( infoLen > 1 )
{
char *infoLog = malloc ( sizeof ( char ) * infoLen );
glGetShaderInfoLog ( shader, infoLen, NULL, infoLog );
esLogMessage ( "Error compiling shader:\n%s\n", infoLog );
free ( infoLog );
}
glDeleteShader ( shader );
return 0;
}
return shader;
}`
why glCreateShader() return 0? I didn't change any code.
And you can see "(Error) There is no context bound to the current thread." in console...
Base Windows 7 and VisualStudio 2013.
@OrangeWxc What GPU and OpenGL driver are you using? Which OpenGL ES 3.0 SDK? It sounds like somehow OpenGL ES context creation failed and glCreateShader is probably just the first entrypoint to be called.
On windows10 system,I use PowerVR_SDK 4.0. build a new code,Now,a new prolem:
FATAL - Exception thrown in GLES32Api::glGetnUniformfvKHR -> FATAL: No EGL context available for type GLES32Api when calling glGetnUniformfvKHR FATAL - Exception thrown in GLES32Api::glGetnUniformfvKHR -> FATAL: No EGL context available for type GLES32Api when calling glGetnUniformfvKHR FATAL - Exception thrown in GLES32Api::glGetTexParameterIuivEXT -> FATAL: No EGL context available for type GLES32Api when calling glGetTexParameterIuivEXT
Hello,
I am getting the same error. Not sure why I am getting this. I am using PowerVR SDK for linux. If you have any idea about this error, please share.
Thanks Ikshwaku
found one more thing: eglChooseConfig is returning zero "numConfigs". So "esCreateWindow" is returning before creating window surface and context, later giving error "There is no context bound to the current thread". Here I am not sure why I am getting "numConfigs" as zero. If you have any idea please let me know.
Thanks, Ikshwaku
I faced the same issue while trying to build another solution based on a sample.
The problem was in the _UNICODE preprocessor definition. I also had to switch the Character Set option to Use Multi-Byte Character Set.
I'm on Windows with vs 2017.
Hope it helps.