|
Dialex
|
 |
« on: October 21, 2007, 10:33:58 AM » |
|
Hi all
I have a weird problem. My TV3D engine render is TV3D.Init3DWindowed(Handle, true); on a Control (in .Net 2.0 scenario). Whenever i resize the control the area rendered is not the same as the control's size (see screenshot where i've resized down - if I resize up, the logo dissapears out of control area).
I've tried using TV3D.ResizeDevice(); and TV3D.GetViewport().Resize(); (and SetAutoResize as well) with no luck.
It worked in my 6.2/6.3 implementation. What am i doing wrong?
Thanks in advance!
|
|
|
|
|
Logged
|
|
|
|
|
EagleEye
|
 |
« Reply #1 on: October 21, 2007, 07:16:00 PM » |
|
Ensure that you're initializing to the handle of the control you're rendering to. If you're rendering to the form, it's Form1.Handle, but if you have a panel IN the form, and you init to Panel1.Handle, then resize the form... if that panel is not docked or anchored properly so it resizes with the form, you'll see problems.
|
|
|
|
|
Logged
|
|
|
|
|
Dialex
|
 |
« Reply #2 on: November 01, 2007, 06:21:05 PM » |
|
Thanks Eagle Eye, but those issues were taken care of.
I digged some more, and found out that the fact that I'm initializing in one thread, before starting the other thread doing the actual handling and rendering, apparently caused this issue. That was definitely not the case in 6.2/6.3!
I don't know why, but when I do the initialization in the same thread, the resize works as expected..
If anyone wants to dig further into this, I'll be more than happy to post the source code which shows the above..
Thank you!
|
|
|
|
|
Logged
|
|
|
|
|
pizzayoyo
|
 |
« Reply #3 on: November 01, 2007, 06:32:12 PM » |
|
Maybe try Tv.EnableMultithreading? Never tried multithreading myself, but its worth a try.
|
|
|
|
|
Logged
|
|
|
|
|
Dialex
|
 |
« Reply #4 on: November 01, 2007, 06:41:13 PM » |
|
I've already tried TV.AllowMultithreading(true), but with no luck..
|
|
|
|
|
Logged
|
|
|
|
WEst
Community Member

Posts: 813
Daniel Martinek
|
 |
« Reply #5 on: November 02, 2007, 03:47:32 AM » |
|
I've already tried TV.AllowMultithreading(true), but with no luck..
Be sure to call it before the initialization of the engine.
|
|
|
|
|
Logged
|
Greetings
Daniel Martinek Lead Programmer Roaming Nova Studios
|
|
|
|
Dialex
|
 |
« Reply #6 on: November 02, 2007, 05:12:11 AM » |
|
This is the code i use which, with the TV3D logo on, gives the same scenario as the screenshot i posted:
public void EngineLoop() { while (bDoLoop) { TV.Clear(false); // Render everything Scene.RenderAll(true); TV.RenderToScreen(); } }
public void Start(IntPtr Handle) { hHandle = Handle;
// - Snip 1 -
TV = new TVEngine();
TV.SetDebugMode(true, true); TV.SetDebugFile(System.IO.Path.GetDirectoryName (Application.ExecutablePath) + "\\debugfile.txt");
//TV.AllowMultithreading(true);
TV.Init3DWindowed(hHandle, true);
TV.GetViewport().SetAutoResize(true); TV.DisplayFPS(true); TV.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE); Scene = new TVScene(); Globals = new TVGlobals();
bDoLoop = true;
// - snip 2 -
LoopThread = new Thread(new ThreadStart(EngineLoop)); LoopThread.Start(); }
Please note, that this is only when the display is in a UserControl.. (hHandle is the this.Handle from the Control).
If i move the code between snip 1 and snip 2 into the thread, before while (bDoLoop) there's no scaling "error"..
|
|
|
|
|
Logged
|
|
|
|
|
SylvainTV
|
 |
« Reply #7 on: November 02, 2007, 06:23:47 PM » |
|
I think the problem here is multithreading !
DirectX has a limitation with multithreading for initialization/reset/resizing.
Engine initialization must be in the same thread as reset, resizing and reset.
When you use viewport.SetAutoResize( true ), the resizing test is done in TV.Clear. So I think that if you initialize the engine in your rendering thread, it should work correctly.
|
|
|
|
|
Logged
|
|
|
|
|