My first glut window is see-through!!

I am just taking my first steps in open gl.
I will be using it for my Msc project.

My problem is, i can create a window using glut, and position it and size it correctly.

But i cannot display anything in it.
Even though i have set glClearColor to black, and used glclear(colorbufferbit), it doesnt go black. It is totally transparent and takes a snapshot of the desktop(icons and wall paper).

have a look at the code in my reply below!.
Can anyone see any problems?

I am using Borland C++ builder 4 and glut!!
I have set up the project as a console project.

Is it something to do with DC’s or RC’s. I thought glut took care of all that for you??

Is my Graphics card just crap(most games using opengl seem to work ok)
Please help!!

[This message has been edited by NewbieBen (edited 06-28-2001).]

Have you set up the drawing function, if you have not, then you need to and in that function tell the program to clear the screen then depending on weather you are using double or single buffering add

Single buffering - glFlush ();
double buffering - glSwapBuffers ();

I think i have done all of that. The code has come from the red book mostly!

The resize function,the fullscreen function all work ok. The window is being displayed, but it is not black!.

have a look at the code (it is short):

void init()


void display()





int main(int argc, char* argv[])
// glutReshapeFunc(reshape);


    return 0;


Do i Have to tell it which window to draw to, is it clearing something else that isnt being displayed??

Or is it just my PC being crap!

Cheers for the reply so far.

Hey Zeus 666.

If you are still out there, can u have a look at my code please.

I am stumped!!

Cheers for looking

I ran your code and it worked just fine for me. What do you have for a video card and OS?

help me anyone?

What is goin on?

Surely i havent stumped you all?

AH Dieussium.
Firstly cheers for replying.
Secondly, I am using windows 98 i think.
The graphics card is an 8 meg ATI rage pro.
Pretty old and crusty, but then im not asking it to do too much.
Could it be a driver problem or something.

[This message has been edited by NewbieBen (edited 06-28-2001).]

Cheers for looking guys.
Deiussum, i checked out my card and the drivers. It was just a Driver problem, and everything works fine now after a 45 minute download.

Why is it always the last thing you check is the one that saves you?

Anyway, im gonna start playing with some graphics code now. Im working for the whole Summer on this project, so dont be surprised to hear from me again!!!

Many thanks people!

One more thing to learn about quickly NewbieBen. You would typically call glOrtho (or glFrustum or gluPerspective) in your GLUT reshape function and you’d call them on your GL_PROJECTION matrix. The projection matrix handles all your viewing volume type stuff and the (default) GL_MODELVIEW matrix handles all your modelling and drawing code. It’s important to distinguish between them. If you’re going to be doing OpenGL stuff all summer, I’d advise buying the red book (OpenGL Programming Guide Third Edition - The Official Guide to Learning OpenGL, Version 1.2) and pretty much reading it cover to cover. There are older editions online if you search. BTW, you may have to change your user name if you’re gonna be posting all summer

I think that most people don’t check any more things after they have checked the thing that saved them because they have already been saved and that is normally why the last thing checked is always the one that saves you. Duhhhhhhh!
As for me, usually the last thing I check is also the first thing I check.
Arrr, shiver me timbers!

Thanks a lot everyone.

I got the red book and am just getting to grips with a bit of animation.

Many thanks for the info on GLU Matrixes and that glu Ortho. Am i right in thinking that i can use GLU ortho to scale the window?

So that maybe i can use it to always get a best view of an object/scene.

So many questions at the moment, but its still all new to me!!

It’s best to use other functions to “scale” your window (glTranslate, glScale). Also look into the glFrustum and gluPerspective calls. IMHO they set up a much nicer viewing volume. glOrtho is typically used for more specialised applications (CAD, HUDs)

Hope that helps.