Sign in to follow this  
Vagos

2d matrix

Recommended Posts

Vagos    100
Hi all! I am currently making my own 3d graphics engine (still only 2d) and for that i use borland pascal, compile in protected mode and use dosbox to run. (the only method in pascal that u can use etc. delay function (only in protected mode) and the graph unit). I know, very stupid to program in pascal, but I am just for start developing the logic behind: first ever image! < /img> and with graph and fill: < /img> I want to know what programming language to use tha can enable to me a 2d matrix to " turn on/off " pixels (and for that task to use the gpu, i mean only to draw the pixels on/off, because the first task is to make the 3d engine's code for cpu ). [Edited by - Vagos on June 19, 2009 10:24:14 AM]

Share this post


Link to post
Share on other sites
rouncED    103
When im writing a software engine, i usually do it in direct draw, I take it you mean a 2d matrix of pixels i.e. being the screen.

Just flip bytes in an array and use an api function to blast it to the screen.

Nice pics btw. :) Its better to actually imbed them in the post, using "< img src="picture url"> < /img>" (without spaces otherwise i couldnt even write it here.)

Share this post


Link to post
Share on other sites
Vagos    100
Sorry, but somehow i can't imbed the images to the topic.. I tried before i post...

Anyway, I had in my mind for ddraw, but how am i gonna use it? what programing language to use? The fill code goes terribly slow if i use the graph to "read" if a pixel exists or not (the code of mine, to fill a shape "scans" if a pixel exists or not) and general the combination of the outputs of pascal and the dosbox is the worst combination...
Also i hope that ddraw can offer something like vsync or just blast pixels all-together because pascal's output draws line by line and causes terrible flickering...

Another thing, due to the combination (dosbox-pascal) the cpu usage isn't accurate. I mean that if u want to make a program and test your code to be as much as optimal (task manager is my right arm to measure the cpu usage..) and use etc dosbox the results simply doesn't matter.. I have a p4 @ 2.4 gh and take the half cpu.. So I hope that ddraw doesn't take the cpu. I want only the code i made to use the cpu, and the output to not "detach the attention of cpu"..

Share this post


Link to post
Share on other sites
rouncED    103
Dont worry, direct draw is the fastest one to use, voxlap this amazing voxel renderer and a ddraw port for it at one stage, did you know you can even use d3d to get at the screen and not use the rest of the api.
(funnily enough thats what they recommend even just for 2d work these days, because eventually ddraw is going to be phased out of the video cards.)

d3d8 is a good version to use because everything supports it.

Youll need c, use that instead of pascal. Pascal is a great language i know it too, but eventually move on to c and never use c++. :) thats what the guy from id software says, and hes totally awesome at programming.

All the latest shite is written in c or c++, including d3d and direct draw.
So organize another book reading session, get a book on c and enjoy reading it. from what ive seen what youve done there it definitely prooves your a good programmer, so you should be able to learn it with your eyes closed.

So I guess your writing a 3d engine? good luck, they are totally awesome to make.

Did you know, if you were working in pascal, why not go to text mode and render 3d in there - that would be awesome for a demo. (goes way back)

Share this post


Link to post
Share on other sites
Vagos    100
I just know basics in pascal (that's why i use it), but i have a c++ guide so i know the very very basic in c++ (i have only made the famous "hello" in pc). For the engine i made i use simple algorithms, and as i know these type of algorithms (in my program only the rotation code until now) can be made in matrix style (matrix in mathematics i mean), but there are simple "for" loops, a record type variable and many ifs .. the lines of my code are 161. anyway what do u mean -> "" why not go to text mode and render 3d in there ""? the first image is pascal as it is without any unit, and the second uses the graph unit. i have still in paper the 3d raster, and i am going to implement in the next 2 or 3 weeks.. As for c, the most sure is that i must move there (i have considered assembly as well, but that's not easy staff). As for directx3d and ddraw, i prefer ddraw because you said it's faster, and it's logic because d3d has more code inside it! Isn't there any way that i can use pascal and ddraw, just for the beginning?

Share this post


Link to post
Share on other sites
OrangyTang    1298
Sounds like a job for pixel toaster. Although pretty much any modern language will let you do what you want - just draw your 3d objects into an offscreen buffer or image and then draw that to the screen using whatever native drawing ops it supports.

Share this post


Link to post
Share on other sites
Vagos    100
rouncED, i found an even better example of use pascal crt unit (not even vga), but uses assembly code (inside pascal)
-> http://www.trsek.com/en/cover/benkovic/bezier
just omg!!!
and the display is v-synced!!!
but i can't understand a thing, because of assembly..

and orangytang, when i am going to switch to c++ or c (it works for c, right?) i am going to give a try to pixel toaster (sounds like the video toaster of amiga!!! (used to blast pixels in tv i thing...) :P)

Also in pascal i have seen 3d graphics demos that use directx (tmt pascal) and have found directx sdk (with ddraw) but no manual. Demos are very nice win32 applications (resize the window, cpu usage at optimal (as needed))..

I insist in pascal because i know some staff, and because it's not easy to move in another language. Once i finish the coding and have results, in pascal, then i am going to move in another language.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this