texture2d

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? ...

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 text when you use it. I would like to modify the method so I could specify the RGB colo...

How do I load pictures in Zune XNA without running out of memory?

Im writing a XNA program that display pictures from a specific picture album on the Zune. The problem is when if I load the textures from all the pictures in the album, the program runs out of memory. I tried loading one by one and call Dispose on the previous picture texture once the user moves on to the next picture. This works but the...

Is there a more efficient way to deal with 2^n pixels size requirement for OpenGL ES texture?

Sorry if my question is uncleared. Let me elaborate. I have a rectangle of size 100 x 200, and I have a graphic size 100 x 200 which fits with the rectangle. Since OpenGL requires all textures to have 2^n width and height, I basically put the 100 x 200 graphic right into a 128 x 256 image for this. It works fine for OpenGL because I sim...

How to Draw pixel data taken from the backbuffer back to itself ?

I'm working on a mobile application for Symbian 5th edition using OpenGLES. This application is a pretty standard 2D app, and I make no use of the DepthBuffer. I need to grab a snapshot of the display and then draw the very same snapshot back to the backbuffer. I'm using glReadPixels((GLint)0, (GLint)0, (GLint)nWidth-1, (GLint)nH...

XNA: Getting a struct as a texture to the GPU

I use XNA as a nice easy basis for some graphics processing I'm doing on the CPU, because it already provides a lot of the things I need. Currently, my "rendertarget" is an array of a custom Color struct I've written that consists of three floating point fields: R, G, B. When I want to render this on screen, I manually convert this arr...

iPhone : creating Texture2D much slower when image loaded from file in app's Documents, why?

Slower than what? slower than creating the same textures from an image loaded from the app bundle. How much slower ? 80 times slower on iPhone, similar ratio (but faster overall) on Mac. My example below shows loading an image with imageNamed: ; creating textures from the first image ; saving image to a file in the app's Documents direc...

Is it correct to load openGL textures like this ?

Hi guys, I started some months ago an OpenGL project which became larger and larger... I began with the crashLanding sample and i use Texture2D. I also use a singleton class to load my textures, and here is what the texture load looks like : //Load the background texture and configure it _textures[kTexture_Background] = [[Texture2D a...

Textures not drawing if multiple EAGLViews are used.

Hi, 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 drawn. Being new to OpenGL, I've got absolutely now clue as to what is causing this behavior. I...

How can I create a texture from an AtlasSpriteManager?

What I want to do is create a huge texture(w/ width of more than 1024) using a 1024x1024 image. I can retrieve the images using an AtlasSpriteManager, but whenever I try to retrieve the texture from the manager I can only get the first image. I need to set the position of every AtlasSprite in the manager to make a lengthy texture. Any ...

Texture2D.Bounds.Intersect, but the Bounds never move? - XNA, .Net 4.0

Hi all, I am still shiny new to XNA, so please forgive any stupid question and statements in this post (The added issue is that I am using Visual Studio 2010 with .Net 4.0 which also means very few examples exist out on the web - well, none that I could find easily): I have two 2D objects in a "game" that I am using to learn more about ...

Android GLSurfaceView glTexImage2D glDrawTexiOES

I'm trying to render a 640x480 RGB565 image using OpenGL ES on Android using GLSurfaceView and Native C code. Initially I had a 0x0501 error with glTexImage2D, which I was able to resolve by changing the image dimensions. But now, in the "drawFrame" call, when I do glDrawTexiOES to resnder the texture, I'm getting the following error o...

Im Stumped, Why is UIImage\Texture2d memory not being freed

I've been looking everywhere trying to find a solution to this problem. Nothing seems to help. I've set up this basic test to try to find the cause of why my memory wasn't being freed up: if (texture != nil) { [texture release]; texture = nil; } else { UIImage* ui = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResourc...

XNA.Texture2D to System.Drawing.Bitmap

I need load XNA.Texture2D to PictureBox. i've tried this: http://www.gamedev.net/community/forums/viewreply.asp?ID=3224621 but it doesn't work. Any suggestions? ...

Is there a fast alternative to creating a Texture2D from a Bitmap object in XNA?

I've looked around a lot and the only methods I've found for creating a Texture2D from a Bitmap are: using (MemoryStream s = new MemoryStream()) { bmp.Save(s, System.Drawing.Imaging.ImageFormat.Png); s.Seek(0, SeekOrigin.Begin); Texture2D tx = Texture2D.FromFile(device, s); } and Texture2D tx = new Texture2D(device, bmp.Wi...

Texture2D implementation on iPhone problem

Im trying draw text using Texture2D but all I get is a big white square. What wrong? glPushMatrix(); glRotatef(rodar+30, 0, 1, 0); glEnable(GL_BLEND); tex = [[Texture2D alloc] initWithString:@"imm" dimensions:CGSizeMake(2,1) alignment:UITextAlignmentCenter fontName:@"arial" fontSize:5]; [tex dra...

Texture2D text color changed after updating from iOS 3.0 to 4.0

I'm using an OpenGL Texture2D class and initWithString method to display strings to the user. When running with iOS 3.0 and XCode 3.1.3 all the text would appear black in the simulator and white on the phone. After updating to iOS 4.0, XCode 3.2.3, and iPhone SDK 4.0 the text appears black on the phone! Not so good since my app is alm...

Problems with glDrawTex_OES

I'm not sure I'm using glDrawTex_OES correctly. In fact, I'm sure I'm not because I'm getting a black rectangle on the screen rather than the intended texture. To get the silly points out of the way: Yes, the GL Extension string contains the OES_draw_texture token. Yes, the texture is loaded into memory/etc. correctly: it displays ju...

OpenGlES: Texture2D: random image strokes when rendered

Hi, Ok, the issue here is that i am developing games for iphone. I render using OpenGLES and Texture2D. When I render a sprite using "drawSprite" from Texture2D if another sprite is overlaying this sprite and the part overlapping is the same RBGA values a stroke will appear on the parts that are overlapping. If they don't share the sam...

Mac OS X version of Texture2D.m, .h available?

Hi all, Apple's Texture2D class is a very useful bit of kit for iOS developers. Q. Is there a Mac OS X version of this class available? (I've googled but can only find iOS implementations, mostly through Cocos2D projects.) Cheers. ...