Hi guys!
Any idea how to replace the lw's Graphics() fct? I can't make it work without it since I don't know how to set it up properly without it (bacbuffer, etc). If I remove the line, I can create meshes but nothing that relates to textures. If I do call LoadTexture for instance, I get a msgbox "OpenGL Error - GL_INVALID_VALUE". Also, the backbuffer's height and width are 0.
I'm using tao and vs2008 and a SimpleOpenglcontrol in my form.
This is my c# code:
m_iWidth = mgr.GetDataInt("OpengGLWindowWidth", DEFAULT_OGL_WIDTH);
m_iHeight = mgr.GetDataInt("OpengGLWindowHeight", DEFAULT_OGL_HEIGHT);
string strFakeAppTitle = mgr.GetDataString("FakeAppTitle", DEFAULT_FAKE_APP_TITLE);
OpenGLControl.InitializeContexts();
///////////////////////
// We're initializing the window just because I can't seem to init all needed stuff in
// lw to make the textures and meshes work.
Leadwerks.Engine.Leadwerks.SetAppTitle(strFakeAppTitle);
Leadwerks.Engine.Leadwerks.Graphics(m_iWidth, m_iHeight, 0, 0, Leadwerks.Engine.Leadwerks.GRAPHICS_BACKBUFFER|Leadwerks.Engine.Leadwerks.GRAPHICS_DEPTHBUFFER);
// hide the window right away -- HACK!!!
int hWnd;
Process[] processRunning = Process.GetProcesses();
foreach (Process pr in processRunning)
{
if (pr.MainWindowTitle == strFakeAppTitle)
{
hWnd = pr.MainWindowHandle.ToInt32();
ShowWindow(hWnd, 0);
}
}
//////////////////////////
// setup leadwerks path
string strAbstractPath = mgr.GetDataString("AbstractPath", Application.StartupPath);
Leadwerks.Engine.Leadwerks.RegisterAbstractPath(strAbstractPath);
// Create our custom buffer
OpenGLControl.MakeCurrent(); // this has to be done before calling leadwerks stuff..
m_World_fake = Leadwerks.Engine.Leadwerks.CreateWorld(); // Create world
m_buffer = Leadwerks.Engine.Leadwerks.CreateCustomBuffer(DGetSize, DMakeCurrent);
Leadwerks.Engine.Leadwerks.SetBuffer(m_buffer);