Commit Graph

6 Commits

Author SHA1 Message Date
wm4 c5e5f38563 vo_opengl: fix a cast
Basically, the OpenGL API is crap (it takes an offset as pointer).
2015-01-29 21:13:06 +01:00
wm4 20c5c7e521 vo_opengl: split out a helper for drawing primitives
Useful if we want to reduce the size of gl_video.c further.

To some degree this emulates traditional glDrawArrays() usage. It also
leaves a loophole for avoiding a reupload every time by leaving
ptr==NULL, although this is unused for now.
2015-01-29 17:19:01 +01:00
wm4 0bd147bd14 vo_opengl: some minor cleanups
default_tex_params() and texture_size() are each called only once, so
move inline/reimplement them at the caller.

image_dw/dh were unused. texture_w/h, image_format, and component_bits
were rarely used, and can be replaced. Regroup some other fields.

Rename surface_num to surface_idx, because the former sounded like a
count, and not an index. Move fbosurface_next() closer to its callers
too.

Move the DebugMessageCallback() code to gl_utils.c (also simplify it
by always setting the callback, instead of only when it changes).
2015-01-29 16:21:02 +01:00
wm4 14bbbffa99 vo_opengl: move FBO helper to gl_utils
This is somewhat messy, because fbotex_init() itself was depending on
some gl_video parameters unrelated to FBO creation (like what scaler was
in use - what the fuck did this check do in this function?), so this
commit does a bit more than moving code around. In particular, the FBO
for the separate scaling intermediate step now always uses GL_NEAREST
sampling, and all FBOs are destroyed/recreated on renderer
reinitialization.

This also moves the function matrix_ortho2d() - trivial enough not to
put it into a separate commit.
2015-01-29 15:16:17 +01:00
wm4 34d3a27f28 vo_opengl: create abstraction for VAOs
Handles stupid boilerplate OpenGL requires you to handle. It's the same
code as in gl_video.c, although if no VAOs are available, the fallback
code rebinds them on every draw call instead of just once.
2015-01-28 22:22:29 +01:00
wm4 3583559164 vo_opengl: move utility functions from loader to a separate file
gl_common.c contained the function loader (which is big) and additional
utility functions (not so big, but will grow when moving more out of
gl_video.c). Just split them. There are no changes other than some
modifications to comments.
2015-01-28 19:40:46 +01:00