Page 1 of 1
Simple graphics & file systems.
Posted: Wed Feb 15, 2012 7:55 pm
by rooper
Hello, are there any easy ways to code graphics? Right now im using arrays to draw small picture, but it is very inefficient. Also I have been trying to get a file system working on my OS for some time, but all my attempts futile. Does any one know of good simple tutorials or examples the explain file systems in a clear understanding, because I have never interfaced with hardware like this, so I need some help.
My os is in C with an asm bootstrap.
Has basic video, cli, idt, gdt, memory management, isrs, irq and all the other basics.
Oh and if there are any people who are good at using grub how do you get that gfx menu stuff to work it looks really cool, but when I try it to put it on a cd or floppy to load my os it just hangs GRUB...? Is there any pre-compiled images of grub that support gfx menu, because I must be doing it wrong.
Re: Simple graphics & file systems.
Posted: Wed Feb 15, 2012 8:03 pm
by VolTeK
rooper wrote:Hello, are there any easy ways to code graphics?
In a GUI like topic, No. There is Not.
rooper wrote:Also I have been trying to get a file system working on my OS for some time, but all my attempts futile. Does any one know of good simple tutorials or examples the explain file systems in a clear understanding, because I have never interfaced with hardware like this, so I need some help.
Look up some PDFs on Google. One of the ways i had learned was from using this pdf (one of many)
http://www.eit.lth.se/fileadmin/eit/cou ... iption.pdf . You may also use the wiki provided by the forum.
Re: Simple graphics & file systems.
Posted: Wed Feb 15, 2012 8:38 pm
by GAT
As far as graphics, I use arrays for icons only.
When it comes to doing GUI stuff, like windows, buttons, input boxes &c. I just use a set of loops to draw rectangles one pixel at a time. I set it up so the box drawing routine takes the x,y of the top right and bottom left corners so it can be easily positioned and shaped.
Once you set up some basic routines then graphics get easier, but until then graphics isn't easy.
Re: Simple graphics & file systems.
Posted: Thu Feb 16, 2012 4:59 am
by brain
There are much faster ways of drawing horizontal lines, filling areas, drawing triangles etc. what graphics mode are you using? There are also some cool ways to draw lines that a lot of people overlook, for example bresenhams algorithm.
Re: Simple graphics & file systems.
Posted: Thu Feb 16, 2012 5:40 am
by bubach
For FAT, I agree:
http://www.eit.lth.se/fileadmin/eit/cou ... iption.pdf is really the best explanation I've found. Recently collected some more documents and snippets for it, here:
http://bos.asmhackers.net/docs/filesystems/fat12-16-32/
Both snippet 8 & 9 are pretty complete FAT drivers in PD thats made for embedded use, so fairly stand-alone.
Grapics
Posted: Thu Feb 16, 2012 10:14 am
by nuke
What do I need to develop a simple VESA and VGA Driver?
I just know few stuff about hardware and I try my level-best to mix those in my kernel.
Re: Grapics
Posted: Thu Feb 16, 2012 11:17 am
by Brendan
Hi,
nuke wrote:What do I need to develop a simple VESA and VGA Driver?
I just know few stuff about hardware and I try my level-best to mix those in my kernel.
The first thing you'd need for any video driver is a specification that describes the video driver's interface. Before writing this I'd recommend creating a list of features for your OS's video subsystem (multi-user, multiple monitor support, resolution independence, etc); and researching how OpenGL works and finding out what modern video cards are capable of. I'd also consider splitting things up into "capabilities", where some capabilities are required (e.g. mouse pointer support) and some are optional (e.g. volumetric fog); and having a function to return the video driver's capabilities and if each capability is hardware accelerated or not.
Once you've designed your video driver interface you'll have a list of "stuff" that you need to implement (the required capabilities). For a generic VESA/VGA driver, everything will need to be implemented in software (e.g. line drawing, blitting, polygons, textures, mouse pointer support, etc).
You'll also need to determine a "graphics pipeline" and figure out parallelism (as software rendering takes a lot of CPU time and you want to speed it up by throwing lots of CPUs at it when you can) and caching. As a rough outline, I'd probably start with something like:
- transformation: doing scaling, rotation, translation, etc to convert "3D world coords" into "view space coords"
- backface culling: get rid of anything that is facing the wrong way
- clipping: get rid of stuff outside the view port
- texture selection: determine which version of each texture to use where (note: mipmaps)
- rasterisation of opaque textures: break everything opaque into horizontal line segments, where nearer line segments overwrite distant line segments
- opaque texturing: Convert "opaque line segments" into a 2D pixel data and Z buffer
- rasterisation of transparent textures: break everything transparent into horizontal line segments, and store the "transparent line segments" in lists sorted in order of Z
- transparent texturing: Merge "transparent line segments" into the 2D pixel data in order from "furtherest" to "closest".
- colour space conversion: convert 2D pixel data from internal format to whatever format the video mode wants (may include HDR)
- blit the final 2D pixel data to display memory
Cheers,
Brendan
Re: Simple graphics & file systems.
Posted: Thu Feb 16, 2012 11:20 am
by nuke
SOoooooooo much complicated.Can you please guide me by telling the first step what i need to do??
Re: Simple graphics & file systems.
Posted: Thu Feb 16, 2012 11:24 am
by Brendan
Hi,
nuke wrote:SOoooooooo much complicated.Can you please guide me by telling the first step what i need to do??
Brendan wrote:The first thing you'd need for any video driver is a specification that describes the video driver's interface.
Cheers,
Brendan
Re: Simple graphics & file systems.
Posted: Thu Feb 16, 2012 12:44 pm
by bluemoon
nuke wrote:SOoooooooo much complicated.Can you please guide me by telling the first step what i need to do??
First, Get a coffee.
Then,
I would recommend you start with software rendering first, since most hardware acceleration interfaces are undocumented.
If you have no experience on graphic programming, try write an X11 or Windows application that has a owner draw widget, and write rastering functions to manipulate the bitmap.
Those functions can then be used by your graphic driver, with little modifications, to work on the frame buffer.
Re: Simple graphics & file systems.
Posted: Thu Feb 16, 2012 12:56 pm
by bubach
nuke wrote:Can you please guide me by telling the first step what i need to do??
First step would be to compile some code. I mean _anything_ at all.
You can't just collect code for a complete OS, with GUI and everything, when it's obvious you haven't even passed the stage of compiling simple code examples from tutorials.
You will never get anywhere if you can't compile and test your code, so I suggest that you start off by taking another look at the GCC cross-compiler section of our wiki.
Re: Simple graphics & file systems.
Posted: Thu Feb 16, 2012 8:37 pm
by rooper
Wow, thanks guys that simple stuff for file systems really helped!