Paweł Kołodziejski
4dc540ffeb
Merge pull request #1280 from vpelletier/graphics_optimise_pixelops
...
GRAPHICS: Optimise PixelBuffer::getValueAt and PixelBuffer::setPixelAt.
2016-07-21 21:01:09 +02:00
Paweł Kołodziejski
4ffde5f680
Merge pull request #1282 from vpelletier/tinygl_loaddata_pixelformat
...
TINYGL: Expect colorKey in the same pixel format as surface.
2016-07-21 18:30:02 +02:00
Vincent Pelletier
46329cca87
TINYGL: Do not compute dirty region when its result is not used.
2016-07-21 16:42:24 +02:00
Vincent Pelletier
d2defcd1cc
TINYGL: Actually check if alpha test and blending are enabled.
2016-07-21 16:42:10 +02:00
Vincent Pelletier
a1418732ec
TINYGL: Typo in disabled code.
2016-07-21 16:41:24 +02:00
Vincent Pelletier
8ec310468d
TINYGL: Replace multiplications by iterative additions.
...
As an iteration is done already anyway.
2016-07-21 16:41:18 +02:00
Vincent Pelletier
a831238a96
TINYGL: Drop some unused locals.
2016-07-21 16:40:36 +02:00
Vincent Pelletier
4ff03d060e
TINYGL: Call tglColor4f from tglColor4fv.
2016-07-21 16:40:07 +02:00
Vincent Pelletier
d437892538
TINYGL: Get rid of PSZB as it duplicates pixelbytes.
2016-07-21 16:39:40 +02:00
Vincent Pelletier
7c1a15c6e8
TINYGL: Expect colorKey in the same pixel format as surface.
...
So caller does not have to depend on the pixel format used internally to
BlitImage.
Update callers which do request for color keying (GRIM/EMI only).
Also, remove a special-casing of transparent color when converting image
format which sets a color in a packed format independent from actual
destination format.
Also, in GfxTinyGL::createTextObject, prefer changing invisible colorKey
value than actually-visible color.
2016-07-21 16:17:32 +02:00
Paweł Kołodziejski
d1be78ca49
Merge pull request #1269 from vpelletier/tinygl_optimise_light
...
Tinygl: optimise gl_shade_vertex
2016-07-20 14:39:05 +02:00
Paweł Kołodziejski
9acb1b9039
Merge pull request #1275 from vpelletier/valgrind
...
TINYGL, GRIM: Fix various errors (mostly memory leaks) found by valgrind
2016-07-20 14:09:52 +02:00
Vincent Pelletier
f4554c1541
GRAPHICS: Optimise PixelBuffer::getValueAt and PixelBuffer::setPixelAt.
...
Avoid doing a lot of operations just to move 2 or 4 bytes around.
Inline these methods as they are hot-spots and do very little: call
overhead becomes significant.
2016-07-19 11:08:35 +02:00
Vincent Pelletier
638b841c74
TINYGL: Simplify zline.cpp .
...
drawLine was broken for dx = 0 lines.
Also, the split between fillLineGeneric and drawLine, along with the many
parameters exchanged (with obscure names with subtle differences), made
the code hard to understand.
This implementation should be easier to check.
There was no visible CPU usage change.
Fixes GRIM's ticket printer, which are composed of a lot of vertical
segments.
2016-07-18 15:55:08 +02:00
Paweł Kołodziejski
d467980499
Merge pull request #1262 from vpelletier/tinygl_dirty2d
...
GRIM: Fix drawLine/Rect/Polygon in TinyGL renderer
2016-07-18 05:17:35 +02:00
Vincent Pelletier
db8cee2a69
TINYGL: Free BlitImage memory on close.
2016-07-18 04:36:37 +02:00
Vincent Pelletier
97dc3881e0
TINYGL: Add free_texture variant taking a GLTexture * argument.
...
To avoid looking texture up in the hash table when caller has a pointer to
it already. Aka, O(0) is better than O(1).
2016-07-18 04:34:09 +02:00
Vincent Pelletier
306fdff963
TINYGL: Dispose of textures beyond the first hash table entry.
2016-07-17 15:06:30 +00:00
Vincent Pelletier
95cc5127e0
TINYGL: Consistently consider Texture::handle as unsigned.
...
Texture handles are unsigned integers everywhere else.
2016-07-17 15:06:30 +00:00
Vincent Pelletier
ed2fdb3aba
TINYGL: Correct dot-product after its sign is known.
...
Normalising d when light is not in front of surface (nor behind when in
two-sides mode) is not needed as the value will not be used.
The same optimisation is already done when handling specular lights.
Also, remove "if (... > 1E-3)" conditions: as dot-product is not zero,
neither operand is zero, so this test (as a divide-by-zero protection) can
be removed.
2016-07-16 14:38:41 +00:00
Vincent Pelletier
f66026a8aa
TINYGL: Only do spotlight & specular computations when actually needed.
...
Spotlight and specular requires normalized d.
Skip specular if the light source or the material have no specular
component.
2016-07-16 12:17:59 +00:00
Vincent Pelletier
411e16fba5
TINYGL: Fix default diffuse and specular values for lights > 0.
2016-07-16 12:17:59 +00:00
Vincent Pelletier
342cf9a60d
TINYGL: Simplify a bit updateTmp .
2016-07-15 22:20:41 +00:00
Vincent Pelletier
03da50312b
TINYGL: Move the task of writing to z-buffer to FrameBuffer::writePixel.
...
Because writePixel may decide to not write anything (alpha test), in which
case no z-buffer write should happen.
Factorises code.
Fixes apparent back-face culling in GRIM behind transparent textures, like
the tube (the 3d-shape Manny takes out, not the flat image in foreground)
in set mo.
2016-07-14 21:30:18 +00:00
Vincent Pelletier
a336422811
TINYGL: Fix clipped triangle vertices alpha channel.
...
In all 4 updateTmp call places, q is not initialised, so there is nothing
of value in the alpha channel (it's 0). So just apply the same rule as for
other color channels.
2016-07-14 15:36:28 +00:00
Bastien Bouclet
08fd76686d
Merge pull request #1256 from bgK/sdl-split
...
SDL: Split the OpenGL code to a separate GraphicsManager
2016-07-14 12:06:30 +02:00
Bastien Bouclet
7a52f226e7
OPENGL: Modify SurfaceRenderer to allow alpha blending
2016-07-14 12:02:55 +02:00
Bastien Bouclet
b718d86a6f
OPENGL: Add TiledSurface to be used for drawing large 2D surfaces
2016-07-14 12:02:55 +02:00
Paweł Kołodziejski
863548efeb
Merge pull request #1261 from vpelletier/tinygl_texture_matrix
...
Tinygl texture matrix
2016-07-14 09:57:52 +02:00
Bastien Bouclet
6b266a9179
OPENGL: Unbind the active program when destroying the active shader
...
Fixes switching renderers from Shaders to OpenGL in Grim with SDL2
2016-07-12 06:29:32 +02:00
Vincent Pelletier
46fa5eb373
TINYGL: Fix off-by-one in TGL_LINE_LOOP/TGL_LINE_STRIP .
...
Also, draw last line from last point to first instead of first point to
last as the latter leaves an unpainted pixel for some reason.
2016-07-11 14:52:36 +00:00
Vincent Pelletier
98696865df
TINYGL: Fix TGL_QUADS with more than one quad.
...
Fixes checkbox border on Copal's computer.
2016-07-11 00:30:58 +00:00
Vincent Pelletier
e72db42ef0
TINYGL: Fix tglOrtho matrix definition.
...
As per glOrtho documentation, bottom-right must be 1.
Also, in TinyGL, matrices are row-major, so m._m[0][3] is r[3], not
r[12].
2016-07-11 00:00:30 +00:00
Vincent Pelletier
6f1e46d6b4
TINYGL: Implement tglColor3ub.
2016-07-11 00:00:30 +00:00
Vincent Pelletier
93d23656fa
TINYGL: Do not clear matrix_model_projection_updated in gl_matrix_update.
...
Changing texture or color matrices must not prevent a model projection
update, even if it is done last.
2016-07-10 13:19:45 +00:00
Vincent Pelletier
f75767fc78
TINYGL: Always check if texture matrix need applying.
...
matrix_model_projection_updated is not set when texture matrix alone is
modified.
2016-07-10 13:13:46 +00:00
Bastien Bouclet
d7b7bad1dc
ALL: Fix warnings when building with Apple's CLang
2016-06-14 08:24:02 +02:00
Bastien Bouclet
9c0950f76c
SDL: Fix build for platforms with incomplete OpenGL headers
2016-06-12 20:08:05 +02:00
Bastien Bouclet
fe4aac9ada
Merge pull request #1250 from bgK/wip-multisampling
...
Multisampling for framebuffers
2016-06-12 19:53:14 +02:00
Bastien Bouclet
5ae1e3a01c
OPENGL: Honor the configured MSAA samples for FBOs
2016-06-11 13:12:37 +02:00
Dries Harnie
dc3e371dc0
OPENGL: Grab pointers for glBlitFramebuffers and
...
glRenderbufferStorageMultisample.
2016-06-11 13:12:37 +02:00
Dries Harnie
be5202d11d
OPENGL: Multisampling for framebuffers (SDL)
2016-06-11 13:12:37 +02:00
Bastien Bouclet
8f20218a2b
OPENGL: Detect FBO multisample support
2016-06-11 13:12:37 +02:00
Bastien Bouclet
5419e37196
GRAPHICS: Fix the GLSL compat shaders when using GLES2 with SDL
2016-06-11 10:33:35 +02:00
Pawel Kolodziejski
4e47c03a64
OPENGL: add checks for case when glGetString return NULL
2016-03-10 05:55:32 +01:00
Pawel Kolodziejski
fcc19fa389
OPENGL: attempt to fix compilation
2016-02-21 21:19:16 +01:00
Bastien Bouclet
ee1784b2f2
OPENGL: Add a SurfaceRenderer class
...
To be used to draw textures as 2D surfaces in the current viewport
2016-02-06 08:53:41 +01:00
Bastien Bouclet
d8743a49bb
OPENGL: Add 16bits pixel format support to the Texture class
2016-02-06 08:53:41 +01:00
Bastien Bouclet
22006859f9
OPENGL: Fix building the SDL backend with USE_GLES2
2016-02-06 08:53:41 +01:00
Bastien Bouclet
b5dcf5d4bc
OPENGL: Select the shader version string at runtime
2016-02-06 08:02:50 +01:00