Questions tagged [texture2d]

Texture2D is a class in used to handle textures. The class allows to edit existing texture assets or to create new textures on the fly.

Texture2D documentation

661 questions
4
votes
2 answers

Unity c#, take screenshot and save to file as jpg

I am trying to Take a screencapture and save it to a file in jpg format. I am following this example. http://docs.unity3d.com/ScriptReference/Texture2D.EncodeToPNG.html This is what I have so far: string jpgFile = Application.persistentDataPath…
running-codebase
  • 998
  • 2
  • 12
  • 17
4
votes
1 answer

How to use OpenGL Array Texture?

I am trying to use sprite sheet in OpenGL, implementing it through Array Texture This is how I load my texture: QImage image; image.load("C:\\QtProjects\\project\\images\\spritesheet.png", "png"); const unsigned char* data = image.bits(); int twidth…
Oleg Arkhipov
  • 278
  • 2
  • 7
  • 17
4
votes
3 answers

Reading GL_UNSIGNED_BYTE OpenGL texture2D in OpenCL kernel (android)

My android app passes in an OpenGL texture2D to my OpenCL kernel, however the pixels values being read by my kernel are out of bounds (>255). I create my OpenGL texture like this: GLES20.glGenTextures ( 2, targetTex, 0 ); …
amirhbp
  • 185
  • 1
  • 1
  • 7
4
votes
1 answer

Textures not drawing if multiple EAGLViews are used

I'm having a bit of a problem with Apples EAGLView and Texture2D. If I create an instance of EAGLView and draw some textures, it works great. However, whenever I create a second instance of EAGLView, the textures in the new view(s) aren't…
4
votes
1 answer

(Unity C#) Texture2D scaling mystery

Alright, I've seen there's a number of threads about scaling a Texture2D both on here and the Unity forums. That line of searching brought me to now being able to scale Texture2Ds by using this class:…
gord0
  • 111
  • 5
4
votes
3 answers

c++ Directx11 capture screen and save to file

i've got problem with saving texture2d to file, it always gives me black image. Here is code: HRESULT hr = SwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), reinterpret_cast< void** >( &g_pSurface ) ); if( g_pSurface ) { ID3D11Texture2D*…
Zapalka
  • 75
  • 1
  • 1
  • 5
4
votes
2 answers

XNA Procedural Textures

I'm trying to make procedural textures in my XNA 4.0 game, mainly for buttons but for other textures as well. Here's an image describing what I want: Hope you understand what I want to do, if you don't, heres some words: I want to make objects in…
user2421021
4
votes
1 answer

OpenGL texture doesn't show correctly - strange behaviour

I want to detect a marker with OpenCV, and then I want to overlay it with an image, with OpenGL. First part is ok (I achieve detection marker perfectly), but I have some problems with the second. marker is: and image is: but the result is…
Cristina1986
  • 505
  • 1
  • 8
  • 21
3
votes
1 answer

Rendering bitmap with XNA slow when grabbing image from webcam, why?

I've been working for a few weeks on grabbing a webcam image and rendering it on a windows form, but have been struggeling with speed issues the entire time. I need at least a frame rate of 10 Hz to be able to update my background process. I started…
bialad
  • 75
  • 7
3
votes
1 answer

Creating a texture from a RGBA value with SlimDX

this is my first post to stack overflow! I'm using SlimDX for a game that my team is making and I've run into an issue. I'm trying to create a ShaderResourceView from RGBA values in a Color4 object. I've searched looked for answers to my issue and…
TrupaJay
  • 71
  • 2
  • 5
3
votes
1 answer

How to check if a Texture2D is transparent?

I want to check if the selected rectangle is transparent: spriteBatch.Draw(texture, new Vector2(0, 0), new Rectangle(0, 0, 16, 16), Color.White); Is it possible?
Yoone
  • 547
  • 3
  • 8
  • 22
3
votes
1 answer

Texture2D iPhone SDK openGL

I'm using the Texture2D class in an iPhone game using OpenGL ES. Are their any good tutorials for understanding the Texture2D class? Specifically I'm looking at the initWithString method for printing text. As the way it is implemented, you get white…
K2Digital
  • 603
  • 3
  • 10
  • 20
3
votes
1 answer

Texture2D Array as Render Target in HLSL Pixel Shader

Currently I need a couple of textures' worth of per-pixel data from my rendering pass (normals, depth and colour). Instead of running three passes with shaders that are essentially the same (WorldViewPos multiplication, etc.) but each outputting a…
Nick Udell
  • 2,420
  • 5
  • 44
  • 83
3
votes
2 answers

Unity Convert Texture to Texture2d takes a lot of time in android device

I have a function that converting a RGB565 Texture2d to a RGB24Texture2d. I use Texture2d.ReadPixs() api and it was successfully achieved but when it's running on android It will take 50 milliseconds on Texture2d.ReadPixs() and the readed size is…
3
votes
2 answers

How are you supposed to update a texture per frame in Vulkan?

I'm trying to work with 2D in vulkan along with 3D. So right now testing out updating a texture for every frame as whatever 2D is going on. I've gotten something of a texture updater working, the problem is that it's very slow and probably not the…
dhz
  • 101
  • 1
  • 6