textures

Error m_InstanceID != 0 when downloading texture from the server

时光怂恿深爱的人放手 提交于 2019-12-24 10:38:15
问题 I'm getting this error in Unity 5.4 when trying to download the texture from the server. Here is the code (the link should work): UnityWebRequest www = UnityWebRequest.GetTexture("https://0.gravatar.com/avatar/fc2beef90fad49f83d79650a10b5c030?s=256&d=identicon&r=G"); www.SetRequestHeader("Accept", "image/*"); async = www.Send(); while (!async.isDone) yield return null; if (www.isError) { Debug.Log(www.error); } else { tex = DownloadHandlerTexture.GetContent(www); // <------------------- } The

How to render a texture with alpha?

百般思念 提交于 2019-12-24 10:37:16
问题 How to render a texture with alpha? I have a texture, and need to render it with different alpha values at different locations. Any way to do so? (My texture is GL_RGBA) If not possible to change alpha value on the fly, I have to create different textures for different alpha levels? 回答1: Your texture is GL_RGBA so it has a different alpha value for each texel. If you want to change the alpha value used for render, I can think of the following methods: Change the texture alpha values (not sure

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

Can libgdx Particle Effects use texture regions?

回眸只為那壹抹淺笑 提交于 2019-12-24 08:39:09
问题 I have all of my images for a libgdx project in a single texture. I'm about to add some nice particle effects, but the documentation implies that each type of emitter requires a separate graphics file for its particle. Is that true? Or, is there a way of specifying a region of a texture to be used as the particle image, so that I may still keep all my images in that single file? 回答1: Yes it can but you need to have the texture inside of an TextureAtlas . Take a look at this article for it.

Opaque OpenGL textures have transparent border

泪湿孤枕 提交于 2019-12-24 07:28:21
问题 My problem concerns rendering text with OpenGL -- the text is rendered into a texture, and then drawn onto a quad. The trouble is that the pixels on the edge of the texture are drawn partially transparent. The interior of the texture is fine. I'm calculating the texture coordinates to hit the center of my texels, using NEAREST (non-)interpolation, setting the texture wrapping to CLAMP_TO_EDGE, and setting the projection matrix to place my vertices at the center of the viewport pixels. Still

Bad (unattractive) blending in OpenGL with bright figures on dark background

我怕爱的太早我们不能终老 提交于 2019-12-24 07:14:46
问题 I have a problems in OpenGL with blending (in result of antialiasing or textured painting). See problem illustration: I have the following setup code // Antialiasing glEnable(GL_POINT_SMOOTH); glEnable(GL_LINE_SMOOTH); // Blending glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); // Texture font glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE

Bad (unattractive) blending in OpenGL with bright figures on dark background

柔情痞子 提交于 2019-12-24 07:14:15
问题 I have a problems in OpenGL with blending (in result of antialiasing or textured painting). See problem illustration: I have the following setup code // Antialiasing glEnable(GL_POINT_SMOOTH); glEnable(GL_LINE_SMOOTH); // Blending glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); // Texture font glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE

Texture/background Image for polygon

我只是一个虾纸丫 提交于 2019-12-24 03:19:41
问题 I'm writing a tiled game board with hexagonal shape tiles using java swing. I'm able to draw polygon with help of this SOF thread. Now I want to add background image to these hexagons and I have totally no idea how to do this. Here is a tutorial that draws background on "Rectangle" but how can I do the same on Hexagon ? 回答1: Create the hexagon using a Shape. Probably a Polygon for this. Set the Shape as a clip for the Graphics2D object. Paint the image. Move the Shape to the next location

OpenGL Bindless Textures: Bind to uniform sampler2D array

血红的双手。 提交于 2019-12-24 03:02:15
问题 I am looking into using bindless textures to rapidly display a series of images. My reference is the OpenGL 4.5 redbook. The book says I can sample bindless textures in a shader with this fragment shader: #version 450 core #extension GL_ARB_bindless_texture : require in FS_INPUTS { vec2 i_texcoord; flat int i_texindex; }; layout (binding = 0) uniform ALL_TEXTURES { sampler2D fs_textures[200]; }; out vec4 color; void main(void) { color = texture(fs_textures[i_texindex], i_texcoord); }; I

openGL render to texture in iPhone fails when MSAA is enabled

浪子不回头ぞ 提交于 2019-12-24 01:44:30
问题 My render to texture iPhone code only works if I disable MSAA, otherwise all I get is a black texture. What could be the cause of the problem? Here is my code: glViewport(0,0, target->_Width, target->_Height); glClear(GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT Or GL_STENCIL_BUFFER_BIT); glBindTexture(GL_TEXTURE_2D, target->_Handle); // render stuff here glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, target->_Width, target->_Height, 0); glBindTexture(GL_TEXTURE_2D, 0); 回答1: Apparently, when