very much screen tearing for MacOS (I have 10.6)?

Previous topic - Next topic

spacefractal

today I have just tested the game on the MacOS..... But its near unplayable because there is so much screen tear, which is very annoying. The issue is simply the vsync is disabled, but would loock much better when its enabled on a tiledbased game.

I mean I have not seen that issue in blitzmax as well other games, so something I can do to got that VSYNC enable, so we can get a much gripper scrolling?

I can not see a forced vsync in the systemsettings as well.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrTAToad

Are you using LIMITFPS -1 ?  Are you using SHOWSCREEN twice in a loop ?

spacefractal

no twice SHOWSCREEN (but removed a uneeded CLEARSCREEN -1 just before it, but did not help about it).

I tried both LIMITFPS -1 as well LIMITFPS 30, and you can still see tear, sometimes very much.

Its clearly VSYNC is disabled by default? And there is no option to enable that on MAC?

The game ran fine elsewise on iOS, Android as well Windows. Its still a early game with a lots of placeholder graphics. So I wait to shown it.....
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

can someone try to IMPORT "C" this:
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);

I should work. I'll implement it then.

spacefractal

I not sure how to inline thing, then I would check it.... its sound really right.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

I have read on google that variable (which I cannot find the value of) is deprected and property need to find a other way.

I read SDL_RENDERER_PRESENTVSYNC should do that, but not sure at all!

In Blitzmax Vwait is done with flip, so should it not been done with GlBasic for SHOWSCREEN true?

I also only see that issue on MAC, not on Android, Windows 7 or iOS. Wierd.


here is the code I trying to due, but have erroers in it:
Code (glbasic) Select

// --------------------------------- //
// Project: Greedy_Mouse
// Start: Tuesday, August 16, 2011
// IDE Version: 10.057


// SETCURRENTDIR("Media") // go to media files

// this function is required to close the MainGame function
@FUNCTION dummy:
ENDFUNCTION


// here we need an inline block _outside_ of functions, that
// gives us some prototypes for glX calls.
INLINE
} // end namespace __GLBASIC__ - see manual for INLINE

// some constants - for more see:
// http://www.css.taylor.edu/~btoll/resources/graphics/opengl/xp/gl.h
#define GL_QUADS 0x0007

// the functions are all >>extern "C" __stdcall<<
extern "C"
{
void __stdcall SDL_GL_SetAttribute(float, int);
void __stdcall glVertex3f(float, float, float);
void __stdcall glColor3f(float, float, float);

void __stdcall glTexCoord2f(float, float);
void __stdcall glBegin(int);
void __stdcall glEnd();
}

// reasuring the namespace
namespace __GLBASIC__
{
ENDINLINE


FUNCTION Glvsync:
INLINE
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
ENDINLINE
ENDFUNCTION
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

Code (glbasic) Select

IMPORT "C" void __stdcall SDL_GL_SetAttribute(int, int);
SDL_GL_SetAttribute(16, 1) // (SDL_GL_SWAP_CONTROL, 1);


Try this. It might work. In SDL 1.3 (which I might update to soon) it's differently, but I'll implement it internally then.

spacefractal

#7
I tried this (in the main project, I have tried this on a little test one as well with same issue):

Code (glbasic) Select

@FUNCTION dummy:
ENDFUNCTION


// here we need an inline block _outside_ of functions, that
// gives us some prototypes for glX calls.
INLINE
} // end namespace __GLBASIC__ - see manual for INLINE

// some constants - for more see:
// http://www.css.taylor.edu/~btoll/resources/graphics/opengl/xp/gl.h

// the functions are all >>extern "C" __stdcall<<
extern "C"
{
void __stdcall SDL_GL_SetAttribute(int, int);
}

// reasuring the namespace
namespace __GLBASIC__
{
ENDINLINE


FUNCTION enablevSync:
INLINE
SDL_GL_SetAttribute(16, 1);
ENDINLINE
ENDFUNCTION


I got this error:
Code (glbasic) Select


_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.8.013 SN:a001d9df - 3D, NET
Wordcount:5094 commands
compiling:

linking:
gpc_temp6.o:gpc_temp6.cpp:(.text+0x18d): undefined reference to `_SDL_GL_SetAttribute@8'
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 28.5 sec. Time: 12:59
Build: 0 succeeded.
*** 1 FAILED ***
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

Quote
*** Configuration: WIN32 ***
...
gpc_temp6.o:gpc_temp6.cpp:(.text+0x18d): undefined reference to `_SDL_GL_SetAttribute@8'

that works for Mac/Linux only, of course.

spacefractal

hey, I did not spot that, but if compile directly to Mac, its does actuelly works!!
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

No more tearing?

You can make:
Code (glbasic) Select

?IFDEF MACOSX
   IMPORT "C" void __stdcall SDL_GL_SetAttribute(int, int);
   SDL_GL_SetAttribute(16, 1) // (SDL_GL_SWAP_CONTROL, 1);
?ENDIF

to have it x-platform.

spacefractal

Yes it works, thanks for the help. Yes its a might been a bug in glbasic, but its do have a workaround like this.

Howover MACOSX should been OSXUNI for me before its works, but howover I do both thing anyway to make sure....

here is what I use:
Code (glbasic) Select

INLINE
} // end namespace __GLBASIC__ - see manual for INLINE
extern "C"
{
void __stdcall SDL_GL_SetAttribute(int, int);
}

// reasuring the namespace
namespace __GLBASIC__
{
ENDINLINE

FUNCTION enablevSync:
?IFDEF MACOSX
INLINE
SDL_GL_SetAttribute(16, 1);
ENDINLINE
?ENDIF

?IFDEF OSXUNI
INLINE
SDL_GL_SetAttribute(16, 1);
ENDINLINE
?ENDIF
ENDFUNCTION
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

The current update has this already fixed.