55 glBindFramebuffer(GL_FRAMEBUFFER,
_fbID);
65 glBindTexture(GL_TEXTURE_2D,
_texID);
66 glTexParameteri(GL_TEXTURE_2D,
67 GL_TEXTURE_MAG_FILTER,
69 glTexParameteri(GL_TEXTURE_2D,
70 GL_TEXTURE_MIN_FILTER,
72 glTexParameteri(GL_TEXTURE_2D,
75 glTexParameteri(GL_TEXTURE_2D,
78 glTexImage2D(GL_TEXTURE_2D,
87 glBindTexture(GL_TEXTURE_2D, 0);
91 glBindRenderbuffer(GL_RENDERBUFFER,
_depthRbID);
92 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID) || defined(SL_EMSCRIPTEN)
93 glRenderbufferStorage(GL_RENDERBUFFER,
98 glRenderbufferStorage(GL_RENDERBUFFER,
103 glBindRenderbuffer(GL_RENDERBUFFER, 0);
106 glGenFramebuffers(1, &
_fbID);
107 glBindFramebuffer(GL_FRAMEBUFFER,
109 glFramebufferTexture2D(GL_FRAMEBUFFER,
110 GL_COLOR_ATTACHMENT0,
114 glFramebufferRenderbuffer(GL_FRAMEBUFFER,
120 if ((glCheckFramebufferStatus(GL_FRAMEBUFFER)) != GL_FRAMEBUFFER_COMPLETE)
123 glBindFramebuffer(GL_FRAMEBUFFER, 0);
145 glBindTexture(GL_TEXTURE_2D,
_texID);
146 glTexImage2D(GL_TEXTURE_2D,
155 glBindTexture(GL_TEXTURE_2D, 0);
158 glBindRenderbuffer(GL_RENDERBUFFER,
_depthRbID);
160 #if defined(SL_OS_MACIOS) || defined(SL_OS_ANDROID) || defined(SL_EMSCRIPTEN)
161 glRenderbufferStorage(GL_RENDERBUFFER,
162 GL_DEPTH_COMPONENT16,
166 glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT32,
_width,
_height);
169 glBindRenderbuffer(GL_RENDERBUFFER, 0);
181 glBindFramebuffer(GL_FRAMEBUFFER, 0);
182 glClear(GL_COLOR_BUFFER_BIT);
183 glDisable(GL_DEPTH_TEST);
193 SLfloat P[] = {-1, -1, 1, -1, -1, 1, 1, 1};
198 glActiveTexture(GL_TEXTURE0);
199 glBindTexture(GL_TEXTURE_2D,
_texID);
203 glEnable(GL_DEPTH_TEST);
static SLint scrHeight
Window height at start up.
static SLint scrWidth
Window width at start up.
#define SL_EXIT_MSG(message)
@ AT_position
Vertex position as a 2, 3 or 4 component vectors.
OpenGL Frame Buffer Object for the Oculus Rift Display.
Singleton class for global render state.
void updateSize(SLint scrWidth, SLint scrHeight)
SLint _halfHeight
Half the width of the buffer.
SLuint _fbID
Half the height of the buffer.
SLint _height
Width of the buffer.
void bindFramebuffer(SLint scrWidth, SLint scrHeight)
void drawFramebuffer(SLGLProgram *stereoOculusProgram)
SLGLVertexArray _vao
OpenGL id of.
SLuint _depthRbID
OpenGL id of frame buffer.
SLint _halfWidth
Height of the buffer.
SLuint _texID
OpenGL id of depth render buffer.
Encapsulation of an OpenGL shader program object.
void setAttrib(SLGLAttributeType type, SLint elementSize, SLint location, void *dataPointer, SLGLBufferType dataType=BT_float)
Adds a vertex attribute with data pointer and an element size.
void drawArrayAs(SLGLPrimitiveType primitiveType, SLint firstVertex=0, SLsizei countVertices=0)
Draws the VAO as an array with a primitive type.
SLuint vaoID() const
Returns either the VAO id or the VBO id.
void generate(SLuint numVertices, SLGLBufferUsage usage=BU_static, SLbool outputInterleaved=true, SLuint divisor=0)
Generates the VA & VB objects for a NO. of vertices.