enable option to use GLFW, instead of our own cross-platform X11/Cocoa/Windows OpenGLWindow classes
This commit is contained in:
@@ -28,7 +28,9 @@ float shadowMapWorldSize=10;
|
||||
#include "OpenGLInclude.h"
|
||||
#include "../CommonInterfaces/CommonWindowInterface.h"
|
||||
//#include "Bullet3Common/b3MinMax.h"
|
||||
#ifdef B3_USE_GLFW
|
||||
|
||||
#else
|
||||
#ifndef __APPLE__
|
||||
#ifndef glVertexAttribDivisor
|
||||
#ifndef NO_GLEW
|
||||
@@ -44,6 +46,7 @@ float shadowMapWorldSize=10;
|
||||
#endif //NO_GLEW
|
||||
#endif
|
||||
#endif //__APPLE__
|
||||
#endif//B3_USE_GLFW
|
||||
#include "GLInstancingRenderer.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -17,7 +17,10 @@ subject to the following restrictions:
|
||||
#ifndef __OPENGL_INCLUDE_H
|
||||
#define __OPENGL_INCLUDE_H
|
||||
|
||||
|
||||
#ifdef B3_USE_GLFW
|
||||
#include "glad/glad.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
#else
|
||||
//think different
|
||||
#if defined(__APPLE__) && !defined (VMDMESA)
|
||||
#include <OpenGL/OpenGL.h>
|
||||
@@ -45,7 +48,7 @@ subject to the following restrictions:
|
||||
//#include <GL/glu.h>
|
||||
#endif //_WINDOWS
|
||||
#endif //APPLE
|
||||
|
||||
#endif //B3_USE_GLFW
|
||||
//disable glGetError
|
||||
//#undef glGetError
|
||||
//#define glGetError MyGetError
|
||||
|
||||
@@ -17,7 +17,10 @@ subject to the following restrictions:
|
||||
#ifndef __OPENGL_INCLUDE_H
|
||||
#define __OPENGL_INCLUDE_H
|
||||
|
||||
|
||||
#ifdef B3_USE_GLFW
|
||||
#include <glad/glad.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#else
|
||||
//think different
|
||||
#if defined(__APPLE__) && !defined (VMDMESA)
|
||||
#include <OpenGL/OpenGL.h>
|
||||
@@ -31,6 +34,7 @@ subject to the following restrictions:
|
||||
#endif
|
||||
#else
|
||||
|
||||
|
||||
#ifdef GLEW_STATIC
|
||||
#include "CustomGL/glew.h"
|
||||
#else
|
||||
@@ -52,7 +56,7 @@ subject to the following restrictions:
|
||||
//#include <GL/glu.h>
|
||||
#endif //_WINDOWS
|
||||
#endif //APPLE
|
||||
|
||||
#endif
|
||||
//disable glGetError
|
||||
//#undef glGetError
|
||||
//#define glGetError MyGetError
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
#include "stdlib.h"
|
||||
#include "TwFonts.h"
|
||||
#include "SimpleOpenGL2Renderer.h"
|
||||
|
||||
#ifdef B3_USE_GLFW
|
||||
#include "GLFWOpenGLWindow.h"
|
||||
#else
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "MacOpenGLWindow.h"
|
||||
#else
|
||||
@@ -30,6 +35,8 @@
|
||||
#endif //BT_USE_EGL
|
||||
#endif //_WIN32
|
||||
#endif//__APPLE__
|
||||
#endif //#ifdef B3_USE_GLFW
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../CommonInterfaces/CommonRenderInterface.h"
|
||||
|
||||
@@ -129,7 +136,7 @@ SimpleOpenGL2App::SimpleOpenGL2App(const char* title, int width, int height)
|
||||
glewExperimental = GL_TRUE;
|
||||
#endif //_WIN32
|
||||
|
||||
|
||||
#ifndef B3_USE_GLFW
|
||||
if (glewInit() != GLEW_OK)
|
||||
{
|
||||
b3Error("glewInit failed");
|
||||
@@ -140,7 +147,7 @@ SimpleOpenGL2App::SimpleOpenGL2App(const char* title, int width, int height)
|
||||
b3Error("GLEW_VERSION_2_1 needs to support 2_1");
|
||||
exit(1); // or handle the error in a nicer way
|
||||
}
|
||||
|
||||
#endif //B3_USE_GLFW
|
||||
#endif //__APPLE__
|
||||
#endif //NO_GLEW
|
||||
|
||||
@@ -580,4 +587,4 @@ int SimpleOpenGL2App::registerCubeShape(float halfExtentsX,float halfExtentsY, f
|
||||
|
||||
int shapeId = m_renderer->registerShape(&verts[0].xyzw[0],numVertices,cube_indices,numIndices,B3_GL_TRIANGLES,textureIndex);
|
||||
return shapeId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
#include "SimpleOpenGL3App.h"
|
||||
#include "ShapeData.h"
|
||||
|
||||
|
||||
#ifdef B3_USE_GLFW
|
||||
#include "GLFWOpenGLWindow.h"
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
#include "MacOpenGLWindow.h"
|
||||
#else
|
||||
@@ -19,6 +24,8 @@
|
||||
#endif //BT_USE_EGL
|
||||
#endif //_WIN32
|
||||
#endif//__APPLE__
|
||||
#endif //B3_USE_GLFW
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "GLPrimitiveRenderer.h"
|
||||
@@ -321,12 +328,12 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, boo
|
||||
glewExperimental = GL_TRUE;
|
||||
#endif //_WIN32
|
||||
|
||||
|
||||
#ifndef B3_USE_GLFW
|
||||
if (glewInit() != GLEW_OK)
|
||||
exit(1); // or handle the error in a nicer way
|
||||
if (!GLEW_VERSION_2_1) // check that the machine supports the 2.1 API.
|
||||
exit(1); // or handle the error in a nicer way
|
||||
|
||||
#endif //B3_USE_GLFW
|
||||
#endif //__APPLE__
|
||||
#endif //NO_GLEW
|
||||
glGetError();//don't remove this call, it is needed for Ubuntu
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#ifndef B3_USE_GLFW
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
Copyright (c) 2012 Advanced Micro Devices, Inc.
|
||||
@@ -196,5 +197,5 @@ int Win32OpenGLWindow::getHeight() const
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif //B3_USE_GLFW
|
||||
@@ -1281,9 +1281,13 @@ bool CMainApplication::SetupTexturemaps()
|
||||
|
||||
#ifdef WIN32
|
||||
GLfloat fLargest;
|
||||
|
||||
#ifdef B3_USE_GLFW
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY, &fLargest);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY, fLargest);
|
||||
#else
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &fLargest);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, fLargest);
|
||||
#endif
|
||||
#endif
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
|
||||
@@ -2295,9 +2299,14 @@ bool CGLRenderModel::BInit( const vr::RenderModel_t & vrModel, const vr::RenderM
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
|
||||
#ifdef _WIN32
|
||||
GLfloat fLargest;
|
||||
#ifdef B3_USE_GLFW
|
||||
glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY, &fLargest );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY, fLargest );
|
||||
#else
|
||||
glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &fLargest );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, fLargest );
|
||||
#endif
|
||||
#endif //B3_USE_GLFW
|
||||
#endif//_WIN32
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
|
||||
m_unVertexCount = vrModel.unTriangleCount * 3;
|
||||
@@ -2388,6 +2397,7 @@ int main(int argc, char *argv[])
|
||||
if (gVideoFileName)
|
||||
pMainApplication->getApp()->dumpFramesToVideo(gVideoFileName);
|
||||
|
||||
#ifndef B3_USE_GLFW
|
||||
#ifdef _WIN32
|
||||
//request disable VSYNC
|
||||
typedef bool (APIENTRY *PFNWGLSWAPINTERVALFARPROC)(int);
|
||||
@@ -2397,7 +2407,7 @@ int main(int argc, char *argv[])
|
||||
if (wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(0);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
GLint sync = 0;
|
||||
CGLContextObj ctx = CGLGetCurrentContext();
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#include "Gwen/Texture.h"
|
||||
|
||||
#include <math.h>
|
||||
#ifdef B3_USE_GLFW
|
||||
#include "glad/glad.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
#else
|
||||
|
||||
#if defined(__APPLE__) && !defined (VMDMESA)
|
||||
#include <OpenGL/OpenGL.h>
|
||||
@@ -22,6 +26,7 @@
|
||||
#endif //NO_GLEW
|
||||
#endif //GLEW_STATIC
|
||||
#endif//(__APPLE__)
|
||||
#endif
|
||||
|
||||
#include "FontData.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user