Interface

HsGLContext

Description [src]

interface Hs.GLContext : GObject.Object

An interface defining an OpenGL context.

Cores should use hs_core_create_gl_context() within load_rom() to create a context.

Frontends must implement Hs.FrontendInterface.create_gl_context and create a context within it.

HsGLContext needs to be realized before being used, using hs_gl_context_realize(). This can fail, for example if the core requested an unavailable profile or version. If that happens, the core should try a different configuration or software rendering if possible, before failing to load entirely.

After that, the context needs to be resized using hs_gl_context_set_size(). This can be done at any time.

The core must render its output into the default framebuffer, provided by the frontend and accessed with hs_gl_context_get_default_framebuffer(). The framebuffer will have a color attachment, as well as depth and stencil attachment according to the flags passed into create_gl_context().

Use hs_gl_context_get_proc_address() to retrieve OpenGL symbols if the core doesn’t have a way to do it on its own.

After rendering each frame, the core must call hs_gl_context_swap_buffers().

OpenGL core output will often be vertically flipped. Pass HS_GL_FLAGS_FLIPPED flag when creating the context to let the frontend know that this is the case.

Prerequisite

In order to implement GLContext, your type must inherit fromGObject.

Instance methods

hs_gl_context_get_default_framebuffer

Gets the name of the default framebuffer object.

hs_gl_context_get_proc_address

Retrieves a GL symbol with the name name.

hs_gl_context_realize

Initializes GL resources for self.

hs_gl_context_set_colorburst

Sets the colorburst for this frame.

hs_gl_context_set_interlacing

Sets the interlacing mode for the current frame.

hs_gl_context_set_overscan

Sets the overscan within the framebuffer.

hs_gl_context_set_size

Resizes the default framebuffer to width × height.

hs_gl_context_swap_buffers

Swap buffers and end the current frame.

hs_gl_context_unrealize

Destroys GL resources for self.

Interface structure

struct HsGLContextInterface {
  GTypeInterface parent;
  gboolean (* realize) (
    HsGLContext* self,
    GError** error
  );
  void (* unrealize) (
    HsGLContext* self
  );
  void (* set_size) (
    HsGLContext* self,
    guint width,
    guint height
  );
  guint (* get_default_framebuffer) (
    HsGLContext* self
  );
  gpointer (* get_proc_address) (
    HsGLContext* self,
    const char* name
  );
  void (* swap_buffers) (
    HsGLContext* self
  );
  void (* set_interlacing) (
    HsGLContext* self,
    HsInterlacingMode mode
  );
  void (* set_overscan) (
    HsGLContext* self,
    HsBorder* overscan
  );
  void (* set_colorburst) (
    HsGLContext* self,
    float cycle_length,
    float line_offset,
    float field_offset
  );
  
}

No description available.

Interface members
parent
GTypeInterface
 

No description available.

realize
gboolean (* realize) (
    HsGLContext* self,
    GError** error
  )
 

No description available.

unrealize
void (* unrealize) (
    HsGLContext* self
  )
 

No description available.

set_size
void (* set_size) (
    HsGLContext* self,
    guint width,
    guint height
  )
 

No description available.

get_default_framebuffer
guint (* get_default_framebuffer) (
    HsGLContext* self
  )
 

No description available.

get_proc_address
gpointer (* get_proc_address) (
    HsGLContext* self,
    const char* name
  )
 

No description available.

swap_buffers
void (* swap_buffers) (
    HsGLContext* self
  )
 

No description available.

set_interlacing
void (* set_interlacing) (
    HsGLContext* self,
    HsInterlacingMode mode
  )
 

No description available.

set_overscan
void (* set_overscan) (
    HsGLContext* self,
    HsBorder* overscan
  )
 

No description available.

set_colorburst
void (* set_colorburst) (
    HsGLContext* self,
    float cycle_length,
    float line_offset,
    float field_offset
  )
 

No description available.

Virtual methods

Hs.GLContext.get_default_framebuffer

Gets the name of the default framebuffer object.

Hs.GLContext.get_proc_address

Retrieves a GL symbol with the name name.

Hs.GLContext.realize

Initializes GL resources for self.

Hs.GLContext.set_colorburst

Sets the colorburst for this frame.

Hs.GLContext.set_interlacing

Sets the interlacing mode for the current frame.

Hs.GLContext.set_overscan

Sets the overscan within the framebuffer.

Hs.GLContext.set_size

Resizes the default framebuffer to width × height.

Hs.GLContext.swap_buffers

Swap buffers and end the current frame.

Hs.GLContext.unrealize

Destroys GL resources for self.