Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il
Hostgator 1 Penny

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


6,847 questions

9,749 answers

573 users

How to Create Window in OpenGL with FreeGLUT 2.8.1 in C/C++

Anker Quick Charge 3.0 63W 5-Port USB Wall Charger, PowerPort Speed 5 for Galaxy S7/S6/Edge/Plus, Note 5/4 and PowerIQ for iPhone X / 8 / 7 / 6s / Plus, iPad Pro/Air 2/mini, LG, Nexus, HTC


68 views
asked Jan 14, 2015 by avibootz
edited Feb 1, 2015 by avibootz

2 Answers

0 votes
// 1. Download glew from glew.sourceforge.net
// 2. Download freeglut from freeglut.sourceforge.net
// 3. Copy freeglut-2.8.1 and glew-1.11.0 libraries to your project directory
// 4. Configure project property for the include and lib files (need to compile to create freeglut.lib)
// 5. Copy freeglut.dll and glew32.dll to the executable file directory
// 6. Build and run

#include <windows.h>
#include <GL\glew.h>
#include <GL\freeglut.h>
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
	glutInit(&argc, argv);

	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

	glutInitWindowSize(800, 600);

	glutCreateWindow("Hello OpenGL");

	glutMainLoop();
	
	return 0;
}



answered Jan 14, 2015 by avibootz
edited Jan 14, 2015 by avibootz
0 votes
#include <windows.h>
#include <GL\glew.h>
#include <GL\freeglut.h>
#include <iostream> 

using namespace std;

void changeViewPort(int w, int h)
{
	glViewport(0, 0, w, h);
}

void render()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}

int main(int argc, char* argv[])
{
	glutInit(&argc, argv);

	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

	glutInitWindowSize(800, 600);

	glutCreateWindow("Hello OpenGL");

	glutReshapeFunc(changeViewPort);
	glutDisplayFunc(render);

	GLenum error = glewInit();
	if (error != GLEW_OK)
	{
		fprintf(stderr, "glewInit() error");
		return 1;
	}

	glutMainLoop();
	
	return 0;
}



answered Jan 14, 2015 by avibootz
...