1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-16 01:54:38 +02:00

#15 non-vbo dyngeom only for RaspberryPi; #23 fix water reflection texture check (no NPOT support)

This commit is contained in:
XProger
2018-03-04 13:57:24 +03:00
parent c996704243
commit 0b85d8b5a1
3 changed files with 24 additions and 18 deletions

View File

@@ -686,7 +686,7 @@ struct WaterCache {
int w, h;
getTargetSize(w, h);
// get refraction texture
if (!refract || w != refract->width || h != refract->height) {
if (!refract || w != refract->origWidth || h != refract->origHeight) {
delete refract;
refract = new Texture(w, h, Texture::RGBA, false);
Core::setTarget(refract, CLEAR_ALL);

View File

@@ -102,23 +102,26 @@ struct Mesh {
if (Core::support.VAO)
glBindVertexArray(Core::active.VAO = 0);
if (vertices || indices) {
glGenBuffers(2, ID);
bind(true);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, iCount * sizeof(Index), indices, GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, vCount * sizeof(VertexGPU), vertices, GL_STATIC_DRAW);
if (Core::support.VAO && aCount) {
VAO = new GLuint[aCount];
glGenVertexArrays(aCount, VAO);
#ifdef DYNGEOM_NO_VBO
if (!vertices && !indices) {
ID[0] = ID[1] = 0;
iBuffer = new Index[iCount];
vBuffer = new VertexGPU[vCount];
return;
}
iBuffer = NULL;
vBuffer = NULL;
} else {
ID[0] = ID[1] = 0;
iBuffer = new Index[iCount];
vBuffer = new VertexGPU[vCount];
#endif
glGenBuffers(2, ID);
bind(true);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, iCount * sizeof(Index), indices, GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, vCount * sizeof(VertexGPU), vertices, GL_STATIC_DRAW);
if (Core::support.VAO && aCount) {
VAO = new GLuint[aCount];
glGenVertexArrays(aCount, VAO);
}
iBuffer = NULL;
vBuffer = NULL;
#endif
}

View File

@@ -92,12 +92,15 @@ struct Texture {
#endif
#endif
origWidth = width;
origHeight = height;
if (!Core::support.texNPOT) {
width = nextPow2(width);
height = nextPow2(height);
}
this->width = origWidth = width;
this->height = origHeight = height;
this->width = width;
this->height = height;
bool filter = (opt & NEAREST) == 0;
bool cube = (opt & CUBEMAP) != 0;