switch to perspective projection
This commit is contained in:
parent
097feecbb7
commit
57f984c92a
@ -21,7 +21,7 @@ const GLfloat data[][2][3] = {
|
|||||||
{{-0.6, 0.6, 0.0}, {0, 0, 1}},
|
{{-0.6, 0.6, 0.0}, {0, 0, 1}},
|
||||||
{{0.2, -0.6, 0.0}, {1, 0, 0}},
|
{{0.2, -0.6, 0.0}, {1, 0, 0}},
|
||||||
{{1.0, -0.6, 0.0}, {0, 1, 0}},
|
{{1.0, -0.6, 0.0}, {0, 1, 0}},
|
||||||
{{0.6, 0.6, -500.0}, {0, 0, 1}}
|
{{0.6, 0.6, -10.0}, {0, 0, 1}}
|
||||||
};
|
};
|
||||||
const GLushort indices[] = {
|
const GLushort indices[] = {
|
||||||
0, 1, 2, 3, 4, 5
|
0, 1, 2, 3, 4, 5
|
||||||
@ -132,10 +132,13 @@ bool init(int width, int height)
|
|||||||
glViewport(0, 0, WIDTH, HEIGHT);
|
glViewport(0, 0, WIDTH, HEIGHT);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho((float)-width/(float)height, (float)width/(float)height,
|
float near = 0.1;
|
||||||
-1, 1, 1000, -1000);
|
float scale = near * 0.577 * 2;
|
||||||
|
float aspect = (float)width / (float)height;
|
||||||
|
glFrustum(-aspect * scale, aspect * scale, -scale, scale, near, 1000.0);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
glTranslatef(0, 0, -1);
|
||||||
|
|
||||||
vs = makeShader(GL_VERTEX_SHADER, "v_shader.glsl");
|
vs = makeShader(GL_VERTEX_SHADER, "v_shader.glsl");
|
||||||
fs = makeShader(GL_FRAGMENT_SHADER, "f_shader.glsl");
|
fs = makeShader(GL_FRAGMENT_SHADER, "f_shader.glsl");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user