elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Programacion Opengl
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Programacion Opengl  (Leído 1,421 veces)
latinoalfredo

Desconectado Desconectado

Mensajes: 15


Ver Perfil
Programacion Opengl
« en: 5 Mayo 2014, 23:20 pm »

Hola, necesito orientacion acerca del funcionamiento de las luces en Opengl.
He conseguido definir sus propiedades, en esto caso cree una luz direccional pero no consigo que apunte hacia donde yo quiero. Esta siempre se queda fija mirando hacia -z.
Con esta funcion puedo mover el foco a donde quiera:
   glLightfv(GL_LIGHT0, GL_POSITION, LuzPos);
Pero esta funcion que en principio es para dirigir el foco, ignora lo que le ponga. Hay alguna razon por la que pase esto.
   glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, SpotDir);

Las luces las inicializo asi:

GLfloat LuzPos[] = { 0, 0, 0, 1 };
GLfloat SpotDir[] = { 0, 10, 0 };
GLfloat Ambient[] = { 0.2f, 0.2f, 0.2f, 1.0f };
GLfloat Diffuse[] = { 1, 0, 0, 0.0f };
GLfloat SpecRef[] = { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat Specular[] = { 1.0f, 1, 1, 1.0f };

   glLightfv(GL_LIGHT0, GL_DIFFUSE, Diffuse);
   glLightfv(GL_LIGHT0, GL_SPECULAR, Specular);
   glLightfv(GL_LIGHT0, GL_AMBIENT, Ambient);
   glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 100.0f);
   glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, 100.0f);
   glLightfv(GL_LIGHT0, GL_POSITION, LuzPos);
   glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, SpotDir);
   glEnable(GL_LIGHT0);
   glEnable(GL_LIGHTING);
   glMaterialfv(GL_FRONT, GL_SPECULAR, SpecRef);
   glMaterialf(GL_FRONT, GL_SHININESS, 100);


En línea

Miseryk

Desconectado Desconectado

Mensajes: 225


SI.NU.SA U.GU.DE (2NE1 - D-Unit)


Ver Perfil
Re: Programacion Opengl
« Respuesta #1 en: 6 Mayo 2014, 01:41 am »

En DirectX la luz se refleja en el material y depende cuantos vertex tenga, va a proyectarse mejor (más visible), pero sí o sí se debe aplicar a un material, supongo que en opengl debe ser lo mismo.


En línea

Can you see it?
The worst is over
The monsters in my head are scared of love
Fallen people listen up! It’s never too late to change our luck
So, don’t let them steal your light
Don’t let them break your stride
There is light on the other side
And you’ll see all the raindrops falling behind
Make it out tonight
it’s a revolution

CL!!!
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
OpenGL Dev C++
Programación C/C++
Monica_Barcelona 7 5,562 Último mensaje 12 Mayo 2010, 18:38 pm
por [Zero]
opengl
Programación General
mapers 4 3,071 Último mensaje 29 Octubre 2010, 23:50 pm
por bolivianito
OPENGL
Programación C/C++
mapers 0 1,703 Último mensaje 13 Enero 2011, 07:08 am
por mapers
OpenGL
Programación C/C++
cazagavilan 1 2,078 Último mensaje 26 Abril 2012, 16:47 pm
por cazagavilan
¿Cómo funciona OpenGL? [Programación General]
Programación General
deleted_account 4 3,277 Último mensaje 26 Enero 2018, 23:13 pm
por deleted_account
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines