textures

AndEngine Texture from Drawable

╄→гoц情女王★ 提交于 2019-11-29 23:48:57
问题 I'm new to AndEngine. For some reason, I have to create a TextureRegion from a Drawable variable. I don't know if it is possible, but my code is not working... public class DrawableTextureSource implements ITextureSource { private final int mWidth; private final int mHeight; private final Drawable mDrawable; private final Context mContext; public DrawableTextureSource(Context context, Drawable D) { mContext = context; mDrawable = D; mWidth = D.getIntrinsicWidth(); mHeight = D

Updating a texture in OpenGL with glTexImage2D

淺唱寂寞╮ 提交于 2019-11-29 20:41:59
Are glTexImage2D and glTexSubImage2D the only ways to pass a buffer of pixels to a texture? At the moment I use in a setup function glTexImage2D passing null as the buffer, and then on the render loop I call glTexSubImage2D with the new buffer data on each iteration. But knowing that the texture will not change any property such as the dimensions, is there any more efficient way to pass the actual pixel data to the rendering texture? Sergey K. In modern OpenGL there are 4 different methods to update 2D textures: glTexImage2D - the slowest one, recreates internal data structures.

OpenGL and monochrome texture

一世执手 提交于 2019-11-29 18:19:11
问题 Is it possible to pump monochrome (graphical data with 1 bit image depth) texture into OpenGL? I'm currently using this: glTexImage2D( GL_TEXTURE_2D, 0, 1, game->width, game->height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, game->culture[game->phase] ); I'm pumping it with square array of 8 bit unsigned integers in GL_LUMINANCE mode (one 8 bit channel represents brightness of all 3 channels and full alpha), but it is IMO vastly ineffective, because the onlu values in the array are 0x00 and 0xFF.

Cuda Create 3d texture and cudaArray(3d) from device memory

拈花ヽ惹草 提交于 2019-11-29 16:32:26
问题 im trying to create a texture 3d from a part of a device array. To do this, these are my steps: malloc Device Array Write Device Array Create CudaArray (3D) Bind Texture to CudaArray The way im doing it it creates no compiler errors, but when i run cuda-memcheck it's failing when im trying to fetch data from the Texture. Invalid global read of size 8 .. Address 0x10dfaf3a0 is out of bounds Thats why i'm guessing i declared the texture Array wrong. here is how i access the texture: tex3D

How do I get textures to work in OpenGL?

被刻印的时光 ゝ 提交于 2019-11-29 16:05:50
I'm using the tutorials on http://arcsynthesis.org/gltut/ to learn OpenGL, it's required, I have to use it. Mostly I want to apply the textures from Tutorial 15 onto objects in tutorial 7 (world with UBO). For now it seemed like the textures only work when mipmaps are turned on. This comes with a downside: The only mipmap used is the one with an index of zero, and that's the 1 colored 1x1 pixel one. I tried setting the minimum level of a mipmap higher or turning off mipmaps entirely, but even that doesn't fix thing, because then everything turns pitch black. Now I'll list the most important

Off Screen Rendering Metal

只愿长相守 提交于 2019-11-29 15:48:34
问题 func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) { print("current drawable size:\(view.drawableSize)") } func draw(in view: MTKView) { guard let drawable = view.currentDrawable else { return } let textureDescriptor = MTLTextureDescriptor() textureDescriptor.textureType = MTLTextureType.type2D textureDescriptor.width = drawable.texture.width textureDescriptor.height = drawable.texture.height textureDescriptor.pixelFormat = .bgra8Unorm textureDescriptor.storageMode = .shared

Text not rendering correctly - OpenGL using FreeType2

↘锁芯ラ 提交于 2019-11-29 15:28:34
Almost exact duplicate question: OpenGL font rendering using Freetype2 . I am trying to render text in my OpenGL program using FreeType2 (2.5.3), based on this tutorial: http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Text_Rendering_02 , using the same structs as Bentebent did in his question (above). I am having the same problem he was having with rectangles showing up instead of legible characters (even using the correct GL_TEXTURE0 parameter for glActiveTexture() ) For example, rendering green strings "Hello" and "World" below it gives me this: As with Bentebent,

Deleting textures in opengl

空扰寡人 提交于 2019-11-29 15:05:37
Do I have to delete all the textures I created (using glDeleteTextures) before the program exists, or does OpenGL delete the textures by himself? Kaiged Depending on what manages your OpenGL context, you may not need to delete the textures. For an example, see this question . There does seem to be consensus, though, that it is good to clean up after yourself, but be careful when using C++ RAII to do so! If a C++ object that manages an OpenGL object via RAII is created or destroyed without an OpenGL context, undefined behavior will occur. See: The Object Oriented Language Problem The OpenGL API

Scenekit some textures have a red hue

时光毁灭记忆、已成空白 提交于 2019-11-29 14:53:57
问题 I have a scene that has many objects, that all have different textures. For some reason 2 objects have a red hue to them, even though their textures have no red. You can still see the pattern in the texture, it just has different shades on red. (On the simulator the 2 objects have black and white textures and on device shades of red) Does anyone have any idea why this is happening? Other objects are working fine. 回答1: For material properties such as metalness and roughness SceneKit has

Are array textures related to sampler arrays?

会有一股神秘感。 提交于 2019-11-29 14:06:21
OpenGL has array textures , denoted in shaders by specific sampler types: sampler2DArray array_texture; But GLSL also allows samplers to be aggregated into arrays: sampler2D array_of_textures[10]; Are these two features related to each other? How are they different? Let's understand the distinction by analogy. Samplers in GLSL are like pointers in C++; they reference some other object of a given type. So consider the following C++ code: int* pi; std::array<int, 5>* pai; std::array<int*, 5> api; pi is a pointer to a single object of type int (let's ignore the fact that technically it could be a