• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Kurt_duncan

Configure Visual Studio 2010 from ogl 1.1 to ogl 3.x or 4.x

8 posts in this topic

Hello experts,

I learned a bit opengl on version 1.1 . I want to upgrade my knowledge to actual versions but i am facing the first (stupid) problem on that. I am using Visual Studio C++ 2010 on a Windows 7 x64. My graphics card is a nvidia gt540M with latest driver. Well, on my visual studio i only found version 1.1 of opengl under include/GL/ . The gl.h is from the last century, and i think that libopengl32.lib is too. I spent last day looking for how to configure visual studio to use latest opengl versions, but i wasn't able to achieve it.

Please, could someone explain how to get latest gl.h and opengl libraries and configure visual studio to start with latest versions?

Thanks in advance!
0

Share this post


Link to post
Share on other sites
There are no newer files, but you don't need any either. You can see pretty much any tutorial on OpenGL that has anything to do with version 1.2 or later. It will describe how to access later versions.
2

Share this post


Link to post
Share on other sites
Thanks for your fast reply Brother Bob!

I was trying to find a tutorial explaining me how to do that, but they seem to be hidden from me. Please, could you paste any resource explaining how to setup visual studio to use opengl 3.x or 4.x ?

Thanks in advance!
0

Share this post


Link to post
Share on other sites
Anything beyond 1.1 you need to query the function pointer through wglGetProcAddress. Using the library called GLEW is a fairly popular choice for gaining access to newer GL functions with minimal work on your part. If you search for GLEW, you'll likely find other libraries that would work just as well.
1

Share this post


Link to post
Share on other sites
You seem to be talking about two things; using anything beyond version 1.1, and using the features in the modern api (version 3 and later). The former should be in any tutorial (see the first tutorials at nehe.gamedev.net). For tutorials on the modern api you can check the links in the getting started box in the OpenGL subforum. Note that you need the former to do the latter since you will run into the same problems in both cases.
0

Share this post


Link to post
Share on other sites
Thanks to you too beans222.
I downloaded glew 1.8 and i am trying to see this code:

[source lang="cpp"]#include <gl/glew.h>
#include <iostream>
#include <stdlib.h>


using namespace std;

void main(int argc, char** argv)
{
if(glGetString(GL_VERSION) == NULL){
GLenum glError = glGetError();
cout << glError;
}
else{

string version( (const char*)glGetString(GL_VERSION) );
cout << version.data();
}
}[/source]

But i am getting error 1282, invalid operation. It seems that it is because opengl context it is not setted up. How i can do that?

Brother Bob, the nehe tutorials that i saw, are based on opengl 1.1 and they are, in my opinion, very good but very old. When i ask you before about a tutorial, i was thinking on a tutorial that explains how to configure visual studio to uses latest versions of opengl.

Has Glew an implementation of latest versions of opengl or how it works to get functions work? I told that because although i am getting error 1282, visual studio finds functions that are part of latest versions! Like glDrawElements, for example.

Thanks for everything.
0

Share this post


Link to post
Share on other sites
You need to create a context like you were doing before in order for glew to be able to set up all the function pointers (it just calls wglGetProcAddress *a lot*). Then, you use some of the function pointers glew set up to get a GL3 context.
See this (under "Proper Context Creation"): [url="http://www.opengl.org/wiki/Creating_an_OpenGL_Context"]http://www.opengl.org/wiki/Creating_an_OpenGL_Context[/url]

ps. All you need for glew to work is a context and then call glewInit
0

Share this post


Link to post
Share on other sites
I'd recommend using Glee [url="http://www.opengl.org/sdk/libs/GLee/"]http://www.opengl.org/sdk/libs/GLee/[/url] for extension managment in windows, it'll get everything upto 3.0 standards, and relieves the headache of having to setup correct function pointers when you have a valid openGL context, as well makes it easy to determine what openGL version the system is using, and what extensions are supported. Edited by slicer4ever
1

Share this post


Link to post
Share on other sites
[quote name='Kurt_duncan' timestamp='1343582284' post='4964278']
Thanks to you too beans222.
I downloaded glew 1.8 and i am trying to see this code:

[source lang="cpp"]#include <gl/glew.h>
#include <iostream>
#include <stdlib.h>


using namespace std;

void main(int argc, char** argv)
{
if(glGetString(GL_VERSION) == NULL){
GLenum glError = glGetError();
cout << glError;
}
else{

string version( (const char*)glGetString(GL_VERSION) );
cout << version.data();
}
}[/source]

But i am getting error 1282, invalid operation. It seems that it is because opengl context it is not setted up. How i can do that?

Brother Bob, the nehe tutorials that i saw, are based on opengl 1.1 and they are, in my opinion, very good but very old. When i ask you before about a tutorial, i was thinking on a tutorial that explains how to configure visual studio to uses latest versions of opengl.

Has Glew an implementation of latest versions of opengl or how it works to get functions work? I told that because although i am getting error 1282, visual studio finds functions that are part of latest versions! Like glDrawElements, for example.

Thanks for everything.
[/quote]

You need to init GLEW before you do anything...

[code]int kContextFlags = WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
#ifdef _DEBUG
| WGL_CONTEXT_DEBUG_BIT_ARB;
#else
;
#endif
bool Device::Initialize(HWND window)
{
// TODO: assert window is valid, make sure get a valid device context also
this->window = window;
deviceContext = ::GetDC(this->window);
PIXELFORMATDESCRIPTOR pfd = { 0 };
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
pfd.cDepthBits = 32;
pfd.iLayerType = PFD_MAIN_PLANE;
int pixelFormat = ::ChoosePixelFormat(deviceContext, &pfd);
if(pixelFormat == 0)
{
return false;
}
if(SetPixelFormat(deviceContext, pixelFormat, &pfd) == FALSE)
{
return false;
}
HGLRC tempContext = ::wglCreateContext(deviceContext);
::wglMakeCurrent(deviceContext, tempContext);
GLenum result = glewInit();
if(result != GLEW_OK)
{
return false;
}
if(wglewIsSupported("WGL_ARB_create_context") == 1)
{
renderingContext = ::wglCreateContextAttribsARB(deviceContext, NULL, kOpenGLAttribs);
BOOL success = ::wglMakeCurrent(NULL, NULL);
::wglDeleteContext(tempContext);
::wglMakeCurrent(deviceContext, renderingContext);
wglSwapIntervalEXT(1);
SetupDebugOutput();
}
else
{
//renderingContext = tempContext;
return false;
}
GLenum error = glGetError();
glGetIntegerv(GL_MAJOR_VERSION, &OpenGLVersion[0]);
glGetIntegerv(GL_MINOR_VERSION, &OpenGLVersion[1]);
return error == GL_NO_ERROR;
}[/code]
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0