OK...then I will leave for a week. Will be back on Sundy. Hope I took everything I needed with me home to make that tutorial about the image sizes.
Take care of this thread for me, while I am away. And keep questions comming.
Printable View
OK...then I will leave for a week. Will be back on Sundy. Hope I took everything I needed with me home to make that tutorial about the image sizes.
Take care of this thread for me, while I am away. And keep questions comming.
I am trying to make the getsize of image tutorial so simple as possible here. But I have found one potential error. For some of the images you have to read a whole buch of the file to find the height and width of it. Lets say like 1kb, but some pictures are maybe not that big. So if you read a picture like this:
VB Code:
Open sFileName For Binary As iFN Get #iFN, 1, bBuf() Close iFN
and bBuf is 1Kb and the picture is not. Do you then get an error? If so can anyone find a way to check the file size so the fixed amount of the file that you read are not bigger then the file....?? I don't have the time to test that now. Trying to strip down the code so it looks nice for the beginners here. Would appriciate if anyone looked it up for me.
Are you wanting to read the whole file in? In the case of filetypes which dont have set headers? Most of the file types I know of have a value in their header telling you the size of the file in total. For example bitmap headers:VB Code:
Private Type BITMAPFILEHEADER bfType As Integer [b]bfSize As Long[/b] bfReserved1 As Integer bfReserved2 As Integer bfOffBits As Long End Type Private Type BITMAPINFOHEADER biSize As Long biWidth As Long biHeight As Long biPlanes As Integer biBitCount As Integer biCompression As Long biSizeImage As Long biXPelsPerMeter As Long biYPelsPerMeter As Long biClrUsed As Long biClrImportant As Long End Type
Hehe....you ****...forget about the BMP file...I have done that part for 7 years now...I am talking about the JPEG standard ans so on....as I have said soooo many times there is no fixed point where the size of the size is in a JPG file. It can even hold the size for the thumbnail image in the JPG file it self...:D.....just listen to me, and answer me...will it give an error...:D
hehehe, I know you know bout BMP but I thought I'd use it as an example, doesn't the jpg have a file header at all? If not I have a way of getting the whole file in one byte array if ya want it. Will code it up now....
the jpeg has a header.. i think i have the source to a jpeg decoder somewhere on my hdd..
This should do the trick, isn't exactly super fast because it uses the redim everytime but its not that slow ;).VB Code:
Dim tBuffer As Byte 'Tiny Buffer Dim dBuf() As Byte Dim i As Integer i = 0 Open sFileName For Binary As 1 Do 'Get the next byte... Get #1, , tBuffer 'Resize Buffer and add extra data... ReDim Preserve dBuf(0 To i) dBuf(i) = tBuffer i = i + 1 Loop Until EOF(1) Close 1
Or this:VB Code:
Dim dBuf() As Byte i = 0 ReDim dBuf(0 To FileLen(sFileName)) Open sFileName For Binary As 1 Get #1, , dBuf() Close 1
Yeah, the last one could work. But I tried to open up a one pixel gif last night, with a 65k buffer, and it didn't give me an error. Looks like VB is looking after you....:D
maybe i miss the point but cant you just use filelen(Filename)
:confused:
Maybe I was tired and ove worked...:D....it was the same that Electroman suggested....;)....but it doesn't seem like VB care anyway...;)
Yeah it has some sort of header...but the point here is that the size of the image is not at a fixed point...so you can't read it as a BMP file....I am always right, stop saying anything else..:dQuote:
Originally posted by kedaman
the jpeg has a header.. i think i have the source to a jpeg decoder somewhere on my hdd..
of course you can't read it like a bmp file, its not a bmp file you moron ;)Quote:
Originally posted by NoteMe
Yeah it has some sort of header...but the point here is that the size of the image is not at a fixed point...so you can't read it as a BMP file....I am always right, stop saying anything else..:d
Now you are irritating me again...:D....what I mean is that the header of a JPG file is not static, and does not have a fixed length....the diffrent parts of the header is seperated by diffrent markers. And that is what you have to look for to get the right answer. What makes this even worse is that the same marked is used for the size of the thumbnail (if there is noe) and for the actual size, and it might be used for at least one more thing to, but I have no idea what that is, but I am 100% sure that it is not the size....I hat JPG...:D
hehe why don't you just use an existing jpeg library :D http://www.ploksoftware.org/docs/en/a00790.html
Hehe...first of all...that is a C library. And this is a VB tutorial. And second of all, I am making a tutorial on how to find it your self, and that big file would be to much of the good in this tutorial....but off Keda..:D
what a useless tutorial ;) I have the code in VB somewhere too, but whats the point in learning how to find it in JPEG files anyway ;)
So they can do it on their own for other formats...;)....and there has been 3 persons asking for diffrent file formats all ready this week..;)
I still think its useless ;)
theres a collection of fileformat info on wotsit.org i think
Yaeh and I am trying to teach them how to use it...and BTW try to read what they write about JPG there...:D...thats just plain fun...:
oh heck.. one of the most useless things I could ever think of is learning of fileformats :D
Just shut up..:D...and let me do my work...as long as people are asking questions, I will answer them...go over to CgitChatForums.com and stay there...;)
no way, its my duty to see that people don't learn any useless stuff here, if there are libraries available to do that then its just to use them ;)
Well...give me the links to the libraries for VB...and I can attach a link to it in my tutorial...;)
i have posted it somewhere on this forum a couple of years ago or so, just search for it ;)
You know I won't do that for you....I bet they will use my code in the tutorial anyway...so if you want it added. Then find it..;)
Here I am again...:D...there is so nearly finished tutorials on it's way, but I doubt that I have the time to finish them before June or something..:D
But I was thinking about an other thing. Would it be nice to have a "diictionary" for game expressions/math expression/computer expressions and so on in the faq. An example could be like this:
DX - DirectX
AGP - Accelerated Graphics CardQuote:
A Graphics Library
Quad TreeQuote:
a PCI based interface that was designed specially for the demands of 3D graphics applications. The 32-bit AGP channel directly links the graphics controller to the main memory. Although the channel runs at only 66Mhz, it supports data transmission during both the rising and falling ends of the clock cycle, yielding an effective speed pf 133MHz
Quote:
Blah blah blah
And after each name and look up, there can be links called 1, 2, 3 and so on, to links to read more upon it.
What do you guys think?
Good idea :D
Nice but I think you'll need to put the definitions on a seperate page because it would take up loads of room, dont you think. Like say on your site you could do some php that will retrive definitions from your Db. That way in another thread when someone asks what something means you just put a link and they see the definition instead of needing to look though loads of others in the FAQ. What you think? If you dont want to use your site I'd be happy to do it as well.
It was a good idea...but I didn't think of using so much space on each definition. It was just ment to be short. And the links to tutorails/articels would show it in depth...I have no problem with using my site for it if you think that is a better solution. But I don't have the time to make that database before in June either...:D
We could start off using a new post or 2-3 in the FAQ and we could see later if we need to use a database. Or you or an other could make that database....If so, it should be possible for everyone to alter the explenation for the word or (can't remember what it is called when you only write the first letter, something on A..arbitueiueir, arbitrary, arbeid...no..can't remember..:D)
Good to hear....I am so tired of reading a lot of technical words that I have to look up all the time. Now we can finaly just look them up...:DQuote:
Originally posted by BodwadUK
Good idea :D
It was just because of the size of the AGP explaination that made me think that and I suppose the Quad Tree one would be around the same size.
I suppose untill their is quite a few we may as well put them at the bottom of the FAQ, but I will get working on some PHP pages that will display defintions and allow you to edit them. Just incase we do decide to use that.
Acronym is the word your after :D ;)
I was thinking about just writing: "Binary tree used for space partitioning in a 3D environment/terrain in a game" for the quad tree. Explaining the whole bit would take 3-4 pages. Thats why I thought about adding links to all of them. So we don't need to write articles or tutoriaols for algorithms, datastructures and so on.Quote:
Originally posted by Electroman
It was just because of the size of the AGP explaination that made me think that and I suppose the Quad Tree one would be around the same size.
Yeah lets start out in some posts, and then see what we need later. If you need any help with the PHP/MySQL or what ever let me know. I am not very good, but I can find my way around it...;)Quote:
Originally posted by Electroman
I suppose untill their is quite a few we may as well put them at the bottom of the FAQ, but I will get working on some PHP pages that will display defintions and allow you to edit them. Just incase we do decide to use that.
Was it....I thought it was more like abrivation or something,....Quote:
Originally posted by Electroman
Acronym is the word your after :D ;)
Abbreviation is kind of the same but like "ect." & "Adv." are abbreviations.Quote:
Posted by NoteMe
Was it....I thought it was more like abrivation or something,....
Ever heard of "TLA is a TLA". TLA = Three Letter Acronym :). An Acronym is when you only use the first letter of every word ;)
K :DQuote:
Posted by NoteMe
I was thinking about just writing: "Binary tree used for space partitioning in a 3D environment/terrain in a game" for the quad tree. Explaining the whole bit would take 3-4 pages. Thats why I thought about adding links to all of them. So we don't need to write articles or tutoriaols for algorithms, datastructures and so on.
Yeah lets start out in some posts, and then see what we need later. If you need any help with the PHP/MySQL or what ever let me know. I am not very good, but I can find my way around it...;)
OK...guess you are right....I have no idea...:D...Quote:
Originally posted by Electroman
Abbreviation is kind of the same but like "ect." & "Adv." are abbreviations.
Ever heard of "TLA is a TLA". TLA = Three Letter Acronym :). An Acronym is when you only use the first letter of every word ;)
SO then I guess it is just to start to make that thread...anyone that want to help are welcome...
You mean like this one but for definitions or do you mean Like the FAQ but for definitions :confused: :D.Quote:
Originally posted by NoteMe
So then I guess it is just to start to make that thread...anyone that want to help are welcome...
Or extra Post in the FAQ thread I assume ;).
I ment adding things here so I could add them to the FAQ, if that sounds like an idea.
If not any other ideas?
Lookig at the AGP thingy you have said that the P in AGP stands for Card :confused: do you mean processor? :D
Nope, Sounds good.Quote:
Posted By NoteMe
If not any other ideas?
Doh, Port not processor ;)
Yeah should have been Port...:D
Yeah add the definitions here, or in a new thread....you choose...
Should I add:
Point
Vertex
Polygon
Mesh
vector
Matrice
And so on too? Or is those to obvious for English/American persons?
Thought about
FFP
TnL
GPU
CPU
PCI
too...what about them?
I think Point would be the only one that you should miss out, the others all seem pretty good.Quote:
Posted by NoteMe
Should I add:
Point
Vertex
Polygon
Mesh
Vector
Matrice
And so on too? Or is those to obvious for English/American persons?
Thought about
FFP
TnL
GPU
CPU
PCI
too...what about them?
Do you actually know the 100%diffrence of polygon and mesh...I am getting confused in most of my books here....
Nope, I know what they are but dont think I could define what either of them are properly.Quote:
Originally posted by NoteMe
Do you actually know the 100% diffrence of polygon and mesh...I am getting confused in most of my books here....
OK. Let me have a go, and then you can tell me what you think. And we have to write in the post in the FAQ that they can post here if they want to add something or reexplain the word/acronym...
Vertex
PolygonQuote:
A point in 3D space that can hold more information then just the point. It can have a color, a normal, texture coordinates and so on.
MeshQuote:
A simple n-sided closed figure, using minimum 3 vertices. Triangle is the simplest polygon
FFP - Fixed Function PipelineQuote:
An object made by hundred or even thousand of vertices to form a shape.
GPU - Graphics Processing UnitsQuote:
The pipeline that your vertices go through before they show up on your screen.
TnL - Transform and Lightning
matrice
vector
CPU
PCI
This is how far I got. A friend just passed by, so I have to leave the computer for a while. Please feel free to change anything or add or what ever when I am away....
Just a couple of SP mistakes ;).
Triangle is the simples polygon
Triangle is the simplest polygon
The pipeline from your vertices go through before they show up on your screen.
The pipeline that your vertices go through before they show up on your screen.
Thats matrix note, note matrice ;)Quote:
matrice
vector
CPU
PCI
matrix - an algebraic datastructure, a grid of columns and rows which is used in solving equation systems in linear algebra. In programming context matrices are mostly used for transformations made on objects in n-d space
vector - an n-tiple (an array of n elements) is a representation of displacement in n-d space
CPU - central processing unit
PCI - Peripheral Component Interconnect