#ifndef __CIMAGEGL_H__
#define __CIMAGEGL_H__

#include "CImage.h"


class CImageGL : public CImage
{
 public:
  CImageGL();
  CImageGL(int w, int h);

  void  SetDimension(int w, int h);
  void  SetPattern(const std::string& strName);
  void  GenerateStereogram();

 private:
  void  CreateFromZBuffer(bool fullcopy = false);
  void  BuildStereogramFromDepth();
  void  WriteToFrameBuffer(bool depths = false) const;
  float getDepth(int x, int y) const;

  auto_array_ptr<float> m_pDepths;
  CImage                m_pattern;
};

inline float CImageGL::getDepth(int x, int y) const
{
  POP_ASSERT(x+y*width() < width()*height(),
             "Trying to access an out-of-range depth");
  return m_pDepths[x+y*width()];
}

#endif // __CIMAGEGL_H__
