Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Mat1515

2 circle painting in middle Help!

This topic is 5400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites

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!!!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!