Giter Site home page Giter Site logo

glabstraction.jl's Introduction

GLAbstraction

A simple library, which makes the use of OpenGL a little bit more convenient and Julian. If you have any questions, please open an issue.

There are some tutorials and examples.

Features

  • Some linear algebrae, to do all kinds of transformations.
  • All the different glUniform functions are wrapped and the right function is determined via multiple dispatch (works for FixedSizeArrays, Colors and Real numbers)
  • Buffers and Texture objects are wrapped, with best support for arrays of FixedSizeArrays, Colors and Reals.
  • An Array interface for Buffers and Textures, offering functions like push!, getindex, setindex!, etc for GPU arrays, just like you're used to from Julia Arrays.
  • Shader loading is simplified and offers templated shaders and interactive editing of shaders and type/error checks.
  • Offers the type RenderOject, which helps you preparing the OpenGL state to render data with a shader.
  • Event handling with Reactive
  • Two camera types (PerspectiveCamera and OrthogonalCamera), which can be instantiated with a list of React signals from GLWindow. You can also supply your own signals.
  • Some wrappers for often used functions, with embedded error handling and more Julian syntax

Example:

using ModernGL, GLWindow, GLAbstraction, GLFW, GeometryTypes

window = GLWindow.create_glcontext("Example", resolution=(512, 512), debugging=true)


const vsh = vert"""
{{GLSL_VERSION}}
in vec2 position;
void main(){
	gl_Position = vec4(position, 0, 1.0);
}
"""
const fsh = frag"""
{{GLSL_VERSION}}
out vec4 outColor;
void main() {
	outColor = vec4(1.0, 1.0, 1.0, 1.0);
}
"""

const triangle = std_renderobject(
	Dict{Symbol, Any}(
        :position => GLBuffer(Point2f0[(0.0, 0.5), (0.5, -0.5), (-0.5,-0.5)]),
    ),
	LazyShader(vsh, fsh)
)

glClearColor(0, 0, 0, 1)

while isopen(window)
  	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    render(triangle)
  	swapbuffers(window)
  	poll_glfw()
end

Credits

Thanks for all the great contributions

glabstraction.jl's People

Contributors

simondanisch avatar timholy avatar programmeroftheeve avatar sjkelly avatar alainlich avatar femtocleaner[bot] avatar levskaya avatar dpsanders avatar jingpengw avatar kwonoh avatar shashi avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.