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:
| procedure TForm1.FormCreate(Sender: TObject); var tex: PSDL_Surface; begin DC:=GetDC(Handle); RC:=CreateRenderingContext(DC,[opDoubleBuffered],32,24,0,0,0,0); ActivateRenderingContext(DC, RC); glViewport(0, 0, ClientWidth, ClientHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity; gluPerspective(60, ClientWidth/ClientHeight, 0.1, 100); glMatrixMode(GL_MODELVIEW);
glEnable(GL_TEXTURE_2D);
tex := IMG_Load(PChar(ExtractFileDir(paramStr(0))+'\Textur.bmp')); if assigned(tex) then begin glGenTextures(1, @TexID); glBindTexture(GL_TEXTURE_2D, TexID);
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_RGB, GL_UNSIGNED_BYTE, tex^.pixels);
SDL_FreeSurface(tex); end; end; |