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
7
votes
2 answers

Resize and Load a texture2d in XNA

i'm a newbie in XNA just in case. What i try to do is load a texture in a different size from his original, or at least have the possibility to change his size after. I see in some places that i can use: Texture2D.FromStream(GraphicsDevice…
mjsr
  • 7,410
  • 18
  • 57
  • 83
7
votes
1 answer

Can I create a tile engine in a pixel shader?

I am attempting to create a tile engine using a pixel shader and two textures. One texture will hold the tileset and one the map. Is it possible to read the texture data as actual (unsampled) data so I can pull indexes from the map? What is the…
Jason
  • 193
  • 7
6
votes
3 answers

How to switch the image of a CCSprite

I have a CCSprite that is initialized using [CCSprite spriteWithSpriteFrameName:@"plist_file_key_here.png"]. I have already added all the sprites from my plist file to CCSpriteFrameCache. I have tried setting the texture like this: CCSpriteFrame *…
Ben Trapani
  • 271
  • 1
  • 4
  • 11
6
votes
2 answers

Repeated textures with WebGL

I need to repeat a texture within a single element. Is it even possible in WebGL? I tried either of the following but had no luck. ctx.texParameteri(ctx.TEXTURE_2D, ctx.TEXTURE_WRAP_S, ctx.CLAMP_TO_EDGE); ctx.texParameteri(ctx.TEXTURE_2D,…
J. K.
  • 8,268
  • 1
  • 36
  • 35
6
votes
1 answer

DirectX: The best way to get RGB data from ID3D11Texture2D with DXGI_FORMAT_NV12 format?

I'm using DirectX to draw videos. After decoding by Intel Media SDK. And then I draw it by the following Intel's Code: mfxStatus CD3D11Device::RenderFrame(mfxFrameSurface1 * pSrf, mfxFrameAllocator * pAlloc) { HRESULT hres = S_OK; mfxStatus…
TTGroup
  • 3,575
  • 10
  • 47
  • 79
6
votes
1 answer

GL_TEXTURE_2D vs GL_TEXTURE_RECTANGLE

I have a little program that render a yellow triangle twice, once on the left half of a framebuffer and once on the right side. Dump of the texture Now, after that I render the content of this framebuffer on the screen. It works if I use…
elect
  • 6,765
  • 10
  • 53
  • 119
6
votes
1 answer

OpenGL 3.3 multitexture: GL_TEXTURE1 and following are always black (Only GL_TEXTURE0 works fine)

Every texture after GL_TEXTURE0 (texture on slot 0) is black. Fragment shader (sample code to check different textures by changing weights): #version 330 uniform sampler2D g_ColorTex; uniform sampler2D g_DepthTex; uniform sampler2D…
Tobias
  • 427
  • 4
  • 19
6
votes
1 answer

OpenGL ES 2.0: Is there a workaround for missing texture access in vertex shader?

I'm currently trying out some OpenGL ES 2.0 with Android for a game. My map is a 2d grid map with a heights value for every position. Now I wanted to store the heights of each coordinate in a texture to do the height lookup in the vertex shader.…
andy
  • 1,852
  • 2
  • 20
  • 31
6
votes
1 answer

Strange color shift after loading a GL_RGB texture

Here's a primitive 5x2 texture, defined in RGB and RGBA formats. // 1 2 3 4 5 unsigned char rgb[] = { 0, 0, 0, 0, 0, 0, 200, 200, 200, 0, 0, 0,…
Kay Sarraute
  • 1,232
  • 8
  • 16
6
votes
1 answer

XNA: Scaling down Texture 2D antialias?

I'm working on a project in XNA, and I'm using some rather large textures, which I'm loading into the game as Texture2D objects, and drawing on the screen much smaller than they are loaded in. The reason for this is that I need to draw them at…
Hoeloe
  • 650
  • 4
  • 21
5
votes
2 answers

Wrong OpenGL Texture Format Type for CL/GL-Interop?

I'm trying the OpenCL-OpenGL interop for textures on my Geforce 330M with CUDA Toolkit 4.0. I want to capture a frame, use that data as an input image (Image2D) to a OpenCL Kernel. The Kernel should manipulate the data and write it to an Image2DGL,…
rdoubleui
  • 3,554
  • 4
  • 30
  • 51
5
votes
1 answer

Mapping dynamic texture causing "Already Mapped Error"

I just starting using Direct3D11 and I am trying to create a dynamic texture that I plan to update with new data several times a second. My issue is that every time I update the texture with the new data, I get this error from the D3D…
Eugene
  • 91
  • 1
  • 6
5
votes
1 answer

Downsizing a Texture2D in XNA

I would like to downsize a Texture2D object to another Texture2D object in XNA. The reason is to use the downsized object for pixel based collision detection. Can this be done?
eflles
  • 6,606
  • 11
  • 41
  • 55
5
votes
0 answers

Unity: Saving Depth from Render Texture as png

What is the simplest way to save my Depth color mode Texture Render. Can it be done without using replacement shaders on my camera? It seems like most of the work is done just setting the color mode to depth on a camera with a render target.…
5
votes
2 answers

how to share texture between 2 OpenGL context?

I'm rendering successfully my OpenGL view by drawing an offscreen texture (which is created by an offscreen framebuffer). draw -> offscreen FBO/Texture ------> onscreen FBO ---> render buffer -> context Now I want to reuse offscreen texture to…
KONG
  • 7,271
  • 6
  • 28
  • 27
1
2
3
43 44