Solved

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

Posted on 2007-03-30
4
560 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

840 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