25 #include <OVR_CAPI_GL.h>
29 textureSwapChain(nullptr),
32 bytes_per_pixel(img.bytes_per_pixel),
34 padding((4 - (width * bytes_per_pixel) % 4) % 4),
35 rowSize(width * bytes_per_pixel + padding),
36 bufferSize(rowSize * height),
37 ptr((GLubyte*)img.pixel_data)
47 void TextureStatic::createTexture()
49 ovrTextureSwapChainDesc desc = {};
50 desc.Type = ovrTexture_2D;
51 desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB;
57 desc.StaticImage = ovrTrue;
58 desc.MiscFlags = ovrTextureMisc_None;
59 desc.BindFlags = ovrTextureBind_None;
69 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
70 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
71 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
72 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
73 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
width,
height, GL_RGBA, GL_UNSIGNED_BYTE,
ptr);
76 glBindTexture(GL_TEXTURE_2D, 0);
82 void TextureStatic::deleteTexture()