opengl-es

How to enable Anti-aliasing in Moderngl EGL backend?

◇◆丶佛笑我妖孽 提交于 2020-05-30 19:19:11
问题 This code renders a colored triangle when there is no anti-aliasing ( samples=0 ). But when I turn on anti-aliasing ( samples=1...32 ) it can't render anything. How to make it work with anti-aliasing? Perhaps I cannot read pixels from multisample fbos or textures directly but I don't know how to fix that. import numpy as np from PIL import Image import moderngl ctx = moderngl.create_standalone_context(backend='egl') fbo = ctx.framebuffer( color_attachments=ctx.texture((512, 512), 4, samples=2

OpenGL ES - Dashed Lines

不羁的心 提交于 2020-05-29 03:15:47
问题 im Using OpenGlEs10 for My Android Game Development, I Want to Draw Dashed-lines Now Im Using This Code to Draw My Line: gl.glColor4f(1.0f, 0.0f, 0.0f, 1.0f); // gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); gl.glLineWidth(4.0f); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices); gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, mDesPoly.getNumPoints()); How Should I Change It? Does I have to Texture The line? And if so, How? 回答1: You don't have to use a texture, you can simply

OpenGL ES - Dashed Lines

烂漫一生 提交于 2020-05-29 03:14:15
问题 im Using OpenGlEs10 for My Android Game Development, I Want to Draw Dashed-lines Now Im Using This Code to Draw My Line: gl.glColor4f(1.0f, 0.0f, 0.0f, 1.0f); // gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); gl.glLineWidth(4.0f); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices); gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, mDesPoly.getNumPoints()); How Should I Change It? Does I have to Texture The line? And if so, How? 回答1: You don't have to use a texture, you can simply

OpenGL ES - Dashed Lines

爱⌒轻易说出口 提交于 2020-05-29 03:13:20
问题 im Using OpenGlEs10 for My Android Game Development, I Want to Draw Dashed-lines Now Im Using This Code to Draw My Line: gl.glColor4f(1.0f, 0.0f, 0.0f, 1.0f); // gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); gl.glLineWidth(4.0f); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mBufDestVertices); gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, mDesPoly.getNumPoints()); How Should I Change It? Does I have to Texture The line? And if so, How? 回答1: You don't have to use a texture, you can simply

OpenGL ES how to apply transformations from android.graphics.Matrix

吃可爱长大的小学妹 提交于 2020-05-28 04:53:47
问题 I have a 3x3 android.graphics.Matrix , and i want to apply all transformation to a 4x4 OpenGL Matrix for 2D transformations only. So far I have manage to apply rotation and scaling I am using the example from the android team HERE to render a triangle. I used this class for generating the android.graphics.Matrix, from finger gestures made by the user for scale , move and translate transformations. After that I attach the MatrixGestureDetector on the onTouchEvent from the View. In the

Encode floating point data in a RGBA texture

情到浓时终转凉″ 提交于 2020-05-28 00:59:40
问题 I wrote some WebGL code that is based on floating point textures. But while testing it on a few more devices I found that support for the OES_texture_float extension isn't as widespread as I had thought. So I'm looking for a fallback. I have currently a luminance floating point texture with values between -1.0 and 1.0. I'd like to encode this data in a texture format that is available in WebGL without any extensions, so probably a simple RGBA unsigned byte texture. I'm a bit worried about the

Encode floating point data in a RGBA texture

左心房为你撑大大i 提交于 2020-05-28 00:58:17
问题 I wrote some WebGL code that is based on floating point textures. But while testing it on a few more devices I found that support for the OES_texture_float extension isn't as widespread as I had thought. So I'm looking for a fallback. I have currently a luminance floating point texture with values between -1.0 and 1.0. I'd like to encode this data in a texture format that is available in WebGL without any extensions, so probably a simple RGBA unsigned byte texture. I'm a bit worried about the

Encode floating point data in a RGBA texture

限于喜欢 提交于 2020-05-28 00:56:51
问题 I wrote some WebGL code that is based on floating point textures. But while testing it on a few more devices I found that support for the OES_texture_float extension isn't as widespread as I had thought. So I'm looking for a fallback. I have currently a luminance floating point texture with values between -1.0 and 1.0. I'd like to encode this data in a texture format that is available in WebGL without any extensions, so probably a simple RGBA unsigned byte texture. I'm a bit worried about the

Font rendering onto off-screen FBO not working. (Note: fonts are loaded by creating textures using Freetype lib with glTexImage2D)

人走茶凉 提交于 2020-05-16 06:31:51
问题 I have the following code to render a rectangle and few texts onto an offscreen FBO. And then I try to bind the texture (attached to FBO) in default/ display framebuffer. I am able to render the rectangle but the fonts are not getting rendered. I tried debugging, but so far could not. I have to do this in OpenGL ES 2.0 only. My rectangle is of orange color. The texts/fonts are of red color. I use Freetype lib and glTexImage2D call to create individual textures for each font. When I render

How to add a depth buffer in Moderngl EGL backend?

时光怂恿深爱的人放手 提交于 2020-05-15 08:08:57
问题 This code renders a colored triangle with anti-aliasing ( samples=8 ) when a depth buffer line depth_attachment=ctx.depth_texture((512, 512), samples=8) is commented. But when I add a depth buffer it returns a GL error at the binding fbo_msaa framebuffer to GL_READ_FRAMEBUFFER . Do you know how to fix this error? import numpy as np from PIL import Image import moderngl import OpenGL.GL as gl ctx = moderngl.create_standalone_context(backend='egl') fbo = ctx.framebuffer( color_attachments=ctx