# Lighting + Normals Question

Hi everyone,
I’m experiencing an issue with OpenGL ES 2.0 on the iPhone. I’m working on a game where I’d like to get a nice “glow” from the sun in the middle. I’ve got the “look” of it down, but I think I’ve botched the normals. Essentially, all I want is a flat triangle strip, with a light source in the middle. But, I’m getting a strange result (see video here). I’ve played around with the normals, setting all to zero, all to one, etc. but it doesn’t seem to work.

Apologies if I’m not being super-clear here, I’m relatively new to OpenGL. I hope the image, video and source code below will better reveal my problem.

Video of the issue can be seen here

The image below displays what I am attempting to achieve here…

Any help would be greatly appreciated!!

``````
static const Vertex3D vertices[]= {
{-480, 320,-1},
{-480, 0 ,-1},
{960, 320, -1},
{960, 0, -1},
};

static const Color3D colors[] = {
{1.0, 0.77647, 0, 0.3},
{1.0, 0.77647, 0, 0.3},
{1.0, 0.77647, 0, 0.3},
{1.0, 0.77647, 0, 0.3},
};

static const GLubyte icosahedronFaces[] = {
0, 1, 2,
2, 1, 3
};

// I'm not sure what to do here for a flat normal...
static const Vector3D normals[] = {
{0.000000, 0.000000, 1.000000},
{0.000000, 1.000000, 1.000000},
{0.000000, 0.000000, 1.000000},
{0.000000, 1.000000, 1.000000},
};

glPushMatrix();
glClear(GL_DEPTH_BUFFER_BIT);

/********** LIGHTING */
// Define the diffuse component of the first light
const GLfloat light0Diffuse[] = {1, 1, 1, 1.0};
// Define the position of the first light
const GLfloat light0Position[] = {lightPosition_.x, lightPosition_.y, 1.0, 1.0};

glEnable(GL_DEPTH_TEST);
glEnableClientState(GL_NORMAL_ARRAY);
glEnable( GL_COLOR_MATERIAL );
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glDisable(GL_TEXTURE_2D);

glBlendFunc (GL_SRC_ALPHA, GL_DST_ALPHA);
glVertexPointer(3, GL_FLOAT, 0, vertices);
glColorPointer(4, GL_FLOAT, 0, colors);
glNormalPointer(GL_FLOAT, 0, normals);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, icosahedronFaces);
glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);

glLightfv(GL_LIGHT0, GL_DIFFUSE, light0Diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, light0Position);

glEnable(GL_TEXTURE_2D);
glDisable(GL_LIGHT0);
glDisable(GL_LIGHTING);
glDisable( GL_COLOR_MATERIAL );
glDisableClientState(GL_NORMAL_ARRAY);
glDisable(GL_DEPTH_TEST);
glPopMatrix();

``````

-G.

To achieve a basic sun glow effect, you can draw additive blended textured quad without any lighting. As lighting can be disabled, you will not need any normals at all. So you should not be setting nor sending any normals.

The code looks like it is for ES 1, not ES 2.