Pages: 1
Author Topic: Problems with multiple views  (25,442 Views)
Offline (Unknown gender) egofree

Contributor
Joined: Jun 2013
Posts: 601
View profile
Posted on: May 19, 2014, 09:19:04 AM
Hello,

It is not possible to have multiple views visible at the same time : i've a room and i want to display two different views of this room. So far i didn't succeed to implement this in ENIGMA. In GM i've no problems. Any help is welcome.

Here is a simple test project :
https://dl.dropboxusercontent.com/u/29802501/test_view.egm

There is a room (640*960), with two views : view0 displays the upper part of the room and view1 the bottom, but we see only view1.

Update: i did more tests and i've found that this problem occurs only with OpenGL (1.1 and 3), with DirectX 9.0 it's ok !
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #1 Posted on: May 19, 2014, 04:49:54 PM
Probably something to do with not flipping the backbuffer, most likely an easy fix.
Offline (Unknown gender) egofree

Contributor
Joined: Jun 2013
Posts: 601
View profile
Reply #2 Posted on: May 26, 2014, 07:05:01 PM
Quote from: Robert B Colton on May 19, 2014, 04:49:54 PM
Probably something to do with not flipping the backbuffer, most likely an easy fix.

I know nothing about OpenGl, but anyway i tried to investigate the problem.  :D I read that when you are using multiple viewports with OpenGL, you should use the instruction SwapBuffers(). So i tried in the GL3screen.cpp file, to add this method in the screen_redraw() function :



    for (view_current = 0; view_current < 8; view_current++)
    {
        ...

        screen_set_viewport(view_xport[vc], view_yport[vc], view_wport[vc], view_hport[vc]);

        clear_view(view_xview[vc], view_yview[vc], view_wview[vc], view_hview[vc], view_angle[vc], background_showcolor && draw_backs);

        ...

        SwapBuffers();
    }


I try to use this method, but i've a message which declares it's not available. ('SwapBuffers' was not declared in this scope). I know it's a noob question, but if someone can help, i will appreciate.

Edit : it seems SwapBuffers is not included in glew.h, but it's available in glew.c, so i tried to include this file also, but it was a mistake as ENIGMA is stuck when compiling the sources. (c.f glew manual : 'The simpler but less flexible way is to include glew.h and glew.c into your project')
Offline (Unknown gender) Darkstar2

Member
Joined: Jan 2014
Posts: 1,238
View profile
Reply #3 Posted on: May 26, 2014, 07:23:50 PM
Aren't you supposed to use glFinish(); before Swapbuffers ?
Offline (Unknown gender) egofree

Contributor
Joined: Jun 2013
Posts: 601
View profile
Reply #4 Posted on: May 26, 2014, 07:39:13 PM
Quote from: Darkstar2 on May 26, 2014, 07:23:50 PM
Aren't you supposed to use glFinish(); before Swapbuffers ?

In the examples i've found on internet, it didn't seem mandatory. But anyway the problem is that i don't know how to include the Swapbuffers method. With the latest glew version, you've  the Swapbuffers defined in glxew.h and wglew.h headers, which are platform specific extensions, but we don't have these files in ENIGMA,.
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #5 Posted on: May 26, 2014, 10:17:52 PM
egofree, we call swap buffers in screen_refresh, which I believe is defined in bridges. Anyway, yes that is exactly what I said the problem was.

Quote from: RobertBColtonProbably something to do with not flipping the backbuffer, most likely an easy fix.
By that I meant, of course, SwapBuffers() or screen_refresh() whatever the fuck you want to call it.
Pages: 1