Cita:
Empezado por blackx5n
1- Que version de delphi usaste para el codigo que posteaste
|
Delphi 2007
Cita:
Empezado por blackx5n
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
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
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
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
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, @ambientLight);
glLightfv(GL_LIGHT0, GL_AMBIENT, @ambientLight); glLightfv(GL_LIGHT0, GL_DIFFUSE, @diffuseLight); glLightfv(GL_LIGHT0, GL_SPECULAR, @specularLight); glLightfv(GL_LIGHT0, GL_POSITION, @positionLight); if SpinLuzFoco.Value <> 0 then begin
glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 90); glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, SpinLuzFoco.Value); end else begin
glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 180); glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, 0); end;
glEnable(GL_LIGHT0); glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); glMaterialfv(GL_FRONT, GL_SPECULAR, @specurefLight); glMaterial(GL_FRONT_AND_BACK, GL_SHININESS, 32); 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;