Lighting problems

	glShadeModel(GL_FLAT);
        glEnable(GL_DEPTH_TEST);
        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
        glLight(GL_LIGHT0, GL_POSITION, asFlippedFloatBuffer(new float[]{2, 2, 2, 0}));

I wonder why the cube is lit and the “spaceship” isn’t, is it due to surface normals or something? The above code is the only light related snippet

Well how are you drawing the ship? Do you specify any normals? Is it within the range of your light? If you remove your light, does the spaceship change?

You need normals. You can calculate the normal of a triangle (just Google it), but if you’re trying to to draw something smoothly shaped like a sphere, you’ll want to calculate the normals per vertex instead of per triangle. That way the normal is interpolated across the surface giving you 100% smooth lighting despite the actual triangles being very “unround”.

YET ANOTHER…post from me most everyone probably wants to ignore. Anyone with little lighting experience certainly does.

Not really…you need close (enough) to accurate normals at all sample points to not produce oddities.

I certainly will since it’s the standard way of interpolating normals across surfaces. Besides, smooth != accurate or perfect. I call bilinear texture filtering smooth too.

Why does GL_QUADS get automatic normals?

just a quick thought
when your space ship is a plane object(just two triangles) then there is nothing wrong about the picture.

on the other hand, just tell us how you draw the ship and want the geometry of the ship looks like(code for example)

It’s a total of 6 triangles drawn with GL_TRIANGLES

I don’t have the code with me now but…

What makes you think it does?

so it’s 99.9% wrong normals

@sproingie as its lighting works all fine

Standard GL vertex lighting (i.e. no shaders used) doesn’t interpolate normals across the surface but light values sampled at the vertices, which is why no pixel inside of a triangle can be brighter than the brightest vertex.

Ah, right. It does vertex lighting…