Tutorial 1 - Setting up an OpenGL Project in Visual Studio 2010

preview_player
Показать описание
This tutorial shows you how to set up an OpenGL project in Visual Studio 2010
Рекомендации по теме
Комментарии
Автор

Code at 1:19 with comments -

#include <gl/glew.h>
#include <gl/freeglut.h>
#include <iostream>

using namespace std;

//Anytime the window is resized, this function gets called. It's setup to the
// "glutReshapeFunc" in main
void changeViewport(int w, int h)
{
glViewport(0, 0, w, h);
}


//This function gets called each the window needs to be redrawn
//It is the "paint" method for our program, and is setup from the glutDisplayFunc in main
void render()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSwapBuffers();
}

int main(int argc, char** argv)
{
//Initialize GLUT
glutInit(&argc, argv);


| GLUT_RGBA | GLUT_DEPTH); //setup some memory buffers for our display
glutInitWindowSize(800, 600); //set the window size
glutCreateWindow("Hello, GL"); //create the window with title "Hello, GL"
//Bind the two functions (above) to respond when necessary

glutDisplayFunc(render);

//Very Important! - This initializes the entry points in the openGL driver so we can
//call all the functions in the API
GLenum err = glewInit();
if (GLEW_OK != err)
{
fprintf(stderr, "GLEW Error");
return 1;
}

glutMainLoop();
return 0;
}

AdarshGupta
Автор

For who want the code used by him. Take below.

#include <gl\glew.h>
#include <gl\freeglut.h>
#include <iostream>

using namespace std;

//Any time the window is resized, this function gets called

void changeViewport(int w, int h) {

glViewport(0, 0, w, h);
}

//Here is the function that gets called each time the window needs.
//It is the paint method for our program

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

int main()
{//initializate GLUT
glutInit(&argc, argv);

//set up some memory bfefers for our display

glutInitDisplayMode(GLUT DOUBLE | GLUT RGBA | GLUT DEPTH);
//Set the window size
glutInitWindowSize(800, 600);
//create the window with the title "hello, gl"
glutCreateWindow("Hello, GL");
//Bind the two functions, above, to respond when necessary

glutDisplayFnc(render);

//very important! TRhis initialize the entry point in the OpenGl DRIVER SO WE CAN
//call all the function in the API.

GLenum err = glewInit();
if (GLEW_OK != err) {
fprint(stderr, "GLEW error");
return 1;
}
//Start up a loop that runs in the background (you never see it)
glutMainLoop();
return 0;
}

unity_with_timoteo
Автор

i can't help myself to say that this is a really great tutorial.I had been looking for a long time for the opengl 3.0 tutorials, but no one explained it efficiently and sufficiently.thanks for sharing.

detectiveking
Автор

definitely one of the best series on opengl out there on the internet now! thanks a lot jeffrey :)

ajsamart
Автор

Awesome stuff man. Well I have been searching all over the internet for recent opengl tutorials. Just by sheer luck I found ur channel. So thank you for the awesome videos. Please keep posting. U just earned a sub my friend :)

AllanJeremy
Автор

thanks for this tutorial! you can usually find tons of tutorials on openGL, but 90% just brush over briefly how to set up the IDE, which for me has caused hours of bashing head against the wall.

Dejawolfs
Автор

This tutuorial is just good. Bravo!!! And many thanks. You give us so much more confidence, and just getting so many people started on this like you have done here gets them past the most critical part, and that is the setup of all of it, so they can start programming.

EddieVanHalen
Автор

its really smart to make tutorial about setting up without linking the code you use and the libary link so people would be sure to download the right thing and using the right code in order to program run and everything be ok

assassin
Автор

Hi - for the files, used the transmission zero site described in the comments below. The version of GLEW doesn't really matter, by the way. The last version I used was 1.9.0 I think. Also, it looks like some folks have been able to get it working in VS 2012 (see below). In general, keep the concepts of paths and linking in mind and then search around the interface until you find similar things.

jeffchastine
Автор

Great Video! It works the same for VS 2013, too! The only difference is that it tells you directly that the .dll files are missing, what is pretty confusing. But, I just continued watching and found out everything, so really, thank you for this little masterpiece! :D

markusa
Автор

Glut is an OpenGL utility that controls things like windowing for each OS (that way OpenGL can be OS independent). Since this was made in 2013 though, you can probably assume v 3.0 will be used

BryanStetson
Автор

Thanks for the tutorial. Where can I download the source code?

MinThantSin
Автор

Sadly i struggled with this .dll linkage for hours until this video. Thanks !!

yorchais
Автор

What version of opengl are you using in your tutorial series?

frahaan
Автор

Thank You soo Much Jeffrey. Been looking for a solution since 4 days and finally found one. Thank you.

hashamnaveed
Автор

I could get the free glut from the repository but it does not have library files that is needed to be linked. Can you help me on this

UdyawarRaghav
Автор

The error means that, during the linking phase (which comes after the compiling phase), it couldn't find glew32.lib. In other words, it's likely a path issue. Make sure you the directory you specify has glew32.lib. Unless you're doing 64-bit compiling, I would avoid using the other versions - though others may want to chime in on that. Also (just a note), most of the time I'm compiling in Debug mode.

jeffchastine
Автор

it would be great that you specify which version of OpenGL it covers.

PanZheng
Автор

Not able to find glew32.dll Could you provide the link to download glew which includes .dll files.

JitendraKumar
Автор

Thanks for the video, much appreciated. If there is one thing that always confuses the heck out of me when I've been out of C++ for quite a while, than it's configuring the external dependencies.

xilconic