fbo

FBO Blitting is not working

≯℡__Kan透↙ 提交于 2019-12-04 06:38:41
I'm trying to render a multisampled scene to texture, here is the code I'm using. I'm getting a black screen. I check the fbo completeness at the end of init, and they report that both fbo's are complete. void init_rendered_FBO() { glGenFramebuffers(1,&fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); glGenTextures(1,&fbo_tex); glBindTexture(GL_TEXTURE_2D, fbo_tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE

Performance variation of encoder using MediaCodec encode from surface

倾然丶 夕夏残阳落幕 提交于 2019-12-03 19:38:58
I render a texture to both display and a codec input surface (from where an encoder uses it). There is a large performance variation when the texture is rendered to the display surface, and when it is rendered to the input surface of the encoder, but only on some devices, like S3 Galaxy (~10 times slower to render to encoder surface). On other devices, the speed is similar (S4, Nexus4, etc). A similar scenario can be demonstrated with Grafika and Record GL app activity. (FBO blit x2) The fps drops from ~60 to 6 only for the mentioned device, while for the other devices there is a constant rate

Draw the contents of the render buffer Object

主宰稳场 提交于 2019-12-03 19:29:38
Do not quite understand the operation render buffer object. For example if I want to show what is in the render buffer, I must necessarily do the render to texture? GLuint fbo,color_rbo,depth_rbo; glGenFramebuffers(1,&fbo); glBindFramebuffer(GL_FRAMEBUFFER,fbo); glGenRenderbuffersEXT(1, &color_rb); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, color_rb); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, 256, 256); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,GL_RENDERBUFFER_EXT, color_rb); glGenRenderbuffersEXT(1, &depth_rb); glBindRenderbufferEXT(GL

Opengl, DrawArrays without binding VBO

∥☆過路亽.° 提交于 2019-12-03 13:06:25
I am rendering array of points with a custom vertex shader. Shaders looks like: void mainVP() in varying int in_vertex_id : VERTEXID { foo(in_vertex_id); } So the only thing I need - is vertex id. But I need a lot of vertices and I don't want to store fake VBO for them (it takes around 16mb of memory). I tried to run my code without binding any VBO. It works. So my rendering looks like: size_t num_vertices = ... glDrawArrays(GL_POINTS, 0, num_vertices); But can I be sure that rendering without binding VBO is safe? But can I be sure that rendering without binding VBO is safe? You can't. The

How to use Multisampling with OpenGL FBOs

﹥>﹥吖頭↗ 提交于 2019-12-03 05:06:17
问题 I'm trying to enable mutlisampling and alpha-to-coverage for an FBO. Using the default framebuffer, all I have to do is call glEnable(GL_MULTISAMPLE) and glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE) . However, I am unable to achieve the same effect using my own FBO. My goal: Draw the scene to an FBO the same way it would be drawn to the default framebuffer with the above properties. From there I want to be able to use the image as a texture for future passes through a shader. This works : Code for

How to use Multisampling with OpenGL FBOs

核能气质少年 提交于 2019-12-02 17:32:35
I'm trying to enable mutlisampling and alpha-to-coverage for an FBO. Using the default framebuffer, all I have to do is call glEnable(GL_MULTISAMPLE) and glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE) . However, I am unable to achieve the same effect using my own FBO. My goal: Draw the scene to an FBO the same way it would be drawn to the default framebuffer with the above properties. From there I want to be able to use the image as a texture for future passes through a shader. This works : Code for making an FBO without multisampling/alpha-to-coverage, 1 color attachment, 1 depth attachment: //

OpenGL: Using only one framebuffer and switching target textures

痴心易碎 提交于 2019-12-02 07:07:48
问题 Instead of using multiple framebuffer objects, can I also create only one and achieve the same results by switching it's target texture when needed? Is this a bad idea in all cases? If yes, why? I've been implementing a function render.SetTargetTexture() in my program's API, and logically it wouldn't work if there were more framebuffers used behind the scenes. I'd have to fully expose framebuffers then. 回答1: A FBO itself is just some logical construct, maintained by the implementation and it

OpenGL: Using only one framebuffer and switching target textures

試著忘記壹切 提交于 2019-12-02 03:06:22
Instead of using multiple framebuffer objects, can I also create only one and achieve the same results by switching it's target texture when needed? Is this a bad idea in all cases? If yes, why? I've been implementing a function render.SetTargetTexture() in my program's API, and logically it wouldn't work if there were more framebuffers used behind the scenes. I'd have to fully expose framebuffers then. A FBO itself is just some logical construct, maintained by the implementation and it will consume only the little memory that its parameters require. The main purpose of a FBO is to have an

glReadPixels from FBO fails with multisampling

廉价感情. 提交于 2019-11-30 04:27:48
问题 I have an FBO object with a color and depth attachment which I render to and then read from using glReadPixels() and I'm trying to add to it multisampling support. Instead of glRenderbufferStorage() I'm calling glRenderbufferStorageMultisampleEXT() for both the color attachment and the depth attachment. The frame buffer object seem to have been created successfully and is reported as complete. After rendering I'm trying to read from it with glReadPixels() . When the number of samples is 0 i.e

Reading the pixels values from the Frame Buffer Object (FBO) using Pixel Buffer Object (PBO)

爷,独闯天下 提交于 2019-11-28 23:34:43
Can I use Pixel Buffer Object (PBO) to directly read the pixels values (i.e. using glReadPixels) from the FBO (i.e. while FBO is still attached)? If yes, What are the advantages and disadvantages of using PBO with FBO? What is the problem with following code { //DATA_SIZE = WIDTH * HEIGHT * 3 (BECAUSE I AM USING 3 CHANNELS ONLY) // FBO and PBO status is good . . glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId); //Draw the objects Following glReadPixels works fine glReadPixels(0, 0, screenWidth, screenHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, (uchar*)cvimg->imageData); Following glReadPixels DOES