Archived

This topic is now archived and is closed to further replies.

Aardwolf

win32 fullscreen pixel in assembly with devcpp4

Recommended Posts

What assembly code do I have to add in devcpp4 to show a pixel at location x,y with color r,g,b in fullscreen in win32 at resolution I want? Or are there better ways with devcpp4 to do it? What's the fastest way, because every nanosecond can help here... Thanks. Edited by - aardwolf on February 18, 2002 10:01:54 PM

Share this post


Link to post
Share on other sites
Dev C++ uses a port of GCC to Windows, not DOS. In Windows you don''t have direct access to the screen buffer like you did in DOS. To still get graphics you''re almost forced to use OpenGL or DirectX. Take your pick . If you''re not really serious about it being fast you can use the GDI also.

Share this post


Link to post
Share on other sites
Well, fast it needs to be
What''s faster? OpenGL or DirectX?

Is DOS even faster?
If DOS is fastest, I may stick with that, but how can I do rgb color with it? (I think rgb color will make my thing faster, not slower)

Thanks.

Share this post


Link to post
Share on other sites
quote:
Original post by Aardwolf
What''s faster? OpenGL or DirectX?

A question to be avoided. They both rely on the hardware to do the rendering so they''re essentially the same.
quote:
Original post by Aardwolf
Is DOS even faster?

For plotting single pixels it may be. But for anything more advanced that can be hardware accelerated, it won''t be.


Share this post


Link to post
Share on other sites
Well, I'll go for OpenGL then, that's the not-microsoft one

Too bad I can't use hardware accelaration for this program, but I just want away from DOS. (well, it's a 3D raytracer that draws a cube based world pixel by pixel, I made it work with FirstBasic already but it's too slow and I can't do colored lighting with only 16 colors)

Edited by - aardwolf on February 18, 2002 10:36:30 PM

Share this post


Link to post
Share on other sites
I will be showing my complete lack of understading here... But how is it possible for Windows to control memory access.

I figured assembly is executed directly (as typed by the programmer). Where does the OS intervene ?

Share this post


Link to post
Share on other sites
umm, direct pixel acces is best done using DIBs (at the same resolution/color depth as the screen) or using directdraw. using opengl for per pixel access is just plain ignorent and doing it because its non microsoft is just plain stupid. if you hate ms that much, code for linux, NOT windows. in fact dont even use windows, show ms you really can get along without them instead of being stupid and using the wrong tool for the job.

NewDeal: quite simple, just like c compiled code, assembly is converted to a machine code excutable. assembly is not magically, just a closer langauge (1:1 for the most part since some "compilers" have special macros). since you are using actual machine instructions, but because of this you must rewrite the entire code if you plan on running on other cpus (since each cpu has a different "language"). i highly suggest learning some simple assembly just to understand how the cpu works, and also appreciate using higher level langauges like c/c++ and how complex cpus have gotten.

also in case i did not make it clear (which i may have not) when using assembly the code will run as coded by the programmer like any code in any langague. no mystical magic is granted except some tricks, optimization opurtunities, and ability to use things like mmx, sse, sse2, 3dnow even if the c/c++ compiler dont support them. heck you can even mix c/c++ and asm code (i do this in msvc++ for certain secions of code that need mmx).

Share this post


Link to post
Share on other sites
I''ve searched around there, but the only thing I found that may contain the ddraw.h file was a 165 MB exe file, and downloading this really is overkill. Is the ddraw.h file somewhere as seperate download, or if you have the file could you please send it to hybrid@altern.org?

Thanks a lot.

Share this post


Link to post
Share on other sites
quote:
Original post by NewDeal
I will be showing my complete lack of understading here... But how is it possible for Windows to control memory access.

I figured assembly is executed directly (as typed by the programmer). Where does the OS intervene ?

Most processors have several modes of operation, with each mode having more operations available than the next. The idea is that there are certain privileged operations that are only available when the processor is in a given mode, and that since mode-changing itself can be a restricted operation, your operating system can limit which processes have access to the privileged instructions. (And then later artificially integrate a web browser with the kernel process, thus destroying these useful boundaries. *mutter*)



[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Share this post


Link to post
Share on other sites
Kylotan:
Im sorta confused about your use of "mode" although your description sounds more like the privilege levels. These privilege levles are available under Protected mode. Windows 3.0 used the first privilege level => Ring-0: System
2nd privilege level => Ring-1: Windows Apps & DLLs
3rd privilege levle => Ring-2: DOS Apps

The 4th privilege level (=>Ring-4) wasnt used at all...

The expression mode is used in context with Protected and Real MODE...

a person:
i just want to get that straight: you dont have to re-write the code for every single cpu... All the IBM compatible cpu use the same set of instructions (of course there r exceptions like the special MMX and 3Dnow! instructions), however if you would like to use your IBM assembler code on, letz say, a Game Boy Advanced, which is using an ARM CPU and is not compatible to IBM processors, your IBM code wouldnt work...

Aardwolf:
dowload the latest DirectX SDK, i know its huge, but there comes lots of interesting stuff with it...

PredeX

Share this post


Link to post
Share on other sites
actualy dibs are just as fast. since when doing most direct access you want the buffer in system memory anyway. ALL video cards now accelerate dibs and the gdi. just keep the dibs the same depth as the screen.

as to the dx problems, go serach for some tutorials on using dx with assmebly, since you have to deal with the vtable ptrs and such. also you may be able to get headers from the site.

Share this post


Link to post
Share on other sites
quote:
Original post by PredeX
Kylotan:
Im sorta confused about your use of "mode" although your description sounds more like the privilege levels. These privilege levles are available under Protected mode. Windows 3.0 used the first privilege level => Ring-0: System
2nd privilege level => Ring-1: Windows Apps & DLLs
3rd privilege levle => Ring-2: DOS Apps

The 4th privilege level (=>Ring-4) wasnt used at all...

The expression mode is used in context with Protected and Real MODE...


Just to nitpick a bit here ...
The 4th privilege level is known as Ring 3 . Also, there''s nothing wrong with using the word ''mode'' in this context. Think kernel mode versus user mode - CPL 0 versus CPL 3. Finally, I''m not sure what Windows 3.0 does, but I believe that NT only uses ring 0 and ring 3.

Share this post


Link to post
Share on other sites
well that Ring-4 was a typo...

and to the expression "mode": i thought it would be easier to understand if you do not mix these two expressions...

And you are right: WinNT only uses Ring-0 and Ring-3 and so does Win9x...

PredeX

Edited by - PredeX on February 20, 2002 8:35:40 AM

Share this post


Link to post
Share on other sites
One more thing...

DirectDraw is all good and such, you can place bitmaps on screen, wow. But, how can I draw a single pixel, for example for a plotter or whatever?

Thanks.

Share this post


Link to post
Share on other sites
I found an article on how to do this with RGB color here: http://www.gamedev.net/reference/articles/article588.asp
But at the end of the article it sais this method is very slow!

So is there actually no fast way to plot RGB pixels in fullscreen in windows?


Well, actually I'd be really happy if I had an example program. Does there exist a simple example program that draws fast rgb pixels in full screen for windows? For example a fractal painter or a plasmademo or something like that... Or even better: something that draws pixels in the 256*256 upper left part of the screen with R = X-coordinate, G = Y-Coordinate and B=128 (that one would make sure that it really is 24-bit rgb and show me in a very simple way how to do it)

Thanks.

Edited by - aardwolf on February 22, 2002 7:04:46 PM

Share this post


Link to post
Share on other sites
see ANY sonique visual (or most winamp visuals) to note that it is VERY possible to do fast per pixel operations using the gdi or directdraw.

EDIT: btw ALL sonique visials MUST end up as 32 bit images, so most are developed using 32bit depth. adavanced visual studio (winamp vis plugin), runs all its stuff in 32bit color as well. though you should stick to 640x480 and less resolutions.

Edited by - a person on February 23, 2002 2:31:17 AM

Share this post


Link to post
Share on other sites