Rendering HTML with OpenGL

While most people seem to try to embed OpenGL in a web browser with plugins, I have the opposite problem. I want to display web pages in an OpenGL application (running on Linux and OSX). The pages would appear in the application and they could be resized, rotated, and translated on the fly by the user. The simplest case (with probably poor quality) would be to texture map a rectangle with the rendered web page.

The most promising option I’ve figured out so far, would be to hook into WebKit/KHTML and render from there. But I haven’t yet investigated how feasible this would be.

Can anyone think of other possible solutions? Writing a complete web browser myself is not an option. Has anyone tried to do something like this before?

If opensource is an option, embed an existing web rendering engine such as Gecko (from mozilla browsers) or the one in Konqueror (I would start with Konqueror, as it seem lighter to use).

Then the only way is to render the page in CPU memory and upload it as a texture. That is basically what does the Fusion/Compiz/Beryl whatever 3d desktop effects, for every window.

Why do you think it will be poor quality ? If your rendered page resolution is >= your onscreen quad, it will be good. Don’t forget to enable automatic mipmap generation and trilinear filtering. Aniso may be useful in some cases too.

Mozilla/Gecko may indeed render itself in a raw buffer that you can then upload to a texture. It has been done in a game company I worked for (in D3D, but the principle remains the same).

Actually, Gecko is moving towards using Cairo for rendering. Cairo has an OpenGL back-end called Glitz. This should get you what you want.


this is an example application:

they do it with an internet explorer instance rendering
into a hidden window and blit this into a texture.