Open blob84 opened 7 years ago
The prespective matrix was not set. Resizing the window call the method 'onResize' and will set the matrix.
Resizing the window worked for me.
Just initializate the projection matriz inside the render function with an aspect ratio of 4/3:
virtual void render(double currentTime)
{
static const GLfloat green[] = { 0.0f, 0.25f, 0.0f, 1.0f };
static const GLfloat one = 1.0f;
glViewport(0, 0, info.windowWidth, info.windowHeight);
glClearBufferfv(GL_COLOR, 0, green);
glClearBufferfv(GL_DEPTH, 0, &one);
glUseProgram(program);
// initalization of projection matrix
proj_matrix = vmath::perspective(50.0f, 1.33f, 0.1f, 1000.0f);
glUniformMatrix4fv(proj_location, 1, GL_FALSE, proj_matrix);
#ifdef MANY_CUBES
...
The window is green, no cube is displayed. (Debian 8)
`#include
include
// Remove this to draw only a single cube! // #define MANY_CUBES
class singlepoint_app : public sb7::application { void init() { static const char title[] = "OpenGL SuperBible - Spinny Cube";
ifdef MANY_CUBES
else
endif
private: GLuint program; GLuint vao; GLuint buffer; GLint mv_location; GLint proj_location;
};
DECLARE_MAIN(singlepoint_app)`