Web Browser on Direct3d Surface

Started by
23 comments, last by remigius 15 years, 10 months ago
Is there any way to get a web browser to render on a direct3d surface? I really want to have it embedded in an XNA game. Someone on another forum mentioned that I look at the Valve's Source SDK. I tried that by creating a mod and searching for the code... but I couldn't find it. Any help or suggestions would be greatly appreciated. -Dave
Advertisement
Interesting challenge - one that I'd hope will get easier with the Vista+1 generation!

I'd imagine you'd need to use some Win32/GDI black magic to create a regular Win32 application with a minimal browser embedded in it and then use GDI to grab the Window's HDC and copy this directly to an IDirect3DSurface9 as part of a texture...

In short, I've never seen these sorts of things pulled off without code that doesn't come across as a complete fudge/hack [headshake]

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Then, how are upcoming web-browser games (quake3online, battlefield online) actually made ? What kind of API do they use ?

VladR My 3rd person action RPG on GreenLight: http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

Any way to grab the handle from a .net browser and use that handle to draw a texture?
Maybe try this?

http://ubrowser.com/index.php

No Flash though...
I was looking at that earlier... not sure how nicely OpenGL and DirectX would play together...
I have not had a chance to use it but from what I can tell (I need this functionality too), LLMozLib is what actually does the web "rendering" and spits out a bitmap/image of some format.

OpenGL is used by the uBrowser to render it. In your case, you would use LLMozLib inside your program and take the image from LLMozLib and blit it on the DX texture.

I do not think LLMozLib has anything to do with either OpenGL or DX.
Part of LLMozLib header:

// access to rendered bitmap dataconst unsigned char* grabBrowserWindow( int browserWindowIdIn );		// renders page to memory and returns pixelsconst unsigned char* getBrowserWindowPixels( int browserWindowIdIn );	// just returns pixels - no renderconst int getBrowserWidth( int browserWindowIdIn );						// current browser width (can vary slightly after page is rendered)const int getBrowserHeight( int browserWindowIdIn );					// current heightconst int getBrowserDepth( int browserWindowIdIn );						// depth in bytesconst int getBrowserRowSpan( int browserWindowIdIn );					// width in pixels * depth in bytes


You are not using uBrowser (which is OpenGL based application), you are using LLMozLib which renders the browser image in memory, it is up to you how you will display it.

Anyone used it before? Am I wrong?
Interesting... I'll have to take a closer look at it.
How does this sound?

1. Create a managed C++ wrapper around LLMozLib.
2. Create some method that would return an array of bytes representing the pixels of the requested page.
3. Use the byte array with the SetData method of the texture2D XNA object.
4. Render the texture to a model.

This topic is closed to new replies.

Advertisement