🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

i put a light, and get a black screen.

Started by
18 comments, last by okapota 23 years, 11 months ago
hi, i have programed one light, i put it where the tutorials says i should, i have writen the normals good. i have writen good colours. but all i get when i enable the GL_LIGHTING is a black screen, instead of a nice textured box. and another q- is that regular light functions as an omni light, or a spot light, how can i create spotlights? where to define direction?
Advertisement
Did you set the materials??? You said you did the colors but you have to make a call to opengl to have the colors mean materials. Dont know the call off the top of my head but if you have a book on it, it should be in the lighting section.

ECKILLER
ECKILLER
oh by the way whatts your light intensity like and if you do set the materials what do they look like?

ECKILLER
ECKILLER
obvious first - try it without the lighting is the box there?
if so is your light giving off light? and r the normals really good?
the standard light0 is a directional light
hi
well, the normals are good. 100%. that is not the problem. im sure. how to create materials? u mean-
gl fv(GL_LIGHT1, GL_DIFFUSE, lightdiffuse);
and the same for ambient and position? if yes, than i did it.
what should i do?
and how to set direction?
hi
well, the normals are good. 100%. that is not the problem. im sure. how to create materials? u mean-
glLightfv(GL_LIGHT1, GL_DIFFUSE, lightdiffuse);
and the same for ambient and position? if yes, than i did it.
what should i do?
and how to set direction?
Try setting the clear colour to something like green, and then run the program. If you see the sillouhette (I dunno how to spell that) of the cube in black, then it''s definitely the materials that are not set correctly.

Also, try just with ambient light...



========
Smidge
www.smidge-tech.co.uk
========
--Mr Smidge
well, i can see the sil'' in black. something is wrong with the materials. what is the material (concerning opengl)?
how to set it?
is it what i mentioned before?
Here's how I set my materials:

        // Material StuffGLfloat	gMaterialAmbient[] = { 0.5, 0.5, 0.5, 1.0 };GLfloat	gMaterialDiffuse[] = { 0.5, 0.5, 0.5, 1.0 };GLfloat	gMaterialSpecular[] = { 0.9, 0.9, 0.9, 1.0 };GLfloat	gMaterialShininess = 100;// Setup Material stuffglMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, gMaterialAmbient );glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, gMaterialDiffuse );glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, gMaterialSpecular );glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, gMaterialShininess );        


Your probably doing something like this, but there's my code so you can double check. Also, you might want to make sure your normals are actually normalized (I'm not sure what OpenGL does when they're not).

Morgan

Edited by - Morgan on August 4, 2000 6:32:06 PM
well, no, thats not what is writen in the 7th tutorial. what i wrote is-

glfloat LightAmbient[] = {........};

glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);

and the same for diffuse and position.
what your code means? and to what light''s number it refers?

This topic is closed to new replies.

Advertisement