Archived

This topic is now archived and is closed to further replies.

need answer

This topic is 5029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

so thats my problem... directional looks like a positional w is 0.0 not 1.0 --part of src code GLfloat dir[] = {0.0, 1.0, 0.0, 0.0}; glLightfv(GL_LIGHT0, GL_POSITION, dir); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); //do the rendering --end of code so, where is the problem??

Share this post


Link to post
Share on other sites
yehaa, thanks for your attention, now I´m really happy, thousand thanks to you...

...well, i expect a light coming from one direction with no radius, no attenuation, and no cut off, and no position (because of this unfinite distance), but all i get is a light which seems to be a spot light, but i need this directional light for a big landscape and i need something like a sun...

...please help, thanks for your efforts.

Share this post


Link to post
Share on other sites
1. Checked glError?

2. Are you sure your normals are correct?

3. The default light position is an directional light, does it look correct (as in, not a point light) if you don''t specify the light position?

Share this post


Link to post
Share on other sites
1. check glerror -> no error

2. normals -> normal also normalized with glNormalize enabled

3. if i don´t specify any position (leaving everything default) i also got a spot light looking light...

thanks for your time helping me

Share this post


Link to post
Share on other sites

hi....

did ur problem get solved?? If yes, then could u plz post how, and what was the problem. If not, then best of luck with it

SuperDuck
=========
We are all like a duck ... it looks calm and cool above the water; but underneath, its tiny feet are peddling hard to stay afloat. Me? I''''m just another duck in the pond!!!

Share this post


Link to post
Share on other sites
The information you provided is far from sufficient for even the remotest assessment of possible problem causes. Anything would just be a stab in the dark. That''s why you don''t get any replies.

Solution: provide more detailed and more relevant information.

Share this post


Link to post
Share on other sites
ok well, here you can see whats the problem is
>> http://www.mitglied.lycos.de/neolord/scap.JPG

//src code
glClearColor(0.4,0.6,0.8,1.0);

glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_NORMALIZE);

GLfloat direction[] = {0, 1.0, 0.0, 0.0};

GLfloat diffuse_bright[] = {0.9f, 0.9f, 0.9f, 1.0f};
GLfloat ambient_off[] = {0.0, 0.0, 0.0, 1.0};

glEnable(GL_LIGHT0);

glLightfv(GL_LIGHT0, GL_POSITION, direction);
glEnable(GL_LIGHTING);

glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_bright);
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_off);

// rendering
glLoadIdentity();
static float rotX = 0;

glTranslatef(0.0f,-100.0f,-750.0f);
glRotatef(30,1,0,0);
glTranslatef(0.0f, -40.0f, -100.0f);
glRotatef(rx, 0, 1, 0);

int o,l;
int tx,ty;

dimx=100;
dimy=100;

glEnable(GL_COLOR_MATERIAL);

glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
glColor3f(0.2,0.8,0);

ty=-(dimy/2)*8;
for(o=0;o{
glBegin (GL_TRIANGLE_STRIP);
tx=-(dimx/2)*8;
for(l=0;l{

glNormal3f(float(tx),30,float(ty));
glVertex3f(float(tx),30,float(ty));
glNormal3f(float(tx),30,float(ty)+8);
glVertex3f(float(tx),30,float(ty)+8);

tx=tx+8;
};
ty=ty+8;
glEnd();
};

hopefully its enough information you can work with,
thanks for your efforts

Share this post


Link to post
Share on other sites