Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualmetsfan

Posted 18 March 2013 - 10:34 AM

How does your Texture class handle 1D, 2D, 3D, and cube textures? Do you have multiple sub-classing?

 

For this, what I've done is create an enumeration for the texture types, arguments, filters, ect that I want to support.  Then, in each API-specific texture class, I define an array of values which map to my custom enumeration, and put -1 where the value is unsupported.  It seems to work pretty well for me at the moment.  

For instance, for texture type I would have an enum:

enum TextureType
{
  TextureType1D,
  TextureType2D,
  TextureType3D
}

 

 

Then my mapping for OpenGL would be

 

static const int GLTextureType[3] = 
{
  GL_TEXTURE_1D,
  GL_TEXTURE_2D,
  -1 // 3D Textures are not supported
}

#2metsfan

Posted 18 March 2013 - 10:34 AM

How does your Texture class handle 1D, 2D, 3D, and cube textures? Do you have multiple sub-classing?

 

For this, what I've done is create an enumeration for the texture types, arguments, filters, ect that I want to support.  Then, in each API-specific texture class, I define an array of values which map to my custom enumeration, and put -1 where the value is unsupported.  It seems to work pretty well for me at the moment.  

For instance, for texture type I would have an enum:

enum TextureType
{
  TextureType1D,
  TextureType2D,
  TextureType3D
}

 

 

Then my mapping for OpenGL would be

 

int GLTextureType[3] = 
{
  GL_TEXTURE_1D,
  GL_TEXTURE_2D,
  -1 // 3D Textures are not supported
}

#1metsfan

Posted 18 March 2013 - 10:32 AM

How does your Texture class handle 1D, 2D, 3D, and cube textures? Do you have multiple sub-classing?

 

For this, what I've done is create an enumeration for the texture types, arguments, filters, ect that I want to support.  Then, in each API-specific texture class, I define an array of values which map to my custom enumeration, and put -1 where the value is unsupported.  It seems to work pretty well for me at the moment.  


PARTNERS