Autor Beitrag
NeoInDerMATRIX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 245

Win95, Win98(+se), WinNT, Win2000, WinME, WinXP(+pro), VISTA, Linux(SuSe), DOS [MultiMon(3)], Vista
D6 PeE + (FP 2.0l) + D3 Pe + D2005+ D2006 Arch
BeitragVerfasst: Di 09.12.03 16:36 
Hallo,

habe ein problemm und finde einfach keinen Ansatz!
Also ich habe eine OpenGL scene und möchte darüber nen HUD zeichnen!
Kann mir einer helfen und sagen wie ich das machen kann!

Danke
NEO
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: Di 09.12.03 16:53 
Hallo,

was für 'ne HUD? Ego-Shooter, Autorennen? Ich mach' mal ein Bsispiel mit 'nem Tach für'n Autorennen.

- erstmal, nachdem alles gerendert ist, die Projektetion auf 2D setzen, am besten mit gluOrtho2D().
- Du erzeugste eine Textur, die wie'n Tacho aussieht, OHNe Zeiger, Hintergrund am besten Transparent (z.B. TGA-Format)
- Den Tach zeichnest du mit 'nem einfachen Quad auf die Szene drauf.
- Dann eine Zeigertextur erzeugen
- Diese mitten auf den Tach zeichnen, auch mit nem Quad. mit glRotatef() in die gewünschte winkellage bringen.

Was noch... du kannst natürlich auch statt Quads 2 Triangles oder einen Triangle-Strip nehmen. Am besten wären natürlich Display-Listen, eine für den Tacho, eine für den Zeiger.

Fragen...? :wink:

_________________
Life is a bad adventure, but the graphic is really good!
NeoInDerMATRIX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 245

Win95, Win98(+se), WinNT, Win2000, WinME, WinXP(+pro), VISTA, Linux(SuSe), DOS [MultiMon(3)], Vista
D6 PeE + (FP 2.0l) + D3 Pe + D2005+ D2006 Arch
BeitragVerfasst: Di 09.12.03 18:28 
Hallo,

danke das werde ich mall probieren! Ist ne gute Idee!

CU
Neo
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: Di 09.12.03 20:16 
Hallo,

dann scheine ich ja richtig zu liegen, mit dem, was du brauchst. Ich habe da noch ein paar Anregungen:

- ein ego-shooter braucht eine ernergieanzeige, die schrift kannst du mit textur-fonts erzeugen (-> google), oder du machst einen simplem balken, der bei weinig energie kürzer wird, und sich dazu rot färbt oder so
- wenn du größere bereiche hast, die von einen undurchsichtigen hud bedeckt sind, kannst du die rendergeschwindigkeit evtl. mit einem stencil-puffer beschleunigen
- auf eines ganz dringend achten: in der regel hat der bildschirm das format 4:3, aber manche auflösungen (wie z.b. 1280x1024) habe ein anderes höhen/breitenverhältnis!!!
- ein autorennen braucht evtl rückspiegel - recht kompliziert: du musst erst alles normal rendern, dann mithilfe von stencil-puffern die rücksicht in den spiegel "einpassen"

mehr tipps fallen mir da grade nicht ein...

_________________
Life is a bad adventure, but the graphic is really good!
flowstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 123

WinME
D6 Enterprise
BeitragVerfasst: Fr 12.12.03 01:04 
Was muss ich bei gluOrtho2D(). für Parameter setzen?
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Fr 12.12.03 11:22 
gluOrtho2D(0,800.0,600);
<- wobei du im Ortho Modus keiine Welteinheiten mehr hast was bei der Positionierung der Objekte ungemein hilft...
in dem Fall oben wäre (0,0) die untere linke Exke und (800,600) die Rechte obere Ecke...
d.h. du gibts quasi die Auflösung der Fläche an ;)
flowstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 123

WinME
D6 Enterprise
BeitragVerfasst: Fr 12.12.03 13:50 
Ich will jetzte eine 3D Szene Zeichnen und dann über das untere viertel ein rotes viereck zeichnen. Ich habe das so gemacht:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
//oben wird die Szene gezeichnet

  gluortho2d(0,800,0,600);

  glbegin(gl_quads);

    glcolor3f(1,0,0);
    glvertex2f(0,0);
    glvertex2f(0,200);
    glvertex2f(800,200);
    glvertex2f(800,0);
  glend;


  SwapBuffers(form1.myDC);  //scene ausgeben


Aber es wird nicht gezeichnet. Was mache ich falsch?
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Fr 12.12.03 14:04 
hast du die Projektsionsmatrix neu gesetzt??:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity;
  gluOrtho2d(0,800, 0,600);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity;
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: Fr 12.12.03 14:51 
Hallo,

daran wird's zwar nich liegen, aber ich würde vor SwapBuffers() lieber nochmal glFinish() aufrufen - sorgt dafür, dass alle OpenGL-Befehle auch fertig ausgeführt werden. Aber wie gesagt, daran wird's nicht liegen, ist aber etwas, was man sich angewöhnen könnte.

_________________
Life is a bad adventure, but the graphic is really good!
flowstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 123

WinME
D6 Enterprise
BeitragVerfasst: Fr 12.12.03 15:24 
jetzt hab ich es so gemacht:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
//oben wird 3d szene gezeichnet

  glMatrixMode(GL_PROJECTION);

  glLoadIdentity;

  gluOrtho2d(0,800, 0,600);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity;
  glbegin(gl_quads);

    glcolor3f(1,0,0);
    glvertex2f(0,0);
    glvertex2f(0,200);
    glvertex2f(800,200);
    glvertex2f(800,0);
  glend;

 SwapBuffers(form1.myDC);


Jetzt wird allerdings die szene ganz kurz angezeigt und dann nur noch das rote Rechteck. Ich denke ich muss wieder auf 3d umstellen, aber wie mach ich das?
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Fr 12.12.03 15:27 
am Anfang des Rendervorgangs mussst du die Projektionsmatrix auf 3D stellen...:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
 glMatrixMode(GL_PROJECTION);
  glLoadIdentity;
  //Perspektivische Darstellung
  gluPerspective(Sichtwinkel, ClientWidth / ClientHeight, Nearclipping,Farclipping);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity;
flowstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 123

WinME
D6 Enterprise
BeitragVerfasst: Fr 12.12.03 17:42 
danke jetzt hab ichs hinbekommen.
Danke für die schnelle hilfe.
NeoInDerMATRIX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 245

Win95, Win98(+se), WinNT, Win2000, WinME, WinXP(+pro), VISTA, Linux(SuSe), DOS [MultiMon(3)], Vista
D6 PeE + (FP 2.0l) + D3 Pe + D2005+ D2006 Arch
BeitragVerfasst: Do 08.01.04 17:19 
Hallo,

ich habe jetzt doch noch ein Problem!
Undzwar wenn ich den 2D Modus einstelle, etwas zeichne und wieder zurück in den 3D modus will, dann ist meine Scene total versaut!
Ich meine damit, das die Objecte sich nur mit sehr viel fantasie erkennen lassen.
Ich habe meine 2 Proceduren die den modus auswählen sollen:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
Procedure tGL.go3D;
 Begin
  glMatrixMode(gl_Projection);
  glLoadIdentity;
  gluPerspective(SichtWinkel, WindowSizeX / WindowSizeY, NearClipping, FarClipping);
  glMatrixMode(gl_ModelView);
  glLoadIdentity;
 End;

Procedure tGL.go2D;
 Begin
  glMatrixMode(gl_Projection);
  glLoadIdentity;
  gluOrtho2D(0, WindowSizeX, 0, WindowSizeY);
  glMatrixMode(gl_ModelView);
  glLoadIdentity;
 End;


und meine Scene wird

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
Procedure tMainLoop.onIdle;
 Begin
  glClear(gl_Color_Buffer_Bit or gl_Depth_Buffer_Bit);
  glLoadIdentity();
  If Not(Mouse) Then
    CenterMouse;
  onRender;
  SwapBuffers(DeviceContext);
 End;

Procedure tMainLoop.onRender;
 Begin
  go3D;
  onRender3D; // Zeichnet den 3D Teil
  go2D;
  onRender2D; // Zeichnet den 2D Teil
 End;


gezeichnet.
Aber irgent wie geht das nicht!

Könnt ihr mir helfen?

CU
Neo
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Do 08.01.04 17:30 
liegt das denn sicher daran, dass du die 2Modi hin und herschaltest?
kommentiere mal das go2D und das Draw2D aus und teste ob der Fehler dann noch immer kommt...
wahrscheinlich liegt es an etwas anderem wie z.B. Culling

außerdem solltest du mal erklären, wie die Onjekte jetzt aussehen...
NeoInDerMATRIX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 245

Win95, Win98(+se), WinNT, Win2000, WinME, WinXP(+pro), VISTA, Linux(SuSe), DOS [MultiMon(3)], Vista
D6 PeE + (FP 2.0l) + D3 Pe + D2005+ D2006 Arch
BeitragVerfasst: Do 08.01.04 17:52 
Hallo,

das habe ich auch schon gemacht! Wenn ich onRender2D und go2D rausnehme dann geht es!

Neo
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Do 08.01.04 17:58 
zeig mal deine 2D-REnderprocedure.. (wenn sie nciht zuu lang ist...)
NeoInDerMATRIX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 245

Win95, Win98(+se), WinNT, Win2000, WinME, WinXP(+pro), VISTA, Linux(SuSe), DOS [MultiMon(3)], Vista
D6 PeE + (FP 2.0l) + D3 Pe + D2005+ D2006 Arch
BeitragVerfasst: Do 08.01.04 18:03 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Procedure tConsole.onRender2D;
 Begin
  Inherited;
  glBegin(gl_Quads);
   glColor3F(0.0, 1.0, 0.0);
   glVertex2I( 50,  50);
   glVertex2I( 50, 100);
   glVertex2I(100, 100);
   glVertex2I(100,  50);
  glEnd();
 End;
[/code]
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Do 08.01.04 18:19 
hm... merkwürdig...
setzt mald ie Farbe ganz am Anfang von Do3D wieder auf Weiß zurück:
ausblenden Delphi-Quelltext
1:
glColor4f(1,1,1,1);					
NeoInDerMATRIX Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 245

Win95, Win98(+se), WinNT, Win2000, WinME, WinXP(+pro), VISTA, Linux(SuSe), DOS [MultiMon(3)], Vista
D6 PeE + (FP 2.0l) + D3 Pe + D2005+ D2006 Arch
BeitragVerfasst: Do 08.01.04 18:31 
Hallo,

das ist aber einproblem! Weil ich die onRender3D in SubKlassen weiter gebe um das Level und so weiter zu erzeugen! Diese setzten dann wieder eigenen Attribute!

CU Neo

PS. Bist du über ICQ erreichbar?