Drawing a single line using floating point position

I’m drawing lots of single vertical lines using floating points as it’s position. when it moves it will flash on and off as it goes in between integer values. so 1.f is ok, 2.f is ok, but 1.5f and it goes dull. I could always just use the integer values but then it goes jerky. I’ve tried making them 2 pixel wide lines but it’s still not right, I feel like I should be able to move a single pixel wide vertical lines without it doing this.

is there some kind of drawing mode i can switch on? I’m drawing this stuff into an fbo if that helps?

Hi,
did you try ofEnableAntiAliasing()/ofDisableAntiAliasing()?
Could you provide a small video or screenshot so that we understand the issue?

Best,
J

i tried enable and disable anti aliasing. it looks like it was already enabled, disabling makes other areas look bad and does nothing for this problem. looks like a flashing aura around the blue lines.

Sorry not sure what is going on there. Just now I recall having similar issues when i was drawing to an FBO and using blending modes to achieve overlay effect. So i had to fight with blending issues.
But you say you are drawing directly to screen. The only thing I can think of is trying to change GL blending modes.
Otherwise try it with an FBO… sorry not much help. Do you have a simple sample code?

I am drawing into an fbo, here is the code

void WaveDisplayCircularBuffer::Draw()
{
    GetLockBlock("Wdcb::Draw");
    
    if(_song == NULL)
    {
        ReleaseLock("Wdcb::Draw");
        return;
    }
    
    if(m_waveFBOLoadState > eWaveLoadNone)
    {
        //printf("wave buffer fbo load \n");
        
        std::vector<WaveDrawBuffer>::iterator it = _orderedBuffers.begin();
        float dist = 0.f;
        
        while( it != _orderedBuffers.end() )
        {
            dist += it->_length/2;
            it++;
        }
        
        if(m_waveFBOLoadState == eLoadFbo1)
        {
            m_wavFbo1.clear();
            m_wavFbo1.allocate(dist, m_height, GL_RGBA);
            m_wavFbo1.begin();
        }
        
        ofSetColor(0,0,255);
        ofClear(255,255,255, 0);
        it = _orderedBuffers.begin();
        dist = 0.f;
        while( it != _orderedBuffers.end() )
        {
            DrawWav(ofPoint(dist, m_height/2),
                    it->_buffer, it->_length, 1, m_height);
            
            dist += it->_length/2;
            it++;
        }
        
        if(m_beatPoints.size() > 0)
        {
            ofSetColor(255, 0, 0);
            std::vector<float>::iterator beatIt/*hee hee*/ = m_beatPoints.begin();
            while(beatIt != m_beatPoints.end())
            {
                ofDrawLine(*beatIt, 0, *beatIt, m_height);
                ofDrawLine(*beatIt + 0.5f, 0, *beatIt + 0.5f, m_height);
                beatIt++;
            }
        }
            
        if(m_waveFBOLoadState == eLoadFbo1)
        {
            if(m_wavFbo1.isAllocated())
            {
                m_wavFbo1.end();
                m_waveFBODrawState = eDrawFbo1;
            }
        }
        
        m_waveFBOLoadState = eWaveLoadNone;

        if(m_pixelStartNext != 0)
        {
            m_pixelStart = m_pixelStartNext;
            m_pixelStartNext = 0;
        }
    }
    
    if(m_waveFBODrawState > eWaveDrawNone)
    {
        ofSetColor(255, 255, 255);
        
        if(m_waveFBODrawState == eDrawFbo1)
        {
            if(m_wavFbo1.isAllocated())
            {
                m_wavFbo1.draw(ofPoint(m_pixelStart, m_waveDrawStart.y - m_height/2));
            }
        }
    }
    ReleaseLock("WaveDisplayCircularBuffer::Draw");
}