Writing a Graphics Library

Discussion about everything. New games, 3d math, development tips...
Post Reply
Aspiring
Posts: 6
Joined: Fri May 09, 2008 1:43 am

Writing a Graphics Library

Post by Aspiring »

I was just wondering what it involved. Does it mostly use assembly? Does it require an immensely good concept of mathematics? Does anyone know how to change a single pixel in assembly? ^_^
hessiess
Posts: 47
Joined: Wed Mar 12, 2008 8:39 pm

Post by hessiess »

Irrlicht is open source, why not look at the source code? thay are normally coded in C/C++ using OpenGL or DX
Brainsaw
Posts: 1241
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

If you use assembly it is quite difficult to get cross platform compatability, so I don't think that Irrlicht has assembly in (though I didn't check the code ;) ). Imho you don't really need to code such stuff in assembly nowadays, modern compilers do a pretty good job in optimization. Just my 2 cents.
Image
Dustbin::Games on the web: https://www.dustbin-online.de/
Aspiring
Posts: 6
Joined: Fri May 09, 2008 1:43 am

Post by Aspiring »

hessiess wrote:Irrlicht is open source, why not look at the source code? thay are normally coded in C/C++ using OpenGL or DX

I don't think you understand what I mean, Irrlicht is a 3D graphics engine isn't it? And it uses DX and OpenGL which are Graphics Libraries.

What I mean is how would I write something like DX or OpenGL? What code was used in their making?
lostclimategames
Posts: 331
Joined: Sat Sep 02, 2006 4:11 am
Location: Michigan
Contact:

Post by lostclimategames »

"DX or OpenGL"

that would probably be a mix between assembly and c. though of course you also need to build your hardware if you want to make a graphics system comparable to theres, engines dont write things like directx or ogl, they use them to write the engine.
___________________________
For all of your 3D/2D resource needs:
Image
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

Well, if you know the memory map you can reference both physical and virtual memory in asm. Moreover, you need to have the databook for the chips you'll be writing drivers for.

Is that the level you want to be in?
Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Aspiring wrote:
hessiess wrote:Irrlicht is open source, why not look at the source code? thay are normally coded in C/C++ using OpenGL or DX
I don't think you understand what I mean
Don't feel too bad about it; effective communication takes practice.

Aspiring wrote:What I mean is how would I write something like DX or OpenGL? What code was used in their making?
...or a software renderer? Like the Irrlicht software renderers?

I have no idea how much of DX or OGL is ASM. I'd imagine very little. The smart strategy is to write everything in C or C++, identify your inner loops, then look at the ASM for that code. If and only if you think you can do better do you begin to ASMify those loops.

Of course, many devs just dive in and start writing ASM without bothering to see if a modern optimising compiler can do as well or better, but you can't really blame them for that: their mothers probably drank a lot during pregnancy.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Don't feel too bad about it; effective communication takes practice.
And as a friend of mine noted: "language is instrument of misunderstanding" so we are doomed anyway ;)
The Onslaught
Posts: 41
Joined: Mon Jan 29, 2007 3:33 pm

Post by The Onslaught »

Well, Good luck son
After reading this sentence you will realize you have wasted 5 seconds of your life
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

"Does anyone know how to change a single pixel in assembly?"

A pixel used to be physically mapped, meaning you simply write a value to a memory location and the pixel will automatically show-up on your monitor. Try Googling CGA and VGA memory map and you'll get a feel of what it looks like.

Nowadays, if you're dealing with a GL or a graphics engine, the pixel is now abstracted to a programmer. You will never touch the actual physical location of the screen simply because some hardware chip is already doing that kind of work. You will not anymore deal with cpu registers and video memory. That's all gone, that's the 80's and early 90's way of doing video.

Maybe your computer has a video card installed, maybe not. But the thing is, if there is a video card installed on your computer, chances are high the applications running on your machine is talking to that video card.
Image
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Video cards are more than an array of output pixels, they provide a huge bag of tricks that make fast and impressive graphics possible. The video driver provides a way for the operating system and graphics libraries to access these hardware accelerated features, and the graphics libraries bundle the them together in a way that makes them relatively easy to use. If you wanted to write something like Direct3D or OpenGL then it would be mostly about knowing and using the features, rather than mathematics.

Writing a software rasterizer is a completely different thing, this book ($20) is a complete guide to making one. If you wanted to read a software rasterizer Irrlicht has two to choose from, you can step through the code and see what it takes to draw a textured triangle
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
bull
Posts: 36
Joined: Wed Sep 12, 2007 8:49 am
Location: s1Ng4p0R3

Post by bull »

I don't think you understand what I mean, Irrlicht is a 3D graphics engine isn't it? And it uses DX and OpenGL which are Graphics Libraries.

What I mean is how would I write something like DX or OpenGL? What code was used in their making?
DX and OpenGL are quite low-level( like asm)
Irrlicht are high level( like C/C++ ) . Irrlicht helps you to use DX, OpenGL and in a simpler way.

I think OpenGL is written in C.
DX is closed source so most of us don't know how they wrote it. It's very likely to be developed with C++, Visual Studio IDE and compiler since it's a M$ product. (and I write M$ just because I like to do so, not because I hate them or anything)
Does it require an immensely good concept of mathematics?
Depends on how you define "immensely".
My name is bull, for we are many ...
FlyingIsFun1217
Posts: 219
Joined: Fri Apr 13, 2007 8:29 pm
Location: Illinois
Contact:

Post by FlyingIsFun1217 »

bull wrote: DX and OpenGL are quite low-level( like asm)
Maybe in terms of a production-quality product like a game or modeling program, but in reality, they are both pretty high-level when it comes to what you would have to do without them.

FlyingIsFun1217
Post Reply