-
Create a texture exactly under the mouse?I know this may not be the ideal place to ask, but I couldn't find much on the examples. If I want to create a new texture (4x4, each pixel a bit different) that is placed under the mouse cursor, how would I go about it? Currently I have a simple buffer sent every frame that clears the window and nothing more. Also I apologize if this question could be pretty obvious. I've only worked with SDL's renderer and raw OpenGL coordinates :P. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm not sure exactly what your goal is. A "texture" has a very specific meaning in graphics APIs and positioning them requires applying a transformation matrix to it in a shader. So, with that out of the way, do you actually want to plot pixels? Or do you want a higher-level abstraction that gives you control over concepts like textures and transformation matrices? If you want to plot pixels, then you can use the pixels/examples/conway/src/main.rs Lines 76 to 98 in 41063db |
Beta Was this translation helpful? Give feedback.
I'm not sure exactly what your goal is. A "texture" has a very specific meaning in graphics APIs and positioning them requires applying a transformation matrix to it in a shader.
pixels
does not give you access to textures and shaders in the traditional graphics model. You are only given an array of bytes and it is up to you to plot pixels within the array. The reason for this is becausepixels
is designed for writing emulators and software renderers. I can't be certain if you intend to plot pixels, but it's safest to not make assumptions.So, with that out of the way, do you actually want to plot pixels? Or do you want a higher-level abstraction that gives you control over concepts like …