You are not logged in.

Read the FAQ and Knowledge Base before posting.
We won't make a 3DS/2DS emulator.



#1 2010-07-06 19:05:38

agingcow
Member
Registered: 2009-08-15
Posts: 8

Texture formats

I have a rather specific question for everyone. How are the textures (those taken from a game) stored in memory? RGB, ABGR, 565, something else? Are they in different formats when it comes time to "apply" them to the texture (whether it be in OGL or the software renderer)? If so, how does Desmume "tell" which method to apply them?

I'm trying to do something unique with textures (but I'd rather not say what it is, in case I fail, then no one gets their hopes up).

Thank you so much! I really appreciate it.

Offline

#2 2010-07-06 20:25:55

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 5,826

Re: Texture formats

despite the names of the enums and comments in the code, textures are stored as 32bpp (8888) for ogl renderer and 32bpp (5-6-6-6) for rasterizer where each component is stored in a byte. they are all in that format when the time comes to apply them.

You shouldn't worry about getting hopes up. That only happens to retarded people. And since theyre retarded, you shouldn't care about them.

Offline

#3 2010-07-08 17:47:39

agingcow
Member
Registered: 2009-08-15
Posts: 8

Re: Texture formats

Thank you for the quick reply! I have some follow up questions, if I may.

1. The (8888) I am assuming that it is ABGR, correct?

2. Are the textures are stored in row-column or column row format?

3. This is turning into a much bigger project. There is 2D sprite information that is somehow combined with the 3D information. A good example is the very start of Super Mario 64 DS, the "press here" text (2D) is separate from the bouncing star (3D). Where are they combined? I can't seem to find the place where that happens. And the same questions 1, and 2 apply to this 2D "texture" (I'm not sure what to call it).

Thank you so much! This is getting exciting, and I'm learning a lot!

Offline

#4 2010-07-08 18:40:28

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 5,826

Re: Texture formats

1. if what you're asking is whether its ABGR or RGBA, then that is ill defined and all I can say is that it uses opengl's GL_RGBA as you can see from the source code. if youre asking whether the 4 8s correspond to A,B,G, and R, in some order, then the answer is, yes, of course.

2. I dont know what row-column or column-row means. I think those words are ill-defined also. Since you asked about the 8888 format earlier, I assume youre testing this in opengl, and so for the answer I must point out that we store things in the format opengl needs them, which is as a framebuffer, like every other computer graphics system in history.

3. it is combined in GPU.cpp where the 2d graphics are rendered. The 2d graphics are stored *by the game* in many different ways depending upon which part of the 2d hardware is being used, and how it is being used. there are a dozen different formats, and desmume doesn't do the storage of them, it renders them out of the game's memory. at a certain point desmume combines the 2d screen with the 3d screen, and then more 2d is rendered on top of that. At no point does desmume predictably have any isolated representation of the 2d graphics.

Offline

#5 2010-07-08 19:00:29

agingcow
Member
Registered: 2009-08-15
Posts: 8

Re: Texture formats

You are right, my words were poorly chosen. By "row-column" I meant "row-major" and since it's using OpenGL then (if memory serves) it's row-major.

Also, you just blew my mind regarding number 3. The 2D is made by the game. Whoa. No wonder I couldn't find anything on it!

I am off to track down where the 2D sprites are copied, wish me luck, and thank you very much, you saved me a boatload of time!

Offline

#6 2010-07-08 19:40:53

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 5,826

Re: Texture formats

the 2d is made by the emulator from data put into vram by the game. You should find plenty of references on it. I merely sought to distinguish it from textures, which the emulator converts and saves a copy of in its own memory, which is far more convenient for you to do whatever it is youre probably doing.

Offline

Board footer

Powered by FluxBB