trzy / Supermodel

Official repository of the Sega Model 3 arcade emulator.

Home Page:https://supermodel3.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Legacy renderer segfault on macOS

trzy opened this issue · comments

When running with the legacy renderer, CCrosshair::Init() crashes when it hits this line:

glGenVertexArrays(1, &m_vao);

This is because glGenVertexArrays() does not exist in GL 2.1 and we set a GL 2.1 context when running the legacy engine.

The fix is to backport the crosshair code to use simple GL 2.1 functions for rendering.

hmm, yes
It works on windows because it creates a compatibility profile to run the legacy renderer, which means you can use depreciated functions. So old/new work together. But of course this doesn't work for apple because they only support core contexts. So I guess this gets stuck at 2.1 when creating a compatibility opengl context, which of course means glGenVertexAarrays doesn't exist

How glGenVertexAarrays works in a compatibility profile is 0 is reserved for like a default vertex array object.

Either you could port the new renderer to say 4.1, this probably isn't a major task, or just check to see if the function pointers go
glGenVertexArray and glBindVertexArray exist, if not just skip them. It should still work but might have to call the glAttributePointers and enables every time.