eglutils.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2011 Nokia Corporation.
  3. */
  4. #ifndef __EGLUTILS_H__
  5. #define __EGLUTILS_H__
  6. #include <EGL/egl.h>
  7. class EglUtils {
  8. public:
  9. EglUtils();
  10. virtual ~EglUtils();
  11. /**
  12. * displayId = -1 = default
  13. */
  14. virtual bool createWindow( int displayId, int handle );
  15. virtual bool swapBuffers();
  16. // sets the context and surfaces as current
  17. virtual bool setCurrent();
  18. // clears the current context
  19. virtual bool clearContext();
  20. /** Clear framebuffer with given color
  21. */
  22. virtual void clear( float r=0, float g=0, float b =0) = 0;
  23. /** Allocate and load texture from given file
  24. * @return rendering handle
  25. */
  26. virtual int loadTexture(const char *filename)=0;
  27. /** Release allocated texture resource handle
  28. */
  29. virtual void releaseTexture(int textureHandle)=0;
  30. protected:
  31. bool fatalError();
  32. bool testEGLError(const char* pszLocation);
  33. EGLNativeWindowType storedWindowHandle;
  34. // EGL variables
  35. EGLDisplay eglDisplay;
  36. EGLConfig eglConfig;
  37. EGLSurface eglSurface;
  38. EGLContext eglContext;
  39. };
  40. #endif