polygone
|
 |
Posted on: May 25, 2013, 03:51:50 pm |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
Hey can I get some feedback please if anybody else is experiencing this issue? https://github.com/enigma-dev/enigma-dev/issues/165
|
|
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
|
|
polygone
|
 |
Reply #3 Posted on: May 26, 2013, 06:20:06 am |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
Interesting. It must be different in GM due to Direct X? But this was working for me before on this system, so something must have changed in ENIGMA or (I think) I may have updated a driver at some point which could have possibly affected it. But the fact that it doesn't seem to be working for anybody on Windows now suggests to me that something in ENIGMA has changed, but I have no idea what that could be?
This is what ENIGMA is using to set-up the drawing in WINDOWSstd.cpp:
void EnableDrawing (HGLRC *hRC) { PIXELFORMATDESCRIPTOR pfd; int iFormat;
enigma::window_hDC = GetDC (hWnd); ZeroMemory (&pfd, sizeof (pfd)); pfd.nSize = sizeof (pfd); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 24; pfd.cDepthBits = 16; pfd.iLayerType = PFD_MAIN_PLANE; iFormat = ChoosePixelFormat (enigma::window_hDC, &pfd);
if (iFormat==0) { show_error("Total failure. Abort.",1); }
SetPixelFormat (enigma::window_hDC, iFormat, &pfd); *hRC = wglCreateContext( enigma::window_hDC ); wglMakeCurrent( enigma::window_hDC, *hRC ); } Then SwapBuffers(enigma::window_hDC); for screen_refresh(). Looking through git though, none of this has changed in 3 years which is before I originally posted the raytracing example.
|
|
« Last Edit: May 26, 2013, 06:39:52 am by polygone »
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
|
polygone
|
 |
Reply #5 Posted on: May 26, 2013, 07:34:48 am |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
hmm I'm not sure. Anyway this is the same problem that is cause draw_getpixel() to not work after screen_refresh() which is an incompatibility with GM. Also if you turn off background drawing in the room editor now, so the screen isn't cleared to a colour then this buffer swapping will also be seen. You can test in this file: https://www.box.com/s/p8w6bs1c0vf1gdj3ex9gPress Right/Down to move the block on key press. E/S to move the block on key hold. At 30 fps pressing Right/Down to move the block doesn't cause the flickering to happen (because then it's getting drawn on both buffers, unless you press it super fast - you can get it to happen at lower frame rates) but if you use E/S to move on hold instead you will get the flickering. So the solution to this problem is: Repeat all the drawing after a screen refresh so it's on both buffers. Or just don't call screen_refresh more than once  But I do also want to know why it's different in GM.
|
|
« Last Edit: May 26, 2013, 09:18:56 am by polygone »
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
|
polygone
|
 |
Reply #7 Posted on: May 26, 2013, 12:41:03 pm |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
I've just realized there are going to be scenarios where a single screen_refresh() doesn't work properly. As per this file: https://www.box.com/s/2oheia1qs3u9n14i5p7cHold space to test, and you will see that the wrong drawn text is shown (because it's showing the text from the previous buffer). If you uncomment the other screen_refresh then it will display the correct text. The fact that it works at all to draw on the screen is kind of a hack that relies on the likelihood that the previous frame is the same. EDIT: I've just thought of adding a moving object to it. When you do that you can see more easily that it jumps back when you hold space. So this is going to look nasty for people on Windows that use screen_refresh for a pause screen (which is common) because it's going to skip the frame back when they pause and it will be noticeable.
|
|
« Last Edit: May 26, 2013, 12:43:12 pm by polygone »
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
|
Goombert
|
 |
Reply #9 Posted on: May 27, 2013, 03:49:54 am |
|
|
 Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Yah ExDeus is right, the whole point of double buffering is to get rid of flickering, you continue to draw what was last drawn while drawing the new stuff then swap at the end of draw events.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect. 
|
|
|
polygone
|
 |
Reply #10 Posted on: May 27, 2013, 03:57:33 am |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
I'm not sure how to swap to triple buffering? Wouldn't you need a fbo? I read this: http://www.opengl.org/wiki/Swap_IntervalIn any case I don't think triple buffering would resolve it. Since it will be swapping the buffers the same. As for single buffering, yes that's going to work but it looks terrible as the drawing is done automatically. I'm not sure if the double buffering is set-up correctly or not, and if not how to make it correct. I read something about WGL_DOUBLE_BUFFER_ARB not sure if we should be using that or how to use it? EDIT: This source here: https://github.com/vanfanel/SDL12-kms-dispmanx/blob/master/src/video/wincommon/SDL_wingl.c seems to be doing shit with it for the pixel format crap.
|
|
« Last Edit: May 27, 2013, 06:07:45 am by polygone »
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
Goombert
|
 |
Reply #11 Posted on: May 27, 2013, 04:12:39 am |
|
|
 Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Polygonz, hey bud, no lol I do not think I don't, no I'm %99.9999 percent certain you do not need a VBO. Vertex Buffer Objects just take the vertices in a model and pack them together into an object that handles storage and sends them to the GPU for fast rendering, so I do not know what that would have to do with tripple buffering?
Also while we are on fixing the double buffering and swapping, we should also take the oppurtunity to finally add MSAA and SSAA to the loop so it can down sample and then we can have some nice Anti-aliasing.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect. 
|
|
|
polygone
|
 |
Reply #12 Posted on: May 27, 2013, 04:16:06 am |
|
|
 Location: England Joined: Mar 2009
Posts: 794
|
fbo*
|
|
|
Logged
|
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
|
|
|
Goombert
|
 |
Reply #13 Posted on: May 27, 2013, 04:25:47 am |
|
|
 Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Oh ok yes that would make sense, hey are you on IRC? I got Ism's network functions working and made a simple client to server example and http request ^_^ Edit:  I made it do a simple http request and query our websites code ^_^
|
|
« Last Edit: May 27, 2013, 04:51:24 am by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect. 
|
|
|
|
|