2 circle painting in middle Help!

Started by
4 comments, last by Mat1515 20 years, 1 month ago
In OpenGL is it possible to create to circles over lapping each other then paint or fill the part where the two circles overlap an entire different color. Like one of those ven diagram thingies if you know what im talking about. My programing teacher said if i was able to do this in OpenGL and C/C++ then he would move onto Open at SWMHS. (Currently using Qbasic) lol Ive been searching and experimenting on ways to do this but have not succeded. Any help/code/links would be great. Thanks, Matt
Ut o not me again:) lol
Advertisement
hum, basiquely opengl is a 3d API.
You have to make it the hard way.
If you want to draw circle, you have to draw LINES arranged to create a circle. if you zoom a lot you will see the lines.
The other way is to create a texture map where you draw a circle on the texture first
And to fill it, good luck lol
No sorry, I made this a long time ago in VB, but in opengl its not very possible, if so, its not a thing that I can explain here in a post, to much thing to say. To much thing to know.
Draw to the pixel buffer OR creating texture with an away and bla bla bla. Using cos and sin to create the circle. Dynamic list for the filling


[edited by - daivuk on February 26, 2004 5:24:58 PM]
cant you do this with the buffers and stencils?
basically use testing stencil operations to create the mask of the intersection and then render to that mask/stencil the diff color.
Good idea using stencill buffer. I am not 100% clear on its use but I can see that if you draw the first circle into a buffer but not to screen. Then require the second circle only show up on screen where the first circle was drawn. I think you can use a stencil buffer like this
How about using a texture? :D



My Website | Everything you need to know about 3D Graphics | Google | Search the Forums

or u could scan the pixels on the screen and through a check put a colored dot on the pixel position which lies inside the equation of the circle. U may skip a pixel in each row and column for the other over lapping circle to fill in.

It would look something like...

for (float i=0; i<100; i+=0.01)
for (float j=0; j<100; j+=0.01)
if ((i-50)*(i-50) + (j-50)*(j-50) <= 400)
glVertex2f(i, j);

check for the parameters and range though. And set some color.

But again when u zoom in, u''d see the individual dots I guess.


SuperDuck
=========
We are all like a duck ... it looks calm and cool above the water; but underneath, its tiny feet are peddling hard to stay afloat. Me? I''''m just another duck in the pond!!!
SuperDuck=========We are all like a duck ... it looks calm and cool above the water; but underneath, its tiny feet are peddling hard to stay afloat. Me? I''m just another duck in the pond!!!

This topic is closed to new replies.

Advertisement