mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-07 10:17:14 +00:00
fix: enable TRIANGLE_MODE and use correct OpenGL constants to fix invisible terrain
This commit is contained in:
parent
12c48a02ad
commit
2f8ed831fc
|
|
@ -77,6 +77,10 @@ void C4JRender::Initialise()
|
|||
// opengl 2.1!!!
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
|
||||
glfwWindowHint(GLFW_DEPTH_BITS, 24);
|
||||
glfwWindowHint(GLFW_STENCIL_BITS, 8);
|
||||
glfwWindowHint(GLFW_DEPTH_BITS, 24);
|
||||
glfwWindowHint(GLFW_STENCIL_BITS, 8);
|
||||
|
||||
GLFWmonitor *fsMonitor = s_fullscreen ? primaryMonitor : nullptr;
|
||||
s_window = glfwCreateWindow(s_windowWidth, s_windowHeight,
|
||||
|
|
|
|||
|
|
@ -218,29 +218,29 @@ public:
|
|||
};
|
||||
|
||||
|
||||
const int GL_MODELVIEW_MATRIX = 0;
|
||||
const int GL_PROJECTION_MATRIX = 1;
|
||||
const int GL_MODELVIEW = 0;
|
||||
const int GL_PROJECTION = 1;
|
||||
const int GL_TEXTURE = 2;
|
||||
const int GL_MODELVIEW_MATRIX = 0x0BA6;
|
||||
const int GL_PROJECTION_MATRIX = 0x0BA7;
|
||||
const int GL_MODELVIEW = 0x1700;
|
||||
const int GL_PROJECTION = 0x1701;
|
||||
const int GL_TEXTURE = 0x1702;
|
||||
|
||||
// These things required for tex gen
|
||||
|
||||
const int GL_S = 0;
|
||||
const int GL_T = 1;
|
||||
const int GL_R = 2;
|
||||
const int GL_Q = 3;
|
||||
const int GL_S = 0x2000;
|
||||
const int GL_T = 0x2001;
|
||||
const int GL_R = 0x2002;
|
||||
const int GL_Q = 0x2003;
|
||||
|
||||
const int GL_TEXTURE_GEN_S = 0;
|
||||
const int GL_TEXTURE_GEN_T = 1;
|
||||
const int GL_TEXTURE_GEN_Q = 2;
|
||||
const int GL_TEXTURE_GEN_R = 3;
|
||||
const int GL_TEXTURE_GEN_S = 0x0C60;
|
||||
const int GL_TEXTURE_GEN_T = 0x0C61;
|
||||
const int GL_TEXTURE_GEN_Q = 0x0C63;
|
||||
const int GL_TEXTURE_GEN_R = 0x0C62;
|
||||
|
||||
const int GL_TEXTURE_GEN_MODE = 0;
|
||||
const int GL_OBJECT_LINEAR = 0;
|
||||
const int GL_EYE_LINEAR = 1;
|
||||
const int GL_OBJECT_PLANE = 0;
|
||||
const int GL_EYE_PLANE = 1;
|
||||
const int GL_TEXTURE_GEN_MODE = 0x2500;
|
||||
const int GL_OBJECT_LINEAR = 0x2401;
|
||||
const int GL_EYE_LINEAR = 0x2400;
|
||||
const int GL_OBJECT_PLANE = 0x2501;
|
||||
const int GL_EYE_PLANE = 0x2502;
|
||||
|
||||
|
||||
// These things are used by glEnable/glDisable so must be different and non-zero (zero is used by things we haven't assigned yet)
|
||||
|
|
@ -254,61 +254,61 @@ const int GL_LIGHTING = 0x0B50;
|
|||
const int GL_LIGHT0 = 0x4000;
|
||||
const int GL_LIGHT1 = 0x4001;
|
||||
|
||||
const int CLEAR_DEPTH_FLAG = 1;
|
||||
const int CLEAR_COLOUR_FLAG = 2;
|
||||
const int CLEAR_DEPTH_FLAG = 0x00000100;
|
||||
const int CLEAR_COLOUR_FLAG = 0x00004000;
|
||||
|
||||
const int GL_DEPTH_BUFFER_BIT = CLEAR_DEPTH_FLAG;
|
||||
const int GL_COLOR_BUFFER_BIT = CLEAR_COLOUR_FLAG;
|
||||
|
||||
const int GL_SRC_ALPHA = D3D11_BLEND_SRC_ALPHA;
|
||||
const int GL_ONE_MINUS_SRC_ALPHA = D3D11_BLEND_INV_SRC_ALPHA;
|
||||
const int GL_ONE = D3D11_BLEND_ONE;
|
||||
const int GL_ZERO = D3D11_BLEND_ZERO;
|
||||
const int GL_DST_ALPHA = D3D11_BLEND_DEST_ALPHA;
|
||||
const int GL_SRC_COLOR = D3D11_BLEND_SRC_COLOR;
|
||||
const int GL_DST_COLOR = D3D11_BLEND_DEST_COLOR;
|
||||
const int GL_ONE_MINUS_DST_COLOR = D3D11_BLEND_INV_DEST_COLOR;
|
||||
const int GL_ONE_MINUS_SRC_COLOR = D3D11_BLEND_INV_SRC_COLOR;
|
||||
const int GL_CONSTANT_ALPHA = D3D11_BLEND_BLEND_FACTOR;
|
||||
const int GL_ONE_MINUS_CONSTANT_ALPHA = D3D11_BLEND_INV_BLEND_FACTOR;
|
||||
const int GL_SRC_ALPHA = 0x0302;
|
||||
const int GL_ONE_MINUS_SRC_ALPHA = 0x0303;
|
||||
const int GL_ONE = 1;
|
||||
const int GL_ZERO = 0;
|
||||
const int GL_DST_ALPHA = 0x0304;
|
||||
const int GL_SRC_COLOR = 0x0300;
|
||||
const int GL_DST_COLOR = 0x0306;
|
||||
const int GL_ONE_MINUS_DST_COLOR = 0x0307;
|
||||
const int GL_ONE_MINUS_SRC_COLOR = 0x0301;
|
||||
const int GL_CONSTANT_ALPHA = 0x8003;
|
||||
const int GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004;
|
||||
|
||||
const int GL_GREATER = D3D11_COMPARISON_GREATER;
|
||||
const int GL_EQUAL = D3D11_COMPARISON_EQUAL;
|
||||
const int GL_LEQUAL = D3D11_COMPARISON_LESS_EQUAL;
|
||||
const int GL_GEQUAL = D3D11_COMPARISON_GREATER_EQUAL;
|
||||
const int GL_ALWAYS = D3D11_COMPARISON_ALWAYS;
|
||||
const int GL_GREATER = 0x0204;
|
||||
const int GL_EQUAL = 0x0202;
|
||||
const int GL_LEQUAL = 0x0203;
|
||||
const int GL_GEQUAL = 0x0206;
|
||||
const int GL_ALWAYS = 0x0207;
|
||||
|
||||
const int GL_TEXTURE_MIN_FILTER = 1;
|
||||
const int GL_TEXTURE_MAG_FILTER = 2;
|
||||
const int GL_TEXTURE_WRAP_S = 3;
|
||||
const int GL_TEXTURE_WRAP_T = 4;
|
||||
const int GL_TEXTURE_MIN_FILTER = 0x2801;
|
||||
const int GL_TEXTURE_MAG_FILTER = 0x2800;
|
||||
const int GL_TEXTURE_WRAP_S = 0x2802;
|
||||
const int GL_TEXTURE_WRAP_T = 0x2803;
|
||||
|
||||
const int GL_NEAREST = 0;
|
||||
const int GL_LINEAR = 1;
|
||||
const int GL_EXP = 2;
|
||||
const int GL_NEAREST_MIPMAP_LINEAR = 0; // TODO - mipmapping bit of this
|
||||
const int GL_NEAREST = 0x2600;
|
||||
const int GL_LINEAR = 0x2601;
|
||||
const int GL_EXP = 0x0800;
|
||||
const int GL_NEAREST_MIPMAP_LINEAR = 0x2702; // TODO - mipmapping bit of this
|
||||
|
||||
const int GL_CLAMP = 0;
|
||||
const int GL_REPEAT = 1;
|
||||
const int GL_CLAMP = 0x2900;
|
||||
const int GL_REPEAT = 0x2901;
|
||||
|
||||
const int GL_FOG_START = 1;
|
||||
const int GL_FOG_END = 2;
|
||||
const int GL_FOG_MODE = 3;
|
||||
const int GL_FOG_DENSITY = 4;
|
||||
const int GL_FOG_COLOR = 5;
|
||||
const int GL_FOG_START = 0x0B63;
|
||||
const int GL_FOG_END = 0x0B64;
|
||||
const int GL_FOG_MODE = 0x0B65;
|
||||
const int GL_FOG_DENSITY = 0x0B62;
|
||||
const int GL_FOG_COLOR = 0x0B66;
|
||||
|
||||
const int GL_POSITION = 1;
|
||||
const int GL_AMBIENT = 2;
|
||||
const int GL_DIFFUSE = 3;
|
||||
const int GL_SPECULAR = 4;
|
||||
const int GL_POSITION = 0x1203;
|
||||
const int GL_AMBIENT = 0x1200;
|
||||
const int GL_DIFFUSE = 0x1201;
|
||||
const int GL_SPECULAR = 0x1202;
|
||||
|
||||
const int GL_LIGHT_MODEL_AMBIENT = 1;
|
||||
const int GL_LIGHT_MODEL_AMBIENT = 0x0B53;
|
||||
|
||||
const int GL_LINES = C4JRender::PRIMITIVE_TYPE_LINE_LIST;
|
||||
const int GL_LINE_STRIP = C4JRender::PRIMITIVE_TYPE_LINE_STRIP;
|
||||
const int GL_QUADS = C4JRender::PRIMITIVE_TYPE_QUAD_LIST;
|
||||
const int GL_TRIANGLE_FAN = C4JRender::PRIMITIVE_TYPE_TRIANGLE_FAN;
|
||||
const int GL_TRIANGLE_STRIP = C4JRender::PRIMITIVE_TYPE_TRIANGLE_STRIP;
|
||||
const int GL_LINES = 0x0001;
|
||||
const int GL_LINE_STRIP = 0x0003;
|
||||
const int GL_QUADS = 0x0007;
|
||||
const int GL_TRIANGLE_FAN = 0x0006;
|
||||
const int GL_TRIANGLE_STRIP = 0x0005;
|
||||
|
||||
// Singleton
|
||||
extern C4JRender RenderManager;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ const int GL_VERTEX_ARRAY = 0;
|
|||
const int GL_NORMAL_ARRAY = 0;
|
||||
const int GL_TEXTURE_COORD_ARRAY = 0;
|
||||
|
||||
const int GL_COMPILE = 0;
|
||||
const int GL_COMPILE = 0x1300;
|
||||
|
||||
const int GL_NORMALIZE = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -710,6 +710,8 @@ int LevelRenderer::render(shared_ptr<Mob> player, int layer, double alpha, bool
|
|||
// sort(sortedChunks[playerIndex]->begin(),sortedChunks[playerIndex]->end(), DistanceChunkSorter(player)); // 4J - removed - not sorting our chunks anymore
|
||||
}
|
||||
Lighting::turnOff();
|
||||
glColor4f(1, 1, 1, 1);
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
int count = renderChunks(0, (int)chunks[playerIndex].length, layer, alpha);
|
||||
|
||||
|
|
@ -948,6 +950,7 @@ void LevelRenderer::renderSky(float alpha)
|
|||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
Lighting::turnOff();
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
|
||||
glDepthMask(false);
|
||||
|
|
@ -1020,6 +1023,7 @@ void LevelRenderer::renderSky(float alpha)
|
|||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
Lighting::turnOff();
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
float *c = level[playerIndex]->dimension->getSunriseColor(level[playerIndex]->getTimeOfDay(alpha), alpha);
|
||||
if (c != NULL)
|
||||
|
|
|
|||
Loading…
Reference in a new issue