justingardner / mgl

A suite of mex/m files for displaying psychophysics stimuli
http://justingardner.net/mgl
Other
18 stars 22 forks source link

Help and examples #54

Closed justingardner closed 2 years ago

justingardner commented 2 years ago

All mgl functions need to have a working help - this is REALLY important. We always should have the arguments with descriptions of what the parameters, but also an e.g. which demonstrates how the function is called. The e.g. part is the most important, cause people can take that code snippet and run it to see the function working - then modify it to work for their purpose.

For example, in mglCreateTexture, you removed all of the e.g. (listed below) and replaced with "Please see mglMetalCreateTexture", but that doesn't have any examples either.

I've added back all the examples as follows:

% e.g.: mglOpen; % mglClearScreen % mglScreenCoordinates % texture = mglCreateTexture(round(rand(100,100)255)); % mglBltTexture(texture,[0 0]); % mglFlush; % % Note that you can use 1D textures for example to display a 1D image like a sine wave grating % e.g.: mglOpen; % mglClearScreen(0.5) % mglScreenCoordinates % x = 0:8pi/99:8pi; % texture = mglCreateTexture(255(sin(x)+1)/2); % mglBltTexture(texture,[0 0 100 500]); % mglFlush; % % For fast creation (this routine can take some time to convert % the matlab matrix to the format necessary for OpenGL) you can % pass in a uint8 texture preformatted for OpenGL. This should % be an rgba x width x height matrix. % e.g.: mglOpen; % mglScreenCoordinates; % mglClearScreen; % r = uint8(floor(rand(3,250,150)*256)); % r(4,:,:) = 255; % tex = mglCreateTexture(r); % mglBltTexture(tex,[mglGetParam('screenWidth')/2 mglGetParam('screenHeight')/2]); % mglFlush; %

benjamin-heasly commented 2 years ago

I reviewed the code we've been working on and added help text where incomplete or missing.