| 777 | virtual ~CFrameBufferObject() { freeResources(); } |
| 778 | |
| 779 | GLuint createTexture(GLenum target, int w, int h, GLint internalformat, |
| 780 | GLenum format) { |
| 781 | GLuint texid; |
| 782 | glGenTextures(1, &texid); |
| 783 | |
| 784 | glBindTexture(target, texid); |
| 785 | |
| 786 | if (format != GL_DEPTH_COMPONENT) { |
| 787 | glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 788 | glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 789 | } else { |
| 790 | glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 791 | glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 792 | } |
| 793 | |
| 794 | glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 795 | glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 796 | |
| 797 | if (internalformat == GL_DEPTH_COMPONENT24) { |
| 798 | glTexImage2D(target, 0, internalformat, w, h, 0, format, GL_UNSIGNED_INT, |
| 799 | 0); |
| 800 | } else { |
| 801 | glTexImage2D(target, 0, internalformat, w, h, 0, format, GL_UNSIGNED_BYTE, |
| 802 | 0); |
| 803 | } |
| 804 | |
| 805 | check_gl_error(__FILE__, __LINE__); |
| 806 | glBindTexture(target, 0); |
| 807 | |
| 808 | return texid; |
| 809 | } |
| 810 | |
| 811 | void attachTexture(GLenum texTarget, GLuint texId, |
| 812 | GLenum attachment = GL_COLOR_ATTACHMENT0, int mipLevel = 0, |
nothing calls this directly
no outgoing calls
no test coverage detected