Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and work.

aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing

You have the vaccine, now let everyone know!
Teach Your Child To Read

BlueHost Web Hosting Black Friday

Bonsai Boy of New York Bonsai Trees and Accessories

DreamCloud The Comfortable Luxury Mattress Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

DreamHost Web Hosting


Disclosure We are a professional Programming & Software Q&A website, that receives compensation from some of the links whose we show you with Information. It means that my content may contain affiliate links.

18,338 questions

24,621 answers

573 users

How to create window with specific size and color using OpenGL with C

1 Answer

0 votes
#include <stdio.h>

#include <GL/glew.h>
#include <GLFW/glfw3.h>

const GLint WIDTH = 800, HEIGHT = 600;

void error_callback(int error, const char* description) {
	puts(description);
}

int main() {

	glfwSetErrorCallback(error_callback);

	if (!glfwInit()) {
		printf("ERROR: GLFW failed to Initialize\n");
		return 1;
	}

	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);

	GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "Test Window", NULL, NULL);

		if (!window) {
		printf("ERROR: GLFW window creation falied!\n");
		glfwTerminate();
		return 1;
	}

	int bufferWidth, bufferHeigth;
	glfwGetFramebufferSize(window, &bufferWidth, &bufferHeigth);

	glfwMakeContextCurrent(window);

	if (glewInit() != GLEW_OK) {
		printf("ERROR: GLEW initialize falied!\n");
		glfwDestroyWindow(window);
		glfwTerminate();
		return 1;
	}

	glViewport(0, 0, bufferWidth, bufferHeigth);

	while (!glfwWindowShouldClose(window)) {
		glfwPollEvents();

		glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
		glClear(GL_COLOR_BUFFER_BIT);

		glfwSwapBuffers(window);
	}

	return 0;



	/*
	run:


	
	*/
}

 




answered May 13 by avibootz
...