Improved simple TimeSeriesCanvas
Fixes in RobotControlExample Disable gravity by default in PhysicsServer
This commit is contained in:
@@ -74,116 +74,4 @@ void GraphingTexture::uploadImageData()
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
//shift the image one pixel
|
||||
for(int y=0;y<texHeight;++y)
|
||||
{
|
||||
// const int t=y>>5;
|
||||
for(int x=1;x<texWidth;++x)
|
||||
{
|
||||
GLubyte* org=image+(x+y*texWidth)*4;
|
||||
|
||||
GLubyte* dst=image+(x-1+y*texWidth)*4;
|
||||
|
||||
dst[0] = org[0];
|
||||
dst[1] = org[1];
|
||||
dst[2] = org[2];
|
||||
dst[3] = org[3];
|
||||
}
|
||||
}
|
||||
//render a new row at the right
|
||||
for(int y=0;y<texHeight;++y)
|
||||
{
|
||||
GLubyte* pi=image+(texWidth-1+y*texWidth)*4;
|
||||
pi[0]=255;
|
||||
pi[1]=255;
|
||||
pi[2]=255;
|
||||
pi[3]=255;
|
||||
if (y==texHeight*0.5)
|
||||
{
|
||||
pi[0]=200;
|
||||
pi[1]=200;
|
||||
pi[2]=200;
|
||||
pi[3]=255;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
static float timer = 0.f;
|
||||
static int prevValue=0;
|
||||
timer+= 0.01;
|
||||
float value = 128+100*sinf(timer);
|
||||
MyClamp(value,0.f,float(texHeight-1));
|
||||
GLubyte* org=image+(texWidth-1+(int)value*texWidth)*4;
|
||||
org[0] = 0;
|
||||
org[1] = 0;
|
||||
org[2] = 0;
|
||||
org[3] = 255;
|
||||
|
||||
if (prevValue<value)
|
||||
{
|
||||
|
||||
} else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
static float timer = 1.4f;
|
||||
timer+= 0.04;
|
||||
float value = 128+150*sinf(timer);
|
||||
MyClamp(value,0.f,float(texHeight-1));
|
||||
|
||||
GLubyte* org=image+(texWidth-1+(int)value*texWidth)*4;
|
||||
org[0] = 0;
|
||||
org[1] = 255;
|
||||
org[2] = 0;
|
||||
org[3] = 255;
|
||||
}
|
||||
|
||||
{
|
||||
static float timer = 1.4f;
|
||||
timer+= 0.02;
|
||||
float value =256+400*sinf(timer);
|
||||
MyClamp(value,0.f,float(texHeight-1));
|
||||
static int prevValue = 0;
|
||||
|
||||
GLubyte* org=image+(texWidth-1+(int)value*texWidth)*4;
|
||||
org[0] = 0;
|
||||
org[1] = 0;
|
||||
org[2] = 255;
|
||||
org[3] = 255;
|
||||
|
||||
if (prevValue<value)
|
||||
{
|
||||
for (int i=prevValue;i<value;i++)
|
||||
{
|
||||
GLubyte* org=image+(texHeight-1+(int)i*texWidth)*4;
|
||||
org[0] = 0;
|
||||
org[1] = 0;
|
||||
org[2] = 255;
|
||||
org[3] = 255;
|
||||
}
|
||||
} else
|
||||
{
|
||||
for (int i=value;i<prevValue;i++)
|
||||
{
|
||||
GLubyte* org=image+(texHeight-1+(int)i*texWidth)*4;
|
||||
org[0] = 0;
|
||||
org[1] = 0;
|
||||
org[2] = 255;
|
||||
org[3] = 255;
|
||||
}
|
||||
}
|
||||
prevValue = value;
|
||||
}
|
||||
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texWidth,texHeight,0,GL_RGBA,GL_UNSIGNED_BYTE,image);
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,10 +18,13 @@ struct GraphingTexture
|
||||
|
||||
void setPixel(int x, int y, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
|
||||
{
|
||||
m_imageData[x*4+y*4*m_width+0] = red;
|
||||
m_imageData[x*4+y*4*m_width+1] = green;
|
||||
m_imageData[x*4+y*4*m_width+2] = blue;
|
||||
m_imageData[x*4+y*4*m_width+3] = alpha;
|
||||
if (y>=0 && y<m_height && x>=0 && x<m_width)
|
||||
{
|
||||
m_imageData[x*4+y*4*m_width+0] = red;
|
||||
m_imageData[x*4+y*4*m_width+1] = green;
|
||||
m_imageData[x*4+y*4*m_width+2] = blue;
|
||||
m_imageData[x*4+y*4*m_width+3] = alpha;
|
||||
}
|
||||
}
|
||||
|
||||
void getPixel(int x, int y, unsigned char& red, unsigned char& green, unsigned char& blue, unsigned char& alpha)
|
||||
|
||||
Reference in New Issue
Block a user