Accessing the Colour Buffer

I have been wanting to write my own rasterization program (learning experience). I would prefer to use opengl to send information to the screen, instead of DirectDraw.

Is there a way to get direct access to the colour buffer memory?


check the “future opengl suggestions” message board for posts of a siimilar vein.

If you’re doing this for pure learning experience (and therefore performance isn’t a major issue), I would suggest simply sticking the rendered output into a bitmap and blitting it to the screen with the Windows GDI.

If, however, performance is an issue, then you’ll have to find a way to get Windows to give you direct access to the framebuffer. Alternatively, you can use the same bit blitting operations that the Window’s movie player uses (you can find out more about these functions in MSDN or on Microsoft’s web site).

You might want to check out TinyPTC and OpenPTC, cross platform libraries for getting frame buffer access.

Ok, thanks guys, I guess DirectDraw is the best way to go, unforetunatly. I thought OpenGL had a way to do this.



yer. well. damn, hey?

I was an undergrad, once upon a time. We first years had ot learn Ada. Ada? Of all languages? I was not a happy camper. I was a C programmer, damnit. I didn’t want to waste my unibar time learning a language I had no interest in. I liked C.

Besides, Ada was sucky. It didn’t let me do half the cool things that C let me do; I had to NEGOTIATE with the damned language to convince it that I knew what I was doing. In fact, I spent most of my time trying to get Ada looking like C, for example by messing around with type sizes and file i/o interfaces in a vain attempt to get something that resembled fread. I knew what types was in my file, I thought. I don’t need to mess around with this disk based array malacky.

But this is wrong, and I eventually realised this. It was far better to code in Ada and respect the designer’s choices than to wish it had ‘features’ that I mistakenly THOUGHT were better.

This story doesn’t have a moral, but it has an idea:

don’t try and get OpenGL to fit to your code because you think your code is somehow better. It has plenty of tools to get data into a frame buffer. ADOPT them, rather than wanting to get AROUND them.

Pointers aren’t the answer to everything. You just need to look at OOP to appreciate that.


Can you explain about these tools, I appologize, my experience in OpenGL is limited.

As I said in my last comment, I think DirectDraw will be my best choice. It is usually best to use the tool which will best fit you application and not try to find a way around the problems.