GLUT Shading

Posts: 40
Joined: 2008.10
Post: #1
Hey does anyone know what OpenGL calls I have to add to this code to make lights & shading work. (othing.c contains the C and GLUT libraries)
#include "othing.c"

int fullscreen=1;
float angle=0.0;
float thing=0.0;
float othing=-5.0;
int fthing=0;
int keys[255];
GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f };

void display(void) {
    glNormal3f( 0.0f, 0.0f, 1.0f);
    glVertex3f(-1.0f, -1.0f,  1.0f);    
    glVertex3f( 1.0f, -1.0f,  1.0f);    
    glVertex3f( 1.0f,  1.0f,  1.0f);    
    glVertex3f(-1.0f,  1.0f,  1.0f);    


void otherkeys(unsigned char key, int x, int y){
void processNormalKeys(unsigned char key, int x, int y) {

void myEvents(void){
void reshape(int width, int height)
    glViewport(0, 0, width, height);
    glClearColor(0.0f, 0.0f, 0.0f, 0.5f);

void idle(void)

int main(int argc, char** argv)
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("Super Ninja Deathmatch");
    return EXIT_SUCCESS;
Please excuse my bad variable naming and the like.
Quote this message in a reply
Posts: 1,234
Joined: 2002.10
Post: #2
Read some tutorials on lighting.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Deferred Shading wquist 0 2,994 Jul 20, 2011 07:42 PM
Last Post: wquist
  Irrlicht Gouraud/Smooth Shading merrill541 4 6,868 Feb 3, 2010 01:13 PM
Last Post: merrill541
  open gl shading language brtnrdr 8 6,048 Dec 30, 2004 02:15 AM
Last Post: OneSadCookie
  Anyone playing with the OpenGL Shading Laguage? NYGhost 7 5,398 Aug 4, 2004 01:23 PM
Last Post: OneSadCookie