Miniquad draw pixels

Hello i want to draw pixels to the screen with miniquad.

I want to move them around via rust and then send an array to openGL to just render them. The pixels should have a color and a position. I am fine with having a fixed number of pixels (assuming variable amounts is harder to code/slower). This should be some sort of particle render at the end.

I have done this before using GL_POINTS but this is at least 10 years ago so my opengl is a bit rusty. I remember that i needed all those fragment shaders etc but i can't remember how i put them together to just draw an array of pixels.

I have looked at the examples but they all do already advanced stuff that i have trouble dumping down to my needs.

Also i am having trouble making sense of other 'normal' openGL code tutorials. I just don't know how i would translate them into the miniquad world.

i couldn't find a miniquad tutorial and only found the examples.

can you help me?

i do have code but its a frankenstein from the examples and doesn't even compile right. I would like to not show it and start from scratch. Where can i find help or a tutorial for miniquad?

i am really only interested in drawing pixels of various colors and maybe get some keyboard input.

1 Like

ok here is my broken code:
It doens't compile at all. i stitched thhis together form the examples but i am lost.

use miniquad::*;

const MAX_PARTICLES:i32 = 1024;

struct Stage {
  ctx: Context,
  pipeline: Pipeline,
  bindings: Bindings,

impl Stage {
  pub fn new(ctx: &mut Context) -> Stage{

    let vertices:&[f32] = &[100.0, 100.0, 100.0];

    let vertex_buffer = Buffer::immutable(ctx, BufferType::VertexBuffer, &vertices);

      let bindings = Bindings {
        vertex_buffers: vec![vertex_buffer],
        images: vec![],

    let shader = Shader::new(ctx, shader::VERTEX, shader::FRAGMENT, shader::meta()).unwrap();

    let pipeline = Pipeline::new(
      &[VertexAttribute::with_buffer("position", VertexFormat::Float3, 0),],

    Stage {
      position: Vec::with_capacity(MAX_PARTICLES),

impl EventHandlerFree for Stage {
  fn update(&mut self) {}

  fn draw(&mut self) {
    //draw pixel array

    //draw ackground gray
    self.ctx.clear(Some((0., 0.1, 0.1, 0.1)), None, None);


fn main() {
        conf::Conf {
            window_title: "Borkele".to_string(),
            window_width: 1024,
            window_height: 768,
            fullscreen: true,
        |ctx| UserData::free(Stage { ctx }),

mod shader {
    use miniquad::*;

    pub const VERTEX: &str = r#"#version 150
    in vec2 position;

    void main() {
        gl_Position = position;

    pub const FRAGMENT: &str = r#"#version 150
    out vec4 color;

    void main() {
        color = vec4(1.0, 1.0, 1.0, 1.0);

    pub fn meta() -> ShaderMeta {
        ShaderMeta {
            images: vec![],
            uniforms: UniformBlockLayout {
                uniforms: vec![],

@MrGloriousFast I think your best bet is to use the quad example from miniquad and strip the uniform bit, the loop, and if you are happy with just one color, the texture.

macro|miniquad has an active community on discord, it will be faster to get help there:,

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.