Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualMcGrane

Posted 11 February 2013 - 08:01 PM

Hi all,

I am currently working on a project using opengl and opencv. 

Heres a snippet of my code (please let me know if more is needed)

 

IplImage* frame = cvQueryFrame( capture );
        
m_currentFrameData = (unsigned char*)frame->imageData;
        
Image->setData( m_currentFrameData );

void cImage::setData( unsigned char* data ) { 
    m_bitmapData = data; 
    this->initialize();
}

void cImage::initialize() {
    glGenTextures( 1, &m_texture );
    glBindTexture( GL_TEXTURE_2D, m_texture );

    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, m_bitmapInfoHeader.biWidth, m_bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, m_bitmapData );
}

 

Correct me if im wrong, but im generating a new texture for every frame.

What i want to do is delete each old texture when a new one is generated. I looked into glDeleteTextures, but this seems to delete an array of textures ?

Is there a way to delete a single texture ? 

Thanks for any help smile.png


#2McGrane

Posted 11 February 2013 - 07:59 PM

Hi all,

I am currently working on a project using opengl and opencv. 

Heres a snippet of my code (please let me know if more is needed)

 

IplImage* frame = cvQueryFrame( capture );
        
m_currentFrameData = (unsigned char*)frame->imageData;
        
Image->setData( m_currentFrameData );

void cImage::setData( unsigned char* data ) { 
    m_bitmapData = data; 
    this->initialize();
}

void cImage::initialize() {
    glGenTextures( 1, &m_texture );
    glBindTexture( GL_TEXTURE_2D, m_texture );

    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, m_bitmapInfoHeader.biWidth, m_bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, m_bitmapData );
}

 

Correct me if im wrong, but im generating a new texture for every frame.

What i want to do is delete each old texture when a new one is generated. I looked into glDelteTextures, but this seems to delete an array of textures ?

Is there a way to delete a single texture ? 

Thanks for any help smile.png


#1McGrane

Posted 11 February 2013 - 07:57 PM

Hi all,

I am currently working on a project using opengl and opencv. 

 

 

IplImage* frame = cvQueryFrame( capture );
        
m_currentFrameData = (unsigned char*)frame->imageData;
        
Image->setData( m_currentFrameData );

void cImage::setData( unsigned char* data ) { 
    m_bitmapData = data; 
    this->initialize();
}

void cImage::initialize() {
    glGenTextures( 1, &m_texture );
    glBindTexture( GL_TEXTURE_2D, m_texture );

    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, m_bitmapInfoHeader.biWidth, m_bitmapInfoHeader.biHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, m_bitmapData );
}

 

Correct me if im wrong, but im generating a new texture for every frame.

What i want to do is delete each old texture when a new one is generated. I looked into glDelteTextures, but this seems to delete an array of tecxtures ?

Is there a way to delete a single texture ? 

Thanks for any help :)

 


PARTNERS