jshmrsn
Sep 30, 2008, 07:32 AM
My implementation of OpenGL displays ambient light normally while running in the iPhone OS simulator, but acts as if ambient light color was 0,0,0 on the device.
I activate lighting like so:
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
GLfloat ambient[] = {0.6, 0.6, 0.6, 1.0 };
GLfloat diffuse[] = { 1, 1, 1, 1 };
GLfloat specular[] = { 0,0, 0, 1.0 };
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv( GL_LIGHT0, GL_SPECULAR, specular);
GLfloat position[] = { direction.x, direction.y, direction.z, 0.0 };
glLightfv(GL_LIGHT0, GL_POSITION, position);
GLfloat amb[] = { 1,1, 1, 1.0 };
GLfloat diffuse[] = { 1, 1, 1, 1.0 };
glMaterialfv(GL_FRONT, GL_AMBIENT, amb);
glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse);
Working...
http://img213.imageshack.us/img213/1002/96233945kc6.th.jpg (http://img213.imageshack.us/my.php?image=96233945kc6.jpg)http://img213.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
Not working...
http://img510.imageshack.us/img510/5461/20435449it6.th.jpg (http://img510.imageshack.us/my.php?image=20435449it6.jpg)http://img510.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
Thanks for any help/ideas.
-Josh Rosen
I activate lighting like so:
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
GLfloat ambient[] = {0.6, 0.6, 0.6, 1.0 };
GLfloat diffuse[] = { 1, 1, 1, 1 };
GLfloat specular[] = { 0,0, 0, 1.0 };
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv( GL_LIGHT0, GL_SPECULAR, specular);
GLfloat position[] = { direction.x, direction.y, direction.z, 0.0 };
glLightfv(GL_LIGHT0, GL_POSITION, position);
GLfloat amb[] = { 1,1, 1, 1.0 };
GLfloat diffuse[] = { 1, 1, 1, 1.0 };
glMaterialfv(GL_FRONT, GL_AMBIENT, amb);
glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse);
Working...
http://img213.imageshack.us/img213/1002/96233945kc6.th.jpg (http://img213.imageshack.us/my.php?image=96233945kc6.jpg)http://img213.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
Not working...
http://img510.imageshack.us/img510/5461/20435449it6.th.jpg (http://img510.imageshack.us/my.php?image=20435449it6.jpg)http://img510.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)
Thanks for any help/ideas.
-Josh Rosen
