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.
Good idea. I think it could be done like this:
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.
Sounds great :) Thanks
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.
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 :)
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.