Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Mo Jun 17, 2024 15:40

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 14 Beiträge ] 
Autor Nachricht
BeitragVerfasst: Do Mai 24, 2007 18:01 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
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):

Bild

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.

Any help appreciated.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Mai 24, 2007 20:47 
Offline
Ernährungsberater
Benutzeravatar

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.

_________________
Steppity,steppity,step,step,step! :twisted:
❆ ❄ ❄ ❄ ❅ ❄ ❆ ❄ ❅ ❄ ❅ ❄ ❅ ❄ ❄
❄ ❄ ❄ ❅ ❄ ❄ ❄ ❅ ❄ ❄ ❆ ❄ ❄


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Mai 24, 2007 21:01 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
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?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Mai 24, 2007 21:27 
Offline
Ernährungsberater
Benutzeravatar

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.

_________________
Steppity,steppity,step,step,step! :twisted:
❆ ❄ ❄ ❄ ❅ ❄ ❆ ❄ ❅ ❄ ❅ ❄ ❅ ❄ ❄
❄ ❄ ❄ ❅ ❄ ❄ ❄ ❅ ❄ ❄ ❆ ❄ ❄


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Mai 24, 2007 22:01 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
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?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Mai 24, 2007 22:26 
Offline
Ernährungsberater
Benutzeravatar

Registriert: Sa Jan 01, 2005 17:11
Beiträge: 2067
Programmiersprache: C++
Use glBitmap from Lossy: Link
If it can't load a format, then it it's useless ;)

_________________
Steppity,steppity,step,step,step! :twisted:
❆ ❄ ❄ ❄ ❅ ❄ ❆ ❄ ❅ ❄ ❅ ❄ ❅ ❄ ❄
❄ ❄ ❄ ❅ ❄ ❄ ❄ ❅ ❄ ❄ ❆ ❄ ❄


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Mai 24, 2007 22:32 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
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?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Mai 24, 2007 22:41 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
Just saw this text on the old t'Internet:

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?

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Mai 24, 2007 23:11 
Offline
Ernährungsberater
Benutzeravatar

Registriert: Sa Jan 01, 2005 17:11
Beiträge: 2067
Programmiersprache: C++
There two possibilitys for NPOT:
GL_ARB_TEXTURE_RECTANGLE
or
GL_ARB_TEXTURE_NON_POWER_OF_TWO

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.

_________________
Steppity,steppity,step,step,step! :twisted:
❆ ❄ ❄ ❄ ❅ ❄ ❆ ❄ ❅ ❄ ❅ ❄ ❅ ❄ ❄
❄ ❄ ❄ ❅ ❄ ❄ ❄ ❅ ❄ ❄ ❆ ❄ ❄


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Mai 24, 2007 23:25 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
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. :)

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Success!
BeitragVerfasst: Fr Mai 25, 2007 01:06 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
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.

Bild

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.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Mai 25, 2007 01:10 
Offline
DGL Member
Benutzeravatar

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 :evil:). 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:
  1. function LoadTexture(Filename: String; var Texture: Cardinal; LoadFromRes : Boolean; Instance: Cardinal): Boolean;
  2. var
  3.   glBitmap: TglBitmap2D;
  4. begin
  5.   Result := false;
  6.   Texture := 0;
  7.  
  8.   if Instance = 0 then
  9.     Instance := HInstance;
  10.  
  11.   if (LoadFromRes)
  12.     then glBitmap := TglBitmap2D.CreateFromResourceName(Instance, FileName)
  13.     else glBitmap := TglBitmap2D.Create(FileName);
  14.  
  15.   try
  16.     glBitmap.DeleteTextureOnFree := False;
  17.     glBitmap.FreeDataAfterGenTexture := False;
  18.     glBitmap.MipMap := mmMipmapGlu;  // Force gluBuild2DMipmaps
  19.     glBitmap.GenTexture(False);  // FALSE because no sizechecking of the texture.
  20.     if (glBitmap.ID > 0) then begin
  21.       Texture := glBitmap.ID;
  22.       Result := True;
  23.     end;
  24.   finally
  25.     glBitmap.Free;
  26.   end;
  27. 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.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Mai 25, 2007 01:12 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
Thank you. Let me think about this, please. I will need to digest some of it properly before replying I think.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Mai 26, 2007 13:33 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jan 24, 2007 00:44
Beiträge: 144
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.

Bild

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.

Thanks for the help so far.

_________________
Cheers, DpM
http://www.hmusiccentre.org.uk


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 14 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

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.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.115s | 17 Queries | GZIP : On ]