Autor Beitrag
G-McKree
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 11.01.04 12:21 
gibt es einen Weg festzustellen auf welches objekt ich klicke in OpenGL?
eigentlich würde mir schon reichen zu wissen welche Koordinaten das sind
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: So 11.01.04 12:49 
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 11.01.04 16:33 
OpenGL behauptet aber immer das da nix is (= -1)
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 11.01.04 16:37 
schon erledigt

der quelltext ausm tut war falsch
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: So 11.01.04 16:40 
was war denn da falsch?
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 11.01.04 17:11 
zu früh gefreut
jetzt hab ich die wahl:
entwede lösch ich ''glMatrixMode(GL_PROJECTION);'' und der erste klick
behauptet objekt 1 gefunden (egal wo ich hinklicke) zu haben und danach findet er niemehr was

oder ich lösch die zeile nich und es wird nie was gefunden

hier is mein quelltext:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.DrawScene;
begin
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity;

glinitnames;
glpushname(0);

glRotate(-135,1,0,0);
glRotate(-45,0,1,0);
glTranslate(15,15,15);
glloadname(1);

//objekt malen

SwapBuffers(h_DC);
FPSTimer.Tag:= FPSTimer.Tag + 1;
end;


und

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
function TForm1.GetSelectBufferHit : Integer;
var
 SelectBuffer : array[0..512] of TGLUInt;
 Viewport     : TVector4i;
 Hits,i       : Integer;
 HitZValue    : TGLUInt;
 Hit          : TGLUInt;
begin
ActivateRenderingContext(h_DC, hRC);
glGetIntegerv(GL_VIEWPORT, @viewport);
glSelectBuffer(512, @SelectBuffer);
glRenderMode(GL_SELECT);
glInitNames;
glPushName(0);
glMatrixMode(GL_PROJECTION);  <- besagte zeile
glPushMatrix;
glLoadIdentity;
gluPickMatrix(mouse.CursorPos.x, screen.Height-mouse.CursorPos.y, 1.0, 1.0, viewport);
gluPerspective(45.0, ClientWidth/ClientHeight, 0.1, 1000);
DrawScene;
glMatrixMode(GL_PROJECTION);
glPopMatrix;
Hits := glRenderMode(GL_RENDER);
DeactivateRenderingContext;
Hit       := High(TGLUInt);
HitZValue := High(TGLUInt);
for i := 0 to Hits-1 do
 if SelectBuffer[(i*4)+1] < HitZValue then
  begin
  Hit       := SelectBuffer[(i*4)+3];
  HitZValue := SelectBuffer[(i*4)+1];
  end;
Result := Hit;
end;


P.S. die form is full-screen
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: So 11.01.04 17:16 
hast du dir mal das beispielprojekt da runtergeladen??

alternativ kansnt du dir auch mal dieses Tutorial hier ansehen:
www.delphigl.com/scr...lection&action=2
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: So 11.01.04 17:19 
hab ich schon
bringt auch nix

das beispielprojekt lässt sich nich compilen


Zuletzt bearbeitet von G-McKree am So 11.01.04 17:27, insgesamt 1-mal bearbeitet
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: So 11.01.04 17:27 
schick dein Projekt mal an Fiji-Fighter[at)web.de