Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / [SOLVED] How to place multiple camera views on the screen?

Years of Service
User Offline
Joined: 8th Feb 2019
Location: Japan
Posted: 9th May 2021 15:50
I thought I was browsing the following thread...

[SOLVED] How to create a camera?

Bengismo say
"There is no need to create another camera as you can only render one scene at a time. It is possible to place multiple camera views on the screen (for 2 player games or 3d viewports but it still only needs one camera ID which is always 1. (in the future it may change but for now there is no need for anything other than camera id 1)"

I found old thread.
Split Screen (3D) AppGameKit version of SET CAMERA VIEW
(The code examples in this thread could be compiled and run on the current AGK2 Classic. Probably to maintain backward compatibility. However, using this CreateCamera function in the current AGK2 project template will result in an error.)

But CreateCamera() function is already obsolute.
I know there should be an equivalent, but I couldn't find a concrete code example.
Could someone please introduce me a simple code?


The author of this post has marked a post as an answer.

Go to answer

Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th May 2021 23:00
This post has been marked by the post author as the answer.
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 10th May 2021 00:09
A drawback of AppGameKit being designed around Mobile Devices., specifically OpenGL ES 1.1 is that as there is no support for Multiple Render Targets... and well unfortunately a lot of the "Feature Support" in AppGameKit is bare minimum.
That is to say that, unless an API explicitly handles something., they tend not to add the functionality.

Now the way around this is simply to manually create a Render Image and do a Draw Pass with the Camera Position changed to what you want "Camera 2" for example to show., then use that Image to create a "Software" Camera.
I'd argue it would be nice if this was built-in to AppGameKit with a more fully realised Camera System.
This could be emulated (ala the above method that we manually have to do anyway) on OpenGL ES 1.1 Platforms., or on OpenGL 1.1+ or OpenGL ES 2.0+ Platforms use Render Targets (i.e. Hardware Accelerated).

Arguably if you're working in C++ (Tier 2) the performance difference is negligible, it's more an argument of Streamlined support for the Developer; but in AppGameKit Script (Tier 1)... well there is a noticeable performance difference, due to the slower nature of AppGameKit Script to execute commands and loops.

It certainly would be a useful addition to say a Toolkit Plug-in., but then the problem with Plug-ins is you can't support all Systems (i.e. Mobile like Droid and iOS can't use Plug-Ins; which is a little annoying, and somewhat forces people into switching to C++ / Tier 2 in order to really expand the limited built-in Functionality of AGK; TGC really needs to either add Plug-In support or as noted actually extend the built-in Features)
Years of Service
User Offline
Joined: 8th Feb 2019
Location: Japan
Posted: 10th May 2021 11:39
I made a mistake and created an unintelligible thread.
I simply forgot to put the source code of the CreateCmaera function in my project.

I should have waited overnight before deciding whether to create the thread or not.
I guess this thread will stay for years.

Anyway, thanks to Bengismo for the great code.
AGK Tool Maker
Years of Service
User Offline
Joined: 9th Mar 2015
Location: Suffolk UK
Posted: 11th May 2021 19:34
Quote: "I should have waited overnight before deciding whether to create the thread or not.
I guess this thread will stay for years."

With the 90 day lock on threads and a retarded search system it helps to have old threads like that brought to current attention.

"The man who asks a question is a fool for a minute, the man who does not ask is a fool for life." - Confucius

Login to post a reply

Server time is: 2021-06-24 18:32:25
Your offset time is: 2021-06-24 18:32:25