Writing to screen without DirectX and OpenGL in Windows

Started by
0 comments, last by Erik Rufelt 13 years, 4 months ago
What is the fastest way to write pixels to the screen in Windows? For example in DOS you can just write to the memory, and.. thats all, it doesnt provide much protection, ect, but its fast.

However in Windows you need a library, GDI, OpenGL or DirectX? But, what if you want to write your own renderer, (without hardware support), how can you code something like that ?

I've writting some renderers, but they all depended on GDI. I used my own bitmap format and converted it in the flip code, to a format that GDI supported, so it could display it. However I would want to know if there are other ways of doing it.

(I'm not asking to manipulate video memory directly, One window with a bitmap buffer, so changing the buffer would display in the window. Thats all I need really, other stuff can be coded like backbuffers, ect. }
Advertisement
The fastest way is to use D3D and use Lock/Map/UpdateTexture or similar to transfer the pixels to video memory.

The best way is probably to begin with separating the actual displaying from your rendering. So your software renderer has a function something like this:
void render(char *screen, int width, int height) {	...}


Then you can call that however you want. In DOS it might be just:
int main() {	render(0xA0000000, 320, 200);}


But if you do it in Windows then you have a wrapper function, something like:
int WinMain(...) {	CreateWindow(...);		d3d->CreateDevice(...);		mem = texture->Lock();		render(mem, width, height);}

This topic is closed to new replies.

Advertisement