Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example Hello_Triangle. glCreateShader() = 0 #34

Open
OrangeWxc opened this issue Mar 14, 2016 · 6 comments
Open

example Hello_Triangle. glCreateShader() = 0 #34

OrangeWxc opened this issue Mar 14, 2016 · 6 comments

Comments

@OrangeWxc
Copy link

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.

@OrangeWxc
Copy link
Author

And you can see "(Error) There is no context bound to the current thread." in console...
Base Windows 7 and VisualStudio 2013.

@danginsburg
Copy link
Owner

@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.

@OrangeWxc
Copy link
Author

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

@ikshwaku
Copy link

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

@ikshwaku
Copy link

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

@EugeneKosmin
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants