mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
Fix OpenGL 1.1 build not drawing rewritten menus at all
This commit is contained in:
parent
05a0a6500b
commit
27a62b9ab1
@ -62,7 +62,7 @@ void AxisLinesRenderer_Render(double delta) {
|
||||
*-----------------------------------------------AxisLinesRenderer component-----------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static void OnContextLost(void* obj) {
|
||||
Gfx_DeleteVb(&axisLines_vb);
|
||||
Gfx_DeleteDynamicVb(&axisLines_vb);
|
||||
}
|
||||
|
||||
static void AxisLinesRenderer_Init(void) {
|
||||
|
@ -790,7 +790,7 @@ static void DeleteVbs(void) {
|
||||
Gfx_DeleteVb(&skybox_vb);
|
||||
Gfx_DeleteVb(&sides_vb);
|
||||
Gfx_DeleteVb(&edges_vb);
|
||||
Gfx_DeleteVb(&weather_vb);
|
||||
Gfx_DeleteDynamicVb(&weather_vb);
|
||||
}
|
||||
|
||||
static void OnContextLost(void* obj) {
|
||||
|
@ -49,8 +49,8 @@ static void Gfx_InitDefaultResources(void) {
|
||||
}
|
||||
|
||||
static void Gfx_FreeDefaultResources(void) {
|
||||
Gfx_DeleteVb(&Gfx_quadVb);
|
||||
Gfx_DeleteVb(&Gfx_texVb);
|
||||
Gfx_DeleteDynamicVb(&Gfx_quadVb);
|
||||
Gfx_DeleteDynamicVb(&Gfx_texVb);
|
||||
Gfx_DeleteIb(&Gfx_defaultIb);
|
||||
}
|
||||
|
||||
@ -1880,7 +1880,6 @@ static void GL_CheckSupport(void) {
|
||||
Gfx.CustomMipmapsLevels = true;
|
||||
}
|
||||
#else
|
||||
GfxResourceID Gfx_CreateDynamicVb(VertexFormat fmt, int maxVertices) { return gl_DYNAMICLISTID; }
|
||||
GfxResourceID Gfx_CreateVb(void* vertices, VertexFormat fmt, int count) {
|
||||
/* Need to get rid of the 1 extra element, see comment in chunk mesh builder for why */
|
||||
count &= ~0x01;
|
||||
@ -1909,14 +1908,28 @@ void Gfx_DeleteIb(GfxResourceID* ib) { }
|
||||
|
||||
void Gfx_DeleteVb(GfxResourceID* vb) {
|
||||
GLuint id = (GLuint)(*vb);
|
||||
if (!id) return;
|
||||
if (id != gl_DYNAMICLISTID) glDeleteLists(id, 1);
|
||||
if (id) glDeleteLists(id, 1);
|
||||
*vb = 0;
|
||||
}
|
||||
|
||||
GfxResourceID Gfx_CreateDynamicVb(VertexFormat fmt, int maxVertices) {
|
||||
return (GfxResourceID)Mem_Alloc(maxVertices, gfx_strideSizes[fmt], "creating dynamic vb");
|
||||
}
|
||||
|
||||
void Gfx_BindDynamicVb(GfxResourceID vb) {
|
||||
gfx_activeList = gl_DYNAMICLISTID;
|
||||
gfx_dynamicListData = (void*)vb;
|
||||
}
|
||||
|
||||
void Gfx_DeleteDynamicVb(GfxResourceID* vb) {
|
||||
cc_uintptr id = (cc_uintptr)(*vb);
|
||||
if (id) Mem_Free((void*)id);
|
||||
*vb = 0;
|
||||
}
|
||||
|
||||
void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) {
|
||||
gfx_activeList = gl_DYNAMICLISTID;
|
||||
gfx_dynamicListData = vertices;
|
||||
Gfx_BindDynamicVb(vb);
|
||||
Mem_Copy((void*)vb, vertices, vCount * gfx_batchStride);
|
||||
}
|
||||
|
||||
static GLuint gl_lastPartialList;
|
||||
|
@ -114,6 +114,16 @@ CC_API void Gfx_DeleteVb(GfxResourceID* vb);
|
||||
/* Deletes the given index buffer, then sets it to 0. */
|
||||
CC_API void Gfx_DeleteIb(GfxResourceID* ib);
|
||||
|
||||
#ifndef CC_BUILD_GL11
|
||||
/* Static and dynamic vertex buffers are drawn in the same way */
|
||||
#define Gfx_BindDynamicVb Gfx_BindVb
|
||||
#define Gfx_DeleteDynamicVb Gfx_DeleteVb
|
||||
#else
|
||||
/* OpenGL 1.1 draws static vertex buffers completely differently. */
|
||||
void Gfx_BindDynamicVb(GfxResourceID vb);
|
||||
void Gfx_DeleteDynamicVb(GfxResourceID* vb);
|
||||
#endif
|
||||
|
||||
/* Sets the format of the rendered vertices. */
|
||||
CC_API void Gfx_SetVertexFormat(VertexFormat fmt);
|
||||
/* Updates the data of a dynamic vertex buffer. */
|
||||
|
@ -2961,7 +2961,7 @@ static struct TexIdsOverlay {
|
||||
static void TexIdsOverlay_ContextLost(void* screen) {
|
||||
struct TexIdsOverlay* s = (struct TexIdsOverlay*)screen;
|
||||
Screen_ContextLost(s);
|
||||
Gfx_DeleteVb(&s->dynamicVb);
|
||||
Gfx_DeleteDynamicVb(&s->dynamicVb);
|
||||
TextAtlas_Free(&s->idAtlas);
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ static struct ModelTex* textures_tail;
|
||||
#define Model_RetAABB(x1,y1,z1, x2,y2,z2) static struct AABB BB = { (x1)/16.0f,(y1)/16.0f,(z1)/16.0f, (x2)/16.0f,(y2)/16.0f,(z2)/16.0f }; e->ModelAABB = BB;
|
||||
|
||||
static void Models_ContextLost(void* obj) {
|
||||
Gfx_DeleteVb(&Models.Vb);
|
||||
Gfx_DeleteDynamicVb(&Models.Vb);
|
||||
}
|
||||
|
||||
static void Models_ContextRecreated(void* obj) {
|
||||
|
@ -440,7 +440,7 @@ void Particles_RainSnowEffect(Vec3 pos) {
|
||||
*---------------------------------------------------Particles component---------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static void OnContextLost(void* obj) {
|
||||
Gfx_DeleteVb(&Particles_VB);
|
||||
Gfx_DeleteDynamicVb(&Particles_VB);
|
||||
}
|
||||
static void OnContextRecreated(void* obj) {
|
||||
Particles_VB = Gfx_CreateDynamicVb(VERTEX_FORMAT_P3FT2FC4B, PARTICLES_MAX * 4);
|
||||
|
@ -102,7 +102,7 @@ void PickedPosRenderer_Update(struct PickedPos* selected) {
|
||||
*-----------------------------------------------PickedPosRenderer component-----------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static void OnContextLost(void* obj) {
|
||||
Gfx_DeleteVb(&pickedPos_vb);
|
||||
Gfx_DeleteDynamicVb(&pickedPos_vb);
|
||||
}
|
||||
|
||||
static void OnContextRecreated(void* obj) {
|
||||
|
@ -68,7 +68,7 @@ void Screen_Render2Widgets(void* screen, double delta) {
|
||||
int i, offset = 0;
|
||||
|
||||
Gfx_SetVertexFormat(VERTEX_FORMAT_P3FT2FC4B);
|
||||
Gfx_BindVb(s->vb);
|
||||
Gfx_BindDynamicVb(s->vb);
|
||||
|
||||
for (i = 0; i < s->numWidgets; i++) {
|
||||
if (!widgets[i]) continue;
|
||||
@ -91,7 +91,7 @@ void Screen_ContextLost(void* screen) {
|
||||
struct Screen* s = (struct Screen*)screen;
|
||||
struct Widget** widgets = s->widgets;
|
||||
int i;
|
||||
Gfx_DeleteVb(&s->vb);
|
||||
Gfx_DeleteDynamicVb(&s->vb);
|
||||
|
||||
for (i = 0; i < s->numWidgets; i++) {
|
||||
if (!widgets[i]) continue;
|
||||
|
@ -132,8 +132,8 @@ void Selections_Remove(cc_uint8 id) {
|
||||
}
|
||||
|
||||
static void Selections_ContextLost(void* obj) {
|
||||
Gfx_DeleteVb(&selections_VB);
|
||||
Gfx_DeleteVb(&selections_LineVB);
|
||||
Gfx_DeleteDynamicVb(&selections_VB);
|
||||
Gfx_DeleteDynamicVb(&selections_LineVB);
|
||||
}
|
||||
|
||||
static void Selections_ContextRecreated(void* obj) {
|
||||
|
@ -718,7 +718,7 @@ static void TableWidget_Render(void* widget, double delta) {
|
||||
|
||||
static void TableWidget_Free(void* widget) {
|
||||
struct TableWidget* w = (struct TableWidget*)widget;
|
||||
Gfx_DeleteVb(&w->vb);
|
||||
Gfx_DeleteDynamicVb(&w->vb);
|
||||
Gfx_DeleteTexture(&w->descTex.ID);
|
||||
w->lastCreatedIndex = -1000;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user