Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

glMaterial and glutSolidCube

394 views
Skip to first unread message

JuanLievano

unread,
Sep 10, 2006, 8:26:39 PM9/10/06
to
Hi.

I have problems drawing a cube with glutSolidCube and assigning a
certain material defined with glMaterialfv to it. Everytime I draw a
cube it renders white at the output.

Anybody knows how to correct this?

JuanLievano

unread,
Sep 10, 2006, 8:40:23 PM9/10/06
to
I think the problem have to do with lighting and it's intensity that
affects certain cubes. As OpenGL's lighting only affects vertices, I
guess the result could become a white cube (heavily lighted cube).
Now, my question is how can I set up the lighting to obtain equally
lighted polygons in the whole scene?

JuanLievano ha escrito:

Harsh

unread,
Sep 11, 2006, 5:42:06 AM9/11/06
to
At the outset it seems that you have an ambient light of high
intensity. Thus all the vertices reflect the light equally. I would
suggest you to reduce your ambient light from 1,1,1 to say
0.1,0.1,0.1... throw a diffuse light from a particular point and set
the color of hte material to non-white.

let us know of the results you get after changing the light settings.

cheers
Harsh

JuanLievano

unread,
Sep 13, 2006, 3:51:53 PM9/13/06
to
The ambient light is currently set to 0.0, 0.0, 0.0, 0.0.
The material's color is copper, so it shouldn't be white.
At the moment I fixed the problem creating a smaller structure, but
still I have the doubt of what was wrong as this mean I cannot create
to large objects or else I will get white surfaces???

Harsh ha escrito:

fungus

unread,
Sep 13, 2006, 3:59:57 PM9/13/06
to
JuanLievano wrote:
> The ambient light is currently set to 0.0, 0.0, 0.0, 0.0.
> The material's color is copper, so it shouldn't be white.
> At the moment I fixed the problem creating a smaller structure, but
> still I have the doubt of what was wrong as this mean I cannot create
> to large objects or else I will get white surfaces???
>

Sounds to me like you have bad normals. All
surface normals should have length 1 or
do "glEnable(GL_NORMALIZE);"


--
<\___/>
/ O O \
\_____/ FTB. For email, remove my socks.

In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again. They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful. But it happens
every day. I cannot recall the last time something like
that happened in politics or religion.

- Carl Sagan, 1987 CSICOP keynote address

JuanLievano

unread,
Sep 15, 2006, 1:23:36 AM9/15/06
to
Normals are already set ok. I was testing and it seems the problem has
more to do with the glScale function. I don't know how but If I reduce
the solid cube in a very small factor, the surface starts to show
itself white... instead, if I define the cube with very small side
length, and use a huge multiplyer in the scale function, then it shows
ok. The thing is I don't understand why.

Another thing is that I made the glEnable(GL_NORMALIZE), and the
renderized image is worst than if I don't use it. Why?

fungus ha escrito:

fungus

unread,
Sep 15, 2006, 6:53:44 AM9/15/06
to
JuanLievano wrote:
> Normals are already set ok. I was testing and it seems the problem has
> more to do with the glScale function.

The normals are transformed by the modelview
matrix, glScale() will change their length.

If you're using glScale then you *MUST* enable
GL_NORMALIZE or lighting won't work.

In the old days, GL_NORMALIZE was expensive
so it was good to be able to turn it off.
These days it's free so you can leave it
on all the time.


> I don't know how but If I reduce
> the solid cube in a very small factor, the surface starts to show
> itself white... instead, if I define the cube with very small side
> length, and use a huge multiplyer in the scale function, then it shows
> ok. The thing is I don't understand why.
>

glScale() changes your normals.

> Another thing is that I made the glEnable(GL_NORMALIZE), and the
> renderized image is worst than if I don't use it. Why?
>

You have a bug somewhere...

0 new messages