Jump to content

  • Log In with Google      Sign In   
  • Create Account


drawing in Win32


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 EngineProgrammer   Members   -  Reputation: 295

Like
0Likes
Like

Posted 08 December 2012 - 03:20 AM

Hey everyone,
I'm just having some fun with reinventing many wheels. Posted Image
I just love to understand the low level programming!

So here is what I want to do: basically I want to make my own pixel drawing system.
I want to create a pixel class which stores a color. After I make an array of [640][480] which will be my "screen".
When I gave all pixels a color I want to draw every pixel on the screen.

How can I draw all pixels on the screen? SetPixel is a very slow method so I want to avoid that.
Is it possible to directly connect my pixels to the screen pixels?
How does the GDI communicate with the screen pixels?
How can I communicate with the screen pixels without using the GDI or SetPixel? Is it even possible?


Kind regards,
Jonathan

Sponsor:

#2 Radikalizm   Crossbones+   -  Reputation: 2792

Like
1Likes
Like

Posted 08 December 2012 - 03:54 AM

Copying over this data by yourself would require you to write to video memory yourself, which is a no-go.

Just use GDI or a library like D2D to get your image rendered.
GDI should provide functions to blit bitmaps to the screen, so there's no messing with pixels individually.

I gets all your texture budgets!


#3 jariRG   Members   -  Reputation: 654

Like
1Likes
Like

Posted 08 December 2012 - 07:16 AM

CreateDIBSection with BitBlt/StretchDIBits/SetDIBitsToDevice is the fastest method as i know. Here: http://sol.gfxile.net/wintut/ch3.html you can find a great tutorial for it.

#4 ic0de   Members   -  Reputation: 804

Like
0Likes
Like

Posted 08 December 2012 - 07:05 PM

How can I communicate with the screen pixels without using the GDI or SetPixel? Is it even possible?


This is fundamentally impossible in win32. In fact that's why api's like GDI and Directx were invented.

History lesson:

DOS allowed a programmer direct access to all hardware on your machine, when windows 95 came along it used protected mode so as a result programmers could not directly write to the video memory. Microsoft then devised a solution to this problem and came up with api's like DirectDraw and GDI.

you know you program too much when you start ending sentences with semicolons;


#5 uglybdavis   Members   -  Reputation: 901

Like
0Likes
Like

Posted 08 December 2012 - 07:07 PM

What sk8beast said. This was my first experiment with software rendering: https://www.dropbox.com/s/eal3z9ypngftw1b/ssr.zip




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS