View Full Version : Why I can't get through the simplest code??
Hello, I'm a very beginner in OpenGL. The problem is that I try to write a very simple code using C++Builder, actually it's a first code in the red book drawing white rectangle on black background. There is no any error while compile...but when running, nothing came out. It's just a blank form and the background color still be a button face color. So...help me please... :'(
02-09-2002, 07:22 PM
Are you forgetting to put glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); before all your drawing code?
again, Here is my code:-
I put it on a FormPaint event. nothing happens...why?
Thanks - job
02-09-2002, 07:36 PM
If you drawing with a 3d matrix, you'll
have to step back a little to see your scene.
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
gluPerspective( 60, winwidth / winheight, 1, 10 );
glMatrixMode( GL_MODELVIEW );
/* step back from origin for our view */
glTranslatef( 0, 0, -5 );
/* draw 3d stuff at origin by starting with a new
/* drawing code here */
Thanks, but it's still the same.
did you initialize a valid render context and made it current?
02-10-2002, 09:22 AM
Put this code in your DrawGL function, this work.
// Clear the color buffer and depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Reset the axes
// The camera location
0,0,5 ==> Eye location
0,0,0 ==> The place where the eye's looking
0,1,0 ==> The directionnal vector
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.