Hey…It’s me again
… I really tried a lot of thinks but can’t wrap my head around it. When I did what you told me to the window was fullscreen and cleared correctly, but when I want to draw from one side to the other somehow OpenGL does not get the size of the window correctly. Everything is drawn correctly but just in a false mode. I’ll just show you the image:
Ignore the texturing, it was just to play around a bit. The vertexBuffer looks like this:
GLfloat positions[5 * 4]
{
-1, -1, 0, 0, 0,
1, -1, 0, 1, 0,
1, 1, 0, 1, 1,
-1, 1, 0, 0, 1
};
The first three numbers in each row are for the position.
The source code looks like this:
static vec2ui16 size;
static int videoModeCount;
static GLFWvidmode const* modes;
static GLFWvidmode mode;
GLFWwindow* window;
GLFWmonitor* monitor;
void window_init(char const* const title)
{
if (!glfwInit())
printf("Failed to init glfw\n");
monitor = glfwGetPrimaryMonitor();
modes = glfwGetVideoModes(monitor, &videoModeCount);
mode = modes[videoModeCount - 1];
size = {mode.width, mode.height};
glfwWindowHint(GLFW_RED_BITS, mode.redBits);
glfwWindowHint(GLFW_GREEN_BITS, mode.greenBits);
glfwWindowHint(GLFW_BLUE_BITS, mode.blueBits);
glfwWindowHint(GLFW_REFRESH_RATE, mode.refreshRate);
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(size.x, size.y, title, monitor, NULL);
if (!window)
{
glfwTerminate();
printf("Failed to create window\n");
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
if (glewInit() != GLEW_OK)
printf("Failed to init glew\n");
}