MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Gfx_CreateTexture2

Function Gfx_CreateTexture2

src/_GraphicsBase.h:444–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442}
443
444GfxResourceID Gfx_CreateTexture2(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, cc_bool mipmaps) {
445 if (Gfx.NonPowTwoTexturesSupport && (flags & TEXTURE_FLAG_NONPOW2)) {
446 /* Texture is being deliberately created and can be successfully created */
447 /* with non power of two dimensions. Typically only used for UI textures */
448 } else if (!Math_IsPowOf2(bmp->width) || !Math_IsPowOf2(bmp->height)) {
449 Process_Abort("Textures must have power of two dimensions");
450 }
451
452 if (Gfx.LostContext) return 0;
453 if (!Gfx_CheckTextureSize(bmp->width, bmp->height, flags)) return 0;
454
455 return Gfx_AllocTexture(bmp, rowWidth, flags, mipmaps);
456}
457
458void Texture_Render(const struct Texture* tex) {
459 Gfx_BindTexture(tex->ID);

Callers 2

Atlas2D_LoadTileFunction · 0.85
Gfx_CreateTextureFunction · 0.85

Calls 3

Math_IsPowOf2Function · 0.85
Gfx_CheckTextureSizeFunction · 0.85
Gfx_AllocTextureFunction · 0.70

Tested by

no test coverage detected