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 > glTexImage2D dynamic parameters

#135481 - Rajveer - Mon Jul 23, 2007 9:13 pm

After a long day of coding, my brain's come to a freeze. To finish the day, I'm trying to load a texture using glTexImage2D with flip S/T and wrap S/T parameters kept as boolean variables. How would I call the related flip/wrap parameters if the variables are set to true? E.g.

Code:
   glTexImage2D(0, 0, GL_RGB32_A3, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD | (if variable1 true, GL_TEXTURE_WRAP_S) | (if variable2 true, GL_TEXTURE_WRAP_T), (u8*)road3_bin);

#135488 - Rajveer - Mon Jul 23, 2007 10:20 pm

Nevermind, delete this thread, its obvious. I get kinda stupid when I'm tired :S

#135864 - tepples - Thu Jul 26, 2007 9:28 pm

Kept for search purposes.

For those reading at home who don't yet know the ternary operator, the translation of "(if variable2 true, GL_TEXTURE_WRAP_T)" into C is the following:
Code:
(variable2 ? GL_TEXTURE_WRAP_T : 0)

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.