Code: Select all
extern number multiplier;
vec4 effect(vec4 color, Image texture, vec2 textureCoords, vec2 screenCoords)
{
number average = (color.r + color.g + color.b) / 3 * multiplier;
return vec4(average, average, average, color.a);
}
Code: Select all
extern number multiplier;
vec4 effect(vec4 color, Image texture, vec2 textureCoords, vec2 screenCoords)
{
number average = (color.r + color.g + color.b) / 3 * multiplier;
return vec4(average, average, average, color.a);
}
While we're on the topic of canvases, what exactly were the requirements to playing a game that uses canvas? And are there any statistics as to how many people don't have these requirements? (Do they only need to download something for it to work or is it a hardware thing?)bartbes wrote:The easiest, and perhaps most correct, way to do this, is to disable the pixeleffect when you don't want to use it anymore. However, this is a pretty slow operation (specifically, setting it is), so then you're left to group your rectangles and images, or even pre-render some of it onto canvases.
It's mainly a driver thing. The current Canvas implementation uses OpenGL framebuffers. They were introduced in OpenGL 3.0 and before that with the framebuffer extension. If the graphics card vendor was motivated enough to write drivers for at least OpenGL 3.0 or the extension, it is possible to use Canvases. It's likely that NVIDIA had it in all their (desktop) cards back in 2008 when OpenGL 3.0 was released. Intel only recently started to support OpenGL 3.0 with their drivers.OmarShehata wrote:While we're on the topic of canvases, what exactly were the requirements to playing a game that uses canvas? And are there any statistics as to how many people don't have these requirements? (Do they only need to download something for it to work or is it a hardware thing?)
Hello,BlackBulletIV wrote:I've just started experimenting with shaders. It seems to me that you need handle images, text, and other things a bit differently than stuff like shapes. For example, I wrote this shader which makes everything grey and allows things to flicker through the multiplier:
When working with a drawn rectangle, it works fine. When working with images and text, everything turns into greyscale boxes. Do I need to use the texture or something? If so, how would you go about using this in fullscreen effects? Thanks.Code: Select all
extern number multiplier; vec4 effect(vec4 color, Image texture, vec2 textureCoords, vec2 screenCoords) { number average = (color.r + color.g + color.b) / 3 * multiplier; return vec4(average, average, average, color.a); }
Code: Select all
extern number multiplier;
vec4 effect(vec4 color, Image texture, vec2 textureCoords, vec2 screenCoords)
{
vec4 color_pt = texture2D(texture, textureCoords);
number average = (color_pt.r + color_pt.g + color_pt.b) / 3 * multiplier;
return vec4(average, average, average, color_pt.a);
}
Users browsing this forum: Ahrefs [Bot] and 2 guests