gsdx-ogl: LINUX-ONLY * Fix context creation. Get opengl working with nvidia graphics cards.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/gsdx-ogl@4984 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2011-12-10 11:56:34 +00:00
parent afdb2dadc3
commit e6057b765f
2 changed files with 31 additions and 14 deletions

View File

@ -52,7 +52,7 @@
// glBindBufferBase(GL_UNIFORM_BUFFER, block_binding_point, some_buffer_object); // glBindBufferBase(GL_UNIFORM_BUFFER, block_binding_point, some_buffer_object);
// glUniformBlockBinding(program, block_index, block_binding_point); // glUniformBlockBinding(program, block_index, block_binding_point);
//#define LOUD_DEBUGGING
GSDeviceOGL::GSDeviceOGL() GSDeviceOGL::GSDeviceOGL()
: m_free_window(false) : m_free_window(false)
, m_window(NULL) , m_window(NULL)
@ -179,6 +179,11 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
// **************************************************************** // ****************************************************************
// convert // convert
// **************************************************************** // ****************************************************************
// There isn't a default VAO in newer versions of OpenGL, so create one.
unsigned int vao = 0;
glGenVertexArrays(1,&vao);
glBindVertexArray(vao);
GSInputLayout il_convert[2] = GSInputLayout il_convert[2] =
{ {
@ -1206,7 +1211,7 @@ void GSDeviceOGL::DebugOutputToFile(unsigned int source, unsigned int type, unsi
else if(type == GL_DEBUG_TYPE_OTHER_ARB) else if(type == GL_DEBUG_TYPE_OTHER_ARB)
strcpy(debType, "Other"); strcpy(debType, "Other");
else else
strcpy(debType, "UNKNOW"); strcpy(debType, "UNKNOWN");
if(severity == GL_DEBUG_SEVERITY_HIGH_ARB) if(severity == GL_DEBUG_SEVERITY_HIGH_ARB)
strcpy(debSev, "High"); strcpy(debSev, "High");
@ -1215,7 +1220,9 @@ void GSDeviceOGL::DebugOutputToFile(unsigned int source, unsigned int type, unsi
else if(severity == GL_DEBUG_SEVERITY_LOW_ARB) else if(severity == GL_DEBUG_SEVERITY_LOW_ARB)
strcpy(debSev, "Low"); strcpy(debSev, "Low");
//fprintf(stderr,"Type:%s\tID:%d\tSeverity:%s\tMessage:%s\n", debType,id,debSev,message); #ifdef LOUD_DEBUGGING
fprintf(stderr,"Type:%s\tID:%d\tSeverity:%s\tMessage:%s\n", debType,id,debSev,message);
#endif
FILE* f = fopen("Debug.txt","a"); FILE* f = fopen("Debug.txt","a");
if(f) if(f)

View File

@ -338,15 +338,26 @@ bool GSWnd::Attach(void* handle, bool managed)
if (m_renderer != 2) { if (m_renderer != 2) {
m_XDisplay = XOpenDisplay(NULL); m_XDisplay = XOpenDisplay(NULL);
// Get visual information if ( !m_XDisplay )
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, {
GLX_RED_SIZE, 8, fprintf( stderr, "Failed to open X display\n" );
GLX_GREEN_SIZE, 8, exit(1);
GLX_BLUE_SIZE, 8, }
GLX_DEPTH_SIZE, 24,
None // Get visual information
}; static int attrListDbl[] =
{
GLX_X_RENDERABLE , True,
GLX_DRAWABLE_TYPE , GLX_WINDOW_BIT,
GLX_RENDER_TYPE , GLX_RGBA_BIT,
GLX_RED_SIZE , 8,
GLX_GREEN_SIZE , 8,
GLX_BLUE_SIZE , 8,
GLX_DEPTH_SIZE , 24,
GLX_DOUBLEBUFFER , True,
None
};
PFNGLXCHOOSEFBCONFIGPROC glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC) glXGetProcAddress((GLubyte *) "glXChooseFBConfig"); PFNGLXCHOOSEFBCONFIGPROC glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC) glXGetProcAddress((GLubyte *) "glXChooseFBConfig");
int fbcount = 0; int fbcount = 0;
GLXFBConfig *fbc = glXChooseFBConfig(m_XDisplay, DefaultScreen(m_XDisplay), attrListDbl, &fbcount); GLXFBConfig *fbc = glXChooseFBConfig(m_XDisplay, DefaultScreen(m_XDisplay), attrListDbl, &fbcount);
@ -364,7 +375,7 @@ bool GSWnd::Attach(void* handle, bool managed)
// FIXME : Request a debug context to ease opengl development // FIXME : Request a debug context to ease opengl development
// Note: don't support deprecated feature (pre openg 3.1) // Note: don't support deprecated feature (pre openg 3.1)
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
0 None
}; };
m_context = glXCreateContextAttribsARB(m_XDisplay, fbc[0], 0, true, context_attribs); m_context = glXCreateContextAttribsARB(m_XDisplay, fbc[0], 0, true, context_attribs);
XSync( m_XDisplay, false); XSync( m_XDisplay, false);
@ -382,7 +393,6 @@ bool GSWnd::Attach(void* handle, bool managed)
} }
return true; return true;
} }