Skip to content

Instantly share code, notes, and snippets.

@Azerothian
Created January 16, 2012 06:53
Show Gist options
  • Save Azerothian/1619473 to your computer and use it in GitHub Desktop.
Save Azerothian/1619473 to your computer and use it in GitHub Desktop.
AxiomEngine - Dynamic Textures
public void CreateScene()
{
_entity = _root.SceneManager.CreateEntity("CubeBrowser", PrefabEntity.Cube);
_sceneNode = Root.Instance.SceneManager.RootSceneNode.CreateChildSceneNode();
_sceneNode.AttachObject(_entity);
_sceneNode.Yaw(45);
_sceneNode.Position = new Vector3(0, 0, -300);
Bitmap bmp = new Bitmap(100, 100, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
using (Graphics gImage = Graphics.FromImage(bmp))
{
gImage.FillRectangle(Brushes.Red, 0, 0, bmp.Width, bmp.Height);
gImage.DrawRectangle(Pens.Black, 10, 10, bmp.Width - 20, bmp.Height - 20);
}
TextureUtil.CreateDynamicTextureAndMaterial(
"DynamicTexture",
"DynamicMaterial",
100,
100,
out _texture,
out _material);
bmp.Save(@"E:\Temp\test2.jpg", ImageFormat.Jpeg);
TextureUtil.BitmapToTexture(bmp, _texture);
bmp.Save(@"E:\Temp\test3.jpg", ImageFormat.Jpeg);
_entity.MaterialName = "DynamicMaterial";
//_entity.MaterialName = "Examples/TestImage";
//_entity.CastShadows = true;
//Core.BrowserManager.BrowserRenderEvent += new BrowserRenderEventHandler(BrowserManager_BrowserRenderEvent);
//_browserId = Core.BrowserManager.CreateBrowser("http://www.google.com.au", _browserWidth, _browserHeight);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment