Bismillahir Rahmanir Rahim
Assalamualaikum everyone!!
_________________________________
Now i'm showing you how can set a window size, position, title and color in c++ openGL.
we are you using codeblocks for doing compile. if you don't have you can see this tutorials :
http://iubatians.blogspot.com/2015/05/opengl-c-and-glut-using-codeblocks-and.html
Bye the way, our first task is create a project.
In main function:
int main(int iArgc, char** cppArgv) {
glutInit(&iArgc, cppArgv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(650, 350);
glutInitWindowPosition(200, 200);
glutCreateWindow("Bangladesh");
Initialize();
glutDisplayFunc(Draw);
glutMainLoop();
return EXIT_SUCCESS;
}
glutInit(&iArgc, cppArgv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(650, 350);
glutInitWindowPosition(200, 200);
glutCreateWindow("Bangladesh");
Initialize();
glutDisplayFunc(Draw);
glutMainLoop();
return EXIT_SUCCESS;
}
glutInitWindowSize(width , height ); this function defined your window size width and height
you can adjust this on your screen as you needed.
note: width and height in pixels
glutInitWindowPosition(X, Y); this function defined your window position where it will be appear the window when you run the project.
note: width and height in pixels
glutInitWindowPosition(X, Y); this function defined your window position where it will be appear the window when you run the project.
Window X location in pixels
Window Y location in pixels
Window Y location in pixels
glutCreateWindow("here put your window title"); this function defined your window title.
now the last one is change the window color....
go Initialize() function. Under this function write a function
glClearColor(GLfloat red,,
GLfloat green,
GLfloat blue,
GLfloat alpha);
here alpha must be less than equal 1. you can take color code from here click
Download complete code
now the last one is change the window color....
go Initialize() function. Under this function write a function
glClearColor(GLfloat red,,
GLfloat green,
GLfloat blue,
GLfloat alpha);
here alpha must be less than equal 1. you can take color code from here click
Download complete code