Draw two objects, but only one teapot display, why?

Here is display function,
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix ();
// glRotatef(0.0, 0.0, 0.0, 1.0);
glutSolidTeapot(2.0); // glutSolidSphere(1.0, 22, 22);

glColor3f(255, 0, 0);
glutSolidSphere(1.0, 22, 22);
glPopMatrix ();
glFlush;
}
When draw the teapot, it can display on the screen, but when draw the shere at the same place instead, it shows very very dark, nearly see nothing if not clear to see, when add a glColor statement, still no use. why?

this is very interesting and strange thing. To draw the teaport, which can display, but others not.
Is the teapot ommand very different from other geometry objects?

and I cannot add color on it. sayt glColor3f(255.0, 0.0,0.0), wand to show red, but it still show green color on the screen. What’s matter?

I would assume that the issue is with some aspect of the rendering state at the time of the call.

The main differences between the two primitives are:

  1. The teapot uses evaluators while the sphere uses glBegin/glEnd.
  2. The teapot has texture coordinates, the sphere doesn’t.

[QUOTE=GClements;1267504]I would assume that the issue is with some aspect of the rendering state at the time of the call.

The main differences between the two primitives are:

  1. The teapot uses evaluators while the sphere uses glBegin/glEnd.
  2. The teapot has texture coordinates, the sphere doesn’t.[/QUOTE]

Thank you for your clue. I check up they are all in glut lib. I have bumped across this problem not long before.
[1] glutSolidTeapot(2.0); // [2] glutSolidSphere(1.0, 22, 22);
the first one can display at any position of screen. (I used glTrans command to change their position), The glOrtho range is in (±3.5 in all planes).
but when I use the second one, instead, without changing any other statement,. or other solid objects, like cone etc, can not display well. very dark, nearly see nothing if carelessly.
and the color doesn’t work either.
very strange.

In the main, there is a glutInitDisplayMode command, which mode parameter includes GLUT_RGBA and
GLUT_ALPHA, do they repeat? whats different?
when GLUT_ALPHA exists, as well as glut_rgb, do I use color3f or color4f?

GLUT_RGBA is an alias for GLUT_RGB. It requests an RGB framebuffer (rather than an indexed-colour framebuffer).

GLUT_ALPHA requests that the framebuffer has an alpha channel.

Whether the framebuffer has an alpha channel is unrelated to whether you specify colours with or without an alpha component. If only 3 components are specified (e.g. glColor3f), the alpha component is set to 1.0.

[QUOTE=GClements;1267514]GLUT_RGBA is an alias for GLUT_RGB. It requests an RGB framebuffer (rather than an indexed-colour framebuffer).

GLUT_ALPHA requests that the framebuffer has an alpha channel.

Whether the framebuffer has an alpha channel is unrelated to whether you specify colours with or without an alpha component. If only 3 components are specified (e.g. glColor3f), the alpha component is set to 1.0.[/QUOTE]

I seem always not to ask question unclear,
then take up your answer, what different between special alpha channel and glColor4f OR GLUT_RGBA?
IF I use GLUT_RGBA, IT seems not neccessary to use that special alpha channel. then tht parameter seems redundent.?

I seem to understand a bit more.
To use alpha chennal or not will have a different algorithm. which is different from rgba algorithm.
this may explain them.

then back the first topic, why do the other object not display, except teapot?

As I said In my original response:

I would assume that the issue is with some aspect of the rendering state at the time of the call.

It’s impossible to say any more than that as you only provide an isolated fragment of the code.

With “why doesn’t this work” posts, the problem is very often in the portion of the code which wasn’t posted.

[QUOTE=GClements;1267518]As I said In my original response:

It’s impossible to say any more than that as you only provide an isolated fragment of the code.

With “why doesn’t this work” posts, the problem is very often in the portion of the code which wasn’t posted.[/QUOTE]
I may not understand yet your explanation, yet I have no a better arguement to dispute.

  1. The teapot has texture coordinates, the sphere doesn’t.

I give the teapot another texture coordinate. it can also accept the new texture mapping.
I doubt if it has something to do with lighting? next, I shall add some light to have a try.

With “why doesn’t this work” posts,

where is the post?

[QUOTE=reader1;1267515]I seem always not to ask question unclear,
then take up your answer, what different between special alpha channel and glColor4f OR GLUT_RGBA?
IF I use GLUT_RGBA, IT seems not neccessary to use that special alpha channel. then tht parameter seems redundent.?[/QUOTE]
Hi, GClements, I find the answer, it really seems redundent, but we have nothng to do about it.
it says, if you use GLUT_RGBA, then you have to use GLUT_ALPHA, in order that alpha chennal could be active. otherwise, the GLUT_RGBA serves as GLUT_RGB.and alpha can not be used.

[QUOTE=GClements;1267504]I would assume that the issue is with some aspect of the rendering state at the time of the call.

The main differences between the two primitives are:

  1. The teapot uses evaluators while the sphere uses glBegin/glEnd.
  2. The teapot has texture coordinates, the sphere doesn’t.[/QUOTE]

I get it at last! There are two commands, glFrontFace(GL_CW);
gand lCullFace(GL_BACK); in the program, when I remark them, the objects beautifully display out.
but oddly, the teapots hide.
it doesn;t matter, I can drink coca cola without teapot.