Vampyre Imaging Library Forum

Imaging Category => Suggestions, Feature Requests, Contributions => Topic started by: aksdb on 27 December 2006, 18:24:53

Title: Texture creation (OGL, DX, SDL) sizes
Post by: aksdb on 27 December 2006, 18:24:53
It would be useful, if for example CreateGLTextureFromImage/File/etc. would somehow return the size of the texture (for example as var-parameters), as these methods may modify the actual size of the texture (power of 2). The size is always necessary to know (how to draw the texture otherwise?) so it saves time and performance if one does not have to additionally query the texture size from opengl/dx/sdl after creating the texture.
Title: Re: Texture creation (OGL, DX, SDL) sizes
Post by: Galfar on 28 December 2006, 01:42:36
Good idea. I think it could be done like this:
Code (delphi) Select

function LoadGLTextureFromFile(const FileName: string; Width: PLongInt = nil; Height: PLongInt = nil): GLuint;
begin
  ... create texture ...
  if Width <> nil then
      Width^ := CreatedWidth;
  ...
end;


This way users that don't care about created texture's dimensions (like when you use it as regular texture mapped on 3D object) wouldn't need to give the function more parameters (like with var parameters) and those who need it can get it. No need to add it to SDL functions too as they return pointer to structure which already contains surface's width and height.
Title: Re: Texture creation (OGL, DX, SDL) sizes
Post by: aksdb on 28 December 2006, 18:05:54
Sounds great :) Thanks
Title: Re: Texture creation (OGL, DX, SDL) sizes
Post by: Galfar on 29 December 2006, 01:05:26
It has just been commited into SVN repository.
I hope it works OK because I haven't had much (any) time to test it yet.
Title: Re: Texture creation (OGL, DX, SDL) sizes
Post by: aksdb on 31 December 2006, 18:18:13
Seems to work great. At least it didn't cause any trouble so far and the textures are displayed correctly :)
Thanks for that fast response and implementation.

Btw. I saw you also started several Canvas methods, looks also great :)
Title: Re: Texture creation (OGL, DX, SDL) sizes
Post by: Galfar on 10 January 2007, 18:12:13
Good to hear it works ok.
Yes, I added rect/line/ellipse drawing to canvas but thats all for 0.22 release. I'm gonna redesign drawing
canvas routines to allow blending and patterns in future (near I hope) so I don't want to add too much stuff now
because I would have to rewrite it later.