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 > Disabling texture mapping... can it be done?

#128508 - goruka - Sat May 12, 2007 3:16 am

Hi! Techie question over here...
I am drawing objects that both intend (and don't intend) to use texture mapping.

I just:

// for texture mapping

glEnable( GL_TEXTURE_2D ); / / DISP3DCNT |= 1

glBegin(GL_TRIANGLES) // BEGIN_VTXS=0

//set texcoord vertex
//draw vertex
//set texcoord vertex
//draw vertex
//set texcoord vertex
//draw vertex

glEnd();

now, i want to draw without texture...

glBegin(GL_TRIANGLES) // BEGIN_VTXS=0
//draw vertex
//draw vertex
//draw vertex
glEnd();

But this doesn't work! it keeps the last texture coordinate for the previous begin/end, so the whole object is painted with that texel color.

Normally, under opengl you do glDisable( GL_TEXTURE_2D) , but if i do this on the DS,
it disables textures for the whole frame (the bit 1 DISP3DCNT on the register is not state-machine based, just works for the entire frame, unlike POLYGON_ATTR register ), so this is obviously not good. So, how is this done?

Thanks in advance!

#128509 - zeruda - Sat May 12, 2007 3:43 am

Cannae you jus' do summin' like glBindTexture(0); just before each object that doesnae hav' a texture?

Edit:
Oh wait, the stannard libnds functions they ave redundant features like phantom parameters that do nuffin so it can be more opengl compliant like. So in this case it would actually be:
glBindTexture(GL_TEXTURE_2D, 0);

#128524 - Sunray - Sat May 12, 2007 9:16 am

Yeah, use glBindTexture(0, 0);. DISP3DCNT (GL_TEXTURE_2D) is a per-frame state.

#128924 - silent_code - Wed May 16, 2007 7:40 pm

or just copy and paste the gl-functions into your project and modify them to not auto-enable stuff you don't want it to. search the forum for it. our just download my shadow volume demo and check the sources: you see that "www" button with the house icon under my post? click it.

#128946 - Lick - Wed May 16, 2007 11:49 pm

It should actually be glBindTexture(GL_TEXTURE_2D, 0);
_________________
http://licklick.wordpress.com

#128974 - Sunray - Thu May 17, 2007 8:20 am

Well, GL_TEXTURE_2D is a dummy argument. Not used for anything.