Autor Beitrag
Calyptus
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 386

Win Xp Prof
D3, D6 Pers, D7 Ent
BeitragVerfasst: So 06.05.07 18:16 
Hallo,

mit diesem Code lade ich bis jetzt meine OpenGL Texturen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.MyLoadTexture(var id: gluInt; path: String);
var tex : PSDL_Surface;
begin
  tex := IMG_Load(PChar(path));
  if assigned(tex) then
  begin
    glGenTextures(1, @id);
    glBindTexture(GL_TEXTURE_2D, id);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glTexImage2D(GL_TEXTURE_2D, 0, 3, tex^.w, tex^.h,0, GL_BGR, GL_UNSIGNED_BYTE, tex^.pixels);

    SDL_FreeSurface(tex);
  end else
   ShowMEssage('textur konnte nicht gelanden werden');
end;


Da ich aber einige Texturen im Programm dynamisch erstelle sieht der Ablauf bis jetzt so aus:

1. ein TBitmap mit Canvas bemalen
2. diesen als temp.bmp speichern
3. mit dem Code oben aus temp.bmp laden
4. temp.bmp löschen

Ich würde jetzt sehr gerne diesen grausigen umweg über tbitmap.savetofile umgehen, nur habe ich bin jetzt nix gefunden wie ich meine OpenGL Texturen direkt aus einem TBitmap laden kann.

_________________
Luft- und Raumfahrtechnik an der Uni Stuttgart
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: So 06.05.07 18:20 
Guck dir mal glBitmap an, damit geht das.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Calyptus Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 386

Win Xp Prof
D3, D6 Pers, D7 Ent
BeitragVerfasst: So 06.05.07 18:59 
danke, war genau das was ich gesucht habe :-)

_________________
Luft- und Raumfahrtechnik an der Uni Stuttgart