Skip to content

Failed to compile vertex shader #29

@richardwilkes

Description

@richardwilkes

Trying to use this on the latest macOS release (Big Sur) and when running, I get the following error message:

failed to compile vertex shader:

                                  ERROR: 0:2: '' :  #version required and missing.
                                  ERROR: 0:2: 'attribute' : syntax error: syntax error

I'm using an OpenGLView directly, rather than some other framework, like glfw or sdl. Is there some special setup I need to do in order to get things to work that those libraries are doing (I'm assuming they work, but I haven't yet tried them to verify)?

For reference, here are some code snippets showing the setup being done for the view:

When creating the view:

NSViewPtr nsNewOpenGLView() {
	NSOpenGLPixelFormatAttribute attr[] = {
		NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
		NSOpenGLPFAColorSize,     24,
		NSOpenGLPFADepthSize,     16,
		NSOpenGLPFAAccelerated,
		// Opt-in to automatic GPU switching. CGL-only property.
		kCGLPFASupportsAutomaticGraphicsSwitching,
		NSOpenGLPFAAllowOfflineRenderers,
		0
	};
	id pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
	NSRect frame = NSMakeRect(0, 0, 0, 0);
	OpenGLView *view = [[OpenGLView alloc] initWithFrame:frame pixelFormat:pixFormat];
	[view setWantsBestResolutionOpenGLSurface:YES];
	[view setWantsLayer:YES];
	return (NSViewPtr)view;
}

The override for prepareOpenGL:

-(void)prepareOpenGL {
	[super prepareOpenGL];
	// Bind a default VBA to emulate OpenGL ES 2.
	GLuint defVBA;
	glGenVertexArrays(1, &defVBA);
	glBindVertexArray(defVBA);
	glEnable(GL_FRAMEBUFFER_SRGB);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions