Discussion:
Problem in GLUT idle call-back ...
(too old to reply)
r***@gmail.com
2013-09-12 09:44:01 UTC
Permalink
Raw Message
y67hj
I have the following code in my GLUT
idle call-back:

> glClearColor(0.0, 1.0, 0.0, 1);
> glClear(GL_COLOR_BUFFER_BIT);
>
> glColor3f(0.0, 0.0, 1.0);
>
> glRectf(125,
> 125,
> 375,
> 375);
>
> glutSwapBuffers();

which I expected to result in a blue
rectangle on a green background, but
I'm finding that, while the background
appears to clear to the intended colour,
the rectangle isn't rendering at all ...

Does anyone know what's going wrong?

Russell
Leclerc
2013-09-12 11:22:46 UTC
Permalink
Raw Message
> Does anyone know what's going wrong?

Hi Russel,

don't get me wrong, but you are showing ignorance of very basic usage of
glut. You have already beet told that *all* drawing must be contained
within function used as parameter for glutDisplayFunc.

This also answers your question: you are not calling OpenGL functions
within wrong function.

gordan
Leclerc
2013-09-12 11:24:45 UTC
Permalink
Raw Message
What mistaken i maken:


> you are not calling OpenGL functions
> within wrong function.

> you are calling OpenGL functions
> from wrong function.
r***@gmail.com
2013-09-18 12:18:08 UTC
Permalink
Raw Message
> you are calling OpenGL functions
> from wrong function.

Well, if I'm doing so from the
*wrong* function, then what's
the *right* function I should
be using, here, instead?


Russell
Nobody
2013-09-19 00:27:08 UTC
Permalink
Raw Message
On Wed, 18 Sep 2013 05:18:08 -0700, russell.potter3 wrote:

>
>> you are calling OpenGL functions
>> from wrong function.
>
> Well, if I'm doing so from the
> *wrong* function, then what's
> the *right* function I should
> be using, here, instead?

Drawing functions go in the display function registered with
glutDisplayFunc().
Loading...