How to access a sampler2d
clankill3r opened this issue · 1 comments
clankill3r commented
How can I access a texture from a shader?
Or set a uniform?
My html looks like this:
<html>
<head>
<title>Loading Shader</title>
<script type="text/javascript" src="https://rawgit.com/patriciogonzalezvivo/glslCanvas/master/dist/GlslCanvas.js"></script>
<style>
body {
margin:0px;
}
</style>
</head>
<body>
<canvas class="glslCanvas" data-fragment-url="shader.frag" data-textures="pic.png" width="500" height="500"></canvas>
</body>
</html>
patriciogonzalezvivo commented
There is a part of the README.md that goes through it.
if in the HTML object you do data-textures="texture.jpg"
Then in the shader will be accesible as:
uniform sampler2D u_tex0;