OpenGL Error #132

Fragment shader failed to compile with the following errors:
ERROR: 0:6: error(#132) Syntax error: “<” parse error
ERROR: error(#273) 1 compilation errors. No code generated

The weirdest problem is that I don’t even have a < in my code.
I can’t see what my problem is and I am using a tutorial at

#version 410 core
out vec3 color;

void main(){
	color = vec3(1, 0, 0);


I’ve already have strange errors like this one. Every time the reason was :

  • I go on internet to found some code
  • I copy/paste some GLSL code from my browser to my source code editor
  • the internet page use a special character code page or UTF8 or whatever
  • GLSL compiler only accept ANSI characters

=> GLSL compilation failed

The solution is to convert the GLSL code copied from the browser to regular ANSI text, using notepad++ for example.

I copied it by hand and not copy and paste though O.o
I load it from a file with an std::fstream.

So try use GDebugger (or an equivalent) to see what GLSL code did the GPU receive, this is how I found my problem with text encoding, and yours seems very close.

Debug String: Detected error: The debugged process asked for an extension function pointer (glCreateShader) from one render context, but called this function pointer in another render context (context #2)
I came up with this, but I don’t do anything with a context apart from the way the tutorial has two. but when I create the shader the other context is deleted and says so in gDEBugger (nice program btw)

int Graphics::initOpenGL(){
deviceContext = new HDC;
*deviceContext = GetDC(*hWnd);

memset(&pfd, 0, sizeof(pfd));

pfd.nSize = sizeof(pfd);
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
pfd.cDepthBits = 32;
pfd.iLayerType = PFD_MAIN_PLANE;

int pixelFormat = ChoosePixelFormat(*deviceContext, &pfd);
if (pixelFormat == NULL){
LogFatal(_Exception("Pixel Format Error", this));
return 1;
if (SetPixelFormat(*deviceContext, pixelFormat, &pfd) == false){
LogFatal(_Exception("Pixel Set Error", this));
return 1;

// Create OpenGL 2.1 Context

HGLRC tempOpenGLContext = wglCreateContext(*deviceContext);
wglMakeCurrent(*deviceContext, tempOpenGLContext);

// Upgrade to OpenGL 4.0

if (glewInit() != GLEW_OK){
LogFatal(_Exception("Init Glew Error", this));
return 1;

int attributes[] = {
glContext = new HGLRC();
if (wglewIsSupported("WGL_ARB_create_context") == 1){
*glContext = wglCreateContextAttribsARB(*deviceContext, NULL, attributes);
wglMakeCurrent(NULL, NULL);
wglMakeCurrent(*deviceContext, *glContext);

*glContext = tempOpenGLContext;

int glVersion[2] = { -1, -1 };
glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]);
glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]);
LogMessage("Using OpenGL " + glVersion[0] + '.' + glVersion[1]);

return 0;

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.