Skip to content

Commit

Permalink
Merge branch 'master' of github.com:openframeworks/openFrameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
arturoc committed May 29, 2014
2 parents 8a73208 + 9f59c99 commit 3942006
Show file tree
Hide file tree
Showing 17 changed files with 300 additions and 53 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ OF 0.8.2
- removed
/ modified

### Graphics
+ ofGetCurrentOrientationMatrix(): query current orientation matrix state (supported by ofGLProgrammableRenderer, ofGLRenderer)

------------------------------------------------------------------------------

CORE
Expand Down
2 changes: 1 addition & 1 deletion libs/openFrameworks/3d/ofCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/// \todo add set projection matrix
/// \todo support for left handed or right handed?

/// \brief A basic comera object for interacting with objects in 3D space.
/// \brief A basic camera object for interacting with objects in 3D space.
/// \author Memo Akten, MSA Visuals Ltd. 2011
class ofCamera : public ofNode {
public:
Expand Down
29 changes: 15 additions & 14 deletions libs/openFrameworks/gl/ofGLProgrammableRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,16 +554,18 @@ void ofGLProgrammableRenderer::uploadCurrentMatrix(){
}

//----------------------------------------------------------
/// \brief Queries the current OpenGL matrix state
///
/// \detail Returns the current state of the matrix from the top of the renderer's current matrix stack.
///
/// You can query one of the following:
///
/// [OF_MATRIX_MODELVIEW | OF_MATRIX_PROJECTION | OF_MATRIX_TEXTURE | OF_MATRIX_ORIENTATION]
///
/// \param matrixMode_ Which matrix mode to query
///
/** @brief Queries the current OpenGL matrix state
* @detail Returns the specified matrix as held by the renderer's current matrix stack.
*
* You can query one of the following:
*
* [OF_MATRIX_MODELVIEW | OF_MATRIX_PROJECTION | OF_MATRIX_TEXTURE]
*
* Each query will return the state of the matrix
* as it was uploaded to the shader currently bound.
*
* @param matrixMode_ Which matrix mode to query
*/
/// \note If an invalid matrixMode is queried, this method will return the identity matrix, and
/// print an error message.
ofMatrix4x4 ofGLProgrammableRenderer::getCurrentMatrix(ofMatrixMode matrixMode_) const {
Expand All @@ -577,9 +579,6 @@ ofMatrix4x4 ofGLProgrammableRenderer::getCurrentMatrix(ofMatrixMode matrixMode_)
case OF_MATRIX_TEXTURE:
return matrixStack.getTextureMatrix();
break;
case OF_MATRIX_ORIENTATION:
return matrixStack.getOrientationMatrix();
break;
default:
ofLogWarning() << "Invalid getCurrentMatrix query";
return ofMatrix4x4();
Expand All @@ -588,7 +587,9 @@ ofMatrix4x4 ofGLProgrammableRenderer::getCurrentMatrix(ofMatrixMode matrixMode_)
}

//----------------------------------------------------------

ofMatrix4x4 ofGLProgrammableRenderer::getCurrentOrientationMatrix() const {
return matrixStack.getOrientationMatrix();
}
//----------------------------------------------------------
void ofGLProgrammableRenderer::setColor(const ofColor & color){
setColor(color.r,color.g,color.b,color.a);
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/gl/ofGLProgrammableRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class ofGLProgrammableRenderer: public ofBaseGLRenderer{
void multMatrix (const float * m);

ofMatrix4x4 getCurrentMatrix(ofMatrixMode matrixMode_) const;
ofMatrix4x4 getCurrentOrientationMatrix() const;

// screen coordinate things / default gl values
void setupGraphicDefaults();
Expand Down
8 changes: 5 additions & 3 deletions libs/openFrameworks/gl/ofGLRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,6 @@ ofMatrix4x4 ofGLRenderer::getCurrentMatrix(ofMatrixMode matrixMode_) const {
case OF_MATRIX_TEXTURE:
glGetFloatv(GL_TEXTURE_MATRIX, mat.getPtr());
break;
case OF_MATRIX_ORIENTATION:
mat = matrixStack.getOrientationMatrix();
break;
default:
ofLogWarning() << "Invalid getCurrentMatrix query";
mat = ofMatrix4x4();
Expand All @@ -538,6 +535,11 @@ ofMatrix4x4 ofGLRenderer::getCurrentMatrix(ofMatrixMode matrixMode_) const {
return mat;
}

//----------------------------------------------------------
ofMatrix4x4 ofGLRenderer::getCurrentOrientationMatrix() const {
return matrixStack.getOrientationMatrix();
}

//----------------------------------------------------------
void ofGLRenderer::multMatrix (const ofMatrix4x4 & m){
multMatrix( m.getPtr() );
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/gl/ofGLRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class ofGLRenderer: public ofBaseGLRenderer{
void multMatrix (const float * m);

ofMatrix4x4 getCurrentMatrix(ofMatrixMode matrixMode_) const;
ofMatrix4x4 getCurrentOrientationMatrix() const;

// screen coordinate things / default gl values
void setupGraphicDefaults();
Expand Down
5 changes: 5 additions & 0 deletions libs/openFrameworks/graphics/ofGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ ofMatrix4x4 ofGetCurrentMatrix(ofMatrixMode matrixMode_){
return renderer->getCurrentMatrix(matrixMode_);
}

//----------------------------------------------------------
ofMatrix4x4 ofGetCurrentOrientationMatrix(){
return renderer->getCurrentOrientationMatrix();
}

//----------------------------------------------------------
void ofTranslate(const ofPoint& p){
renderer->translate(p);
Expand Down
9 changes: 9 additions & 0 deletions libs/openFrameworks/graphics/ofGraphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ ofHandednessType ofGetCoordHandedness();
void ofPushMatrix();
void ofPopMatrix();
ofMatrix4x4 ofGetCurrentMatrix(ofMatrixMode matrixMode_);

/// \brief Query the current (oF internal) Orientation Matrix state.
/// \note The matrix returned is the matrix openFrameworks uses internally
/// to calculate the (final, oriented) projection matrix as it is
/// passed on to the GPU.
///
/// Currently, only GL Programmable Renderer and GL Renderer
/// implement getCurrentMatrix.
ofMatrix4x4 ofGetCurrentOrientationMatrix();
void ofTranslate(float x, float y, float z = 0);
void ofTranslate(const ofPoint & p);
void ofScale(float xAmnt, float yAmnt, float zAmnt = 1);
Expand Down
8 changes: 6 additions & 2 deletions libs/openFrameworks/graphics/ofImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void ofCloseFreeImage();


/// \brief A class representing an image using memory and gpu based pixels.
/// \tparam PixelType The data type used to represent a single pixel value.
template<typename PixelType>
class ofImage_ : public ofBaseImage_<PixelType>{
public:
Expand Down Expand Up @@ -473,8 +474,11 @@ class ofImage_ : public ofBaseImage_<PixelType>{
/// \brief Loads ofPixels data into ofTexture so that draw() calls reflect changes to the pixels.
void reloadTexture();

int width, height, bpp; ///< w,h, bits per pixel
int type; ///< OF_IMAGE_GRAYSCALE, OF_IMAGE_COLOR, OF_IMAGE_COLOR_ALPHA
int width; ///< \brief Image width in pixels.
int height; ///< \brief Image Height in pixels.
int bpp; ///< \brief Bits per image pixel.
int type; ///< \brief Image type.
///< \sa ofImageType

ofImage_<PixelType> & operator=(ofPixels_<PixelType> & pixels);

Expand Down
6 changes: 6 additions & 0 deletions libs/openFrameworks/types/ofBaseTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,9 @@ void ofBaseVideoPlayer::previousFrame(){
// ofLogWarning("ofBaseVideoPlayer") << "getPixelFormat() not implemented";
// return OF_PIXELS_RGB;
//}

//---------------------------------------------------------------------------
ofMatrix4x4 ofBaseRenderer::getCurrentOrientationMatrix() const {
ofLogWarning() << "getCurrentOrientationMatrix() Not implemented for this renderer. Returning Identity matrix.";
return ofMatrix4x4();
}
1 change: 1 addition & 0 deletions libs/openFrameworks/types/ofBaseTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ class ofBaseRenderer{
virtual void pushMatrix(){};
virtual void popMatrix(){};
virtual ofMatrix4x4 getCurrentMatrix(ofMatrixMode matrixMode_) const { return ofMatrix4x4();};
virtual ofMatrix4x4 getCurrentOrientationMatrix() const;
virtual void translate(float x, float y, float z = 0){};
virtual void translate(const ofPoint & p){};
virtual void scale(float xAmnt, float yAmnt, float zAmnt = 1){};
Expand Down
9 changes: 5 additions & 4 deletions libs/openFrameworks/types/ofColor.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
///
/// [1]: http://en.wikipedia.org/wiki/RGB_color_model "RGB Model"
///
/// \tparam PixelType The data type used to represent a single pixel value.
template<typename PixelType>
class ofColor_{
public:
Expand Down Expand Up @@ -560,10 +561,10 @@ class ofColor_{

union {
struct {
PixelType r; //< \brief The red color component.
PixelType g; //< \brief The green color component.
PixelType b; //< \brief The blue color component.
PixelType a; //< \brief The alpha color component.
PixelType r; ///< \brief The red color component.
PixelType g; ///< \brief The green color component.
PixelType b; ///< \brief The blue color component.
PixelType a; ///< \brief The alpha color component.
};
PixelType v[4]; ///< \brief The pixel values as an array.
};
Expand Down
2 changes: 1 addition & 1 deletion libs/openFrameworks/utils/ofConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ enum ofPolyWindingMode{

enum ofHandednessType {OF_LEFT_HANDED, OF_RIGHT_HANDED};

enum ofMatrixMode {OF_MATRIX_MODELVIEW=0, OF_MATRIX_PROJECTION, OF_MATRIX_TEXTURE, OF_MATRIX_ORIENTATION};
enum ofMatrixMode {OF_MATRIX_MODELVIEW=0, OF_MATRIX_PROJECTION, OF_MATRIX_TEXTURE};

//--------------------------------------------
//
Expand Down
2 changes: 2 additions & 0 deletions libs/openFrameworks/utils/ofSystemUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ gboolean text_dialog_gtk(gpointer userdata){
static void initGTK(){
static bool initialized = false;
if(!initialized){
#if !defined(TARGET_RASPBERRY_PI)
XInitThreads();
#endif
int argc=0; char **argv = NULL;
gtk_init (&argc, &argv);
ofGstUtils::startGstMainLoop();
Expand Down
6 changes: 3 additions & 3 deletions libs/openFrameworks/utils/ofThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ class ofThread: protected Poco::Runnable {
/// \brief Start the thread with options.
///
/// \param mutexesBlock Set blocking to true if you want the mutex to
/// block when lock() is called.
/// block when lock() is called.
/// \param verbose use verbose logging methods.
OF_DEPRECATED_MSG("Use startThread(bool blocking = true) instead.",
void startThread(bool mutexesBlock, bool verbose) );

/// \brief Start the thread with options.
/// \param mutexBlocks Set blocking to true if you want the mutex to
/// block when lock() is called.
/// block when lock() is called.
/// \note Subclasses can directly access the mutex and employ thier
/// own locking strategy.
void startThread(bool mutexBlocks = true);
Expand Down Expand Up @@ -296,7 +296,7 @@ class ofThread: protected Poco::Runnable {

enum {
INFINITE_JOIN_TIMEOUT = LONG_MAX
///< \brief An sentinal value for an infinite join timeout.
///< \brief A sentinal value for an infinite join timeout.
///<
///< Primarily used with the waitForThread() method.
};
Expand Down
Loading

0 comments on commit 3942006

Please sign in to comment.