earlygrey/shapedrawer

Point

Closed this issue · 11 comments

I wanna draw the POINTs ) How ?

I'm not sure what you're trying to ask, could you try to be more specific?

shape.point(x, y, color?)
shape.points(Array, Array?)
shape.points(Array<x, y, color?>)

What would a point look like? A small filled circle? Maybe you're suggesting you want to define the radius in terms of pixels?

Why do circle calculations? Isn't it possible to draw a point at 2D coordinates at the viewport position?

What do you think about when you talk about a point?

First question: What shape does a point have for you? (a point in geometry does not have a shape...)
A circle?
A rectangle?
Another shape?

Second question: What size does a point have for you? (a point in geometry does not have a size...)
A single pixel? Bigger than a single pixel?
Should the size be relative to the screen resolution of the user (this will be totally different depending on the machine you're on...) or to the world resolution?

I guess we need to define what a "point" is for you because it will be something else for other people...

When drawing a line, what does the line consist of? Pixels? Texels?
The pixel can be sized based on world coordinates.

My English is poor and I use google translate.

I guess you just need to write a small method like this and then just use that?

public final void point(float x, float y, Color color) {
    shapeDrawer.filledRectangle(x - 0.5f, y - 0.5f, 1f, 1f, color);
}

I don't know how opengl works. But is it necessary for the every pixel to send its width and height to the video card? Isn't it enough to send the X, Y coordinates for thousands of pixels and send the pixel size once, because all pixels are the same size? Why overload your graphics card?

I don't know a lot about OpenGL neither so I cannot answer your question.
But if you don't run into performance problems, why not just try the method and see if it works for you?
What exactly are you trying the achieve? Do you want to draw thousands of separate pixels? If not, then the above should be just fine.

Naturally, I tried all the methods, and I think that for an array of pixels, you can optimize performance so as not to overload the video card. You may need a different shader to pass the pixel size (ONCE) and array of pixel coordinates each frame.

If you're looking to manipulate individual pixels this is not the way to do it, look into pixmaps if you want to do it using the CPU or shaders if you want to do it using the GPU.