Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!
Moderators: Pete, Mods
-
Mentat
- Veteran
- Posts: 409
- Joined: Tue Aug 07, 2007 3:39 pm
- Location: NC, US
Post
by Mentat » Thu Nov 29, 2007 8:54 pm
I just figured out how to do it. My book was talking about rasterization of polygons. Though it does some complicated stuff with vectors and matricies. I didn't figure out how to do it the way the book said, but the chapter/section on culling did lead me to a question. Which in turn, led me to an idea of filling a triangle by sweeping a line. Unfortunately, my design only works if the 2nd point is to the left of the 3rd (By the nature of the For loops).
So are there better ways, and ways that don't leave holes at the edges?
And what is the deffinition of rasterization. The book says everything about rasterization except the definition.

For any grievances posted above, I blame whoever is in charge . . .
-
burger2227
- Veteran
- Posts: 2445
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Post
by burger2227 » Thu Nov 29, 2007 11:29 pm
You did not mention what programming language, but QBasic can use PAINT. It requires an enclosed shape of one border color only.
PAINT(x, y), fillcolor, bordercolor
You also have to place the PAINT coordinates x and y inside of the shape.
Ted
-
k7
- Coder
- Posts: 41
- Joined: Wed Aug 01, 2007 7:38 am
- Location: Tasmania, Australia
-
Contact:
Post
by k7 » Fri Nov 30, 2007 12:00 am
I can't remember the proper syntax of PAINT, but I once did it with it by painting in the centre of the triangle:
PAINT(width/2, height/2), fillcolor, bordercolour.
-
nkk_kan
- Veteran
- Posts: 57
- Joined: Thu Jun 01, 2006 10:45 am
- Location: Gujrat,India,Asia
-
Contact:
Post
by nkk_kan » Fri Nov 30, 2007 6:22 am
Rasterization or rasterisation is the task of taking an image described in a vector graphics format (shapes) and converting it into a raster image (pixels or dots) for output on a video display or printer.
and you should get good info on this too..
http://en.wikipedia.org/wiki/Rasterisation
because i think this is what you are looking for..
-
Mentat
- Veteran
- Posts: 409
- Joined: Tue Aug 07, 2007 3:39 pm
- Location: NC, US
Post
by Mentat » Fri Nov 30, 2007 6:54 am
I don't want to use paint due to the possibility of a sideways triangle (a line). I forgot to mention, these triangles are in 3D.
For any grievances posted above, I blame whoever is in charge . . .
-
D.S
- Coder
- Posts: 38
- Joined: Wed Sep 14, 2005 7:37 am
Post
by D.S » Fri Nov 30, 2007 9:21 am
Relsoft's 3d tutorials talk about polygon filling (in the vector article). The math was a little over my head, but it probably wont be for you.
Also, one of his programs uses the PAINT statement to fill a 3d box. You can check that out too.
-
Nodtveidt
- Veteran
- Posts: 826
- Joined: Sun Jul 25, 2004 4:24 am
- Location: Quebradillas, PR
-
Contact:
Post
by Nodtveidt » Fri Nov 30, 2007 7:58 pm
Honestly? The best way to fill a triangle is to just use OpenGL.

-
Mentat
- Veteran
- Posts: 409
- Joined: Tue Aug 07, 2007 3:39 pm
- Location: NC, US
Post
by Mentat » Fri Nov 30, 2007 9:21 pm
Nodtveidt wrote:Honestly? The best way to fill a triangle is to just use OpenGL.

In FB?
I wouldn't be surprised if it could.
For any grievances posted above, I blame whoever is in charge . . .
-
Nodtveidt
- Veteran
- Posts: 826
- Joined: Sun Jul 25, 2004 4:24 am
- Location: Quebradillas, PR
-
Contact:
Post
by Nodtveidt » Sat Dec 01, 2007 7:58 am
Oh, if you're using FB then you can just use OpenGL anyways. No point in reinventing the wheel.
-
Mentat
- Veteran
- Posts: 409
- Joined: Tue Aug 07, 2007 3:39 pm
- Location: NC, US
Post
by Mentat » Sat Dec 01, 2007 8:28 am
Nodtveidt wrote:Oh, if you're using FB then you can just use OpenGL anyways. No point in reinventing the wheel.
Ohhhhhhh. I thought OpenGL was just for C++.
For any grievances posted above, I blame whoever is in charge . . .
-
Codemss
- Veteran
- Posts: 124
- Joined: Sun Jun 24, 2007 6:49 am
- Location: Utrecht, The Netherlands
-
Contact:
Post
by Codemss » Sun Dec 02, 2007 6:26 am
Well, I thibk it has something to do with interpolation and flat bottom and flat top triangles. Check out this article:
http://www.petesqbsite.com/sections/tut ... apter3.htm
If you scroll a bit down, to: 'III. Different Polygon fillers', there is MUCH info on how to make polygon fillers. Solid, but also with interpolating colours, and even environment mapped polygons.
Also look on Petesqbsite > tutorials > Graphics, then look at some of the 3d series (the link I sended you is that from Relsoft).
-
Nodtveidt
- Veteran
- Posts: 826
- Joined: Sun Jul 25, 2004 4:24 am
- Location: Quebradillas, PR
-
Contact:
Post
by Nodtveidt » Thu Dec 06, 2007 10:47 pm
Mentat wrote:Ohhhhhhh. I thought OpenGL was just for C++.
Hehe, of course not. The headers use procedural prototypes anyways, so any compiler that can link the libraries and pass arguments using the correct convention can use OpenGL. Hell, I use OpenGL on the Nintendo DS.
