Commit Graph

75 Commits

Author SHA1 Message Date
Jonas Kulla bf712f3738 Graphics: Remove useless and confusing function 2013-12-08 12:57:46 +01:00
Jonas Kulla 5328d17090 Graphics: Fix viewport effect rendering bug
We didn't account for the spec dictating that
scissor test does affect FBO blit operations,
which resulted in corrupted output if more than
one viewport with an active effect (tone, color)
was created.

The reason I never caught this before must be
that the fglrx-legacy driver is actually bugged
in this aspect and ignores the scissor on blit.
2013-12-08 12:23:12 +01:00
Jonas Kulla ef2430e0c3 Sanitize #include statements
The general rule I'm aiming for is to <> include
system wide / installed paths / generally everything
that's outside the git managed source tree (this means
mruby paths too!), and "" include everything else,
ie. local mkxp headers.

The only current exception are the mri headers, which
all have './' at their front as to not clash with
system wide ruby headers. I'm leaving them be for now
until I can come up with a better general solution.
2013-12-04 17:48:37 +01:00
Jonas Kulla 58bd60a70f Graphics: Attempt to provide more consistent frame timings
We now actively track how far behind / in front of an
ideal timestep we are during each frame, and try to
catch up / delay approximate this timing.

Therefore we use more precise timers and sleep functions
(nanosleep if available). We also delay **before** the
final buffer swap so the frame displays at more consistent
points in time.

Not only should this provide a somewhat more consistent
looking map scrolling at lower frame rates, it also
guarantees that we don't fall out of sync eg. with the
Audio during longer cutscenes.

'Graphics.frameReset()' now finally has a function, in
that it resets the ideal timestep approximation, which I
beliefe was also its job in the original RMXP engine.

I'm not sure how well this will work when the frame rate
is set to the monitor refresh rate and vsync is turned on.
Very likely unnecessary frame skips will occur here and there
due to imprecise timers. In the future we should probably
check if the frame rate is equal to or higher than the
monitor rate, and disable frame skip accordingly.

These changes currently break the F2 FPS display (it shows
a value that's slightly too high).
2013-10-22 17:05:46 +02:00
Jonas Kulla f5a178b9bb Add config option "fixedFramerate" 2013-10-17 02:18:16 +02:00
Jonas Kulla 39436ad231 Fix up SDL2 include paths
Using "SDL2/SDL_xxx.h" instead of "SDL_xxx.h" caused
the include paths provided by pkg-config to be ignored,
and headers from a standard include path to be used instead.
2013-10-13 23:21:34 +02:00
Jonas Kulla cb6f73f7df Rename 'GlobalState' to 'SharedState' to avoid confusion with GLState
This was particularly nasty with the shorthand macros
'gState' and 'glState'. The former is now 'shState'.
2013-10-09 12:30:33 +02:00
Jonas Kulla dd25323cdd Ifdef out more RGSS2 functionality 2013-10-06 10:28:03 +02:00
Jonas Kulla 26843f2e51 Implement FPS display (F2 to toggle ON/OFF) 2013-10-06 07:05:01 +02:00
Jonas Kulla 20ec560145 Wrap color clear in 'FBO::clear()' convenience function 2013-10-01 13:10:14 +02:00
Jonas Kulla 307eeb732d Factor out performance timers into separate files
This should make graphics.cpp somewhat easier to navigate/read.
GL_EXT_timer_query is also made optional, and if it's not present
dummy functions will be called instead.
2013-09-27 16:54:01 +02:00
Jonas Kulla 92525cd077 Make this mess of performance measuring a bit more readable 2013-09-27 04:47:12 +02:00
Jonas Kulla fe557bca1d Implement "show_cursor" attribute in Graphics module
If false (the default), the system cursor is hidden
inside the game window.
2013-09-24 22:56:25 +02:00
Jonas Kulla a327d4c324 Fix valgrind warning (value might be uninitialized) 2013-09-24 19:56:36 +02:00
Jonas Kulla b85988d194 Fix typo 2013-09-23 11:18:20 +02:00
Jonas Kulla da4e0fbed0 Implement smooth scaling 2013-09-23 11:00:50 +02:00
Jonas Kulla f00136c489 Implement fixed aspect ratio 2013-09-23 10:39:16 +02:00
Jonas Kulla 9e63fb6b64 Remove the remaining bits of deprecated GL usage
The drawing is now completely shader based, which makes away
with all usage of the depracted matrix stack. This also allows
us to do things like simple translations and texture coordinate
translation directly instead of doing everything indirectly
through matrices.

Fixed vertex attributes ('vertexPointer()' etc) are also
replaced with user defined attribute arrays.
2013-09-23 07:50:22 +02:00
Jonas Kulla 6c7d751dbd Remove 'Default' FBO binding (only allow 'Read' and 'Draw')
Also make code more verbose by removing default mode
parameter value to 'FBO::bind'
2013-09-06 14:56:30 +02:00
Jonas Kulla b151a22f6e Rename 'Tex' to 'TEX' for consistency 2013-09-06 12:26:41 +02:00
Jonas Kulla 55596e9da9 Rename 'RB'(renderbuffer) to 'RBO'(renderbuffer object) 2013-09-06 12:16:24 +02:00
Jonas Kulla 0253b6ed2b Use C99 integer types instead of Qt's 2013-09-04 13:30:14 +02:00
Jonas Kulla 84db116d0c Rename 'bound' to 'clamp' 2013-09-03 15:31:29 +02:00
Jonas Kulla 8674cb8e06 Always glClear before blitting to screen
Prevents a distorted screen when an error happens during
script loading (ie. before the first drawn frame) and fullscreen
is turned on in the config.
This will also be necessarry once fixed aspect ratio is implemented.
2013-09-02 17:31:34 +02:00
Jonas Kulla ff25887f41 Initial commit 2013-09-01 16:27:21 +02:00