<p>I reckon your instructor is encouraging you to implement low-level rendering algorithms.</p>

<p>The obstacle to draw shapes using just points is the contradiction between continuous and discrete. Shapes are logically continuous if in its area every pixel is shaded. But you can not draw an actually continuous line using discrete points because infinite points are needed. If you draw points directly in the "world", you can not guarantee every pixel on the screen can be covered after projection, unless you set the interval small enough(which may be of quite low performance).</p>

<p>My advice is to maintain the world coordinates of the vertices of the shape but not draw it. Get the "projected" coordinates on screen and fill the area later using <a href="https://en.wikipedia.org/wiki/Digital_differential_analyzer_%28graphics_algorithm%29" rel="nofollow">DDA</a> or some other interpolation algorithms. "Projected" is the coordinates obtained by the three matrices(Projection, View, Model), I think you've heard of these. So in the filling process GLUT is used to draw points on the 2D screen, and cover every pixel in the area.</p>

CC BY-SA 3.0
2015-09-29T16:34:04.137Z
It might be that he does not need to draw a solid object! Or just draw in a 2d projection screen.
joojaa
CC BY-SA 3.0
2015-09-29T07:42:29.213Z
2015-09-29T07:42:29.213Z
zzdever
<p>I'm working on an assignment and I need to draw using only GL_POINTS. I realize this is an expensive approach but it's for the homework, so no GL_TRIANGLES / GL_POLYGON / GL_LINES etc.</p>

<p>First, I'm trying to understand the concept of using only points. Say I want to draw a square that's 100 x 100 pixels. Would I need four for-loops drawing 100 pixels each in straight lines to create the square? What if I want to fill the square with color?</p>

<p>I understand drawing a square using GL_POLYGON as that's fairly straight forward. We're using the GLUT library just to draw shapes with points.</p>

CC BY-SA 3.0
2015-09-23T17:23:14.007Z
[Meta discussion](http://meta.computergraphics.stackexchange.com/questions/167/how-should-we-respond-to-homework-questions) about homework questions.
trichoplax is on Codidact now
CC BY-SA 3.0
2015-09-23T18:34:42.750Z
Could you refine your question? You have a nice introduction, but it's difficult to know what you're really asking. How to use GL_POINTS? How to use points to draw a 2D shape? etc..
RichieSams
<opengl>
GLUT OpenGL - Drawing Shapes using only GL_POINTS
Chris
# GLUT OpenGL - Drawing Shapes using only GL_POINTS

(Asked by: username_0 on 2015-09-23)

I'm working on an assignment and I need to draw using only GL\_POINTS. I realize this is an expensive approach but it's for the homework, so no GL\_TRIANGLES / GL\_POLYGON / GL\_LINES etc.

First, I'm trying to understand the concept of using only points. Say I want to draw a square that's 100 x 100 pixels. Would I need four for-loops drawing 100 pixels each in straight lines to create the square? What if I want to fill the square with color?

I understand drawing a square using GL\_POLYGON as that's fairly straight forward. We're using the GLUT library just to draw shapes with points.

**Tags:** opengl

> **Comments:**
> **username_1**: [Meta discussion](http://meta.computergraphics.stackexchange.com/questions/167/how-should-we-respond-to-homework-questions) about homework questions.  
> **username_2**: Could you refine your question? You have a nice introduction, but it's difficult to know what you're really asking. How to use GL_POINTS? How to use points to draw a 2D shape? etc..  

---

## 1 answers

### Answer by username_3 on 2015-09-29. Score: 2

I reckon your instructor is encouraging you to implement low-level rendering algorithms.

The obstacle to draw shapes using just points is the contradiction between continuous and discrete. Shapes are logically continuous if in its area every pixel is shaded. But you can not draw an actually continuous line using discrete points because infinite points are needed. If you draw points directly in the "world", you can not guarantee every pixel on the screen can be covered after projection, unless you set the interval small enough(which may be of quite low performance).

My advice is to maintain the world coordinates of the vertices of the shape but not draw it. Get the "projected" coordinates on screen and fill the area later using [DDA](https://en.wikipedia.org/wiki/Digital_differential_analyzer_%28graphics_algorithm%29) or some other interpolation algorithms. "Projected" is the coordinates obtained by the three matrices(Projection, View, Model), I think you've heard of these. So in the filling process GLUT is used to draw points on the 2D screen, and cover every pixel in the area.

> **Comments:**
> **username_4**: It might be that he does not need to draw a solid object! Or just draw in a 2d projection screen.  

---

