Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:openframeworks/openFrameworks in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
arturoc committed Oct 29, 2012
2 parents a111f51 + a6928c3 commit 710d781
Show file tree
Hide file tree
Showing 13 changed files with 133 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/3d/advanced3dExample/src/testApp.cpp
Expand Up @@ -292,7 +292,7 @@ void testApp::drawScene(int iCameraDraw){
// from the inverseCameraMatrix object
// to OpenGL, and apply that matrix to
// the current OpenGL transform
glMultMatrixf(inverseCameraMatrix.getPtr());
ofMultMatrix( inverseCameraMatrix );

//
//--
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/normalsExample/src/testApp.cpp
Expand Up @@ -99,7 +99,7 @@ void testApp::draw(){

mesh.drawFaces();
ofSetColor(255,255,255);
light.customDraw();
light.draw();


// draw our normals, and show that they are perpendicular to the vector from the center to the vertex
Expand Down
2 changes: 1 addition & 1 deletion libs/openFrameworks/3d/of3dUtils.cpp
Expand Up @@ -122,7 +122,7 @@ void ofDrawArrow(const ofVec3f& start, const ofVec3f& end, float headSize) {
mat.makeRotationMatrix(ofVec3f(0,0,1), end - start);
ofPushMatrix();
ofTranslate(end);
glMultMatrixf(mat.getPtr());
ofMultMatrix(mat.getPtr());
ofTranslate(0,0,-headSize);
ofCone(headSize, headSize);
ofPopMatrix();
Expand Down
13 changes: 9 additions & 4 deletions libs/openFrameworks/3d/ofCamera.cpp
Expand Up @@ -97,7 +97,8 @@ void ofCamera::begin(ofRectangle viewport) {
calcClipPlanes(viewport);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
ofLoadIdentityMatrix();

if(isOrtho) {
// if(vFlip) glOrtho(0, width, height, 0, nearDist, farDist);
// else
Expand All @@ -106,14 +107,18 @@ void ofCamera::begin(ofRectangle viewport) {
#else
ofMatrix4x4 ortho;
ortho.makeOrthoMatrix(0, viewport.width, 0, viewport.height, nearClip, farClip);
glLoadMatrixf(ortho.getPtr());
ofLoadMatrix( ortho );
#endif
} else {
gluPerspective(fov, viewport.width/viewport.height, nearClip, farClip);

ofMatrix4x4 persp;
persp.makePerspectiveMatrix( fov, viewport.width/viewport.height, nearClip, farClip );
ofLoadMatrix( persp );
//gluPerspective(fov, viewport.width/viewport.height, nearClip, farClip);
}

glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(ofMatrix4x4::getInverseOf(getGlobalTransformMatrix()).getPtr());
ofLoadMatrix( ofMatrix4x4::getInverseOf(getGlobalTransformMatrix()) );
ofViewport(viewport);
}

Expand Down
7 changes: 4 additions & 3 deletions libs/openFrameworks/3d/ofNode.cpp
Expand Up @@ -342,13 +342,14 @@ void ofNode::draw() {

//----------------------------------------
void ofNode::transformGL() const {
glPushMatrix();
glMultMatrixf(getGlobalTransformMatrix().getPtr());
ofPushMatrix();
ofMultMatrix( getGlobalTransformMatrix() );
//glMultMatrixf( getGlobalTransformMatrix().getPtr() );
}

//----------------------------------------
void ofNode::restoreTransformGL() const {
glPopMatrix();
ofPopMatrix();
}

//----------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions libs/openFrameworks/gl/ofFbo.cpp
Expand Up @@ -241,6 +241,8 @@ ofFbo::ofFbo(const ofFbo & mom){
retainRB(colorBuffers[i]);
}
textures = mom.textures;
dirty = mom.dirty;
defaultTextureIndex = mom.defaultTextureIndex;
}

ofFbo & ofFbo::operator=(const ofFbo & mom){
Expand Down Expand Up @@ -271,6 +273,8 @@ ofFbo & ofFbo::operator=(const ofFbo & mom){
retainRB(colorBuffers[i]);
}
textures = mom.textures;
dirty = mom.dirty;
defaultTextureIndex = mom.defaultTextureIndex;
return *this;
}

Expand Down
39 changes: 37 additions & 2 deletions libs/openFrameworks/gl/ofGLRenderer.cpp
Expand Up @@ -360,11 +360,20 @@ void ofGLRenderer::setupScreenPerspective(float width, float height, ofOrientati

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(fov, aspect, nearDist, farDist);

ofMatrix4x4 persp;
persp.makePerspectiveMatrix(fov, aspect, nearDist, farDist);
loadMatrix( persp );
//gluPerspective(fov, aspect, nearDist, farDist);


glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(eyeX, eyeY, dist, eyeX, eyeY, 0, 0, 1, 0);

ofMatrix4x4 lookAt;
lookAt.makeLookAtViewMatrix( ofVec3f(eyeX, eyeY, dist), ofVec3f(eyeX, eyeY, 0), ofVec3f(0, 1, 0) );
loadMatrix( lookAt );
//gluLookAt(eyeX, eyeY, dist, eyeX, eyeY, 0, 0, 1, 0);

//note - theo checked this on iPhone and Desktop for both vFlip = false and true
if(ofDoesHWOrientation()){
Expand Down Expand Up @@ -677,6 +686,32 @@ void ofGLRenderer::rotate(float degrees){
glRotatef(degrees, 0, 0, 1);
}


//----------------------------------------------------------
void ofGLRenderer::loadIdentityMatrix (void){
glLoadIdentity();
}

//----------------------------------------------------------
void ofGLRenderer::loadMatrix (const ofMatrix4x4 & m){
loadMatrix( m.getPtr() );
}

//----------------------------------------------------------
void ofGLRenderer::loadMatrix (const float *m){
glLoadMatrixf(m);
}

//----------------------------------------------------------
void ofGLRenderer::multMatrix (const ofMatrix4x4 & m){
multMatrix( m.getPtr() );
}

//----------------------------------------------------------
void ofGLRenderer::multMatrix (const float *m){
glMultMatrixf(m);
}

//----------------------------------------------------------
void ofGLRenderer::setColor(const ofColor & color){
setColor(color.r,color.g,color.b,color.a);
Expand Down
7 changes: 6 additions & 1 deletion libs/openFrameworks/gl/ofGLRenderer.h
Expand Up @@ -64,7 +64,12 @@ class ofGLRenderer: public ofBaseRenderer{
void rotateY(float degrees);
void rotateZ(float degrees);
void rotate(float degrees);

void loadIdentityMatrix (void);
void loadMatrix (const ofMatrix4x4 & m);
void loadMatrix (const float * m);
void multMatrix (const ofMatrix4x4 & m);
void multMatrix (const float * m);

// screen coordinate things / default gl values
void setupGraphicDefaults();
void setupScreen();
Expand Down
25 changes: 25 additions & 0 deletions libs/openFrameworks/graphics/ofGraphics.cpp
Expand Up @@ -270,6 +270,31 @@ void ofRotate(float degrees){
renderer->rotate(degrees);
}

//----------------------------------------------------------
void ofLoadIdentityMatrix (void){
renderer->loadIdentityMatrix();
}

//----------------------------------------------------------
void ofLoadMatrix (const ofMatrix4x4 & m){
renderer->loadMatrix(m);
}

//----------------------------------------------------------
void ofLoadMatrix (const float *m){
renderer->loadMatrix(m);
}

//----------------------------------------------------------
void ofMultMatrix (const ofMatrix4x4 & m){
renderer->multMatrix(m);
}

//----------------------------------------------------------
void ofMultMatrix (const float *m){
renderer->multMatrix(m);
}

// end transformation matrix related functions
//----------------------------------------------------------

Expand Down
5 changes: 5 additions & 0 deletions libs/openFrameworks/graphics/ofGraphics.h
Expand Up @@ -52,6 +52,11 @@ void ofRotateX(float degrees);
void ofRotateY(float degrees);
void ofRotateZ(float degrees);
void ofRotate(float degrees);
void ofLoadIdentityMatrix (void);
void ofLoadMatrix (const ofMatrix4x4 & m); // Andreas: I've included both a ofMatrix4x4* and a float* version here,
void ofLoadMatrix (const float *m); // ideally we would always use ofMatrix4x4, but in a lot of temporary
void ofMultMatrix (const ofMatrix4x4 & m); // ofMatrix4x4 objects when interacting with non-OF code
void ofMultMatrix (const float *m);

// screen coordinate things / default gl values
void ofSetupGraphicDefaults();
Expand Down
31 changes: 31 additions & 0 deletions libs/openFrameworks/graphics/ofRendererCollection.h
Expand Up @@ -197,6 +197,37 @@ class ofRendererCollection: public ofBaseRenderer{
}
}

void loadIdentityMatrix (void){
for(int i=0;i<(int)renderers.size();i++){
renderers[i]->loadIdentityMatrix();
}
}

void loadMatrix (const ofMatrix4x4 & m){
for(int i=0;i<(int)renderers.size();i++){
renderers[i]->loadMatrix( m );
}
}

void loadMatrix (const float * m){
for(int i=0;i<(int)renderers.size();i++){
renderers[i]->loadMatrix( m );
}
}

void multMatrix (const ofMatrix4x4 & m){
for(int i=0;i<(int)renderers.size();i++){
renderers[i]->multMatrix( m );
}
}

void multMatrix (const float * m){
for(int i=0;i<(int)renderers.size();i++){
renderers[i]->multMatrix( m );
}
}


// screen coordinate things / default gl values
void setupGraphicDefaults(){
for(int i=0;i<(int)renderers.size();i++){
Expand Down
8 changes: 7 additions & 1 deletion libs/openFrameworks/types/ofBaseTypes.h
Expand Up @@ -16,6 +16,7 @@
#include "ofColor.h"
#include "ofMesh.h"
#include "ofPixels.h"
#include "ofMatrix4x4.h"

template<typename T>
class ofImage_;
Expand Down Expand Up @@ -318,7 +319,12 @@ class ofBaseRenderer{
virtual void rotateY(float degrees){};
virtual void rotateZ(float degrees){};
virtual void rotate(float degrees){};

virtual void loadIdentityMatrix (void){};
virtual void loadMatrix (const ofMatrix4x4 & m){};
virtual void loadMatrix (const float *m){};
virtual void multMatrix (const ofMatrix4x4 & m){};
virtual void multMatrix (const float *m){};

// screen coordinate things / default gl values
virtual void setupGraphicDefaults(){};
virtual void setupScreen(){};
Expand Down
3 changes: 2 additions & 1 deletion scripts/dev/pull_and_build.sh
@@ -1,7 +1,8 @@
#!/bin/bash
repo_url='https\:\/\/github\.com\/openframeworks\/openFrameworks\/blob\/develop\/'
EMAILMESSAGE="/tmp/emailmessage.txt"
EMAIL="of-dev@dev.openframeworks.cc"
#EMAIL="of-dev@dev.openframeworks.cc"
EMAIL="arturo@openframeworks.cc"
SUBJECT="errors building OF"
FROM="ci@openframeworks.cc"
errors=0
Expand Down

0 comments on commit 710d781

Please sign in to comment.