@@ -328,7 +328,7 @@ void ofGLProgrammableRenderer::draw(const ofPolyline & poly) const{
328328
329329// ----------------------------------------------------------
330330void ofGLProgrammableRenderer::draw (const ofPath & shape) const {
331- ofColor prevColor;
331+ ofFloatColor prevColor;
332332 if (shape.getUseShapeColor ()){
333333 prevColor = currentStyle.color ;
334334 }
@@ -848,33 +848,33 @@ glm::mat4 ofGLProgrammableRenderer::getCurrentOrientationMatrix() const {
848848 return matrixStack.getOrientationMatrix ();
849849}
850850// ----------------------------------------------------------
851- void ofGLProgrammableRenderer::setColor (const ofColor & color){
851+ void ofGLProgrammableRenderer::setColor (const ofFloatColor & color){
852852 setColor (color.r ,color.g ,color.b ,color.a );
853853}
854854
855855// ----------------------------------------------------------
856- void ofGLProgrammableRenderer::setColor (const ofColor & color, int _a){
856+ void ofGLProgrammableRenderer::setColor (const ofFloatColor & color, float _a){
857857 setColor (color.r ,color.g ,color.b ,_a);
858858}
859859
860860// ----------------------------------------------------------
861- void ofGLProgrammableRenderer::setColor (int _r, int _g, int _b){
862- setColor (_r, _g, _b, 255 );
861+ void ofGLProgrammableRenderer::setColor (float _r, float _g, float _b){
862+ setColor (_r, _g, _b, 1 . f );
863863}
864864
865865// ----------------------------------------------------------
866- void ofGLProgrammableRenderer::setColor (int _r, int _g, int _b, int _a){
867- ofColor newColor (_r,_g,_b,_a);
866+ void ofGLProgrammableRenderer::setColor (float _r, float _g, float _b, float _a){
867+ ofFloatColor newColor (_r,_g,_b,_a);
868868 if (newColor!=currentStyle.color ){
869869 currentStyle.color = newColor;
870870 if (currentShader){
871- currentShader->setUniform4f (COLOR_UNIFORM,_r/ 255 . ,_g/ 255 . ,_b/ 255 . ,_a/ 255 . );
871+ currentShader->setUniform4f (COLOR_UNIFORM,_r,_g,_b,_a);
872872 }
873873 }
874874}
875875
876876// ----------------------------------------------------------
877- void ofGLProgrammableRenderer::setColor (int gray){
877+ void ofGLProgrammableRenderer::setColor (float gray){
878878 setColor (gray, gray, gray);
879879}
880880
@@ -883,7 +883,7 @@ void ofGLProgrammableRenderer::setHexColor(int hexColor){
883883 int r = (hexColor >> 16 ) & 0xff ;
884884 int g = (hexColor >> 8 ) & 0xff ;
885885 int b = (hexColor >> 0 ) & 0xff ;
886- setColor (r,g,b );
886+ setColor (( float )r/ 255 . f ,( float )g/ 255 . f ,( float )b/ 255 . f );
887887}
888888
889889// ----------------------------------------------------------
@@ -898,7 +898,7 @@ void ofGLProgrammableRenderer::clear(){
898898
899899// ----------------------------------------------------------
900900void ofGLProgrammableRenderer::clear (float r, float g, float b, float a) {
901- glClearColor (r / 255 . , g / 255 . , b / 255 . , a / 255 . );
901+ glClearColor (r, g, b, a);
902902 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
903903}
904904
@@ -926,35 +926,39 @@ bool ofGLProgrammableRenderer::getBackgroundAuto(){
926926}
927927
928928// ----------------------------------------------------------
929- ofColor ofGLProgrammableRenderer::getBackgroundColor (){
929+ ofFloatColor ofGLProgrammableRenderer::getBackgroundColor (){
930930 return currentStyle.bgColor ;
931931}
932932
933933// ----------------------------------------------------------
934- void ofGLProgrammableRenderer::setBackgroundColor (const ofColor & c){
934+ void ofGLProgrammableRenderer::setBackgroundColor (const ofFloatColor & c){
935935 currentStyle.bgColor = c;
936- glClearColor (currentStyle.bgColor [0 ]/ 255 . , currentStyle.bgColor [1 ]/ 255 . , currentStyle.bgColor [2 ]/ 255 . , currentStyle.bgColor [3 ]/ 255 . );
936+ glClearColor (currentStyle.bgColor [0 ], currentStyle.bgColor [1 ], currentStyle.bgColor [2 ], currentStyle.bgColor [3 ]);
937937}
938938
939939// ----------------------------------------------------------
940- void ofGLProgrammableRenderer::background (const ofColor & c){
940+ void ofGLProgrammableRenderer::background (const ofFloatColor & c){
941941 setBackgroundColor (c);
942942 glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
943943}
944944
945945// ----------------------------------------------------------
946946void ofGLProgrammableRenderer::background (float brightness) {
947- background (ofColor (brightness));
947+ background (ofFloatColor (brightness));
948948}
949949
950950// ----------------------------------------------------------
951- void ofGLProgrammableRenderer::background (int hexColor, float _a){
952- background ( (hexColor >> 16 ) & 0xff , (hexColor >> 8 ) & 0xff , (hexColor >> 0 ) & 0xff , _a);
951+ void ofGLProgrammableRenderer::background (int hexColor, int _a){
952+ int r = (hexColor >> 16 ) & 0xff ;
953+ int g = (hexColor >> 8 ) & 0xff ;
954+ int b = (hexColor >> 0 ) & 0xff ;
955+ background ( (float )r/255 .f , (float )g/255 .f , (float )b/255 .f , _a/255 .f );
956+ // background ( (hexColor >> 16) & 0xff, (hexColor >> 8) & 0xff, (hexColor >> 0) & 0xff, _a);
953957}
954958
955959// ----------------------------------------------------------
956- void ofGLProgrammableRenderer::background (int r, int g, int b, int a){
957- background (ofColor (r,g,b,a));
960+ void ofGLProgrammableRenderer::background (float r, float g, float b, float a){
961+ background (ofFloatColor (r,g,b,a));
958962}
959963
960964// ----------------------------------------------------------
@@ -1562,7 +1566,7 @@ void ofGLProgrammableRenderer::uploadMatrices(){
15621566// ----------------------------------------------------------
15631567void ofGLProgrammableRenderer::setDefaultUniforms (){
15641568 if (!currentShader) return ;
1565- currentShader->setUniform4f (COLOR_UNIFORM, currentStyle.color .r / 255 . ,currentStyle.color .g / 255 . ,currentStyle.color .b / 255 . ,currentStyle.color .a / 255 . );
1569+ currentShader->setUniform4f (COLOR_UNIFORM, currentStyle.color .r ,currentStyle.color .g ,currentStyle.color .b ,currentStyle.color .a );
15661570 bool usingTexture = texCoordsEnabled & (currentTextureTarget!=OF_NO_TEXTURE);
15671571 currentShader->setUniform1f (USE_TEXTURE_UNIFORM,usingTexture);
15681572 currentShader->setUniform1f (USE_COLORS_UNIFORM,colorsEnabled);
0 commit comments