How does opengl work?

Started by
1 comment, last by chowe6685 19 years, 6 months ago
Hi, today i was trying to learn software rasterization and now i can draw 2d lines using the bresenham algorithm. It got me thinking, how does opengl actualy draw lines. I mean, in my line function, you pass in 2 points and it draws a line between them by plotting pixels. With opengl, u define two points and call glBegin(GL_LINES) does opengl do pretty much the same thing and use the same algos as software except implements them on graphics cards or is it completly different? Is it possible to draw hardware lines without a graphics api? Thanks for any info
Advertisement
Quote:Original post by one mind
Hi, today i was trying to learn software rasterization and now i can draw 2d lines using the bresenham algorithm. It got me thinking, how does opengl actualy draw lines. I mean, in my line function, you pass in 2 points and it draws a line between them by plotting pixels.


I'm sure that that's just what OpenGL does too, although it's implemented in hardware (or at least partially in hardware)

Quote:
With opengl, u define two points and call glBegin(GL_LINES)
does opengl do pretty much the same thing and use the same algos as software except implements them on graphics cards or is it completly different?


There are not all that many different ways of drawing lines. Of course if you have antialiasing enabled it would work differently, but yes, it's basically the same

Quote:
Is it possible to draw hardware lines without a graphics api?


Only if you're prepared to program the hardware directly, this has several problems:
- It's hardware-specific
- It's likely to be extremely difficult
- It will have severe OS incompatibility issues because of the complexity of having to gain permissions to directly poke the hardware on modern OSs.

Mark
I actually think most consumer level cards draw lines by using two really thin triangles. This explains why the performance for large numbers of lines can be poor.

This topic is closed to new replies.

Advertisement