Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Gráficos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 16-04-2013
blackx5n blackx5n is offline
Miembro
 
Registrado: feb 2008
Posts: 51
Poder: 17
blackx5n Va por buen camino
OpenGL

cesarsoftware:

Me parecio muy interesante el codigo que posteaste lo trate de probar pero no me funciono use D7


Tengo varias preguntas
1- Que version de delphi usaste para el codigo que posteaste
2- Tengo que tener instalado el opengl que version, o solo funciona con agregar al uses opengl.
3- Que tipo de variables son h_DC y h_RC de el procedimiento glInicia;
4- Que tipo de componente es el SpinZoom y SimCfg
5- Que procedimiento es el glIniciaLuz();

De antemano muchas gracias
Responder Con Cita
  #2  
Antiguo 16-04-2013
Avatar de cesarsoftware
cesarsoftware cesarsoftware is offline
Miembro
 
Registrado: nov 2006
Posts: 241
Poder: 18
cesarsoftware Va por buen camino
Cita:
Empezado por blackx5n Ver Mensaje
1- Que version de delphi usaste para el codigo que posteaste
Delphi 2007
Cita:
Empezado por blackx5n Ver Mensaje
2- Tengo que tener instalado el opengl que version, o solo funciona con agregar al uses opengl.
solo agrega en el uses la unidad opengl
Cita:
Empezado por blackx5n Ver Mensaje
3- Que tipo de variables son h_DC y h_RC de el procedimiento glInicia;
Son handles, necesitas la unidad windows en el uses en mi caso son globales
h_DC : HDC; // handle del contexto del formulario
h_RC : HGLRC; // handle del contexto OpenGL
Cita:
Empezado por blackx5n Ver Mensaje
4- Que tipo de componente es el SpinZoom y SimCfg
SpinZoom: TUpDown;
SimCfg es un formulario que contiene la configuracion base
Cita:
Empezado por blackx5n Ver Mensaje
5- Que procedimiento es el glIniciaLuz();
Código Delphi [-]
procedure TfrmOpenGl.glIniciaLuz();
begin
  ambientLight[1] := 0.30;
  ambientLight[2] := 0.30;
  ambientLight[3] := 0.30;
  ambientLight[4] := 1.0;
  diffuseLight[1] := 0.1;
  diffuseLight[2] := 0.1;
  diffuseLight[3] := 0.1;
  diffuseLight[4] := 1.0;
  specularLight[1] := 0.5;
  specularLight[2] := 0.5;
  specularLight[3] := 0.5;
  specularLight[4] := 0.5;
  specurefLight[1] := 1.0;
  specurefLight[2] := 1.0;
  specurefLight[3] := 1.0;
  specurefLight[4] := 1.0;
  positionLight[1] := 0.0;
  positionLight[2] := 0.0;
  positionLight[3] := 150.0;
  positionLight[4] := 1.0;
end;

procedure TfrmOpenGl.glAjustaLuz();
begin
  // Definir Luz numero 0
  glLightModelfv(GL_LIGHT_MODEL_AMBIENT, @ambientLight);
  glLightfv(GL_LIGHT0, GL_AMBIENT, @ambientLight);       // luz ambiente
  glLightfv(GL_LIGHT0, GL_DIFFUSE, @diffuseLight);       // luz difusa
  glLightfv(GL_LIGHT0, GL_SPECULAR, @specularLight);     // luz especular
  glLightfv(GL_LIGHT0, GL_POSITION, @positionLight);     // posiciona la luz
  if SpinLuzFoco.Value <> 0 then begin
    glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 90);             // Angulo corte a 90º
    glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, SpinLuzFoco.Value); // Foco brillante
  end else begin
    glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 180);              // Angulo corte a 180º
    glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, 0);            // sin Foco
  end;
  glEnable(GL_LIGHT0);                                   // enciende luz nº 0
  glEnable(GL_COLOR_MATERIAL); // activa seguimiento del color
  glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);  // material sigue a color
  glMaterialfv(GL_FRONT, GL_SPECULAR, @specurefLight);// reflexivo especular
  glMaterial(GL_FRONT_AND_BACK, GL_SHININESS, 32);       // brillo moderado
end;

procedure TfrmOpenGl.BotonResetLuzClick(Sender: TObject);
begin
  glIniciaLuz();
  SpinLuzAmbiente.Value := 0;
end;

procedure TfrmOpenGl.SpinLuzAmbienteChange(Sender: TObject);
begin
  if EsNumero(SpinLuzAmbiente.Text) then begin
    ambientLight[1] := SpinLuzAmbiente.Value / 100;
    ambientLight[2] := SpinLuzAmbiente.Value / 100;
    ambientLight[3] := SpinLuzAmbiente.Value / 100;
    ambientLight[4] := 1.0;
    glDibuja();
  end;
end;
__________________
Disfruta de la vida ahora, vas a estar muerto mucho tiempo.
Responder Con Cita
  #3  
Antiguo 16-04-2013
Avatar de cesarsoftware
cesarsoftware cesarsoftware is offline
Miembro
 
Registrado: nov 2006
Posts: 241
Poder: 18
cesarsoftware Va por buen camino
He grabado un pequeño video de lo que hacen esas funciones que he publicado.



Espero que os aclaren algo.

Un saludo.
__________________
Disfruta de la vida ahora, vas a estar muerto mucho tiempo.

Última edición por Casimiro Notevi fecha: 19-04-2013 a las 11:26:03.
Responder Con Cita
  #4  
Antiguo 17-04-2013
blackx5n blackx5n is offline
Miembro
 
Registrado: feb 2008
Posts: 51
Poder: 17
blackx5n Va por buen camino
OpenGL

Muchas gracias cesarsoftware por aclarar estas dudas que tenia, has sido claro y especifico, gracias por el video.

Se llego a tener otra duda aqui mismo posteare.

Salu2
Responder Con Cita
  #5  
Antiguo 19-04-2013
jfh900 jfh900 is offline
Registrado
 
Registrado: ago 2010
Posts: 7
Poder: 0
jfh900 Va por buen camino
Realmente no sería más interesante utilizar GLScene. Una gran parte de las funciones de OpenGL están encapsuladas en sus componentes, siendo muy facil realizar un primer programa, ya que la programación es mediante componentes visibles.

Un saludo
Responder Con Cita
  #6  
Antiguo 19-04-2013
mirkogonzales mirkogonzales is offline
Registrado
NULL
 
Registrado: feb 2013
Posts: 5
Poder: 0
mirkogonzales Va por buen camino
Smile

Es muy interesante lo publicado... Pero igual sigo sin entender cual seria la forma de generar el plano pseudo infinito...
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Opengl??? craven Gráficos 13 21-02-2007 17:25:29
opengl juanperalta Gráficos 4 11-09-2006 16:11:43
SIG opengl cecitt Gráficos 0 27-04-2005 16:47:58
OpenGL Sotrono Varios 2 26-02-2005 23:57:49
Opengl jose_2057111 Gráficos 0 14-12-2004 04:06:48


La franja horaria es GMT +2. Ahora son las 18:24:22.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi