Solved

OpenGL School Project Arch simple rectangle with transparent half-circle need help ASAP

Posted on 2007-03-30
4
556 Views
Last Modified: 2013-12-21
http://img503.imageshack.us/my.php?image=clipimage002yr3.jpg

The image above is essentially what I must draw with my openGL program.
This is for a school project, and I am not doing very well so if I mess this up I am resigned to a grim fate.
I'm pretty confident that I could handle everything *BUT* the notch in the block as simple as it looks. I know maybe this has something to do with transparency but I feel clueless right now. If anyone has any idea how I could do the notch in the block to make an 'arch' please let me know. I have only a few days left to figuere this out or I am dead meat.
0
Comment
Question by:lordvr
  • 2
4 Comments
 
LVL 25

Expert Comment

by:InteractiveMind
ID: 18854262
Does it have to use transparency?
It would seem simpler to just draw a polygon - defining the arc yourself; (with a little bit of pythag, that shouldn't be particularly difficult)..
0
 
LVL 25

Accepted Solution

by:
InteractiveMind earned 500 total points
ID: 18854277
Try

float W=200, H=100, ar=50; // W is the width of the rectangle (which contains the arc),
                                              // H is the height of the rectangle (..)
                                              // ar is the radius of the arc
glBegin(GL_POLYGON);
glVertex3f(-W/2,0,0);
glVertex3f(-W/2,H,0);
glVertex3f(W/2,H,0);
glVertex3f(W/2,0,0);
for(float i=ar; i>=-ar; i--)
{
    gl.glVertex3f(i,(float)sqrt(ar*ar-i*i),0);
}
gl.glEnd();
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now