Astahost.com   Mar 20, 2010
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > C, C++ & Visual C++

Question About Opengl Codes.

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > C, C++ & Visual C++

Question About Opengl Codes.

Feelay
Hey!

I've started to learn windows API programming. And I've been using OpenGL.
I am following a tutorial, But I didn't understand every comment. So I rewrote the code some times to learn it, and made my own comments. Some of the rows have the comment "What do this row do??". I would be happy, if you could explain those rows to me =), please.

And BTW: I am only on the first tutorial. When I start with the others, I am sure I will have more questions. And if someone else have a questions about OpenGl, feel free to ask them here, instead of starting a new topic wink.gif.

PS! The codes I will write here is not mine! (they come from tutorials from a site named swiftless), and I don't know if I should put them in quote tags or code tags. But If they should be in qoute tags, I am sorry.

CODE
#include <GL/gl.h>//include the gl header file
#include <GL/glut.h>//Include the glut header file

void display (void){
     glClearColor(0.0,0.5,0.9,0.8);//BG Color
     glClear (GL_COLOR_BUFFER_BIT);//What do this row do??
     glLoadIdentity();//What do this row do??
     gluLookAt(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0);//Camera Position
     glFlush();//What do this row do??
     }
    
int main (int argc, char **argv){
    glutInit (&argc, argv);//What do this row do??
    glutInitDisplayMode (GLUT_SINGLE);//What do this row do??
    glutInitWindowSize(900,900);//Window Size
    glutInitWindowPosition(0,0);//Window Position
    glutCreateWindow ("Feelay's Fifth;)");//Window Title
    glutDisplayFunc (display); //What do this row do??
    glutMainLoop();//What do this row do??
    return 0; //xD What do this row do :P??
}

 

 

 


Comment/Reply (w/o sign-up)

(G)rizqi
source code c++ openGL for car
Question About Opengl Codes.

do you know source code c++ openGL for car's model??

if you have send to my email...Please

thanks ^^

-question by rizqi


Comment/Reply (w/o sign-up)

wutske
glClear() -> clears the buffer with the color you've set the line before. In other words, it just set the background color of your view (not the right terms to say, but easyest to understand wink.gif )

glLoadIdentity() -> it loads an identity matrix, it's what openGL uses to transform the 3D to 2D.

glFlush() -> flushes the buffer (write everything to the video ram so it can be shown on the screen)

glutInit (&argc, argv) -> initialization for openGL, ignore this, if it works, don't touch it tongue.gif

glutInitDisplayMode (GLUT_SINGLE) -> Google GLUT_SINGLE, it'll explain what it does

glutDisplayFunc (display) -> loads the function display() which configures your openGL view

glutMainLoop() -> tells openGL that this is the main loop. openGL loops through a single function all the time, you'll understand it when you start coding objects that move wink.gif

 

 

 


Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)




See Also,

*SIMILAR VIDEOS*
Searching Video's for question, opengl, codes,
advertisement




Question About Opengl Codes.

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com



Creative Commons License