Horde3D

Next-Generation Graphics Engine
It is currently 24.11.2024, 14:21

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Window resizing
PostPosted: 01.11.2013, 11:58 
Offline

Joined: 01.11.2013, 11:39
Posts: 14
Hello

I have put Horde3D inside a wxWidgets canvas and context. When the canvas is resized, I tell Horde3D to resize using:
Code:
h3dSetNodeParamI(FCam, H3DCamera::ViewportXI, 0);
h3dSetNodeParamI(FCam, H3DCamera::ViewportYI, 0);
h3dSetNodeParamI(FCam, H3DCamera::ViewportWidthI, width);
h3dSetNodeParamI(FCam, H3DCamera::ViewportHeightI, height);
h3dSetupCameraView(FCam, 45.0f, static_cast<float>(width)/height, 0.1f, 1000.0f);
h3dResizePipelineBuffers(FPipelineRes, width, height);

where FCam is the camera resource and FPipelineRes is the pipeline resource. This works on resize when the window is set up but when I resize the window later on, I the Horde3D drawing region does not resize. If I step into h3dResizePipelineBuffers, I can see that is calls pipeResObj->resize( width, height );, which in turn calls createRenderTargets().

The canvas and parent window is reporting the correct size but I have a bounding box that the content is drawn inside. If I do not call glClear at the beginning of the paint routine, I get all manner of buffer rubbish drawn outside the bounding box region.

My code is pretty much identical to http://www.horde3d.org/docs/html/_tutorial.html., merged with the Qt5 code on the wiki.

Does anyone have any tips?


Top
 Profile  
Reply with quote  
 Post subject: Re: Window resizing
PostPosted: 01.11.2013, 16:56 
Offline

Joined: 01.11.2013, 11:39
Posts: 14
As an example, I have attached a screenshot. The red section at the top is a panel, with the rest of the window being a wxGLCanvas / wxGLContext. The rendering is done in debug mode (h3dSetOption( H3DOptions::DebugViewMode, 1);), and as you can see there is a large bounding box region. If I scale the window larger, the knight will be drawn further right until it disappears into the black void.


Attachments:
File comment: A screenshot
screenshotscaled.png
screenshotscaled.png [ 65.78 KiB | Viewed 19314 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: Window resizing
PostPosted: 01.11.2013, 22:52 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Never used wxWidgets before, do they manipulate the viewport settings anywhere?
Do you have more than one camera/pipeline within the scene, so that it could be that you're settings the new size on the wrong nodes/resources?
Are there any warnings or errors within the log. As an additional debug step you may want add some debug code to read out the viewport params (glGetIntegerv(GL_VIEWPORT, viewport);) set within Horde3D's render code and check if they may have been overriden somewhere.


Top
 Profile  
Reply with quote  
 Post subject: Re: Window resizing
PostPosted: 04.11.2013, 01:39 
Offline

Joined: 01.11.2013, 11:39
Posts: 14
Volker wrote:
Never used wxWidgets before, do they manipulate the viewport settings anywhere?


Yes! Thanks for the help. It turns out that wxWidgets is calling some Mac specific code (a function named void wxGLCanvas::SetViewport()). This is called from within wxGLContext::SetCurrent() which assigns a wxGLCanvas to the context. Resizing the window is not enough to get this SetViewport called, so when the window is resized, I simply needed to call wxGLContext::SetCurrent with the same canvas again, and all works.

Many thanks for the help
Rich


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group