Screen: Allow readout of stereo quad-buffer pairs in homegrown frame-seq stereo mode.

Add readout code to Screen('GetImage') for special case of frame-sequential
stereo mode via our own homegrown method which uses the imaging pipeline.

Map 'frontLeftbuffer' to GL_FRONT, 'frontRightBuffer' to GL_BACK, and
'backLeftBuffer' / 'backRightBuffer' to finalizedFBO[0/1] for readback.

This gives correct results for the 'backBuffer' (aka left buffer), 'backLeftBuffer'
and 'backRightBuffer' as well as 'drawBuffer'. Assignment of buffers for
'frontBuffer', 'frontLeftBuffer' and 'frontRightBuffer' is more or less
random, depending on the swap timing of the periodic bufferswaps. There's
no way to get the equivalent of the stereo front buffers with reliable
correct mapping. Therefore we warn the user about the ambiguity of those
buffers are requested.

Also the standard 8 bpp uint8 readback path was optimized to issue
only one glReadPixel() call, instead of as many calls as color channels.
This is now the same implementation is in the float precision readback
and 'AddFrameToMovie' mode.

Screen for 64-Bit Matlab on OSX rebuilt and tested.
Screen: Add kPsychGUIWindow flag, and document its use.

Document the 'specialFlags' argument in Screen('OpenWindow'), hint
to new kPsychGUIWindow flag as a possible argument. This allows
onscreen windows which behave roughly like normal windows of other
applications in the system GUI.

Screen for 64-Bit Matlab on OSX rebuilt & tested.
PsychImaging: Fix input argument parsing for PsychImaging('OpenWindow')

This allows to honor and pass the 'specialFlags' parameter and possible
followup parameters to underlying Screen('OpenWindow') code.

A small bug prevented this so far.
PsychColorCorrection: Add color correction via 3D CLUT lookup.

* Define new method 'LookupTable3D' and new clut set method:
'SetLookupTable3D':

This allows to define a 3D color lookup table. Each cell in the
table is indexed by a 3D (R,G,B) input color value and contains
a corresponding 3D (R,G,B) remapped/corrected output color value.

This allows a 3D -> 3D remapping of input colors to arbitrary
output colors. Trilinear interpolation is used by default for a
smooth mapping, nearest neighbour interpolation is an option.

* Allow to control level of verbosity via new subfunction 'Verbosity'.

The new PsychTest Color3DLUTTest.m tests the functionality and
its accuracy.

This should prove useful, e.g., for color correction of projectors
with InfiTec stereo spectral comb filters.
SpinningMovieCube: Update for current environment.

Was a bit broken and outdated.
PsychColorCorrection: Support color transformation by 4x4 matrix multiply.

New 'SetMultMatrix4' function allows definition of 4-by-4 color
transformation matrix for projective color transformations with
possible included bias.

New shader ICMMatrixMult4Shader.frag.txt performs actual color correction
by matrix multiply.
Screen('TransformTexture') -- Fix specialflags setting 0x2

Optional specialFlags setting 2 should request high-precision
processing, default should be standard processing. It was the exact
opposite - Default was high precision processing.
Fix it.
Screen('BeginOpenGL') - Only do one-time viewport setup on onscreen windows.

Only perform the 1st time bind viewport/scissor/etc. setup on real
onscreen windows, not on offscreen windows. Offscreen windows share the
OpenGL context and its state with their parent onscreen windows.
Performing the one-time setup on first bind is unexpected behaviour.

Fixes FDFDemo.m / moglFDF().
Screen: Add render-to-texture support for GL_TEXTURE_2D textures.

We so far only allowed to create GL_TEXTURE_2D textures of power-of-two
size for drawing them / applying them to 3D surfaces. Other uses have
been unsupported.

Now we extend support for this texture type:

* Render-to-texture via OpenGL FBO's is now supported for drawing into
them or using them as backing storage for Offscreen windows.

* The GPU image processing pipeline can handle them now, ie.,
Screen('TransformTexture') can work with them now.

* We now accept non-power-of-two sizes if the GPU supports this,
allowing to use GL_REPEAT texture coordinate wrapping modes on them
even if they are not power-of-two sized, for enhanced scrolling support.

This allows to use them almost everywhere and to have better interop
with 3rd party OpenGL components, e.g., Horde3D.

Some restrictions remain:

They can't be used as framebuffers for onscreen windows, as the image
post-processing pipeline is tuned to use of GL_RECTANGLE textures.
Should not be a problem, as these buffers are opaque to the outside
world and never need to directly interact with external toolkits.

Our builtin GLSL shaders for special operations like HDR drawing,
YUV-I800 and YUV-I420 texturing, self-made filtering, planar texture
support etc. do not support sampling from GL_TEXTURE_2D textures. This
means that the format can't be used with such special modes - or more
specific: If one wants to use them, one needs to provide dedicated
shaders and attach them manually to the textures - PTB will not
automatically take care of it. This is a small inconvenience. It is
easy to code such shaders, but not worth doing as a default part of
PTB, as simultaneous use of GL_TEXTURE_2D and such special formats is a
tiny corner-case, rather unlikely to be used ever.

Screen.mexmaci64 for 64-Bit Matlab on OSX rebuilt & tested.
Screen: Improve mip-mapped texture filtering.

Screen('DrawTexture', ...) filterMode argument now accepts negative
values to define a specific downsampling level: -1 = original res., -2
= half res., -3 = quarter res., -4 = 1/8 res. etc. -- selects mip-level
to use for mip-mapped texture filtering.

'DrawTexture' now auto-generates the mip-map image resolution pyramid
on demand, if a mip-mapped filtermode is used. Each time a texture is
updated via one of the texture creation functions, by
'TransformTexture' or by drawing into it, a rebuild of mip-maps is
triggered in 'DrawTexture' on next draw. We use the GL_GENERATE_MIPMAP
auto-generation for non render-to-texture and manually
glGenerateMipmap() triggered regeneration for render-to-texture cases.
Seems we need to use both methods, intermixed for what looks like it
could be a graphics driver bug on OSX 10.7 -- at least nothing in the
official specs hints that we'd need to do it how we have to do it,
glGenerateMipMap should always "just work(tm)", but apparently doesn't
without screwing up big time.

Screen for 64-Bit Matlab on osx rebuilt and tested.
Screen: Allow opt-out of auto mipmap creation.

New 'specialFlags' setting (usually 8, sometimes 16) to texture
creation functions allows to disable auto-(re)generation of texture
mipmap pyramid if texture content changes.

This allows usercode to define custom (e.g., shader-based) mipmap
downsampling methods if the default "gpu builtin" algorithm is not good
enough. Typically the builtin procedure is a box filter.

By default, mip-maps get autogenerated if a 'filterMode' with
mipmapping is selected during Screen('DrawTexture').

Screen for 64-Bit Matlab on OSX rebuilt & tested.
BlurredVideoCaptureDemo: Clean it and move it.

Clean it up a bit, move it from PsychAlpha to PsychDemos were it
belongs.
New: BlurredMipmapDemo - Use mipmapping for blurred gaze-contingent display.

BlurredMipmapDemo.m can do a gaze-contingent display with increasing
blur level away from the current mouse cursor position (aka gaze
position) on both live video or played back movies. It uses the new
mip-mapping functionality + an adaptive shader.
Screen: Add two additional mipmap filterMode's

Modes 4 and 5 for nearest neighbour interpolation with either nearest
neighbour mipmapping or linear interpolated mipmapping. These to allow
custom shaders to perform nearest neighbour sampling in all dimensions
if they wish, e.g., for complex filtering ops.
New: CreateResolutionPyramid() for manual shader based mipmap generation.

Allows to create the mip-map chain of a texture "manually" by
successive downsampling, running a selectable glsl shader on each
level. This for cases where the standard box filter of GPU mipmap
generation doesn't cut it.
BlurredMipmapDemo: Add custom mipmap generation support.

Employs CreateResolutionPyramid() together with a dummy-shader
"MipMapDownsamplingShader.frag.txt" for custom mipmap generation.

This is not yet very meaningful, as the shader doesn't do meaningful
quality-enhancing filtering. Just a placeholder.
mogl: Implement raw pointer support for glTexImage2D()

glTexImage2D / moglcore now accepts scalar values with raw memory
pointer values (e.g., 0 for NULL), not only matrices with image content.

This is similar to behaviour of functions like glReadPixels().
Especially useful here to pass in a real NULL pointer to allocate
texture object storage without initializing it with content.

moglcore.mexmaci64 for 64-Bit Matlab on OSX rebuilt.
CreateResolutionPyramid(): Make mip-map chain init more efficient.

Now we allocate the mip-chain without initializing its content. Avoid
needless mip-computation.
BlurredMipmapDemo: Implement more useful mipmap downsampling shader.

MipMapDownsamplingShader.frag.txt now not only does (optional) color ->
grayscale conversion, but proper downsampling via a 3x3 gaussian blur
kernel.

Actual tangible benefit of shader-based method vs. GPU auto-mipmap
generation.

This is still a proof-of-concept shader, not necessarily the most
opimal implementation, just to show interested people how to roll their
own method.
Screen, moglcore for 64-Bit Octave on Linux rebuilt.