Coming soon!

Blitz3D SDK Forums/Blitz3D SDK Programming/Coming soon!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Just wanted to confirm that it is possible to render BB3D SDK in a panel control in Visual C# .NET. I have only tested using the Express edition, but I cannot see any reason why it shouldn't work in Visual Studio 2005 pro.

For this example I created a panel and a timer control.
Initially, the timer control to be enabled = false and interval to be 1.

The below code is just a translation of the example which comes with the SDK.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using bb = Blitz3DSDK;

namespace MyBB3DSDKTest
{
    
    public partial class Form1 : Form
    {
        int cube, light, camera;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            bb.SetBlitz3DHWND(this.panel1.Handle.ToInt32());
            bb.BeginBlitz3D();
            bb.Graphics3D(panel1.Width, panel1.Height, 0, 2);

            cube = bb.CreateCube(0);
            light = bb.CreateLight(1, 0);
            camera = bb.CreateCamera(0);
            bb.PositionEntity(camera, 0, 0, -4, 1);

            timer1.Enabled = true;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            bb.EndBlitz3D();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            bb.UpdateWorld(1);
            bb.RenderWorld(0);
            bb.TurnEntity(cube, .1f, .2f, .3f, 1);
            bb.Text(20, bb.GraphicsHeight() - 20, "Blitz3d SDK C# example to use a panel control", 0, 0);
            bb.Flip(1);
        }
    }
}