diff --git a/app/ofBaseApp.markdown b/app/ofBaseApp.markdown index e1a008a..762866c 100644 --- a/app/ofBaseApp.markdown +++ b/app/ofBaseApp.markdown @@ -17,13 +17,13 @@ This function gets called when ever we resize the application window. You receiv ### void keyPressed( int key ) ### {#keyPressed} This function gets called when a key is pressed. The value key can be tested against. - There are more complicated character codes, for keys such as F1-F12, Down, Enter: OF_KEY_BACKSPACE, OF_KEY_RETURN, OF_KEY_PRINTSCR, OF_KEY_F1 - OF_KEY_F12, OF_KEY_LEFT, OF_KEY_UP, OF_KEY_RIGHT, OF_KEY_DOWN, OF_KEY_PAGE_UP, OF_KEY_PAGE_DOWN, OF_KEY_HOME, OF_KEY_END, OF_KEY_INSERT +There are more complicated character codes, for keys such as F1-F12, Down, Enter: OF_KEY_BACKSPACE, OF_KEY_RETURN, OF_KEY_PRINTSCR, OF_KEY_F1 - OF_KEY_F12, OF_KEY_LEFT, OF_KEY_UP, OF_KEY_RIGHT, OF_KEY_DOWN, OF_KEY_PAGE_UP, OF_KEY_PAGE_DOWN, OF_KEY_HOME, OF_KEY_END, OF_KEY_INSERT ### void keyReleased( int key ) ### {#keyReleased} This function gets called when a key is released. The value key can be tested against. - There are more complicated character codes, for keys such as F1-F12, Down, Enter: OF_KEY_BACKSPACE, OF_KEY_RETURN, OF_KEY_PRINTSCR, OF_KEY_F1 - OF_KEY_F12, OF_KEY_LEFT, OF_KEY_UP, OF_KEY_RIGHT, OF_KEY_DOWN, OF_KEY_PAGE_UP, OF_KEY_PAGE_DOWN, OF_KEY_HOME, OF_KEY_END, OF_KEY_INSERT +There are more complicated character codes, for keys such as F1-F12, Down, Enter: OF_KEY_BACKSPACE, OF_KEY_RETURN, OF_KEY_PRINTSCR, OF_KEY_F1 - OF_KEY_F12, OF_KEY_LEFT, OF_KEY_UP, OF_KEY_RIGHT, OF_KEY_DOWN, OF_KEY_PAGE_UP, OF_KEY_PAGE_DOWN, OF_KEY_HOME, OF_KEY_END, OF_KEY_INSERT ### void mouseMoved( int x, int y ) ### {#mouseMoved} This function gets when ever the mouse moves. You receive the x and y corrdinates of the mouse. @@ -39,9 +39,8 @@ This function gets when ever the mouse moves. ### void mouseReleased(int x, int y, int button ) ### {#mouseReleased} This function gets when ever the mouse moves. You receive the x and y corrdinates of the mouse and the button that was released. - + ### void dragEvent(ofDragInfo dragInfo) ### {#dragEvent} Sends an [ofDragInfo](../events/ofEvents.htm#ofDragInfo) event. ### void gotMessage(ofMessage msg) ### {#gotMessage} - \ No newline at end of file diff --git a/events/ofEventUtils.markdown b/events/ofEventUtils.markdown index e69de29..b42bdd8 100644 --- a/events/ofEventUtils.markdown +++ b/events/ofEventUtils.markdown @@ -0,0 +1,47 @@ + +## ofEvent ## + +define ofEvent as a poco FIFOEvent to create your own events use: ofEvent myEvent + +### ofEvent() ### + + ### ofEvent(const ofEvent & mom) ### + allow copy of events, by copying everything except the mutex + + ### ofEvent & operator=(const ofEvent & mom) ### + + +### void ofAddListener(EventType & event, ListenerClass * listener, void (ListenerClass::*listenerMethod)(const void*, ArgumentsType&)) ## + +register any method of any class to an event. the method must provide one of the following +signatures: + void method(ArgumentsType & args) + void method(const void * sender, ArgumentsType &args) +ie: + ofAddListener(addon.newIntEvent, this, &Class::method) + +### void ofAddListener(EventType & event, ListenerClass * listener, void (ListenerClass::*listenerMethod)(ArgumentsType&)) ### + + + +### void ofRemoveListener(EventType & event, ListenerClass * listener, void (ListenerClass::*listenerMethod)(const void*, ArgumentsType&)) ### + +unregister any method of any class to an event. +the method must provide one the following +signatures: + void method(ArgumentsType & args) + void method(const void * sender, ArgumentsType &args) +ie: + ofAddListener(addon.newIntEvent, this, &Class::method) + +### void ofRemoveListener(EventType & event, ListenerClass * listener, void (ListenerClass::*listenerMethod)(ArgumentsType&)) ### + +### void ofNotifyEvent(EventType & event, ArgumentsType & args, SenderType * sender) ### +notifies an event so all the registered listeners +get called +ie: + ofNotifyEvent(addon.newIntEvent, intArgument, this) +or in case there's no sender: + ofNotifyEvent(addon.newIntEvent, intArgument) + +### void ofNotifyEvent(EventType & event, ArgumentsType & args) ## \ No newline at end of file diff --git a/events/ofEvents.htm b/events/ofEvents.htm index 49c50d5..b9b0428 100644 --- a/events/ofEvents.htm +++ b/events/ofEvents.htm @@ -68,4 +68,144 @@

void ofUnregisterTo

void ofUnregisterGetMessages(ListenerClass * listener)

Stop the listener from listening to message events.

void ofUnregisterDragEvents(ListenerClass * listener)

+

Stop the listener from listening to drag events.

ofDragInfo

+

Passed to the ofBaseApp in the dragEvent method.

+

vector files

+

All the files included in the drag events

+

ofPoint position

+

The location in the app where the drag event terminated, i.e. where you dropped the file/s.

+

ofKeyEventArgs

+

Sent during keyPressed and keyReleased events.

+

ofMouseEventArgs

+

Sent to [ofBaseApp}(../app/ofBaseApp.htm) during mousePressed mouseReleased and mouseDrag notifications.

+

ofTouchEventArgs

+

These are sent to any any registered listeners when the device detects touches. Most commonly this is the ofBaseApp in the touchDown, touchUp, touchUp, touchDoubleTap, touchCancelled method.

+

int id

+

The id of the touch.

+

int time

+

For taps or presses this is the time in seconds. Not currently used.

+

float x

+

Application coordinate location of the event

+

float y

+

Application coordinate location of the event

+

int numTouches

+

How many touch points the event involves. Not currently used.

+

float width

+

The width of the touch area. Not currently used.

+

float height

+

The height of the touch area. Not currently used.

+

float angle

+

If there are two touches this is the angle between them. Not currently used.

+

float minoraxis

+

The shorter axis of a touch area. Not currently used.

+

float majoraxis

+

The longer axis of a touch area. Not currently used.

+

float pressure

+

If your device is recording pressure, this represents the pressure of the touch. Not currently used.

+

float xspeed

+

For touch drag events, this is the approximation of the speed of the movement along the x-axis. Not currently used.

+

float yspeed

+

For touch drag events, this is the approximation of the speed of the movement along the y-axis. Not currently used.

+

float xaccel

+

For touch drag events, this is the approximation of the acceleration of the movement along the x-axis. Not currently used.

+

float yaccel

+

For touch drag events, this is the approximation of the acceleration of the movement along the y-axis. Not currently used.

+

ofAudioEventArgs

+

float* buffer

+

int bufferSize

+

int nChannels

+

ofResizeEventArgs

+

### int width ### {#width}

+

### int height ### {#height}

+

ofEvents

+

Below are the public methods of ofEvents

+

void ofRegisterMouseEvents(ListenerClass * listener)

+

Register the mouse events to the listener. This assumes that the listener has mousePressed, mouseReleased, mouseMoved, and mouseDragged methods to handle the events being dispatched to it.

+

void ofRegisterKeyEvents(ListenerClass * listener)

+

Register the mouse events to the listener. This assumes that the listener has keyPressed, keyReleased methods to handle the events being dispatched to it.

+

void ofRegisterTouchEvents(ListenerClass * listener)

+

Register the mouse events to the listener. This assumes that the listener has touchDown, touchMoved, touchUp, touchDoubleTap, touchCancelled methods to handle the events being dispatched to it.

+

void ofRegisterGetMessages(ListenerClass * listener)

+

Register the mouse events to the listener. This assumes that the listener has a gotMessage method to handle the events being dispatched to it.

+

void ofRegisterDragEvents(ListenerClass * listener)

+

Register the drag events to the listener. This assumes that the listener has the dragEvent method to handle the events being dispatched to it.

+

void ofUnregisterMouseEvents(ListenerClass * listener)

+

Stop the listener from listening to mouse events.

+

void ofUnregisterKeyEvents(ListenerClass * listener)

+

Stop the listener from listening to key events.

+

void ofUnregisterTouchEvents(ListenerClass * listener)

+

Stop the listener from listening to touch events.

+

void ofUnregisterGetMessages(ListenerClass * listener)

+

Stop the listener from listening to message events.

+

void ofUnregisterDragEvents(ListenerClass * listener)

+

Stop the listener from listening to drag events.

ofDragInfo

+

Passed to the ofBaseApp in the dragEvent method.

+

vector files

+

All the files included in the drag events

+

ofPoint position

+

The location in the app where the drag event terminated, i.e. where you dropped the file/s.

+

ofKeyEventArgs

+

Sent during keyPressed and keyReleased events.

+

ofMouseEventArgs

+

Sent to [ofBaseApp}(../app/ofBaseApp.htm) during mousePressed mouseReleased and mouseDrag notifications.

+

ofTouchEventArgs

+

These are sent to any any registered listeners when the device detects touches. Most commonly this is the ofBaseApp in the touchDown, touchUp, touchUp, touchDoubleTap, touchCancelled method.

+

int id

+

The id of the touch.

+

int time

+

For taps or presses this is the time in seconds. Not currently used.

+

float x

+

Application coordinate location of the event

+

float y

+

Application coordinate location of the event

+

int numTouches

+

How many touch points the event involves. Not currently used.

+

float width

+

The width of the touch area. Not currently used.

+

float height

+

The height of the touch area. Not currently used.

+

float angle

+

If there are two touches this is the angle between them. Not currently used.

+

float minoraxis

+

The shorter axis of a touch area. Not currently used.

+

float majoraxis

+

The longer axis of a touch area. Not currently used.

+

float pressure

+

If your device is recording pressure, this represents the pressure of the touch. Not currently used.

+

float xspeed

+

For touch drag events, this is the approximation of the speed of the movement along the x-axis. Not currently used.

+

float yspeed

+

For touch drag events, this is the approximation of the speed of the movement along the y-axis. Not currently used.

+

float xaccel

+

For touch drag events, this is the approximation of the acceleration of the movement along the x-axis. Not currently used.

+

float yaccel

+

For touch drag events, this is the approximation of the acceleration of the movement along the y-axis. Not currently used.

+

ofAudioEventArgs

+

float* buffer

+

int bufferSize

+

int nChannels

+

ofResizeEventArgs

+

### int width ### {#width}

+

### int height ### {#height}

+

ofEvents

+

Below are the public methods of ofEvents

+

void ofRegisterMouseEvents(ListenerClass * listener)

+

Register the mouse events to the listener. This assumes that the listener has mousePressed, mouseReleased, mouseMoved, and mouseDragged methods to handle the events being dispatched to it.

+

void ofRegisterKeyEvents(ListenerClass * listener)

+

Register the mouse events to the listener. This assumes that the listener has keyPressed, keyReleased methods to handle the events being dispatched to it.

+

void ofRegisterTouchEvents(ListenerClass * listener)

+

Register the mouse events to the listener. This assumes that the listener has touchDown, touchMoved, touchUp, touchDoubleTap, touchCancelled methods to handle the events being dispatched to it.

+

void ofRegisterGetMessages(ListenerClass * listener)

+

Register the mouse events to the listener. This assumes that the listener has a gotMessage method to handle the events being dispatched to it.

+

void ofRegisterDragEvents(ListenerClass * listener)

+

Register the drag events to the listener. This assumes that the listener has the dragEvent method to handle the events being dispatched to it.

+

void ofUnregisterMouseEvents(ListenerClass * listener)

+

Stop the listener from listening to mouse events.

+

void ofUnregisterKeyEvents(ListenerClass * listener)

+

Stop the listener from listening to key events.

+

void ofUnregisterTouchEvents(ListenerClass * listener)

+

Stop the listener from listening to touch events.

+

void ofUnregisterGetMessages(ListenerClass * listener)

+

Stop the listener from listening to message events.

+

void ofUnregisterDragEvents(ListenerClass * listener)

Stop the listener from listening to drag events.

\ No newline at end of file diff --git a/events/ofEvents.markdown b/events/ofEvents.markdown index d2ba1a4..bf7e1ab 100644 --- a/events/ofEvents.markdown +++ b/events/ofEvents.markdown @@ -2,106 +2,109 @@ ## ofDragInfo ## Passed to the [ofBaseApp](../app/ofBaseApp.htm) in the [dragEvent](../app/ofBaseApp.htm#dragEvent) method. -### vector files ### +### vector files ### {#files} All the files included in the drag events -### ofPoint position ### +### ofPoint position ### {#position} The location in the app where the drag event terminated, i.e. where you dropped the file/s. -## ofKeyEventArgs ## +## ofKeyEventArgs ## {#ofKeyEventArgs} Sent during [keyPressed](../app/ofBaseApp.htm#keyPressed) and [keyReleased](../app/ofBaseApp.htm#keyReleased) events. -## ofMouseEventArgs ## +## ofMouseEventArgs ## {#ofMouseEventArgs} Sent to [ofBaseApp}(../app/ofBaseApp.htm) during [mousePressed](../app/ofBaseApp.htm#mousePressed) [mouseReleased](../app/ofBaseApp.htm#mouseReleased) and [mouseDrag](../app/ofBaseApp.htm#mouseDrag) notifications. -## ofTouchEventArgs ## +## ofTouchEventArgs ## {#ofTouchEventArgs} These are sent to any any registered listeners when the device detects touches. Most commonly this is the ofBaseApp in the [touchDown](../app/ofBaseApp.htm#touchDown), [touchUp](../app/ofBaseApp.htm#touchUp), [touchUp](../app/ofBaseApp.htm#touchUp), [touchDoubleTap](../app/ofBaseApp.htm#touchDoubleTap), [touchCancelled](../app/ofBaseApp.htm#touchCancelled) method. -### int id ### +### int id ### {#id} The id of the touch. -### int time ### +### int time ### {#time} For taps or presses this is the time in seconds. Not currently used. -### float x ### +### float x ### {#x} Application coordinate location of the event -### float y ### +### float y ### {#y} Application coordinate location of the event -### int numTouches ### +### int numTouches ### {#numTouches} How many touch points the event involves. Not currently used. -### float width ### +### float width ### {#width} The width of the touch area. Not currently used. -### float height ### +### float height ### {#height} The height of the touch area. Not currently used. -### float angle ### +### float angle ### {#angle} If there are two touches this is the angle between them. Not currently used. -### float minoraxis ### +### float minoraxis ### {#minoraxis} The shorter axis of a touch area. Not currently used. -### float majoraxis ### +### float majoraxis ### {#majoraxis} The longer axis of a touch area. Not currently used. -### float pressure ### +### float pressure ### {#pressure} If your device is recording pressure, this represents the pressure of the touch. Not currently used. -### float xspeed ### +### float xspeed ### {#xspeed} For touch drag events, this is the approximation of the speed of the movement along the x-axis. Not currently used. -### float yspeed ### +### float yspeed ### {#yspeed} For touch drag events, this is the approximation of the speed of the movement along the y-axis. Not currently used. -### float xaccel ### +### float xaccel ### {#xaccel} For touch drag events, this is the approximation of the acceleration of the movement along the x-axis. Not currently used. -### float yaccel ### +### float yaccel ### {#yaccel} For touch drag events, this is the approximation of the acceleration of the movement along the y-axis. Not currently used. -## ofAudioEventArgs ## +## ofAudioEventArgs ## {#ofAudioEventArgs} -### float* buffer ### -### int bufferSize ### -### int nChannels ### +### float* buffer ### {#buffer} -## ofResizeEventArgs ## +### int bufferSize ### {#bufferSize} - ### int width ### - ### int height ### +### int nChannels ### {#nChannels} -## ofEvents ## +## ofResizeEventArgs ## {#ofResizeEventArgs} + + ### int width ### {#width} + + ### int height ### {#height} + +## ofEvents ## {#ofEvents} Below are the public methods of ofEvents -### void ofRegisterMouseEvents(ListenerClass * listener) ### +### void ofRegisterMouseEvents(ListenerClass * listener) ### {#ofRegisterMouseEvents} Register the mouse events to the listener. This assumes that the listener has mousePressed, mouseReleased, mouseMoved, and mouseDragged methods to handle the events being dispatched to it. -### void ofRegisterKeyEvents(ListenerClass * listener) ### +### void ofRegisterKeyEvents(ListenerClass * listener) ### {#ofRegisterKeyEvents} Register the mouse events to the listener. This assumes that the listener has keyPressed, keyReleased methods to handle the events being dispatched to it. -### void ofRegisterTouchEvents(ListenerClass * listener) ### +### void ofRegisterTouchEvents(ListenerClass * listener) ### {#ofRegisterTouchEvents} Register the mouse events to the listener. This assumes that the listener has touchDown, touchMoved, touchUp, touchDoubleTap, touchCancelled methods to handle the events being dispatched to it. -### void ofRegisterGetMessages(ListenerClass * listener) ### +### void ofRegisterGetMessages(ListenerClass * listener) ### {#ofRegisterGetMessages} Register the mouse events to the listener. This assumes that the listener has a gotMessage method to handle the events being dispatched to it. -### void ofRegisterDragEvents(ListenerClass * listener) ### +### void ofRegisterDragEvents(ListenerClass * listener) ### {#ofRegisterDragEvents} Register the drag events to the listener. This assumes that the listener has the dragEvent method to handle the events being dispatched to it. -### void ofUnregisterMouseEvents(ListenerClass * listener) ### +### void ofUnregisterMouseEvents(ListenerClass * listener) ### {#ofUnregisterMouseEvents} Stop the listener from listening to mouse events. -### void ofUnregisterKeyEvents(ListenerClass * listener) ### +### void ofUnregisterKeyEvents(ListenerClass * listener) ### {#ofUnregisterKeyEvents} Stop the listener from listening to key events. -### void ofUnregisterTouchEvents(ListenerClass * listener) ### +### void ofUnregisterTouchEvents(ListenerClass * listener) ### {#ofUnregisterTouchEvents} Stop the listener from listening to touch events. -### void ofUnregisterGetMessages(ListenerClass * listener) ### +### void ofUnregisterGetMessages(ListenerClass * listener) ### {#ofUnregisterGetMessages} Stop the listener from listening to message events. -### void ofUnregisterDragEvents(ListenerClass * listener) ### +### void ofUnregisterDragEvents(ListenerClass * listener) ### {#ofUnregisterDragEvents} Stop the listener from listening to drag events. diff --git a/gl/ofShader.markdown b/gl/ofShader.markdown index 67b0d38..4c5cde0 100644 --- a/gl/ofShader.markdown +++ b/gl/ofShader.markdown @@ -1,81 +1,199 @@ - ofShader() - ~ofShader() - - bool load(string shaderName) - bool load(string vertName, string fragName, string geomName="") - - - - // these are essential to call before linking the program with geometry shaders - void setGeometryInputType(GLenum type) // type: GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_EXT, GL_TRIANGLES, GL_TRIANGLES_ADJACENCY_EXT - void setGeometryOutputType(GLenum type) // type: GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP - void setGeometryOutputCount(int count) // set number of output vertices - - int getGeometryMaxOutputCount() // returns maximum number of supported vertices - - - void unload() - - void begin() - void end() - - // set a texture reference - void setUniformTexture(const char* name, ofBaseHasTexture& img, int textureLocation) - void setUniformTexture(const char* name, ofTexture& img, int textureLocation) - - // set a single uniform value - void setUniform1i(const char* name, int v1) - void setUniform2i(const char* name, int v1, int v2) - void setUniform3i(const char* name, int v1, int v2, int v3) - void setUniform4i(const char* name, int v1, int v2, int v3, int v4) - - void setUniform1f(const char* name, float v1) - void setUniform2f(const char* name, float v1, float v2) - void setUniform3f(const char* name, float v1, float v2, float v3) - void setUniform4f(const char* name, float v1, float v2, float v3, float v4) - - // set an array of uniform values - void setUniform1iv(const char* name, int* v, int count = 1) - void setUniform2iv(const char* name, int* v, int count = 1) - void setUniform3iv(const char* name, int* v, int count = 1) - void setUniform4iv(const char* name, int* v, int count = 1) - - void setUniform1fv(const char* name, float* v, int count = 1) - void setUniform2fv(const char* name, float* v, int count = 1) - void setUniform3fv(const char* name, float* v, int count = 1) - void setUniform4fv(const char* name, float* v, int count = 1) - - // set attributes that vary per vertex (look up the location before glBegin) - GLint getAttributeLocation(const char* name) - - void setAttribute1s(GLint location, short v1) - void setAttribute2s(GLint location, short v1, short v2) - void setAttribute3s(GLint location, short v1, short v2, short v3) - void setAttribute4s(GLint location, short v1, short v2, short v3, short v4) - - void setAttribute1f(GLint location, float v1) - void setAttribute2f(GLint location, float v1, float v2) - void setAttribute3f(GLint location, float v1, float v2, float v3) - void setAttribute4f(GLint location, float v1, float v2, float v3, float v4) - - void setAttribute1d(GLint location, double v1) - void setAttribute2d(GLint location, double v1, double v2) - void setAttribute3d(GLint location, double v1, double v2, double v3) - void setAttribute4d(GLint location, double v1, double v2, double v3, double v4) - - void printActiveUniforms() - void printActiveAttributes() - - - // advanced use - - // these methods create and compile a shader from source or file - // type: GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_GEOMETRY_SHADER_EXT etc. - bool setupShaderFromSource(GLenum type, string source) - bool setupShaderFromFile(GLenum type, string filename) - - // links program with all compiled shaders - bool linkProgram() - - GLuint& getProgram() - GLuint& getShader(GLenum type) \ No newline at end of file + +## ofShader ## + +Graphics Language Shading Language (GLSL) can be used in oF by using the ofShader object. Shading happens in two distinct steps: the vertex shader creates values for each vertex in the model, and the fragment shader creates values for each pixel in the rendered object. To define a shader, create a .frag file for the fragment shader and a .vert file for the vertex shader. +A vertex shader has attributes about a location in space or vertex, which means not only the actual coordinates of that location but also its color, how any textures should be mapped onto it, and how the vertices are modified in the operation. A vertex shader can change the positions of each vertex, the number of lighting computations per vertex, and the color that will be applied to each vertex. +A geometry shader can generate new graphics primitives like points, lines, and triangles, from those primitives that were sent to the graphics card from the CPU. This means that you could get a point and turn it into a triangle or even a bunch of triangles, or get a line and turn it into a rectangle, or do real-time extrusion. They are very powerful and can be quite tricky to get right, but they’re becoming more popular. +The fragment shader is somewhat misleadingly named because what it really allows you to do is to change values assigned to each pixel. The vertex shader operates on the vertices, and the fragment shader operates on the pixels. By the time the fragment shader gets information passed into it by the graphics card, the color of a particular pixel has already been computed and in the fragment shader can be combined with an element like a lighting effecting, a fog effect, or a blur among many other options. The usual end result of this stage per fragment is a color value and a depth for the fragment. + +### ofShader() ### +### ~ofShader() ### + +### bool load(string shaderName) ### +This assumes that your vertex and fragment shaders have the same name and loads them. + +### bool load(string vertName, string fragName, string geomName="") ### +Here you can load shaders with whatever names you choose. The geometry shader is optional, but the vertex and fragment shaders aren't. + +### void setGeometryInputType(GLenum type) ### +You have to call this before linking the program with geometry shaders. +Possible types are GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_EXT, GL_TRIANGLES, GL_TRIANGLES_ADJACENCY_EXT + +### void setGeometryOutputType(GLenum type) ### +You have to call this before linking the program with geometry shaders. +type: GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP + +### void setGeometryOutputCount(int count) ### +You have to call this before linking the program with geometry shaders to set number of output vertices + +### int getGeometryMaxOutputCount() ### ### +returns maximum number of supported vertices for your graphics card + + +### void unload() ### +This unload the shader, which means that it will not be active on the graphics card any longer. + +### void begin() ### + +After you call begin() everything that you draw, vertexes and textures, in your of application have the effects of the shader applied to them. + +### void end() ### + +After you call end() any drawing, vertexes and textures, do not have the effect of the shader applied to them. + +### void setUniformTexture(const char* name, ofBaseHasTexture& img, int textureLocation) ### +set a texture reference + +On your shader it should look like this: + +```cpp +uniform sampler2DRect texture; +``` + +### void setUniformTexture(const char* name, ofTexture& img, int textureLocation) ### + +For multi-texturing. + +```cpp +uniform sampler2DRect texture; +``` + +### void setUniform1i(const char* name, int v1) ### + +set a single uniform value. On your shader this should look like: + +```cpp +uniform int texture; +``` + +### void setUniform2i(const char* name, int v1, int v2) ### + +```cpp +uniform ivec2 texture; +``` + +### void setUniform3i(const char* name, int v1, int v2, int v3) ### + +```cpp +uniform ivec3 texture; +``` + +### void setUniform4i(const char* name, int v1, int v2, int v3, int v4) ### + +```cpp +uniform ivec4 texture; +``` + +### void setUniform1f(const char* name, float v1) ### +set a float uniform on the shader + +### void setUniform2f(const char* name, float v1, float v2) ### +set a vec2 uniform on the shader + +### void setUniform3f(const char* name, float v1, float v2, float v3) ### +set a vec3 uniform on the shader + + +### void setUniform4f(const char* name, float v1, float v2, float v3, float v4) ### +set a vec4 uniform on the shader + +```cpp +vec4 fv; +``` + +### void setUniform1iv(const char* name, int* v, int count = 1) ### + +set an array of uniform values on the shader, this uses single values, i.e. + +```cpp +int ids[4] = {1, 2, 3, 4}; +``` +On the shader side, this is: + +```cpp +ivec iv[2]; +``` + +### void setUniform2iv(const char* name, int* v, int count = 1) ### +set an array of uniform values on the shader using int[2] value. On the shader this looks like: + +```cpp +ivec2 iv[2]; +``` + +### void setUniform3iv(const char* name, int* v, int count = 1) ### +set an array of uniform values on the shader using int[2] value. On the shader this looks like: + +```cpp +ivec3 iv[2]; +``` + +### void setUniform4iv(const char* name, int* v, int count = 1) ### +set an array of uniform values on the shader using int[2] value. On the shader this looks like: + +```cpp +ivec4 iv[2]; +``` + +### void setUniform1fv(const char* name, float* v, int count = 1) ### + +set an array of uniform values on the shader using int[2] value. On the shader this looks like: + +```cpp +float v[2]; +``` + +### void setUniform2fv(const char* name, float* v, int count = 1) ### + +```cpp +vec2 v[2]; +``` + +### void setUniform3fv(const char* name, float* v, int count = 1) ### + +```cpp +vec3 v[2]; +``` + +### void setUniform4fv(const char* name, float* v, int count = 1) ### + +```cpp +vec4 v[2]; +``` + +### GLint getAttributeLocation(const char* name) ### +// set attributes that vary per vertex (look up the location before glBegin) + +### void setAttribute1s(GLint location, short v1) ### +### void setAttribute2s(GLint location, short v1, short v2) ### +### void setAttribute3s(GLint location, short v1, short v2, short v3) ### +### void setAttribute4s(GLint location, short v1, short v2, short v3, short v4) ### + +### void setAttribute1f(GLint location, float v1) ### +### void setAttribute2f(GLint location, float v1, float v2) ### +### void setAttribute3f(GLint location, float v1, float v2, float v3) ### +### void setAttribute4f(GLint location, float v1, float v2, float v3, float v4) ### + +### void setAttribute1d(GLint location, double v1) ### +### void setAttribute2d(GLint location, double v1, double v2) ### +### void setAttribute3d(GLint location, double v1, double v2, double v3) ### +### void setAttribute4d(GLint location, double v1, double v2, double v3, double v4) ### + +### void printActiveUniforms() ### +### void printActiveAttributes() ### + +### bool setupShaderFromSource(GLenum type, string source) ### +// these methods create and compile a shader from source or file +// type: GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_GEOMETRY_SHADER_EXT etc. +// advanced use + +### bool setupShaderFromFile(GLenum type, string filename) ### +// advanced use + +### bool linkProgram() ### +// links program with all compiled shaders +// advanced use + +### GLuint& getProgram() ### + +### GLuint& getShader(GLenum type) ### \ No newline at end of file diff --git a/video/ofVideoGrabber.markdown b/video/ofVideoGrabber.markdown index 58adc6f..97297c3 100644 --- a/video/ofVideoGrabber.markdown +++ b/video/ofVideoGrabber.markdown @@ -4,7 +4,7 @@ The ofVideoGrabber class wraps quicktime's sequence grabbing component to provide low level access to live cameras. On windows it now uses the directshow based videoInput library which offers mainy performance advantages over quicktime and does not require quicktime or WinVDig to be installed. A #define in ofConstants.h allows you to choose whether to use quicktime or directshow (default) for windows. -In linux it uses by default unicap, although you can change to v4l through a #define in ofConstants in case some v4l device doesn't work properly with unicap. +In linux it uses by default unicap, although you can change to v4l through a #define in [ofConstants](../utils/ofConstants.htm) in case some v4l device doesn't work properly with unicap. ### listDevices() ###