summaryrefslogtreecommitdiffstats
path: root/src/extras/custompipes_gl.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-02-19 00:30:02 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2021-02-19 00:30:02 +0100
commitdfa0c8bf1921d955f1ea5af6388a381b280fcd98 (patch)
tree639af8a47ae411af564387c5cf1f700b9495390d /src/extras/custompipes_gl.cpp
parentGet keyboard input from X11 on Linux (diff)
parentname error strings to REVC (diff)
downloadre3-dfa0c8bf1921d955f1ea5af6388a381b280fcd98.tar
re3-dfa0c8bf1921d955f1ea5af6388a381b280fcd98.tar.gz
re3-dfa0c8bf1921d955f1ea5af6388a381b280fcd98.tar.bz2
re3-dfa0c8bf1921d955f1ea5af6388a381b280fcd98.tar.lz
re3-dfa0c8bf1921d955f1ea5af6388a381b280fcd98.tar.xz
re3-dfa0c8bf1921d955f1ea5af6388a381b280fcd98.tar.zst
re3-dfa0c8bf1921d955f1ea5af6388a381b280fcd98.zip
Diffstat (limited to 'src/extras/custompipes_gl.cpp')
-rw-r--r--src/extras/custompipes_gl.cpp84
1 files changed, 14 insertions, 70 deletions
diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp
index 6cbd0bb7..fd68c743 100644
--- a/src/extras/custompipes_gl.cpp
+++ b/src/extras/custompipes_gl.cpp
@@ -91,13 +91,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
-#ifdef RW_GL_USE_VAOS
- glBindVertexArray(header->vao);
-#else
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
- glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
- setAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@@ -138,9 +132,7 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
SetRenderState(SRCBLEND, BLENDSRCALPHA);
-#ifndef RW_GL_USE_VAOS
- disableAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ teardownVertexInput(header);
}
void
@@ -211,13 +203,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
-#ifdef RW_GL_USE_VAOS
- glBindVertexArray(header->vao);
-#else
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
- glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
- setAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@@ -255,9 +241,7 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
inst++;
}
setTexture(1, nil);
-#ifndef RW_GL_USE_VAOS
- disableAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ teardownVertexInput(header);
}
void
@@ -319,13 +303,7 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
Material *m;
-#ifdef RW_GL_USE_VAOS
- glBindVertexArray(header->vao);
-#else
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
- glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
- setAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@@ -368,9 +346,7 @@ glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
SetRenderState(SRCBLEND, BLENDSRCALPHA);
SetRenderState(DESTBLEND, BLENDINVSRCALPHA);
-#ifndef RW_GL_USE_VAOS
- disableAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ teardownVertexInput(header);
}
void
@@ -454,13 +430,7 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
-#ifdef RW_GL_USE_VAOS
- glBindVertexArray(header->vao);
-#else
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
- glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
- setAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@@ -483,9 +453,7 @@ rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
drawInst(header, inst);
inst++;
}
-#ifndef RW_GL_USE_VAOS
- disableAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ teardownVertexInput(header);
}
static void
@@ -505,13 +473,7 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
setWorldMatrix(atomic->getFrame()->getLTM());
lightingCB(atomic);
-#ifdef RW_GL_USE_VAOS
- glBindVertexArray(header->vao);
-#else
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
- glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
- setAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ setupVertexInput(header);
InstanceData *inst = header->inst;
rw::int32 n = header->numMeshes;
@@ -532,9 +494,7 @@ rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
drawInst(header, inst);
inst++;
}
-#ifndef RW_GL_USE_VAOS
- disableAttribPointers(header->attribDesc, header->numAttribs);
-#endif
+ teardownVertexInput(header);
}
void
@@ -697,13 +657,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
if(!setupDone){
defaultShader->use();
setWorldMatrix(&building->matrix);
-#ifdef RW_GL_USE_VAOS
- glBindVertexArray(building->instHeader->vao);
-#else
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
- glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
- setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
-#endif
+ setupVertexInput(building->instHeader);
setLights(&lights);
setupDone = true;
}
@@ -714,9 +668,7 @@ AtomicFirstPass(RpAtomic *atomic, int pass)
drawInst(building->instHeader, inst);
}
-#ifndef RW_GL_USE_VAOS
- disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
-#endif
+ teardownVertexInput(building->instHeader);
if(defer)
numBlendInsts[pass]++;
}
@@ -755,13 +707,7 @@ RenderBlendPass(int pass)
for(i = 0; i < numBlendInsts[pass]; i++){
BuildingInst *building = &blendInsts[pass][i];
-#ifdef RW_GL_USE_VAOS
- glBindVertexArray(building->instHeader->vao);
-#else
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
- glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
- setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
-#endif
+ setupVertexInput(building->instHeader);
setWorldMatrix(&building->matrix);
if(building->lighting)
lights.ambient = pAmbient->color;
@@ -783,9 +729,7 @@ RenderBlendPass(int pass)
drawInst(building->instHeader, inst);
}
-#ifndef RW_GL_USE_VAOS
- disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
-#endif
+ teardownVertexInput(building->instHeader);
}
}
}