Jump to content


framework help


3 replies to this topic

#1 Richboy

    New Member

  • Members
  • Pip
  • 2 posts

Posted 24 May 2006 - 12:21 AM

hi,

i want to start writing a software and a raytrace renderer. i know all the howto of software and raytrace rendering now, but i have a problem with the GUI. ive just coded a window using the win API for the first time in my life, i found a really cool tutorial on windows programming by Brook Miles (theForger) and i know how to create a basic window now, well thats all i need to know for my case.

i dont know how im gonna draw specific pixels and stuff into the window, could anyone help me out here? that would be very much appreciated. im not looking into getting into really advanced win api coding, just looking into how i will be able to draw individual pixels etc.

also, where can i put the drawing code??? sorry if i sound like a lamer, im just pretty confused with all this windows api stuff. i mean, its really huge and messy!?!?!?

i just want to know how i can start drawing pixels into an empty window, and maybe some other stuff if its needed? its also my first time to try writing a renderer, ive writen a few apps with openGL using GLUT, but thats a totally different thing...

are there any tutorials that cover this as well??? coz that would be really useful...

hope you can help me out!

much thanks!

#2 Wernaeh

    Senior Member

  • Members
  • PipPipPipPip
  • 368 posts

Posted 24 May 2006 - 12:52 AM

There are several alternatives, depending on what you want to do.

First, you might consider using the GDI. The GDI is the standard windows way of doing things. It wasn't probably designed with gaming in mind though, and it's not really nice to work with or getting it anywhere near playable framerates. There are GDI tutorials available within the MSDN, you might check these out. Basically, what you do is to react to a WM_PAINT message by manually drawing around in the window interior. Advanced methods improve on that by rendering to an offscreen bitmap, and then blitting that to the screen.

Another alternative is to use DirectDraw (kinda outdated these days, but still...). It's a bit less hassle to get it fast, and there are several tutorials available all over the net, so that would be my prime suggestion. I think they had a very basic one (drawing single pixels) over at gamedev.net, so you might check that as well.

If you just want to go for the rendering code, it's perhaps even easier to just write out some common image file (.tga or similiar), until you have got the actual renderer running.

Cheers,
- Wernaeh
Some call me mathematician, some just call me computer guy. Yet, I prefer the term professional weirdo :)

#3 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 24 May 2006 - 01:02 AM

For starters, look up the function SetPixel() in the MSDN documentation. You will want to have an off-screen buffer (i.e. a big array) on which you compose the image, and then when a Paint message is received you can transfer it to screen.

It wasn't clear to me what kind of renderer you are writing. A "software renderer" usually implies a real-time renderer that operates by rasterization, not by raytracing. If you are making a raytracer and don't care too much about speed, then the SetPixel method would work fine. On the other hand if you are making a real-time renderer (rasterizer, or RTRT) it will definitely be too slow and you'll need to use something like DirectDraw as Wernaeh suggested.
reedbeta.com - developer blog, OpenGL demos, and other projects

#4 Richboy

    New Member

  • Members
  • Pip
  • 2 posts

Posted 28 May 2006 - 11:32 AM

hey ppl!

thanks for all the help! sorry i didnt reply sooner, had to complete a college assignment...

i think ill go with writing an image util... prob the easiest way to go about it i guess!

thanks again!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users