Solved

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

Posted on 2007-03-30
562 Views
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
Question by:lordvr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 25

Expert Comment

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

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses
Course of the Month4 days, 16 hours left to enroll