LWJGL3 project not working on Macbook Pro

Started by lucasfraser, January 18, 2016, 11:41:26

Previous topic - Next topic

lucasfraser

Hi guys,

Kind of a general question before I get into anything specific. I've been working on this game engine in LWJGL 3 for a while now and developing on windows. Everything is working fine on windows machines (amd, nvidia and intel integrated graphics cards). However I've recently purchased a Macbook Pro (retina with intel iris GPU) and am trying to get my code to run there too.

All the code is using VBOs, no textures, and GLSL version 330 shaders. I've had to add the following code into the glfw initialisation
        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
        glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);


The issue I am facing is that the window is appearing blank, just the clear colour. However I am getting no errors to trace down an issue.

Has anyone experienced this before? and if so how might i rectify this?

If not, does anyone have any ideas on what I can do to debug this issue on a mac?

Cheers,
Lucas

Kai

If you did not use the OpenGL >= 3.2 "core" profile before on Windows, then chances are, you are using OpenGL in a way that is incompatible with the core profile. It is correct that when you want to use OpenGL later than 3.1 on OS X you have to use the OpenGL core profile introduced with OpenGL 3.2.

My gut tells me that you are probably not using a Vertex Array Object (VAO) when rendering your data.
If not, then basically just do the following somewhere in your initialization:
GL30.glBindVertexArray(GL30.glGenVertexArrays());


Also, when you say you did not get any "errors", what do you mean? You sure are to get OpenGL errors when not using OpenGL correctly with the core profile. GL11.glGetError() should also indicate an error. To make sure that you indeed get error messages, do the following:
// Have this field somewhere in your class:
Closure debugProc;

// Set this as a GLFW window hint before creating the GLFW window:
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);

// Do this after the OpenGL context is initialized
debugProc = GLUtil.setupDebugMessageCallback();

This should print an error message in case you weren't using a VAO when making a draw call or doing vertex specification calls.

If the problem still persists you gonna have to show some code.

lucasfraser

Quote from: Kai on January 18, 2016, 12:05:36
If you did not use the OpenGL >= 3.2 "core" profile before on Windows, then chances are, you are using OpenGL in a way that is incompatible with the core profile. It is correct that when you want to use OpenGL later than 3.1 on OS X you have to use the OpenGL core profile introduced with OpenGL 3.2.

My gut tells me that you are probably not using a Vertex Array Object (VAO) when rendering your data.

Thanks for that Kai,

Yes I am using VAOs and my source is fully compatible with the core profile. I've been trying my best not to use any old style OpenGL calls and have managed this far.

I meant I wasnt getting any java errors but I'll implement that code you gave me to have a look at GL errors and report back. Thanks!

Cheers,
Lucas