2D Polygon Overlap Checking using OpenGL?

2D Polygon Overlap Checking using OpenGL?

Post by Al » Thu, 21 Feb 2002 19:23:38



Is it theoretically possible to use OpenGL to do overlap checking for
2D polygons? Placing 2D polygons onto a 2D plane(xy) but checking for
overlap
continuously to make sure we can get the polygon as close to the
existing polygons on the plane. A good example would be Tetris.
Obviously it is possible to implement overlap detection by either
representing the polygons by using either bitmaps or vectors. This
approach will not take advantage of hardware acceleration. The overlap
check method would be purely software driven.

Thankyou in advance for any help.

 
 
 

2D Polygon Overlap Checking using OpenGL?

Post by ZZ » Fri, 22 Feb 2002 03:23:27


it is possible but itll only give u pixel perfect results.
draw one + thrn enable a blend mode (many to choose from) + draw the other +
then do a read pixels or else u could also use the stencilbuffer with
readpixels.

though with tetris + practically all else itll more accurate/faster doing all
the math yourself

--
-- captain lovespunk and the spaceship ecstasy -- preaching from S 4442  E
16907
now the catains mission was to seek out all forms of intelligent life
he and the good ship ecstasy had a message of luv to spread
http://uk.geocities.com/sloppyturds/gotterdammerung.html


Quote:> Is it theoretically possible to use OpenGL to do overlap checking for
> 2D polygons? Placing 2D polygons onto a 2D plane(xy) but checking for
> overlap
> continuously to make sure we can get the polygon as close to the
> existing polygons on the plane. A good example would be Tetris.
> Obviously it is possible to implement overlap detection by either
> representing the polygons by using either bitmaps or vectors. This
> approach will not take advantage of hardware acceleration. The overlap
> check method would be purely software driven.

> Thankyou in advance for any help.


 
 
 

2D Polygon Overlap Checking using OpenGL?

Post by fungu » Fri, 22 Feb 2002 06:10:15



>Is it theoretically possible to use OpenGL to do overlap checking for
>2D polygons?

Theoretically, yes. In practical terms, no, you wouldn't
want to do it that way.

Quote:>Obviously it is possible to implement overlap detection by either
>representing the polygons by using either bitmaps or vectors. This
>approach will not take advantage of hardware acceleration.

Don't get all starry eyed over the phrase "hardware
acceleration". Remember, your Pentium CPU is also
"hardware".

If you ask hardware to do things it isn't designed to do
then it's likely to be slow. Would you ask your sound card
to do overlap checkin? It's probably just as capable of
doing it as your graphics card.

--
<\___/>
/ O O \
\_____/  FTB.

 
 
 

2D Polygon Overlap Checking using OpenGL?

Post by Al » Fri, 22 Feb 2002 18:16:55



> it is possible but itll only give u pixel perfect results.
> draw one + thrn enable a blend mode (many to choose from) + draw the other +
> then do a read pixels or else u could also use the stencilbuffer with
> readpixels.

> though with tetris + practically all else itll more accurate/faster doing all
> the math yourself

> --
> -- captain lovespunk and the spaceship ecstasy -- preaching from S 4442  E
> 16907
> now the catains mission was to seek out all forms of intelligent life
> he and the good ship ecstasy had a message of luv to spread
> http://uk.geocities.com/sloppyturds/gotterdammerung.html



> > Is it theoretically possible to use OpenGL to do overlap checking for
> > 2D polygons? Placing 2D polygons onto a 2D plane(xy) but checking for
> > overlap
> > continuously to make sure we can get the polygon as close to the
> > existing polygons on the plane. A good example would be Tetris.
> > Obviously it is possible to implement overlap detection by either
> > representing the polygons by using either bitmaps or vectors. This
> > approach will not take advantage of hardware acceleration. The overlap
> > check method would be purely software driven.

> > Thankyou in advance for any help.

I actually tried a similar method as you suggested but what I found
was that the glReadPixel command slowed the application considerably.
Checking potentially every pixel on the screen to detect overlap would
be slow. In GDI
it is also slow but I was hoping that reading a pixel from the
rendering context would be faster than a device context due to GPU and
OpenGL.

Thanks for your help.

 
 
 

1. checking whether 2 2D polygons overlap

I've partly implemented the Newell-Newell-Sancha hidden surface algorithm on the Amiga for a real-time 3D animation package I've written. This algorithm is also known as the Painter's algorithm, for it establishes a priority list and draws polygons from the back to the front.

The program allows scenes composed of planar polygons which have no holes. I
don't however get perfect results because there's one step in the algorithm I
 don't know how to implement: to check if the projections of two polygons on
the screen overlap or not. I haven't been able to find an article on this
subject, not even in articles from the authors of the painter's algorithm
themselves!

So please could anyone help me with some hints or source code to determine QUICKLY whether two 2D polygons overlap or not? Then I'll be able to implement the algorithm completely.

Please E-mail your responses to


Any help is greatly appreciated!

2. : rotation around a vector

3. --Polygon overlap checking--

4. once again.......

5. Overlap of 2D polygons

6. Mac person interested in Amiga

7. How do I determine if 2d polygons overlap?

8. --- need .BGI driver for Trident 8900C ---

9. Algorithm to check if a point is inside an n-sided 2d polygon

10. 2D polygon simplification using wavelets

11. How to find intersections between 2D polygons using scanline

12. Checking rectangle overlap in a plane