Commit Graph

647 Commits

Author SHA1 Message Date
Jonas Kulla ca9f83c6de Bitmap: Always upload data in GL_RGBA format 2014-07-21 01:38:22 +00:00
Jonas Kulla c1d627e0ae GLMeta: Disable blending when blitting via quad draw 2014-07-20 13:20:43 +02:00
Jonas Kulla 27b7815f52 GLState: Remove 'BlendNone' mode in favor of disabling blending alltogether 2014-07-20 13:17:12 +02:00
Jonas Kulla 7ce747d34d GLProperty: Assert proper stack usage 2014-07-20 13:15:03 +02:00
Jonas Kulla c44f4d7d28 gl-util.h: GL_RGBA8 is not a legal internalformat under GLES2
GL_RGBA ought to be synonymous.
2014-07-19 15:40:40 +00:00
Jonas Kulla 6f17b6ff46 Hookup mkxp to run under a OpenGL ES 2.0 context 2014-07-19 14:26:42 +00:00
Jonas Kulla a310318c65 MRuby-Binding: Account for 'char' not being signed everywhere 2014-07-19 11:13:11 +00:00
Jonas Kulla 83ceed5592 'fgetc()' returns int 2014-07-19 11:11:27 +00:00
Jonas Kulla a56d446664 More size_t fixes 2014-07-19 09:57:41 +02:00
Jonas Kulla 86b207e389 Actually switch to 16 bit index buffers 2014-07-19 09:31:39 +02:00
Jonas Kulla 5640c3d04b Print RGSS thread error message to console 2014-07-19 02:59:05 +02:00
Jonas Kulla 813130fbf6 More size_t fixes 2014-07-19 02:58:57 +02:00
Jonas Kulla 48db6fbeda Binding-MRuby: Make stuff work with latest mruby git 2014-07-19 02:22:22 +02:00
Jonas Kulla ccba946973 util.h: Use size_t for static array sizes 2014-07-19 00:52:00 +02:00
Jonas Kulla 20e46a98dd Plane: Add fallback without GL_REPEAT texture wrapping
This isn't supported under GLES 2.0 for npot textures.
2014-07-17 10:09:58 +02:00
Jonas Kulla a17043f785 MRI-Binding: Bitmap#get_pixel always returns a Color object 2014-07-16 17:39:39 +02:00
Jonas Kulla 3a3ccf590e Plane: Don't set dirty flags when settings props to existing value 2014-07-16 13:43:13 +02:00
Jonas Kulla b878149f5c MRI-Binding: Properly init Bitmap in Graphics#snap_to_bitmap 2014-07-16 05:27:16 +02:00
Jonas Kulla b8d861b4cd gl-util.h: Remove wrappers for things abstracted via GLMeta 2014-07-16 05:22:43 +02:00
Jonas Kulla bae977d4ab GLMeta: "Finish" -> "End" 2014-07-16 04:53:08 +02:00
Jonas Kulla a26c73930d GLMeta: Add framebuffer blitting support 2014-07-16 04:48:40 +02:00
Jonas Kulla 7ad6b7b5df MRI-Binding: Add some RGSS2 Graphics bindings 2014-07-15 12:34:58 +02:00
Jonas Kulla 4a3a769b15 Graphics: Properly initialize uniform before drawing 2014-07-15 11:54:31 +02:00
Jonas Kulla 97f18beb91 Graphics: Remove dubious optimization 2014-07-15 11:53:34 +02:00
Jonas Kulla c5f18ee535 Print SDL error message if window creation fails 2014-07-14 06:22:49 +02:00
Jonas Kulla 35dbaab0c3 Shader: Use GetShader/Programiv instead of GetObjectParameterivARB
The former are core 2.0 while the latter is part of GL_ARB_shader_objects.
2014-07-14 04:13:15 +02:00
Jonas Kulla f7d63bafd0 Merge pull request #46 from BlackLotus/master
Added new source files to CMakeLists.txt
2014-07-13 23:54:10 +02:00
Thomas Schneider 20db1a7b39 Added some cmake deps 2014-07-13 22:18:27 +02:00
Jonas Kulla 97708d25b6 Tilemap: Reduce a few unnecessary blits
No need to replicate static autotiles if we're not animating
at all.
2014-07-13 14:05:56 +02:00
Jonas Kulla efb2fd2695 GLMeta: Add vertex array object support 2014-07-13 14:05:12 +02:00
Jonas Kulla dac1407120 Add some comments 2014-07-13 13:38:50 +02:00
Jonas Kulla b73461721c Add meta path with fallback for EXT_unpack_subimage parameters 2014-07-13 05:51:04 +02:00
Jonas Kulla a541cb1205 Some RGSS2/RGSS3 compile fixes 2014-07-13 05:34:18 +02:00
Jonas Kulla 91aefdc17a Tilemap: Fix map wrap around 2014-07-11 08:43:39 +02:00
Jonas Kulla d1bad9b45f Bitmap#get_pixel: Use cached client side copy of pixels
A very simplistic optimization for games that create a
Bitmap and then only ever query pixels from it.
2014-07-11 03:25:28 +02:00
Jonas Kulla caae9c5689 Wrap IBO index type into one definition
Makes it easier to switch between types (eg. 32 -> 16 bit).
2014-07-11 02:09:53 +02:00
Jonas Kulla 295e0e5b15 Tilemap: Rewrite to only process and render visible region
Previously, on creation, we would parse the entire map data,
translating it into and uploading vertices once, then rendering
the entire map on every draw (to keep the draw calls minimal).
This worked great for smaller and medium sized maps, but starting
with larger maps (200x200+) it doesn't scale as the GPUs vertex
processing/culling is overwhelmed by the amount of data each frame.

This rewrite instead changes the strategy to only processing and
uploading a small subregion of the map (the currently visible part)
and regenerating all buffers if this subregion changes. The amount
of data transferred is small enough that it can be done every frame
without causing lag.

The changes also have the convenient side effect that we no longer
require 32 bit indices in mkxp, easing the road to possible GLES2
support in the future.
2014-07-11 02:00:30 +02:00
Jonas Kulla 300e61c64b TileAtlas: Fix broken atlas generation
The stuff committed in 56226c40c6
was actually completely broken.. oops.
2014-07-10 21:48:33 +02:00
Jonas Kulla c0f25548bd CMakeLists.txt: Add new file "tilemap.vert" 2014-07-09 17:11:05 +02:00
Jonas Kulla 6bbdf7e183 Bitmap#blt: Clamp source rect to source bitmap bounds
RGSS allows the source rectangle in both `blt` and
`stretch_blt` to lie outside the source bitmap bounds
(treating the missing data as (0, 0, 0, 0)) and to be
inverted (in which case the blitted image is also inverted).

This commit only hanldes a corner case that
arises in the game "Last Scenario"; emulating the full
RGSS behavior is however desirable.
2014-07-09 03:06:43 +02:00
Jonas Kulla 527a372bd3 Window: Fix contents not being drawn if no windowskin is set 2014-07-09 02:47:32 +02:00
Jonas Kulla 56226c40c6 Tilemap: Use vertex shader based autotile animation strategy
Previously, we would just stuff the entire tilemap vertex data
four times into the buffers, with only the autotile vertices
offset according to the animation frame. This meant we could
prepare the buffers once, and then just bind a different offset
for each animation frame without any shader changes, but it also
lead to a huge amount of data being duplicated (and blowing up
the buffer sizes).

The new method only requires one buffer, and instead animates by
recognizing vertices belonging to autotiles in a custom vertex
shader, which offsets them on the fly according to the animation
index.

With giant tilemaps, this method would turn out to be a little
less efficient, but considering the Tilemap is planned to be
rewritten to only hold the range of tiles visible on the screen
in its buffers, the on the fly offsetting will become neglient,
while at the same time the amount of data we have to send to the
GPU everytime the tilemap is updated is greatly reduced; so a
net win in the end.
2014-07-06 19:44:19 +02:00
Jonas Kulla 033d46a293 Window: Use bilinear filtering for drawing controls
See #44
2014-07-03 14:32:03 +02:00
Jonas Kulla 4a0084801e Graphics: Respect non-default initial window size 2014-07-03 02:48:28 +02:00
Jonas Kulla 843a7bf571 gl-fun.h: Fix KHR_debug function signatures 2014-06-24 23:56:13 +02:00
Jonas Kulla 902a5e8c76 README: Clarify SDL_sound version 2014-06-21 17:01:05 +02:00
Jonas Kulla a4615fb8cc Add copyright notice to gl-fun.{cpp,h} 2014-06-15 07:52:26 +02:00
Jonas Kulla 6808b9a6dd SoundEmitter: Optimize source allocation strategy
Before, we would blindly rotate through the sources (like a
revolver through its chambers), which worked great if one
assumed all sounds to be relatively short and therefore oldest
use == most likely to be free, but breaks if there is one long
sound playing, which would be stopped and overtaken if we rotated
back to it even though there might be other free sources available.

Instead, keep an ascending priority list of sources with last
used == highest priorty that is iterated through for the first
free one, and only if none is found overtake the one with lowest
priority. This also ensures we're always able to play 'SE_SOURCES'
sounds at once independently of their length.

Fixes #37.
2014-06-15 06:26:34 +02:00
Jonas Kulla 282d547ad4 Remove Perftimer classes
Performance can still be crudely measured by turning off
the framelimit and observing the FPS count. For everything
else, there's always callgrind / apitrace.
2014-06-13 19:01:15 +02:00
Jonas Kulla 6c481e5eb8 Eliminate GLEW dependency
GL entrypoint resolution is now done manually. This has a couple
immediate benefits, such as not having to retrieve hundreds of
functions pointers that we'll never use. It's also nice to have
an exact overview of all the entrypoints used by mkxp.

This change allows mkxp to run fine with core contexts, not sure
how relevant that is going to be in the future.

What's noteworthy is that  _all_ entrypoints, even the ones core
in 1.1 and guaranteed to be in every libGL, are resolved
dynamically.
This has the added benefit of not having to link directly against
libGL anymore, which also cleans up the output of `ldd` quite
a bit (SDL2 loads most system deps dynamically at runtime).

GL headers are still required at build time.
2014-06-13 18:46:45 +02:00