Skip to content

EGL/GBM troubles #6

Closed
Closed
@abandoned-cocoon

Description

@abandoned-cocoon

It seems that

prefix = 'EGL_'
assumed_version = [1,0]
version_prefix = 'EGL_VERSION_EGL_'

in raw/EGL/_types.py gives errors and should be

prefix = as_8_bit('EGL_')
assumed_version = [1,0]
version_prefix = as_8_bit('EGL_VERSION_EGL_')

The other issue is that I cannot call eglGetPlatformDisplayEXT to get a display because it's marked as part of an extension and pyopengl tries to check if the extension is present without specifying a display but my egl implementation (glvnd/mesa) answers with an error.
My workaround right now is

import OpenGL
import OpenGL.platform.egl
OpenGL.platform.PLATFORM = p = OpenGL.platform.egl.EGLPlatform()
from OpenGL.EGL import *
from OpenGL.EGL.EXT.platform_base import *
from OpenGL.EGL.MESA.platform_gbm import *
import ctypes

with open("/dev/dri/renderD128", "w") as f:
	gbm = ctypes.CDLL("libgbm.so")
	dev = gbm.gbm_create_device(f.fileno())

	eglGetPlatformDisplayEXT.extension = None
	oc = p.__class__.constructFunction
	def nc(*args, **kwargs):
		kwargs.update({"force_extension": True})
		return oc(p, *args, **kwargs)

	p.constructFunction = nc
	dpy = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, ctypes.c_void_p(dev), ctypes.c_void_p(0))
	del p.constructFunction
	print(dpy)

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