EAGL.Error (eagl v0.7.0)

View Source

OpenGL error checking and reporting utilities.

Provides Wings3D-inspired error handling patterns with meaningful abstractions for development and debugging.

Original Source

Error handling patterns are inspired by Wings3D's wings_gl.erl module: https://github.com/dgud/wings/blob/master/src/wings_gl.erl

Usage

import EAGL.Error

# Check for errors with context
check("After buffer creation")

# Get error descriptions
error_string(1280)  # "GL_INVALID_ENUM"

# Raise on error (debugging)
check!("Critical operation")

Summary

Functions

Check for OpenGL errors and print them. Similar to Wings3D's check_error/2 function.

Check for OpenGL errors and raise an exception if one is found. Useful for development and debugging.

Get a human-readable string for an OpenGL error code. Similar to Wings3D's error_string/1 function.

Functions

check(context \\ "OpenGL")

@spec check(String.t()) :: :ok | {:error, String.t()}

Check for OpenGL errors and print them. Similar to Wings3D's check_error/2 function.

Parameters

  • context: String describing the context where the error check is performed

Returns

  • :ok if no error
  • {:error, error_message} if an error occurred

Example

EAGL.Error.check("After buffer creation")
EAGL.Error.check("Shader compilation")

check!(context \\ "OpenGL")

@spec check!(String.t()) :: :ok

Check for OpenGL errors and raise an exception if one is found. Useful for development and debugging.

error_string(error_code)

@spec error_string(integer()) :: String.t()

Get a human-readable string for an OpenGL error code. Similar to Wings3D's error_string/1 function.