render-to-texture

MTKView texture correct color build-up

我与影子孤独终老i 提交于 2020-01-24 01:03:30
问题 I am working on a metal-backed drawing application where brushstrokes are drawn on an MTKView by stamping a textured square repeatedly along a path. I am having color-accumulation issues as illustrated with the picture below: For alpha values [0.5 - 1.0] the results are more or less what I expect. However, for small alpha values, the result looks patchy and never achieves the uniform/correctly saturated value of the original fully opaque brush color (i.e. like the top brushstroke in above

Render camera preview on a Texture with target GL_TEXTURE_2D

梦想的初衷 提交于 2020-01-23 08:04:50
问题 I'm trying to render the camera preview on an OpenGL Texture with target GL_TEXTURE_2D . I'm very well aware of SurfaceTexture but I cannot use it because it only works with GL_TEXTURE_EXTERNAL_OES . In the documentation of SurfaceTexture, it's written : Each time the texture is bound it must be bound to the GL_TEXTURE_EXTERNAL_OES target rather than the GL_TEXTURE_2D target I cannot use GL_TEXTURE_EXTERNAL_OES because, I'll have to make a lot of changes in my existing code. Is there a way to

How to load a texture onto a circle with OpenGL ES

五迷三道 提交于 2020-01-04 02:45:11
问题 I am facing problems on loading a texture onto a circle. My circle is made with a triangle fan. It gives a bad output. Original Image: The Result : My code: public class MyOpenGLCircle { private int points=360; private float vertices[]={0.0f,0.0f,0.0f}; private FloatBuffer vertBuff, textureBuffer; float texData[] = null; float theta = 0; int[] textures = new int[1]; int R=1; float textCoordArray[] = { -R, (float) (R * (Math.sqrt(2) + 1)), -R, -R, (float) (R * (Math.sqrt(2) + 1)), -R }; public

Render OpenGL scene to texture using FBO in fixed function pipeline drawing

懵懂的女人 提交于 2019-12-28 03:14:08
问题 The Problem I work on the open source game torcs (http://torcs.sourceforge.net/). The game's graphic pipeline is still using the fixed function pipeline (FFP) of OpenGL 1.3. I try to render the game scenes to textures in a FBO (Framebuffer Object) in order to do some post-processing on the rendered textures. I use OpenGL 3.3. on my machine. Currently I have set up the FBO with attached textures at GL_COLOR_ATTACHMENT0&1 (2 in order to have two consecutive frames readable in the shader) and an

DirectX 10 Draw Text to texture

亡梦爱人 提交于 2019-12-24 10:27:11
问题 I am atempting to draw text to a textured mesh object. The mesh is basically a cube which has been pasted up to the front of the screen. (overall I'm aiming for a menu system). After a bit of googling I've found surprisingly little information on how to draw a text to a texture. I've read that it should be as simple as making a texture, setting it as a render source and then drawing to it, yet I cannot figure this one out. Any ideas, suggestions or skeleton code with the necessary function

Write to texture GLSL

微笑、不失礼 提交于 2019-12-22 13:57:40
问题 I want to be able to (in fragment shader) add one texture to another. Right now I have projective texturing and want to expand on that. Here is what I have so far : Im also drawing the viewfrustum along which the blue/gray test image is projected onto the geometry that is in constant rotation. My vertex shader: ProjTexCoord = ProjectorMatrix * ModelTransform * raw_pos; My Fragment Shader: vec4 diffuse = texture(texture1, vs_st); vec4 projTexColor = textureProj(texture2, ProjTexCoord); vec4

Render to texture problem with alpha

拟墨画扇 提交于 2019-12-22 08:55:02
问题 When I render to texture, and then draw the same image, it seems to make everything darker. To get this image: http://img24.imageshack.us/img24/8061/87993367.png I'm rendering the upper-left square with color (1, 1, 1, .8) to a texture, then rendering that texture, plus the middle square (same color) to another texture, then finally that texture plus the lower-right square (same color) to the screen. As you can see, each time I render to texture, everything gets a little darker. My render-to

Android OpenGLES Render-to-Texture

陌路散爱 提交于 2019-12-20 14:15:44
问题 I write graphics apps for the iPhone and I'm looking to port my most recent app, 'Layers,' to the Android platform. Layers is painting app that allows users to draw on the screen and create multi-layered paintings with different brushes, colors, etc... and export to PSD. It's got desktop sync, a smudge tool, lots of good stuff... http://www.layersforiphone.com/ I started looking at the Android platform Monday and I've run into a major problem. I use OpenGL to do all the drawing because it

After Writing to a RenderTarget, How to Efficiently Clone the Output?

天大地大妈咪最大 提交于 2019-12-19 15:58:32
问题 XNA noob here, learning every day. I just worked out how to composite multiple textures into one using a RenderTarget2D. However, while I can use the RenderTarget2D as a Texture2D for most purposes, there's a critical difference: these rendered textures are lost when the backbuffer is resized (and no doubt under other circumstances, like the graphics device running low on memory). For the moment, I'm just copying the finished RenderTarget2D into a new non-volatile Texture2D object. My code to

Render TO and WITH texture using QOpenGLTexture and QOpenGLFramebufferObject

二次信任 提交于 2019-12-13 07:20:00
问题 According to the document of QOpenGLTexture in Qt5, one can render WITH texture, and can also render TO texture. Is there any simple example about these two usages? The scenario of such usages could be found at this link. The problematic codes about this are listed below: In the offscreen part: Initialization of offscreen rendering: p_offscreen_context_ = std::make_unique<QOpenGLContext>(); p_offscreen_context_->setFormat(_p_onscreen_context->format()); // _p_onscreen_context is the context