# Mac and 3.2 Core\_Profile

**URL:** <https://discourse.glfw.org/t/mac-and-3-2-core-profile/528>\
**Category:** support\
**Created:** [February 12, 2013, 11:16pm UTC](https://discourse.glfw.org/t/mac-and-3-2-core-profile/528 "2013-02-12T23:16:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [February 12, 2013, 11:16pm UTC](https://discourse.glfw.org/t/mac-and-3-2-core-profile/528/1 "2013-02-12T23:16:59Z")

</div>

**anonymous** wrote on [Tuesday, February 12, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/63ea83a0/#2893):

Hi everybody,

I am having a problem with glfw, glew, Mac and the 3.2 Core Profile.

I can open a Window just fine but nothing gets drawn. I researched the net and found this:

> <https://stackoverflow.com/questions/9017023/cannot-deploy-glfw-3-2>

which seems to be the same Problem but I couldn’t solve it (partly because I have no Idea what crossfire is supposed to be)

So here is my Code followed by the console output

```auto
int Render::openWindow(int width /* =0*/, int height /* =0*/, int antialising /* =0*/, int vsync /* =0*/, const char* title /* ="LS_Black"*/, int fullscreen /* =0*/) 
{
	
	glfwCloseWindow();
	/**
	 * Settings for the OpenGL-Window
	 */
	
	glfwOpenWindowHint(GLFW_FSAA_SAMPLES, antialising); //antialising
	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); //We want Version 3.2
	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
	glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //Set Profile to not fallback able
	glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
	glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, 1); //Don't want the user to resize the window
	glfwSwapInterval(vsync); // Vsync on or off

	/**
	 * Opening the Window
	 */
	int windowmode = GLFW_WINDOW;
	if (fullscreen)
	{
		windowmode = GLFW_FULLSCREEN;
	}

	if (!glfwOpenWindow(width, height, 0, 0, 0, 0, 32, 0, windowmode))
	{
		fprintf(stderr, "Failed to open OpenGL Window\n");
		return 0;
	}
	int major, minor, rev;

	glfwGetVersion(&major, &minor, &rev);
	fprintf(stderr, "Version: %d.%d.%d\n", major,minor,rev);
	/**
	 * Setting up GLEW
	 */
	glewExperimental = GL_TRUE;
	GLenum err = glewInit();
	if (err != GLEW_OK)
	{
		glfwTerminate();
		fprintf(stderr, "Failed to initialize GLEW\n");
		fprintf(stderr, "%s\n", glewGetErrorString(err));
		return 0;
	}
	glfwSetWindowTitle(title);
	fprintf(stderr, "0: %s\n", gluErrorString(glGetError()));
	return 1;
}

int main(int argc, char const *argv[])
{
	Render *myRender = new Render();
	myRender->resizeWindow(1024, 768);
	myRender->setKeyCallback(endLoop);
	myRender->setCloseCallback(closeWindow);

	GLfloat geometry[] = {
		-1.0f, -1.0f, 0.0f, 1.0f,
		1.0f, -1.0f, 0.0f, 1.0f,
		0.0f, 1.0f, 0.0f, 1.0f
	};

	GLfloat colors[] = {
		1.0f, 0.0f, 0.0f, 1.0f,
		0.0f, 1.0f, 0.0f, 1.0f,
		0.0f, 0.0f, 1.0f, 1.0f
	};

	glClearColor(0.0f, 0.0f, 0.4f, 0.0f);

	GLuint VertexArrayID;
	glGenVertexArrays(1,&VertexArrayID);
	glBindVertexArray(VertexArrayID);
	fprintf(stderr, "1: %s\n", gluErrorString(glGetError()));
	
	GLuint myObjectVertexBuffer;
	glGenBuffers(1, &myObjectVertexBuffer);
	glBindBuffer(GL_ARRAY_BUFFER,myObjectVertexBuffer);
	glBufferData(GL_ARRAY_BUFFER,12 * sizeof(GLfloat),geometry,GL_STATIC_DRAW);
	glVertexAttribPointer(0,4,GL_FLOAT,GL_FALSE,0,0);
	glEnableVertexAttribArray(0);
	fprintf(stderr, "2: %s\n", gluErrorString(glGetError()));

	GLuint ColorBufferID;
	glGenBuffers(1,&ColorBufferID);
	glBindBuffer(GL_ARRAY_BUFFER, ColorBufferID);
	glBufferData(GL_ARRAY_BUFFER,12 * sizeof(GLfloat),colors,GL_STATIC_DRAW);
	glVertexAttribPointer(1,4,GL_FLOAT,GL_FALSE,0,0);
	glEnableVertexAttribArray(1);
	fprintf(stderr, "3: %s\n", gluErrorString(glGetError()));

	
	//shader
	GLuint vertexShaderID = glCreateShader(GL_VERTEX_SHADER);
	glShaderSource(vertexShaderID,1,&VertexShader,NULL);
	glCompileShader(vertexShaderID);

	GLuint fragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
	glShaderSource(fragmentShaderID,1,&FragmentShader,NULL);
	glCompileShader(fragmentShaderID);

	GLuint programID = glCreateProgram();
	glAttachShader(programID,vertexShaderID);
	glAttachShader(programID,fragmentShaderID);
	glLinkProgram(programID);
	glUseProgram(programID);

	GLenum error = glGetError();
	if (error != GL_NO_ERROR)
	{
		fprintf(stderr, "4: %s \n", gluErrorString(error));
		exit(-1);
	}
	

	
	while(running)
	{
		glClear(GL_COLOR_BUFFER_BIT);
		
		glBindBuffer(GL_ARRAY_BUFFER,myObjectVertexBuffer);
		glEnableVertexAttribArray(0);

		glDrawArrays(GL_TRIANGLES,0,3); //Start from 0; 3 verticies
		glDisableVertexAttribArray(0);
		
		glfwSwapBuffers();
	}

	delete myRender;
	myRender = NULL;

	delete myRenderObjectManager;
	myRenderObjectManager = NULL;

	return 1;
}	

	
	while(running)
	{
		glClear(GL_COLOR_BUFFER_BIT);
		
		glBindBuffer(GL_ARRAY_BUFFER,myObjectVertexBuffer);
		glEnableVertexAttribArray(0);

		glDrawArrays(GL_TRIANGLES,0,3); //Start from 0; 3 verticies
		glDisableVertexAttribArray(0);
		
		glfwSwapBuffers();
	}

	delete myRender;
	myRender = NULL;

	delete myRenderObjectManager;
	myRenderObjectManager = NULL;

```

Console:

Version: 2.7.7  
0: invalid enumerant  
1: no error  
2: no error  
3: no error  
4: invalid operation

It seems that OpenGL 3.2 is not loaded

I have Mountain Lion running and OpenGL Extension Viewer says my System has the Core-Profile 3.2 available

Greetings

Stefan

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [March 19, 2013, 10:31pm UTC](https://discourse.glfw.org/t/mac-and-3-2-core-profile/528/2 "2013-03-19T22:31:51Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Tuesday, March 19, 2013](https://sourceforge.net/p/glfw/discussion/247562/thread/63ea83a0/#f15c):

glfwGetVersion retrieves the version of GLFW, not the version of the current context. The function you are looking for is glfwGetGLVersion.
