iDevGames Forums
GLUT Shading - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: GLUT Shading (/thread-2284.html)

GLUT Shading - merrill541 - Oct 15, 2008 02:26 PM

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.

GLUT Shading - arekkusu - Oct 15, 2008 02:53 PM

Read some tutorials on lighting.