gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > 3D questions part III?

#72122 - Webez - Thu Feb 16, 2006 3:48 pm

Hi.

Here I am again. Let's see how many of my questions can be answered.

A) Display list have a size limit if am not wrong . What is this limit?

B) Is there a way so when drawing a model, colors and texture don't mix together (like glTexEnvf in OpenGL)?

C) The console doesn't draw polys wich are out of the screen. But wich thing would be faster, let the hardware do it or implement frustum culling in software?

D) Is there a function to free textures?

E) There is something I don't understand in the examples when loading textures. First thing is to call loadPCX so it loads data in image->data8. But then imge8to16 is called. And in this function data8 is freed wich is then used as a parameter in glTexImage2D. I don't understand why image->data8 can be used if it has been freed.

F) How many bytes per pixel are used when loading textures as in question E?

Thanks!!

#72323 - dovoto - Fri Feb 17, 2006 5:52 pm

Webez wrote:

E) There is something I don't understand in the examples when loading textures. First thing is to call loadPCX so it loads data in image->data8. But then imge8to16 is called. And in this function data8 is freed wich is then used as a parameter in glTexImage2D. I don't understand why image->data8 can be used if it has been freed.



On my way out so i will answer this one and get the rest when i have a bit more time:
Code:

free (img->data8);
free (img->palette);

img->bpp = 16;
img->data16 = temp;



Allthough data8 is freed, data16 is assigned the new buffer. If you look in the definition for the image struct you will see the data pointers are unioned and so are the same pointer. They are defined with multiple widths to make accessing them simpler from c code. Changing data8 will change data16.

It would definatly be more clear to pass data16 to the texture loader although it makes no practical difference.
_________________
www.drunkencoders.com

#72331 - dovoto - Fri Feb 17, 2006 7:22 pm

Webez wrote:

A) Display list have a size limit if am not wrong . What is this limit?


As far as I am aware there is no limit on display list size itself other than that impossed by the dma hardware (I do not believe that limit is of concern)

However, there is a limit on the number of vertecies the DS can hold in memory for any given frame which is 6144. This amounts to 2K triangles or about 1500 quads.

Webez wrote:

B) Is there a way so when drawing a model, colors and texture don't mix together (like glTexEnvf in OpenGL)?


I have not found a way to change texture modulation. As far as I can tell it allways blends the texture with the current color. I may have just not found it yet i have not had the time to fully explore the texture format register. Anyone else know how to disable the color blend?

Webez wrote:

C) The console doesn't draw polys wich are out of the screen. But wich thing would be faster, let the hardware do it or implement frustum culling in software?


From what minimal testing i have done the culling performed by the DS is basicaly free. You only pay the penility of actualy sending the vertex data to the pipeline.

This penility adds up with scene complexity so you will probably get the most performance from an algorothym that quickly rejects the sections of the scene that are definatly not visiable and let the DS handle the situations where part of a screen element is on screen and part off. You will have to play with how much data is in each screen element to see where the best trade off is.

Webez wrote:

D) Is there a function to free textures?


void glResetTextures(void)
This releases all textures. You can still reuse textures by loading different texture data but the texture size must be the same size as the original(smaller would probably also work).
Webez wrote:

F) How many bytes per pixel are used when loading textures as in question E?

8 or 16 with the currently support image functions, although there are texture formats which have 4 bit pixels.
_________________
www.drunkencoders.com

#72342 - Webez - Fri Feb 17, 2006 8:17 pm

If display list don't have size limit then I will be doing something bad .
I save them in a u8 vector and then call it like this
std::vector<u32>::iterator list;
for (list=displayList.begin(); list!=displayList.end(); list++)
GFX_FIFO= *list;
and I think there is nothing wrong with it.


And thanks a lot for your answers and time!!!