2 Replies - 1536 Views - Last Post: 03 February 2007 - 10:54 AM Rate Topic: -----

#1 Pontus  Icon User is offline

  • Cattlebruiser

Reputation: 18
  • View blog
  • Posts: 612
  • Joined: 28-December 06

Need help with opengl lighting

Posted 03 February 2007 - 10:01 AM

Here is my code, i dont know how to light the plane with a spot, my code so far:
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_COLOR_MATERIAL);
GLfloat lightpos[] = {0.5,0.5,-0.05,0.0};
GLfloat lightdir[] = {0,0,0.1};
GLfloat red[]={256,0,0};
GLfloat blue[]={0,0,256};
GLfloat white[]={256,256,256};
glLightfv(GL_LIGHT0,GL_POSITION,lightpos);
glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,lightdir);
glLighti(GL_LIGHT0,GL_SPOT_CUTOFF,15);
glLightfv(GL_LIGHT0,GL_AMBIENT,blue);
glLightfv(GL_LIGHT0,GL_SPECULAR,blue);
glLightfv(GL_LIGHT0,GL_DIFFUSE,blue);



Is This A Good Question/Topic? 0
  • +

Replies To: Need help with opengl lighting

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Need help with opengl lighting

Posted 03 February 2007 - 10:40 AM

Is it a spotlight you're looking for? I don't do a lot of graphics work, but this has helped with my lighting needs in the past:

http://www.opengl.or...ical/lights.htm
Was This Post Helpful? 0
  • +
  • -

#3 Pontus  Icon User is offline

  • Cattlebruiser

Reputation: 18
  • View blog
  • Posts: 612
  • Joined: 28-December 06

Re: Need help with opengl lighting

Posted 03 February 2007 - 10:54 AM

the problem is as soon i declare:
glLighti(GL_LIGHT0,GL_SPOT_CUTOFF,15);
the lighting goes away
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1