Jump to content

Two Rendering windows?


TheMasterMaind
 Share

Recommended Posts

Seems like you kinda can.

 

I tinkered around a bit and at first got two windows, where nothing rendered, though the game was running in the background, then I tinkered some more and stuff now actually runs, in the second window.

I tested it with the AI and Events map from the MyGame demo project.

 

I changed App.lua to enable the second window and make it actually sync up but I also changed FPSPlayer.lua to fix the context and window that's used in there, I somehow end up on the incorrect window though but this is just the result of less than 10 minutes tinkering, so go wild and tell me how it went.

 

Might be easier if you start and empty new project just to test.

App.lua

FPSPlayer.lua

Link to comment
Share on other sites

Weeee, this is fun.

Some more tinkering and the game is displaying in both windows now. You have to manually set the context you want to render each frame, which means your overall fps will be cut in half (at least, because I've heard OpenGL is awful at context switching) as its is split between windows but this is how this works.

 

This might still be useful for something you don't want to update as fast as possible.

 

Also, you might not need the change to FPSPlayer.lua anymore but it is still useful, as you will always have the same window as reference for input events.

App.lua

Link to comment
Share on other sites

Okay thank you very much for your answer! I also tried to open two windows and had the same results so far!

 

Since we can possibly create two or more windows, i wonder how resource management is managed then because if I load a resource (i.e. Texture/Shader etc.) then i've read that there is only one instance in memory so if I want to have this resource available in both windows. As if I load my resource in the first window being active and also want this resource in the second window I have to load the resource again but as all Load commands return the same reference when atempted to load twice how could this resource being there in the second window? Or will it be checked to reupload to OpenGL as the 'id' is only Valid in the first context? Or are the context shared to each other? Sorry for maybe bad eplaination and so many questions but there so many questions spinning around in my head when I think of two rendering windows :P.

As a sitenote: Two rendering are not really needed for me I just thought of this possible idea because of the fact that we can create two rendering windows and can render each seperately via the GetCurrent() call.

 

Thanks in advance and especially "DerRidda" for your tinkering

Danke!

 

Edit: I have tested your scripts but couldnt bring it to work properly as the second window always "hangs" with only white screen wheres the first is working properly! Maybe Mr. can provide some more information if and how MultiWindows are supported in LE.

 

Edit2: Thank you again, I also had the idea to set the current rendering context manually but it would be better if the i can run like two games from one instance not the game in two windows. BTW: Yes you are right, OpenGL really hates context switches and also managing of shared context is really awful for the graphics driver

Link to comment
Share on other sites

Might be worth changing the offset of the second window, I have a dual monitor setup and thus am not all that concerned as to where my window spawns.

 

And as I said, OpenGL context switching can be awful. I'm using the latest Nvidia beta drivers for Linux (343.13) and Nvidia does OpenGL best. AMD is the worst with OpenGL on every operating system there is, don't know how good Intel is.

Link to comment
Share on other sites

Ok yeah that should work. I have an AMD card actually (AMD apu HD6310 IGP) where I dont have any problems with. Before that I had an NVIDIA card which was very good and supported things they shouldnt and my amd card doesnt support things they should. But the drivers from AMD arent that bad as OpenGL simply outperforms DirectX especially on Linux thats why im using OpenGL for my engine too! But Intel graphics card/chips sucks at everything my brother have a Laptop with Intel graphics which only supports DirectX10 and OpenGL2.1 wheres OpenGL isnt useably at all on this Laptop due to bad performance and the Drivers are very bad as they often doesnt work at all, even Windows or Linux "standard" drivers are performing better as the dedicated ones!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...