Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 01 Dec 2009
Offline Last Active Jul 17 2013 09:00 AM

Posts I've Made

In Topic: What does 2.5D actually mean?

21 March 2013 - 09:15 AM

It's a horrible term that I first saw used in relation to games with 2D gameplay but 3D graphics. The term seemed to become really common when Nights into Dreams was released on the Sega Saturn.

In Topic: Namespaces good for anything else?

04 December 2012 - 11:07 AM

I don't really like seeing namespaces to break down subsystems in C++ projects. Similarly, I don't think there is a need for nested namespaces.

That said, I use a single top level namespace for each project I work on and heavy use of anonymous namespaces for implementation hiding.

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

30 July 2012 - 08:19 AM

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.

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

#ifdef _DEBUG
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);
	    pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
	    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);
			    ::wglMakeCurrent(deviceContext, renderingContext);
			    //renderingContext = tempContext;
	  return false;
	   GLenum error = glGetError();
	   glGetIntegerv(GL_MAJOR_VERSION, &OpenGLVersion[0]);
	   glGetIntegerv(GL_MINOR_VERSION, &OpenGLVersion[1]);
	    return error == GL_NO_ERROR;

In Topic: Interleaved Arrays

17 July 2012 - 03:16 AM

I use 3.2 Core for compatibility with OSX 10.7 but on that version at least, Vertex Array Objects are required. Perhaps this is true of 4.x?

They are similar to Input Layouts in D3D10+ or FVFs in D3D9 in that they describe the data you're passing to the pipeline. In the case of VAOs, you just create and bind a VAO, get the indices of your attributes and bind them with the correct offsets.

In Topic: Overusing smart pointers?

18 June 2012 - 03:56 AM

3) unique_ptr .. which is like 2 but if you are willing to write unique_ptr<blabla>, .get() and all that nonsense over and over again to AVOID 1 SINGLE CALL TO "delete" in your destructor.

Somewhat agree, somewhat disagree with this point.

I don't use exceptions in my C++, but using a unique or scoped pointer makes your code more exception safe.

Even if you don't use exceptions, for allocations within a function, it take out a lot of the programmer overhead of memory management. Then, for consistency's sake, I use scoped pointer wrapper for member variables too.

I do agree that littering code with myPtr.get() is a bit of a pain in the neck though!