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

Aktuelle Zeit: Fr Jul 18, 2025 04:28

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



Ein neues Thema erstellen Auf das Thema antworten  [ 61 Beiträge ]  Gehe zu Seite Vorherige  1, 2, 3, 4, 5  Nächste
Autor Nachricht
 Betreff des Beitrags:
BeitragVerfasst: Mi Apr 12, 2006 22:59 
Offline
DGL Member

Registriert: So Mär 19, 2006 12:30
Beiträge: 29
Hello Flash

I load them exactly like you presented in the code here in this thread.

My delphi program does not present any errors and
i see box where the texture should be present.

When i load a few images and move frame slider i see
that box changes colors a bit but it has no texture.

When i asked about non power of 2 textures you recommended me
to change some lines in the code of glBitmap.pas. I reverted that
changes, deleted .dcu's, recompiled, but the thing still does not work.

It loads images, it displays a window where is should
present texture. That window is not white like background,
but it has some plain colors which change when i change
frames. the textures are not present.

This does not work in VMWare WindowsXP or on a laptop with
Intel Graphics Extreme 2 - i have seen that card to emulate
OpenGL 1.4. But this has nothing to do with VMWare Windowses
on my dekstop machine which use some other graphics card
emulation.

Strange things...

If not texture dimensions, if not non-power-of-2 textures, then what
this could be..


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Apr 13, 2006 10:09 
Offline
Guitar Hero
Benutzeravatar

Registriert: Do Sep 25, 2003 15:56
Beiträge: 7810
Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
Maybe its a problem with the pixelformat of the file. But thats like guessing for me. I really have no idea.
Does everything else work correctly? What OpenGL states do you manipulate? Maybe some other stuff is activ and changes your output.

A screenshot whould be helpfull, too (I hope ;) )

_________________
Blog: kevin-fleischer.de und fbaingermany.com


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Apr 13, 2006 10:22 
Offline
DGL Member

Registriert: So Mär 19, 2006 12:30
Beiträge: 29
1.Pixel format is 24Bit OS/2 type BMP file, because glBitmap does not accept any other format like Windows BMP.
2.Do you have idea what format have OpenGL textures?
3.what depth do these textures have? [ i have read somewhere that consumer 3D cards convert textures to 32bit - is this time consuming??? ]


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Apr 13, 2006 10:49 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 05, 2002 10:35
Beiträge: 4234
Wohnort: Dortmund
1. glBitmap accept all bitmaps they can loaded with the TBitmap class. Normally they only could load windows bitmaps. JPGs, TGAs, PNGs are also supported.

2. Opengl texture are uncomressed images with many formats. The most important format is the 8bit per channel format and there the 32 Bit rgba format.

3. Internally they where converted to 32 bit. Sometime and driver depended. The data from an windows 24bit rgb file could transfer directlly to opengl. If some spacerbytes where removed. The convertig of the data is the choise of the driver.


Textureproblem. I don't have any ideas. If you dosn't get any error and no texture where drawn i think we need some picture how it looks like. I think the problem is anywhere else.

PS: If no texture where loaded and white as color is set you should get white planes. Otherwise you should check your texturecoordinates and texturesettings. Some lighteffekt could also result in dark(er) planes.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Apr 13, 2006 13:46 
Offline
DGL Member
Benutzeravatar

Registriert: So Okt 26, 2003 20:07
Beiträge: 249
1st of all, you should put your textures in an array for a better handling.
this saves loads of code because your ifs would turn into something like this:
Code:
  1.  
  2. Iterator := (Iterator + 1) mod (High(TextureArray)+1);
  3. TextureArray[Iterator].Bind;
  4.  


thats all - using this code, you're able to load hundrets of textures and change them without changing these 2 lines of code.

I don't know exactly what you mean with flickering-effect. Something like this could be caused by too high framerates, which the monitor
can't display, so the graphics card throws the new texture in the graphics ram and the monitor just starts painting it even when the first
texture is drawn before. so you see for a piece of a second two textures on your quad. turning on the vertical synchronisation in your graphics
driver will help.

Another Point is the using of the timer component itself. you should implement a high performance counter to get rid of it.

if that doesn't solve your problem, you should explain exactlier what you mean with flickering.

greetings

edit:
damn, should read more than only the first site ^^

_________________
I'm not the signature, I'm just cleaning the floor...

Derzeitiges Projekt:
FireBlade Particle Engine (Release R2 2009.06.29)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Apr 24, 2006 14:07 
Offline
DGL Member

Registriert: So Mär 19, 2006 12:30
Beiträge: 29
Hello again;)

I am having a lot of brainstorming how to speed up my app.

I have 3 points more to ask today.
I wish to know your opinion.


1.
I have came to the point where i probably experience TBitmap jgp->bmp conversion as performance killer.
I was doing it even in 2-3 TThread objects to check if it could be quicker or maybe my database is slow.
No. i see that frame[0].LoadFromStream function slowly loads JPG image.

I wish to quickly load jpg images to texture array of TglBitmap2D ( frame[1..50] of of TglBitmap2D)
from a disk database.

Do you have any idea how to do this EFFICIENTLY?


I think i cannot afford to load all pictures to TglBitmap2D ARRAY in memory, generate them and use them.
I need to load them from disk file.
My database with images would be 50-200MB for example - too big size for memory.

The function bellow uses TBitmap jpg->bmp conversion which i suspect to be performance killer.
Do you know if there are any other functions to convert loaded jpg to bmp without using
standard TBitmap library?
I would load jpg to memorystream and convert it fast to bmp, then load it with
TglBitmap2D.Load function which would choose LoadFromStream then, without all
that lengthly conversion from JPG using TBitmap.

Or maybe i am wrong and TBitmap is fast conversion??

glBitmap.pas:

Code:
  1.  
  2. function TglBitmap.LoadJpg(const Stream: TStream): Boolean;
  3. var
  4.   bmp: TBitmap;
  5.   jpg: TJPEGImage;
  6.   StreamPos: Int64;
  7.   Temp: array[0..1]of char;
  8. begin
  9.   Result := False;
  10.  
  11.   // reading first two bytes to test file and set cursor back to begin
  12.   StreamPos := Stream.Position;
  13.   Stream.Read(Temp[0], 2);
  14.   Stream.Position := StreamPos;
  15.  
  16.   // if Bitmap then read file.
  17.   if ((Temp[0] = chr($FF)) and (Temp[1] = chr($D8))) then begin
  18.     bmp := TBitmap.Create;
  19.     try
  20.       jpg := TJPEGImage.Create;
  21.       try
  22.         jpg.LoadFromStream(Stream);
  23.         bmp.Assign(jpg);
  24.         Result := AssignFromBitmap(bmp);
  25.       finally
  26.         jpg.Free;
  27.       end;
  28.     finally
  29.       bmp.Free;
  30.     end;
  31.   end;
  32. end;
  33.  



****
2.

You suggested that i should create some kind of texture manager.
I have declared an array:
frame[1..50] of of TglBitmap2D;

where i load textures using LoadFromStream glBitmap function

a. I load a bmp file to TglBitmap2D object using LoadfromStram
b. I use GenTexture function to generate it

1) at which point the texture is already loaded to graphics card memory?

2)What if all my textures in that array are lets say 200MB ( a 50 images? )
and my graphics card memory is only 128MB like cheap Ati X550.

3) How do i know where that texture went? graphics RAM? operating system RAM? swap file?

3b) There is a function in TglBitmap2D to release memory after texture had been generated.
But what memory? I load these textures to TglBitmap2D array and do not see any
decrease in the memory usage after these textures are generated.

Tell me if you are tired with my questions or i can ask more like today:P
I wish to know everything,i read sources, wiki but my knowledge is still...less than satisfactory.


***
3.
I have analysed glBitmap source and see it uses AssignFromBitmap function which uses TBimap.scanline
function.

I have googled a bit to find some newsgroup post about speeding this bitmap operation up.

I do not know yet IF in AssignFromBitmap
JPG.load function - slows down the program
or bitmap.scanline - slows down the program/

I am sitting here and checking all possibilities to speed up the things.

Maybe part of AssignFromBitmap in glBitmap function:

Code:
  1.  
  2.     for Row := 0 to Height -1 do begin
  3.       pSource := Bitmap.Scanline[Row];
  4.  
  5.       if (Assigned(pSource)) then begin
  6.         Move(pSource^, pData^, RowSize);
  7.         Inc(pData, RowSize);
  8.  


can be replaced with..

Code:
  1.  
  2. Right. But direct memory access can be optimized, too (probably you cannot
  3. save more than a few cycles per pixel). But... Did you know that calling
  4. ScanLine takes much time (I think Graphics32's ScanLine is faster)? You can
  5. minimize the calls to ScanLine by using something like:
  6.  
  7. var
  8. Origin: Integer;
  9. Pitch: Integer;
  10. P: Pointer;
  11. begin
  12. Origin := Integer(Bitmap.ScanLine[0]);
  13. Pitch := Integer(Bitmap.ScanLine[1]) - Origin;
  14. for Y := 0 to Height - 1 do begin
  15. P := Pointer(Origin + Y * Pitch);
  16.  



or using Bitmap32 library
Code:
  1.  
  2. var
  3. PixelPtr: PColor32;
  4.  
  5. begin
  6. PixelPtr:= Bitmap32.PixelPtr[0,0];
  7.  
  8. with Bitmap32 do for j:= 0 to Width*Height -1 do
  9. begin
  10. PixelPtr^:= Intensity(PixelPtr^);
  11. Inc(PixelPtr)
  12. end;
  13. end;
  14.  
  15. and to avoid the intensity callback, you could implement it directly into
  16. the loop.
  17. As you see, there is a few operations to save.
  18.  


What do you think? What could be the real bottleneck in TglBitmap2D.LoadFromStream ( jpg!) ?


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Apr 24, 2006 23:27 
Offline
Guitar Hero
Benutzeravatar

Registriert: Do Sep 25, 2003 15:56
Beiträge: 7810
Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
Something about your texturemanager:

You should make this a clever tool. Load 2 up to 4 pics which will be shown next. And let the last 10 pics rest in your GraKa-RAM. If the user steps forward and back, you have no problems with unloaded pics.
The user will whatch those pics, doesn't he? I mean, it is no animation, it should be a slide show? For animations it whould be much harder, because of the huge amount of data you have to load. But if the pic count is < 20 then your gfx-card will have no problem.

You can not determine if a texture is on the card or in the client RAM.

_________________
Blog: kevin-fleischer.de und fbaingermany.com


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Apr 25, 2006 09:09 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 05, 2002 10:35
Beiträge: 4234
Wohnort: Dortmund
In your special case everthing could be a bottleneck. All the function calls of the glBitmap waste time. You dosnt need to test everything on everyimage. The way to load an jpg and transform it to an Bitmap an load it again is also an bottleneck.

The glBitmap wasn't designed to be the most powerfull textureloader in world. Second place is okay. ;-) I designed it to be an easy and very flexible loader.

Some other things.
On generation the glBitmap disposed the internal memory where the texturedata was stored. OpenGL has its own memory so its not necessary to store it longer until generation. But Delphi has its own memorymanager so the Memory could also be allocated by delphi or the taskmanager displayed some differences. To Free the Memory you must set the FreeDataAfterGeneration property to true. Is the default.

To query if the Texture is in the Videomemory you can call the Methode glAreTexturesResident. The property in the glBitmap has the name IsResident. If the card has no own memory the function allways return true.

You must remember. The 128MB of your graphics card are not only for Textures. You must store your Framebuffer into it. Doublebufferd you need 2 Buffers. Windows allocated some memory. So i think from your 128 mb you can only use 64 for textures.

Scanlinecalls. I think this is not your main problem. But yes. Its not the fastes way to load the the difference its just 1 or max 2 milliseconds. Not an thing we should talk about it.


The best thing you could do is to search an jpegalgithym they load it fast and transfer the texturedata direktly to OpenGL!


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Apr 26, 2006 14:53 
Offline
DGL Member

Registriert: So Mär 19, 2006 12:30
Beiträge: 29
Could you tell me to which format should i decompress JPG image?
I thought until now i need BMP, but as i see in the sources, even bitmap is
not destination format of image to load to OpenGL.

JPG -> what ? to a pixel array of RGBA?

So in reality i should not generate BMP from JPG but rather try to decompress it and get an array of
pixels in some format?

Please give me a hint about it and what exactly should i search for.

I do not see any OpenGL jpg loaders beside those easy and slow which base on JPG->BMP by Delphi.

I have found this page:
http://datacompression.info/CommercialLibs.shtml

wihich as they claim are: "fast" commercial jpeg decoders.
It this what i need?

sorry i am still green :D

Regards!


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Apr 26, 2006 15:03 
Offline
Ernährungsberater
Benutzeravatar

Registriert: Sa Jan 01, 2005 17:11
Beiträge: 2068
Programmiersprache: C++
Aro hat geschrieben:
Could you tell me to which format should i decompress JPG image?
I thought until now i need BMP, but as i see in the sources, even bitmap is
not destination format of image to load to OpenGL.

BMP uses BGR, which is not a problem because you can tell OpenGL that it is in BGR-Format.
Another format ist (unkompressed) TGA. Supports alphachannel but is still BGR(A).


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Apr 26, 2006 15:04 
Offline
DGL Member

Registriert: So Mär 19, 2006 12:30
Beiträge: 29
How can i tell it to OpenGL?
What instruction in Delphi?


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Apr 26, 2006 16:18 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 05, 2002 10:35
Beiträge: 4234
Wohnort: Dortmund
Sorry i just have seen it yet.

I can't tell you what algorith you should use. And i never would say you must/should use an commercial lib. I dosn't know what jpeg lib are avail and what the fastet one. It may be possible that an self written algorithm is faster than the delphi class. When i look at irfanview. They loaded all jpegs really fast. Between 70 and 150 milliseconds. I think the loading of an jpeg in delphi is fast but the conversion to RGB is really slow.

The format you transfer to opengl isn't important and you can set it by one parameter of the glTexImage2D function. I mean it's the internal format param. I allways confuse the params. ;-)
glTexImage used the Pixelbuffer and interprete it as textur or do some conversions. This buffer is only an memorybuffer that contains sequentiall pixel. No more.

When you could load the image as RGBA (BGRA) (8bits per channel) you should do this. RGB (BGR) as format are sometimes slower than RGBA (BGRA). But only if you can load it directlly. To load the image and convert it is slower than the conversion of opengl.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Apr 26, 2006 17:42 
Offline
DGL Member

Registriert: So Mär 19, 2006 12:30
Beiträge: 29
When i have jpeg image it is in jpeg format which i need to convert to RGBA.
But to do this i need to decompress that image as i understand...
and that is where these commercial libs are advertising themselves - speed, multicore support ( intel integrated performance primitives lib )
or pegasus ImagXpress library.
They claim to have jpeg decompression 3 times faster than standard. How

Yes i wish to have it for free, who wants to pay, but as for today i do not understand jpeg format, image compression/decompression.
How much truth in there - i do not know;)

I think i will study jpeg format now:)

What is OpenGL function to return size of memory for textures in graphics card, size of free memory for textures on graphics card?


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Apr 26, 2006 17:43 
Offline
Forenkatze
Benutzeravatar

Registriert: Mi Okt 22, 2003 18:30
Beiträge: 1945
Wohnort: Närnberch
Programmiersprache: Scala, Java, C*
Aro hat geschrieben:
What is OpenGL function to return size of memory for textures in graphics card, size of free memory for textures on graphics card?

afaik there is none.

€dit:
Here you can obtain some informations about JPEG:
http://www.faqs.org/faqs/jpeg-faq/

_________________
"Für kein Tier wird so viel gearbeitet wie für die Katz'."


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Apr 27, 2006 09:49 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 05, 2002 10:35
Beiträge: 4234
Wohnort: Dortmund
Frase hat geschrieben:
Aro hat geschrieben:
What is OpenGL function to return size of memory for textures in graphics card, size of free memory for textures on graphics card?

afaik there is none.

It's right. There is no way to query these informations.

Another site who contains information about many formats ist wotsit.


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 61 Beiträge ]  Gehe zu Seite Vorherige  1, 2, 3, 4, 5  Nächste
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 0 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.011s | 15 Queries | GZIP : On ]