Click here to Skip to main content
15,896,111 members
Articles / Multimedia / OpenGL

Zoom An Image With Different Interpolation Types

Rate me:
Please Sign up or sign in to vote.
4.91/5 (57 votes)
21 Sep 2011CPOL13 min read 226.9K   14.6K   109  
Implementation of different interpolations[Bi-Linear and Bi-Cubic] with OpenGL.
#pragma once

#include "GL\GL.h"

class GLSLShader;
class GLVertexBuffer;
class GLTexture;
class GLText;

/*
 This class prepares Zoomed image with the provided parameters.
 This class require different resources( Such as GLSLShader, GLTexture, GLVertexBuffert etc )
 to create a final image.
 This class is prepared to create Multiple views in ZoomInterpolation application.
 */
class GLImageView
{
public:
    GLImageView(void);
    ~GLImageView(void);

    void SetViewport( const int nLeft_i, const int nTop_i,
                      const int nWidth_i, const int nHeight_i );
    void SetVertexBuffer( GLVertexBuffer* pVertexBuffer_i );
    // Input flag indicate shader object need to delete.
    // All In View prepares different shader objects and put it in ImageView list.
    // When ImageView delete, GLSLShader objects deleted from this class.
    void SetShader( GLSLShader* pShader_i , const bool bDeleteShader_i = false );
    void SetText( GLText* pText_i );
    void SetTextureParam( GLTexture* pTexture_i, const int nTextureWidth_i,
                          const int nTextureHeight_i, const GLenum eTextureFilter_i );
    void Draw();

private:

    int m_nViewportLeft;
    int m_nViewportTop;
    int m_nViewportWidth;
    int m_nViewportHeight;
    int m_nTextureWidth;
    int m_nTextureHeight;
    GLTexture* m_pTexture;
    GLSLShader* m_pShader;
    GLVertexBuffer* m_pVertexBuffer;
    GLText*          m_pText;
    GLenum    m_eTextureFilter;
    bool m_bDeleteShader;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions