如何用纹理填充屏幕?我可以获得屏幕尺寸和密度,还有位图尺寸。但接下来呢?我应该用矩阵变换纹理还是使用特殊的油漆?还要别的吗?谢谢。
I am referring to this excellent example of how to encode the preview frames of the camera directly into an mp4 file: http://bigflake.com/mediacodec/CameraToMpegTest.java.txt
I have adopted the code in the way that I also would like to render the preview image on the screen. Therefore I got something like a GLTextureView with its own EGLContext. This Context is then used as shared EGLContext when I create the EGLContext for the encoder rendering:
mEGLContext = EGL14.eglCreateContext(mEGLDisplay, configs[0], sharedContext == null ? …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 OpenGL ES 2 上下文在 Android 上使用 MediaCodec 录制视频。
为此,我想使用以下方法使用可记录表面:
private static final int EGL_RECORDABLE_ANDROID = 0x3142;
Run Code Online (Sandbox Code Playgroud)
创建一个新的上下文。实际上,我正在我的第一个上下文中在纹理中渲染一个场景。我想在新的上下文中呈现它以将数据发送到 MediaCodec。
我正在尝试使用Recording 补丁执行与本突破教程相同的操作
我在我的游戏中实现了 InputSurface 和 GameRecorder,但我只记录了一个空场景。
我的主要问题是,上下文不共享相同的 OpenGL 对象,我不知道这样做的最佳解决方案。
我如何发送最终图像渲染或整个场景以在同一线程中渲染以避免线程问题,以正确记录表面?
我是纹理识别领域的新手,我想知道在 opencv 中解决纹理问题的可能方法有哪些。
我需要识别图片中某个区域内的纹理,并判断它在整个区域内是否均匀、均匀。
更深入地讲,我需要能够判断可能坠落的人是人(具有许多不同类型的纹理)还是枕头或毯子之类的错误。
任何人都可以提出解决方案吗?是否有一些已经制作的opencv代码来适应?
提前致谢!
对于标准 OpenGL 纹理,过滤状态是纹理的一部分,必须在创建纹理时定义。这导致代码如下:
glGenTextures(1,&_texture_id);
glBindTexture(GL_TEXTURE_2D,_texture_id);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexImage2D(...);
Run Code Online (Sandbox Code Playgroud)
这非常有效。我正在尝试制作多重采样纹理(用于 FBO)。代码非常相似:
glGenTextures(1,&_texture_id);
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE,_texture_id);
glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexImage2DMultisample(...);
Run Code Online (Sandbox Code Playgroud)
我正在使用调试上下文,并且使用此代码,第一次glTexParameterf(...)
调用会导致:
生成 GL_INVALID_ENUM 错误。多重采样纹理目标不支持采样器状态
我不知道这是什么意思。请注意,多重采样纹理仅支持最近过滤。我正在指定这一点。我注意到,对于某些调用(特别是glTexParameterf(...)
),GL_TEXTURE_2D_MULTISAMPLE
不是文档中列出的输入(如果它们实际上无效,而不仅仅是忘记,这确实可以解释无效的枚举错误)。但是,如果不被接受,那么我应该如何设置最近的过滤?
无论我做什么,我的纹理似乎都会被拉伸/缩放到我应用它们的网格的大小。我已经阅读了这个问题的很多答案,似乎没有一个解决方案可以为我解决问题,所以我发布了一个新的解决方案。只是一点信息,
这是我的代码
makeTestObject:function()
{
var scope = this,
tileGeometry = new THREE.BoxGeometry(TILE_SIZE , TILE_HEIGHT , TILE_SIZE),
texture = new THREE.Texture(preloadedImageObject),
textureMaterial = new THREE.MeshLambertMaterial({map:texture}),
tile = new THREE.Mesh(tileGeometry , new THREE.MeshFaceMaterial(
[
textureMaterial, // +x
textureMaterial, // -x
textureMaterial, // +y
textureMaterial, // -y
textureMaterial, // +z
textureMaterial // -z
]));
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
tile.position.y = BASE_HEIGHT * 2;
tile.castShadow = true;
tile.receiveShadow = true;
texture.needsUpdate = true;
scope.scene.add(tile); …
Run Code Online (Sandbox Code Playgroud) 我没有在网上找到任何有效的更新资源并比较桌面版 OpenGL 的纹理压缩格式。一切要么已经过时,要么适合移动设备。
查看我的平台,我看到许多不同的格式:
GL_ARB_compressed_texture_pixel_storage
GL_ARB_texture_compression
GL_ARB_texture_compression_bptc
GL_ARB_texture_compression_rgtc
GL_EXT_texture_compression_dxt1
GL_EXT_texture_compression_latc
GL_EXT_texture_compression_rgtc
GL_EXT_texture_compression_s3tc
GL_NV_texture_compression_vtc
Run Code Online (Sandbox Code Playgroud)
如果我直接查询,我还有其他一些GL_COMPRESSED_TEXTURE_FORMATS
public static final int GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
public static final int GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778;
public static final int GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;
public static final int GL_PALETTE4_RGB8_OES = 0x8B90 = 35728;
public static final int GL_PALETTE4_RGBA8_OES = 0x8B91;
public static final int GL_PALETTE4_R5_G6_B5_OES = 0x8B92;
public static final int GL_PALETTE4_RGBA4_OES = 0x8B93;
public static final int GL_PALETTE4_RGB5_A1_OES = 0x8B94;
public static final int GL_PALETTE8_RGB8_OES = 0x8B95; …
Run Code Online (Sandbox Code Playgroud) 我有一个输出纹理的内核,它是一个有效的 MTLTexture 对象。我想将它保存到我项目工作目录中的一个 png 文件中。这应该怎么做?
纹理格式为 .bgra8Unorm
,目标输出格式为PNG
. 纹理存储在 MTLTexture 对象中。
编辑:我在 macOS XCode 上。
我正在尝试将纹理应用于图像
原来的
质地
结果(用 PHP GD 制作)
但是对于 SVG,我得到的最接近的是这个结果
<svg preserveAspectRatio="none" width="500" height="500" viewBox="0 0 500 500">
<defs>
<filter id="texture">
<feImage href="https://i.imgur.com/pjWcnJs.jpg" result="texture-img"/>
<feBlend in="SourceGraphic" in2="texture-img" mode="multiply"/>
</filter>
</defs>
<g>
<g filter="url(#texture)">
<image x="0" y="0" href="https://i.imgur.com/oVEdsQt.png" opacity="1" width="500" height="500" />
</g>
</g>
</svg>
Run Code Online (Sandbox Code Playgroud)
还有另一种不会对透明像素进行纹理化的方法吗?
我正在尝试通过 OpenGL 将体积数据作为 3D 纹理上传。但是,当通过 指定格式和数据本身时glTexImage3D
,会引发 GL_INVALID_OPERATION 错误。
代码(包括我添加的调试代码以找出错误的来源)如下:
void Texture3D::upload()
{
std::cout << "TEX GL ERROR: " << glGetError() << std::endl;
glGenTextures(1, &_textureId);
std::cout << "TEX GL ERROR: " << glGetError() << std::endl;
glBindTexture(GL_TEXTURE_3D, _textureId);
std::cout << "TEX GL ERROR: " << glGetError() << std::endl;
glTexStorage3D(GL_TEXTURE_3D, 6, GL_R8, _width, _height, _depth);
std::cout << "TEX GL ERROR: " << glGetError() << std::endl;
glTexImage3D(GL_TEXTURE_3D, 0, GL_R8, _width, _height, _depth, 0, GL_RED, GL_UNSIGNED_BYTE, _data);
std::cout << "TEX GL ERROR: " …
Run Code Online (Sandbox Code Playgroud)