Wrong light Help me

Started by
3 comments, last by bioglaze 9 years, 2 months ago
What is wrong with my light?
What should I do to get a light-Phong or some realistic?

float vec[4];
	SET_VEC4(vec, -10.7f, -posY, 0.4f, 1.0f);
	glLightfv(GL_LIGHT3, GL_POSITION, vec);

	SET_VEC4(vec, 0.9f, 0.9f, 0.9f, 1.0f);
	glLightfv(GL_LIGHT3, GL_DIFFUSE, vec);

	SET_VEC4(vec, 0.0f, 0.0f, 0.0f, 1.0f);
	glLightfv(GL_LIGHT3, GL_AMBIENT, vec);

	SET_VEC4(vec, 0.05f, 0.05f, 0.05f, 1.0f);
	glLightfv(GL_LIGHT3, GL_EMISSION, vec);

	SET_VEC4(vec, 0.003f, 0.003f, 0.003f, 1.0f);
	glLightfv(GL_LIGHT3, GL_SPECULAR, vec);

material


float m1_amb[] = { 0.0005f, 0.0005f, 0.0005f };
float m1_dif[] = { 0.5f, 0.5f, 0.5f };
float m1_spe[] = { 0.5f, 0.5f, 0.5f };
float m1_em[] = { 0.4f, 0.4f, 0.4f };
glMaterialfv(GL_FRONT, GL_AMBIENT, m1_amb);
glMaterialfv(GL_FRONT, GL_DIFFUSE, m1_dif);
glMaterialfv(GL_FRONT, GL_SPECULAR, m1_spe);
glMaterialfv(GL_FRONT, GL_EMISSION, m1_em);

yWeJfVZ.pngucrdrNK.png

Advertisement


What should I do to get a light-Phong or some realistic?

You should stop using fixed-function pipeline, and write shaders for per-pixel lighting.

FFP calculates light per-vertex, so quality depends mainly on geometry's good tesselation.

How do I create these shaders ? I am new in opengl. I've tried the manual but did not work for me.

View one of the billions of tutorials that exist online.
We don’t help people who don’t even begin to help themselves or know the very basics to using Google.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

How do I create these shaders ? I am new in opengl. I've tried the manual but did not work for me.

There are countless tutorials in the web, example: http://www.opengl-tutorial.org/

Aether3D Game Engine: https://github.com/bioglaze/aether3d

Blog: http://twiren.kapsi.fi/blog.html

Control

This topic is closed to new replies.

Advertisement