AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi OpenGl Rendercontex schützen
Thema durchsuchen
Ansicht
Themen-Optionen

OpenGl Rendercontex schützen

Ein Thema von EWeiss · begonnen am 16. Jun 2008 · letzter Beitrag vom 16. Jun 2008
 
EWeiss
(Gast)

n/a Beiträge
 
#5

Re: OpenGl Rendercontex schützen

  Alt 16. Jun 2008, 14:05
Zitat:
Genau so ist es richtig. Nach dem glBlendFunc solltest du natürlich noch rendern, sonst ist der ganze Aufwand ja umsonst. Nachdem du dann alles gerendert hast, kannst du dann mit glPopAttrib die ganzen Sachen wieder zurücksetzen.
und da ist mein Problem
Was Rendern `? (keine dumme frage)
Ich befinde mich innerhalb DrawPosition

kann ja nun nicht wieder DrawPosition innerhalb Drawposition aufrufen.
wäre eine endlose sache.

zur veranschaulichung
Delphi-Quellcode:
procedure DrawPosition;
Var
    x1,x2,
  x12,x21,
  z1,y1,
  y2,x,y,hd : GLfloat;
  d1,d2 : GLfloat;
  overdraw : GLfloat;

begin

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity;
  gluPerspective(45, BassBoxInfo^.w / BassBoxInfo^.h, 1, 1000.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity;

  d1 := 0.05;
  d2 := 0.01;
  overdraw := 0.03;

  // PushAttrib
  glPushAttrib(GL_ALL_ATTRIB_BITS);
  try
    // RenderCode
    glDepthMask(ByteBool(GL_FALSE));
    glDisable(GL_LIGHTING);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE);
  finally
    glPopAttrib;
  end;

   glBindTexture(GL_TEXTURE_2D, BarTexture);
   glColor4f( 1.0, 1.0, 1.0, 0.0);

   z1 := -4.0;
   y1 := -1.65;
   y2 := y1 + d1 - d2 + overdraw;
   x1 := -2.21;
   x2 := 2.20;
   x12 := x1 + (d1 - d2) * 0.3;
   x21 := x2 - (d1 - d2) * 0.3;

   glBegin(GL_QUADS);

      glTexCoord2f(0.0, 0.0);
      glVertex3f(x1, y2, z1);
      glTexCoord2f(1.0, 0.0);
      glVertex3f(x1, y1, z1);
      glTexCoord2f(1.0, 0.3);
      glVertex3f(x12, y1, z1);
      glTexCoord2f(0.0, 0.3);
      glVertex3f(x12, y2, z1);
      glTexCoord2f(0.0, 0.3);
      glVertex3f(x12, y2, z1);
      glTexCoord2f(1.0, 0.3);
      glVertex3f(x12, y1, z1);
      glTexCoord2f(1.0, 0.7);
      glVertex3f(x21, y1, z1);
      glTexCoord2f(0.0, 0.7);
      glVertex3f(x21, y2, z1);
      glTexCoord2f(0.0, 0.7);
      glVertex3f(x21, y2, z1);
      glTexCoord2f(1.0, 0.7);
      glVertex3f(x21, y1, z1);
      glTexCoord2f(1.0, 1.0);
      glVertex3f(x2, y1, z1);
      glTexCoord2f(0.0, 1.0);
      glVertex3f(x2, y2, z1);

   glEnd();

   glBindTexture(GL_TEXTURE_2D, PeaksTexture);

   hd :=(d1 - d2) * 4.0;
   x :=(x2 - x1) * CurrentPositionPart + x1;
   y :=(y2 + y1) * 0.5;

   glBegin(GL_QUADS);
  glTexCoord2f(0.0, 0.0);
  glVertex3f(x - hd, y - hd, z1);
  glTexCoord2f(0.0, 1.0);
  glVertex3f(x - hd, y + hd, z1);
  glTexCoord2f(1.0, 1.0);
  glVertex3f(x + hd, y + hd, z1);
  glTexCoord2f(1.0, 0.0);
  glVertex3f(x + hd, y - hd, z1);
  glEnd();

  // PushAttrib
  glPushAttrib(GL_ALL_ATTRIB_BITS);
  try
    glDepthMask(ByteBool(GL_TRUE));
      glDisable(GL_BLEND);
  finally
    glPopAttrib;
  end;

end;
EDIT:
Bei Plugins ohne Texturen wird bei mir die Texture für die Bar nicht angezeigt! Hmmmm
Ach so der aufruf der RenderFunktion

Delphi-Quellcode:
procedure ProgressBarRender;
begin
    if (PosCounter = 0) then
    begin
      CurrentLength := BassBoxInfo.MediaLength;
      if (CurrentLength = 0) then
        CurrentLength := 1;

      CurrentPosition :=
        Round(1000 * Bass_ChannelBytes2Seconds(BB_VisDataThread.Stream,
        Bass_ChannelGetPosition(BB_VisDataThread.Stream, BASS_POS_BYTE)));

      If not (PlayState = 0) and not (CurrentPosition = -1)Then
      begin
        CurrentPositionPart := (CurrentPosition / 1000) / CurrentLength;
        if (CurrentPositionPart > 1) then
          CurrentPositionPart := 1;
    end else
      CurrentPositionPart := 0;
    end;
      PosCounter := (PosCounter +1) and 3;

    HoldMatrixMode;
end;
gruss Emil
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:08 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz