I wonder if anyone can offer any advice on how I might soften or anti-alias the harsh horizontal edges of some non-PoT textures I am loading and placing onto a moving background. This screenshot has been resized to 800x600 so I'm sure Paint Shop Pro will have done some softening itself during the resize... but when running the program at 1024x768, I do seem to get some quite harsh edges, I think it's still apparent with this image (especially on the top edge of the fifth image down):
Also... a separate question if I may... how would I might create a highlight selection box that I could place around the Artist that is selected, i.e. Christina Milian in the image above... I would like to get a neon-green bounding box placed around the current selection and if possible, that bounding box would have nicely curved edges... would I be best doing this with simple line drawing? The location of the current selection should not change.
Registriert: Sa Jan 01, 2005 17:11 Beiträge: 2067
Programmiersprache: C++
You're looking for antialiasing. As far as I know it's a WGL-Extension or set while initialising your program. But I'm not sure about how to activate it.
About the Box:
Just take a texture for the box in combination with alpha blending. Same effect but just one rectangle.
OK thanks... can I clarify... do you mean, I have another rectangular texture with a thick green line around it and nothing in the middle, then I just draw that over the selection Artist texture and turn on something to do with alphablending and I'll then see my Artist image through where the black was, as that won't be shown? Or something different?
Registriert: Sa Jan 01, 2005 17:11 Beiträge: 2067
Programmiersprache: C++
Yes exactly.
You have the green line on the texture and the other pixel have alpha 255. Possible with PNG and TGA. You have the option Alpha Channel in PSP.
OK, I get the concept... but I don't yet have the software to achieve this it seems. Does anyone know of anything simple out there that I can download for free that will allow me to create and save 32-bit .TGA files? I am using Jan Horn's Textures.pas from 2001 that says it "Added support for 32bit TGA files"... but doesn't mention anything about .PNGs. Should I be using something different here?
I remember having a look at this previously - it didn't like me using not PoT textures I seem to remember. What I can't remember is whether there was an easy way around it.
Update:
Just downloaded it and tried it. Program compiles fine, no source changes required. Upon running though, I get the following exception raised... "then raise EglBitmapNonPowerOfTwoException.Create('TglBitmap2D.GenTexture - Rendercontex dosn''t support non power of two texture.');" in TglBitmap2D.GenTexture. I'm going to have to wrack my brain to try and remember if this was the reason I couldn't use this glBitmap.pas - or whether I just used Textures.pas 'cos it was easier at the time.
What is all this PoT texture stuff anyway... I get the idea that it was for performance in the old days, but surely it's not a hard requirement these days, or is it?
GL_ARB_texture_non_power_of_two "There is no additional procedural or enumerant api introduced by this extension except that an implementation which exports the extension string will allow an application to pass in texture dimensions for the 1D, 2D, cube map, and 3D targets that may or may not be a power of two."
So I guess that means I can't even turn it on - if it's not working, it's not capable of doing it, does that sound right?
The first one needs to change your target for texture to GL_TEXTURE_RECTANGLE_ARB and adjustment of textur coordinates, the second one does need a nVidia 6x00 or higher. Better forget ATI about this...
So you see:
On newer GPUs is a solution, but you need same scaling or something for older PCs.
Just take a look at http://www.delphi3d.net which cards has which implementation and then rethink your npot textures.
As Textures.pas is bringing in non-PoT (426x104px) textures at the moment, .JPGs, I am going to try and get myself this bounding box in a 32-bit .TGA file with alpha see if it brings that in successfully, with transparency. If it does, I'm going to stick with Textures.pas.
If it doesn't... then I'll have to dig into GL_ARB_TEXTURE_RECTANGLE and GL_ARB_TEXTURE_NON_POWER_OF_TWO I guess. I would love to see some examples / tutorials of using these so I could download then and then quickly check if they work on my system. If you have any pointers I will check them out.
It sounds like I'm not having much luck with all this OpenGL stuff, but I'm still having fun and it's gotta be better for me than tinkering with DirectX.
OK, I have something that works. I wouldn't say I'm exactly pleased with the effect actually - looks too jagged to me - but it is what I was trying to do, so I will count it as a success. I found a tiny tool, TGATool, that allows you to add an alpha channel to a 24-bit .TGA saved by an older version of Paint Shop Pro. I am still using Textures.pas and it seems to work.
I think I can make the original bounding box image a bit better actually... thicken the lines, consider actually removing anti-aliasing in Paint Shop Pro. I'll have a play around. Any views on how to make this work better, I would happily listen to them.
Registriert: Do Dez 05, 2002 10:35 Beiträge: 4234 Wohnort: Dortmund
dpm_dpmartin: The error you get from the glBitmap.pas results from my rule that i never change the texturedata excepting the programmer want it. The Texture.pas works in the basic version with the very old and really slow function gluBuild2DMipmaps. This function change the resolution of your Texturedata so that will match to power of two. As result of this filtering its possible that you get some colorchanges if you don't use texturecoordinates like 0 or 1.
GL_ARB_TEXTURE_NON_POWER_OF_TWO: If you Graphicscard supports OpenGL 2.0 you automatically get NPOT Textures (except ati with enabled mip maps ). That works automatic. You dont have to change any. Its only an removed restriction.
GL_ARB_TEXTURE_RECTANGLE: You only must use an other target to create the texture. Just an simple parameter if you use the classes of the glBitmap. And you must use other texturcoordinates. The coordinates are in height and width in pixels not normalized between 0 and 1. Thats all.
But if you really want it you can force the use of the gluBuild2DMipmaps function. But you must use the classes instead of the LoadTexture function. Some enhancements to the LoadTexture function from the glBitmap.
Code:
function LoadTexture(Filename:String;var Texture:Cardinal; LoadFromRes :Boolean; Instance:Cardinal):Boolean;
var
glBitmap: TglBitmap2D;
begin
Result :=false;
Texture :=0;
if Instance =0then
Instance := HInstance;
if(LoadFromRes)
then glBitmap := TglBitmap2D.CreateFromResourceName(Instance, FileName)
else glBitmap := TglBitmap2D.Create(FileName);
try
glBitmap.DeleteTextureOnFree:=False;
glBitmap.FreeDataAfterGenTexture:=False;
glBitmap.MipMap:= mmMipmapGlu;// Force gluBuild2DMipmaps
glBitmap.GenTexture(False);// FALSE because no sizechecking of the texture.
if(glBitmap.ID > 0)thenbegin
Texture := glBitmap.ID;
Result :=True;
end;
finally
glBitmap.Free;
end;
end;
BUT: I Really prefer the use of the classes and gluBuild2DMipmaps only when nothing else is supported.
Don't realize if these points are still questions.
Selection box: You simple can create an other Quad under your Picture. Of better you createn an Border with 8 Quads around your picture. When you use an outfading texture you will get an nice selection.
Smothen border from pictures. Antialising is smooth but its still 1 pixel wide. If you need an larger smooth border you can "cut" of your image an border like 5 pixel. You will draw 9 quads. You draw the middle normal but at the borders you can use an simple alphatextur that blends to zero. When you use these alphatexture with multitexturing the alpha will be modulated with the original texture. I dont know if you undertand what i try to explain. I think not. If not i can make an picture. That says more than words.
But with this method you must do this on all images and pictures. Antialiasing works automatically on all polygons.
Well, this is where I've got to with my selection boxes, using 32-bit .TGA files that I create as 24-bit .BMPs and then use this snazzy little utility TGATool to add an alphachannel layer. Not especially clever, but it seems to all be working - and it plays music and uses the MCE Remote too, heh-heh, actually I just lifted that from my old HMusicCentre codebase.
All of this is using that old 2001 Textures.pas; there are challenges ahead that I can see already, but I think it won't hurt me to stick with what is working (even if I'm not entirely aware of what it's doing under the covers). As this is the starting point of migrating HMusicCentre across to OpenGL I'm sure there will be many more questions from me in the coming months.
Mitglieder in diesem Forum: 0 Mitglieder und 12 Gäste
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.