fix perspective projection
This commit is contained in:
parent
17edc0a9d6
commit
eb83cb256e
4
app.cc
4
app.cc
@ -67,7 +67,7 @@ bool init(void)
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (void *)(3 * sizeof(GLfloat)));
|
||||
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (void *)(6 * sizeof(GLfloat)));
|
||||
|
||||
projection = glm::perspective(60.0f, (float)WIDTH / (float)HEIGHT, 0.1f, 1000.0f);
|
||||
projection = glm::perspective((float)(60.0 * M_PI / 180.0), (float)WIDTH / (float)HEIGHT, 0.1f, 1000.0f);
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
@ -124,7 +124,7 @@ static void draw_cube()
|
||||
void display(SDL_Window * window)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
modelview = glm::translate(glm::mat4(1.0), glm::vec3(0, 0, -2));
|
||||
modelview = glm::translate(glm::mat4(1.0), glm::vec3(0, 0, -5));
|
||||
modelview = glm::rotate(modelview, (float)(SDL_GetTicks() / 1000.0), glm::vec3(0, 1, 0));
|
||||
|
||||
draw_cube();
|
||||
|
Loading…
x
Reference in New Issue
Block a user