Horde3D

Next-Generation Graphics Engine
It is currently 28.12.2024, 10:59

All times are UTC + 1 hour




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 28.04.2008, 11:35 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
Does Horde3D support multiple viewports / windows? I can't see an obvious way to implement this, but rendering on window A, then switching the GL context to window B, calling resize and rendering again. But that would probably be very slow with resize updating internal resources.

My goal is to be able to use dual - or more - monitor setups in fullscreen mode: I have to create two fullscreen windows to do this, since I can't assume that the monitors are connected to the same graphics card like in a twinview setup.


Top
 Profile  
Reply with quote  
PostPosted: 28.04.2008, 11:55 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Currently I think that's not supported because of the static instances in egModules. But maybe you can easily adjust this by introducing some setCurrentInstance method that will activate a specific instance in egModules. Than you have to change only the Modules class to support more than one instance and returning the active one when calling sceneMan, resMan, etc.


Top
 Profile  
Reply with quote  
PostPosted: 28.04.2008, 12:23 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
ok, I'll try that approach.


Top
 Profile  
Reply with quote  
PostPosted: 28.04.2008, 12:38 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
I've proposed this solution to Nicolas some time ago, but he thought that there's currently no need for this. If you are able to implement the approach and if it's working fine I would be happy if you'll provide it as a patch here in the forum. Maybe more people are interested in this and we'll integrate it in a future version of Horde3D.


Top
 Profile  
Reply with quote  
PostPosted: 28.04.2008, 18:09 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
I've done a bit more research: There are problems related to hardware acceleration on multi monitor setups when windows span between different monitors. That's not a problem here as I assume fullscreen. But I read about cases when only the primary display is hardware accelerated which is really bad... On the other hand I read someone got a dual 7800GTX with 4 monitors to work using either a single logical screen spanning 4 displays or 2 logical screens spanning each two monitors.

But I still think this feature could be usefull and I'll try to implement it, at least that way we can use multiple graphics cards at the same time and / or display different scenes in different windows.
In a simple implementation I'll have to assume that nothing is shared between the instances. So anyone wanting to display the same scene would have to duplicate all calls for every Horde3D instance.

Back to my original problem:
For now the optimal solution for me is to create a single window which spans the whole width of TwinView / MergedFB displays. I'd like to render on the left half camera A, on the right half camera B. They are viewing the same scene from different positions / angles.

I think it should be possible to render both - or any number of - cameras to textures and then copy those textures to the framebuffer. I'm uncertain how to do the last step. Overlays?

With plain OpenGL I'd use first glViewport(0, 0, w, h), render camera A and then glViewport(w, 0, 2 * w, h) and render camera B. Using Horde3D::resize as a substitute is probably a bad idea since this destroys and recreates the render targets with each call.
Ideas?


Top
 Profile  
Reply with quote  
PostPosted: 28.04.2008, 19:12 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
If you want to render the same scene multiple times (with different cameras) you can just create a shared GL context. That's the way I've implemented the fullscreen and model preview mode in the editor. The only thing you have to care about in this case is that the shaders are loaded all in the first context. If I remember correctly, I had problems if I tried adding a shader when the shared context is active. I don't know if it's also possible to create two shared contexts bound to different graphics cards. I haven't experimented with such a scenario so far.

Concerning the hardware acceleration:
At least for Nvidia cards you can switch between different acceleration modes. The fastest mode is the Single Acceleration, where only one display ouput will be accelerated, but there are also some dual view acceleration modes. But at least the terrain sample performs very bad on my GF7600 in Dual View Acceleration mode.


Top
 Profile  
Reply with quote  
PostPosted: 28.04.2008, 20:29 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
You might want to glance at Ysaneya's technique: here.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 28.04.2008, 21:35 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
swiftcoder: That's a very interesting technique. I can't directly use it since I need very different views on each camera. But the idea of rendering on one graphics card and then pushing just a texture over to the other one is really good. That will prevent doubling the work of maintaining resources and the scene graph.

Volker: I'll try out your editor and look at the source code.
I have a 7600GT with two monitors in a twin view configuration under Linux equaling 3360x1050 pixels. The terrain sample gives me around 230 FPS independent of screen position when one does not move the mouse at the starting scene (had to comment the disable / enable mouse parts in main.cpp to move the window around) - even when spanning both screens. In fullscreen mode I get 130 FPS (3360x1050). Is that good / bad?


I'll describe a bit more what I want to do using the terrain sample:
When you have multiple monitors the landscape is shown across all monitors. I want a different view on the same landscape on every monitor - ideally this could be subpartitioned further so that I have maybe two different views on one monitor. Now you could use the mouse / keyboard inside each of these views to look at different parts of the landscape.


I'll do a bit of prototyping and then tell you what I got. Probably first get the terrain extensions to cooperate with Python - that would be the ideal testbed for this ;)


Top
 Profile  
Reply with quote  
PostPosted: 28.04.2008, 22:22 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Codepoet wrote:
I have a 7600GT with two monitors in a twin view configuration under Linux equaling 3360x1050 pixels. The terrain sample gives me around 230 FPS independent of screen position when one does not move the mouse at the starting scene (had to comment the disable / enable mouse parts in main.cpp to move the window around) - even when spanning both screens. In fullscreen mode I get 130 FPS (3360x1050). Is that good / bad?

I think that's good. When I remove the fixed resolution setting for 1280 x 1024 in the Terrain Sample, I got about 170 fps on a single accelerated monitor with a resolution of 1600x1200. With a dual view setup and the multi display acceleration mode I got only about 11-30 fps, although the sample runs in fullscreen mode on one single monitor with a resolution of 1600x1200, too. Interestingly I got about 120 fps with the compatibility acceleration mode set, although it should be the slowest of all possible driver settings regarding nvidia's documentation.

With a horizontal spread desktop and a resolution of 2560x1024 I also got about 120fps in all modes. This leads me to the assumption, that the multi display mode is slow in dual view mode because of the different resolution I got for each monitor. Nevertheless I wonder why the compatibility mode works still fast.

So all things considered I think you can be happy with your 130fps at 3360x1050. :-)


Top
 Profile  
Reply with quote  
PostPosted: 30.04.2008, 15:51 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
I have multiple windows working now. I'm using pyglet to create N windows and switch to the appropriate context before calling Horde3D::render, so that every frame is rendered to every window with a different camera. All contexts are shared, so that works good.

But my problem is that I have to call Horde3D::resize before rendering. Looking at the code that's probably not that good for performance... Any ideas?
If I don't call Horde3D::resize and the windows have different sizes the behavior is a bit strange: The view gets scaled in wrong ways and displays only a part of it when the window is too small.


Volker: This is different to what you do in your editor. You only render into ONE window at the same time. I want to render to many windows at the same time which all must be updated every frame.



The next thing I want to try is a splitscreen approach: Only one window, but N areas where I can render all cameras at the same time. But I think I need again Horde3D::resize before rendering to any area...


Top
 Profile  
Reply with quote  
PostPosted: 30.04.2008, 16:11 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Another possibility would be to render in textures and draw them as overlays. But performance might be not that good using this approach.


Top
 Profile  
Reply with quote  
PostPosted: 30.04.2008, 16:18 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
I'll try it and compare the solutions.


Top
 Profile  
Reply with quote  
PostPosted: 15.05.2008, 09:40 
Offline

Joined: 15.05.2008, 09:30
Posts: 2
I've tracked this thread, but I want to ask simply for clarity.
Is it possible to render just a part of a window with Horde3D?
Hello, I want to do so called dual stereo in my application.
Just one window with 3840x1080 where two 1920x1080 images / renderings will be drawn side by side with little offset for left and right eye.

I've done this in pure OpenGL. The key is "glViewport" and the asymetric "glFrustum"
Is it possible to do so in Horde3D.

void onPaint()
{
// first rendering
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
calculateLeftFrustum(); // asymetric frustum based on left eye position
glFrustum(left,right,bottom,top,camera.near,camera.far);
glViewport(0,0,screenwidth/2,screenheight);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// r indicates eye offset
gluLookAt(camera.pos.x + r.x,camera.pos.y + r.y,camera.pos.z + r.z,
camera.pos.x + r.x + camera.dir.x,
camera.pos.y + r.y + camera.dir.y,
camera.pos.z + r.z + camera.dir.z,
camera.up.x,camera.up.y,camera.up.z);
drawScene();

// second rendering
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
calculateRightFrustum(); // asymetric frustum based on right eye position
glFrustum(left,right,bottom,top,camera.near,camera.far);
glViewport(screenwidth/2,0,screenwidth/2,screenheight);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// r indicates eye offset
gluLookAt(camera.pos.x - r.x,camera.pos.y - r.y,camera.pos.z - r.z,
camera.pos.x - r.x + camera.dir.x,
camera.pos.y - r.y + camera.dir.y,
camera.pos.z - r.z + camera.dir.z,
camera.up.x,camera.up.y,camera.up.z);
drawScene();
}


If it can be done, a minimal code samlpe would be quite helpful since I'm just getting started using Horde3D.

Sorry for asking again. But at this point of my project I have to decide which rendering engine ist best for my purposes. And I really like the lightweight Horde3D.

Thanks,

Jan


Top
 Profile  
Reply with quote  
PostPosted: 15.05.2008, 16:52 
Offline

Joined: 14.04.2008, 15:06
Posts: 183
Location: Germany
Rendering to a specific area of a window is possible using Horde3D::resize. In principle every glViewport call is replaced with a Horde3D::resize call.

I have a similar testcase with multiple windows in my Python examples. It's inside multiwindow.py.


Top
 Profile  
Reply with quote  
PostPosted: 21.05.2008, 11:36 
Offline

Joined: 15.05.2008, 09:30
Posts: 2
You are using several Windows in your sample. In each you can make it current and swap the buffers.
Is that right?

If so, it is not what I want to achieve. I need one render window with two renderings in it. So I can't make a call to makeCurrent() to switch render context.

Here the code how I tried to solve my problem:
Code:
   
Horde3D::resize( 0, 0, (float) _width / 2.0f, _height );
Horde3D::setupCameraView( _cam0, 45.0f, (float)_width / _height, 0.1f, 1000.0f );
Horde3D::setNodeTransform( _cam0, _x, _y, _z, _rx ,_ry, 0, 1, 1, 1 );
Horde3D::render( _cam0 );

// omited: changing coordinates for camera 1

Horde3D::resize( (float) _width / 2.0f, 0, _width, _height );
Horde3D::setupCameraView( _cam1, 45.0f, (float) _width / _height, 0.1f, 1000.0f );
Horde3D::setNodeTransform( _cam1, _x, _y, _z, _rx ,_ry, 0, 1, 1, 1 );
Horde3D::render( _cam1 );

swapbuffers();

With this code, the left half of the render window is black, while the right is rendered correctly. If I swap code blocks its the other way round.

When swapping explicit after first render call, the left side ist also drawn, but flickers between scene and black.

So my concern is, when do I have to switch buffers, and in which buffers do I have do render to get both parts of the pictures the same time.
Without Horde and two glViewport() calls I get two pictures within the same window as desired.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 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