Skip to content

support uniform textures and other compose methods#125

Open
fisherevans wants to merge 1 commit intogopxl:mainfrom
fisherevans:fisher/support-uniform-textures
Open

support uniform textures and other compose methods#125
fisherevans wants to merge 1 commit intogopxl:mainfrom
fisherevans:fisher/support-uniform-textures

Conversation

@fisherevans
Copy link
Copy Markdown

This PR does two things:

  • allow users to pass in uniform shaders
  • add support for Screen and Multiply composition methods.

Shader example

var someTex *glhf.Texture
var canvas *opengl.Canvas
canvas.SetUniformTexture("uBackgroundTexture", someTex, 0)

This is how you would pass in the uniform texture to a shader like this

uniform sampler2D uBackgroundTexture;

Compose example

Using canvas.SetComposeMethod(pixel.ComposeMultiply) allows you to achieve this kind of lighting:
https://www.slembcke.net/blog/2DLightingTechniques#screen-space-lightmaps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant