preparation to replace glew by glad
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h")) then
|
if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h")) then
|
||||||
links {"GL"}
|
links {"GL"}
|
||||||
else
|
else
|
||||||
print("No GL/gl.h found, using dynamic loading of GL using glew")
|
print("No GL/gl.h found, using dynamic loading of GL using glad")
|
||||||
defines {"GLEW_INIT_OPENGL11_FUNCTIONS=1"}
|
defines {"GLEW_INIT_OPENGL11_FUNCTIONS=1"}
|
||||||
links {"dl"}
|
links {"dl"}
|
||||||
end
|
end
|
||||||
@@ -50,24 +50,20 @@
|
|||||||
configuration {"Windows"}
|
configuration {"Windows"}
|
||||||
defines { "GLEW_STATIC"}
|
defines { "GLEW_STATIC"}
|
||||||
includedirs {
|
includedirs {
|
||||||
projectRootDir .. "examples/ThirdPartyLibs/Glew"
|
projectRootDir .. "examples/ThirdPartyLibs/glad"
|
||||||
}
|
}
|
||||||
files { projectRootDir .. "examples/ThirdPartyLibs/Glew/glew.c"}
|
files { projectRootDir .. "examples/ThirdPartyLibs/glad/glad.c"}
|
||||||
end
|
end
|
||||||
if os.is("Linux") then
|
if os.is("Linux") then
|
||||||
configuration{"Linux"}
|
configuration{"Linux"}
|
||||||
if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h") and os.isfile("/usr/include/GL/glew.h")) then
|
print("Using glad and dynamic loading of glx functions")
|
||||||
links {"GLEW"}
|
|
||||||
print ("linking against system GLEW")
|
|
||||||
else
|
|
||||||
print("Using static glew and dynamic loading of glx functions")
|
|
||||||
defines { "GLEW_STATIC","GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1"}
|
defines { "GLEW_STATIC","GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1"}
|
||||||
includedirs {
|
includedirs {
|
||||||
projectRootDir .. "examples/ThirdPartyLibs/Glew"
|
projectRootDir .. "examples/ThirdPartyLibs/glad"
|
||||||
}
|
}
|
||||||
files { projectRootDir .. "examples/ThirdPartyLibs/Glew/glew.c"}
|
files { projectRootDir .. "examples/ThirdPartyLibs/glad/glad.c",
|
||||||
|
projectRootDir .. "examples/ThirdPartyLibs/glad/glad_glx.c"}
|
||||||
links {"dl"}
|
links {"dl"}
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
configuration{}
|
configuration{}
|
||||||
|
|||||||
Binary file not shown.
@@ -33,7 +33,9 @@ float shadowMapWorldSize=10;
|
|||||||
#else
|
#else
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#ifndef glVertexAttribDivisor
|
#ifndef glVertexAttribDivisor
|
||||||
|
|
||||||
#ifndef NO_GLEW
|
#ifndef NO_GLEW
|
||||||
|
|
||||||
#define glVertexAttribDivisor glVertexAttribDivisorARB
|
#define glVertexAttribDivisor glVertexAttribDivisorARB
|
||||||
#endif //NO_GLEW
|
#endif //NO_GLEW
|
||||||
#endif //glVertexAttribDivisor
|
#endif //glVertexAttribDivisor
|
||||||
|
|||||||
@@ -170,17 +170,19 @@ void dumpInfo(void)
|
|||||||
if (m_resizeCallback)
|
if (m_resizeCallback)
|
||||||
{
|
{
|
||||||
(*m_resizeCallback)(width,height);
|
(*m_resizeCallback)(width,height);
|
||||||
}
|
|
||||||
#ifndef NO_OPENGL3
|
|
||||||
NSRect backingBounds = [self convertRectToBacking:[self bounds]];
|
|
||||||
GLsizei backingPixelWidth = (GLsizei)(backingBounds.size.width),
|
|
||||||
backingPixelHeight = (GLsizei)(backingBounds.size.height);
|
|
||||||
|
|
||||||
// Set viewport
|
#ifndef NO_OPENGL3
|
||||||
glViewport(0, 0, backingPixelWidth, backingPixelHeight);
|
NSRect backingBounds = [self convertRectToBacking:[self bounds]];
|
||||||
#else
|
GLsizei backingPixelWidth = (GLsizei)(backingBounds.size.width),
|
||||||
glViewport(0,0,(GLsizei)width,(GLsizei)height);
|
backingPixelHeight = (GLsizei)(backingBounds.size.height);
|
||||||
|
|
||||||
|
// Set viewport
|
||||||
|
glViewport(0, 0, backingPixelWidth, backingPixelHeight);
|
||||||
|
#else
|
||||||
|
glViewport(0,0,(GLsizei)width,(GLsizei)height);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[m_context setView: self];
|
[m_context setView: self];
|
||||||
@@ -236,7 +238,7 @@ void dumpInfo(void)
|
|||||||
[fmt release];
|
[fmt release];
|
||||||
[m_context makeCurrentContext];
|
[m_context makeCurrentContext];
|
||||||
|
|
||||||
checkError("makeCurrentContext");
|
//checkError("makeCurrentContext");
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) MakeCurrent
|
-(void) MakeCurrent
|
||||||
@@ -420,7 +422,7 @@ int Mac_createWindow(struct MacOpenGLWindowInternalData* m_internalData,struct M
|
|||||||
|
|
||||||
// float newBackingScaleFactor = [m_internalData->m_window backingScaleFactor];
|
// float newBackingScaleFactor = [m_internalData->m_window backingScaleFactor];
|
||||||
|
|
||||||
dumpInfo();
|
//dumpInfo();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,33 +21,7 @@ subject to the following restrictions:
|
|||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#else
|
#else
|
||||||
//think different
|
#include "glad/glad.h"
|
||||||
#if defined(__APPLE__) && !defined (VMDMESA)
|
|
||||||
#include <OpenGL/OpenGL.h>
|
|
||||||
#include <OpenGL/gl.h>
|
|
||||||
#else
|
|
||||||
|
|
||||||
#ifdef GLEW_STATIC
|
|
||||||
#include "CustomGL/glew.h"
|
|
||||||
#else
|
|
||||||
#ifdef NO_GLEW
|
|
||||||
#define GL_GLEXT_LEGACY
|
|
||||||
#include "third_party/GL/gl/include/GL/gl.h"
|
|
||||||
#include "third_party/GL/gl/include/GL/glext.h"
|
|
||||||
#else
|
|
||||||
#include <GL/glew.h>
|
|
||||||
#endif //NO_GLEW
|
|
||||||
#endif //GLEW_STATIC
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
//#include <GL/gl.h>
|
|
||||||
//#include <GL/glu.h>
|
|
||||||
#else
|
|
||||||
//#include <GL/gl.h>
|
|
||||||
//#include <GL/glu.h>
|
|
||||||
#endif //_WINDOWS
|
|
||||||
#endif //APPLE
|
|
||||||
#endif //B3_USE_GLFW
|
#endif //B3_USE_GLFW
|
||||||
//disable glGetError
|
//disable glGetError
|
||||||
//#undef glGetError
|
//#undef glGetError
|
||||||
|
|||||||
@@ -21,56 +21,8 @@ subject to the following restrictions:
|
|||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#else
|
#else
|
||||||
//think different
|
#include "glad/glad.h"
|
||||||
#if defined(__APPLE__) && !defined (VMDMESA)
|
#endif //B3_USE_GLFW
|
||||||
#include <OpenGL/OpenGL.h>
|
|
||||||
//#include <OpenGL/gl.h>
|
|
||||||
//#include <OpenGL/glu.h>
|
|
||||||
//#import <Cocoa/Cocoa.h>
|
|
||||||
#if defined (USE_OPENGL2) || defined (NO_OPENGL3)
|
|
||||||
#include <OpenGL/gl.h>
|
|
||||||
#else
|
|
||||||
#include <OpenGL/gl3.h>
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLEW_STATIC
|
|
||||||
#include "CustomGL/glew.h"
|
|
||||||
#else
|
|
||||||
#ifdef NO_GLEW
|
|
||||||
#define GL_GLEXT_LEGACY
|
|
||||||
#include "third_party/GL/gl/include/GL/gl.h"
|
|
||||||
#include "third_party/GL/gl/include/GL/glext.h"
|
|
||||||
#else
|
|
||||||
#include <GL/glew.h>
|
|
||||||
#endif //NO_GLEW
|
|
||||||
#endif //GLEW_STATIC
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
//#include <GL/gl.h>
|
|
||||||
//#include <GL/glu.h>
|
|
||||||
#else
|
|
||||||
//#include <GL/gl.h>
|
|
||||||
//#include <GL/glu.h>
|
|
||||||
#endif //_WINDOWS
|
|
||||||
#endif //APPLE
|
|
||||||
#endif
|
|
||||||
//disable glGetError
|
|
||||||
//#undef glGetError
|
|
||||||
//#define glGetError MyGetError
|
|
||||||
//
|
|
||||||
//GLenum inline MyGetError()
|
|
||||||
//{
|
|
||||||
// return 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
///on Linux only glDrawElementsInstancedARB is defined?!?
|
|
||||||
//#ifdef __linux
|
|
||||||
//#define glDrawElementsInstanced glDrawElementsInstancedARB
|
|
||||||
//
|
|
||||||
//#endif //__linux
|
|
||||||
|
|
||||||
#endif //__OPENGL_INCLUDE_H
|
#endif //__OPENGL_INCLUDE_H
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ static SimpleOpenGL2App* gApp2=0;
|
|||||||
|
|
||||||
static void Simple2ResizeCallback( float widthf, float heightf)
|
static void Simple2ResizeCallback( float widthf, float heightf)
|
||||||
{
|
{
|
||||||
|
glViewport(0, 0, widthf, heightf);
|
||||||
|
|
||||||
int width = (int)widthf;
|
int width = (int)widthf;
|
||||||
int height = (int)heightf;
|
int height = (int)heightf;
|
||||||
if (gApp2->m_renderer && gApp2->m_window)
|
if (gApp2->m_renderer && gApp2->m_window)
|
||||||
@@ -141,12 +143,15 @@ SimpleOpenGL2App::SimpleOpenGL2App(const char* title, int width, int height)
|
|||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#ifndef B3_USE_GLFW
|
#ifndef B3_USE_GLFW
|
||||||
//some Linux implementations need the 'glewExperimental' to be true
|
//some Linux implementations need the 'glewExperimental' to be true
|
||||||
glewExperimental = GL_TRUE;
|
|
||||||
#endif//B3_USE_GLFW
|
#endif//B3_USE_GLFW
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
#ifndef B3_USE_GLFW
|
#ifndef B3_USE_GLFW
|
||||||
if (glewInit() != GLEW_OK)
|
//gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (glewInit() != GLEW_OK)
|
||||||
{
|
{
|
||||||
b3Error("glewInit failed");
|
b3Error("glewInit failed");
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -156,6 +161,7 @@ SimpleOpenGL2App::SimpleOpenGL2App(const char* title, int width, int height)
|
|||||||
b3Error("GLEW_VERSION_2_1 needs to support 2_1");
|
b3Error("GLEW_VERSION_2_1 needs to support 2_1");
|
||||||
exit(1); // or handle the error in a nicer way
|
exit(1); // or handle the error in a nicer way
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif //B3_USE_GLFW
|
#endif //B3_USE_GLFW
|
||||||
#endif //__APPLE__
|
#endif //__APPLE__
|
||||||
#endif //NO_GLEW
|
#endif //NO_GLEW
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ static SimpleOpenGL3App* gApp=0;
|
|||||||
|
|
||||||
static void SimpleResizeCallback( float widthf, float heightf)
|
static void SimpleResizeCallback( float widthf, float heightf)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int width = (int)widthf;
|
int width = (int)widthf;
|
||||||
int height = (int)heightf;
|
int height = (int)heightf;
|
||||||
if (gApp && gApp->m_instancingRenderer)
|
if (gApp && gApp->m_instancingRenderer)
|
||||||
@@ -285,6 +287,14 @@ struct MyRenderCallbacks : public RenderCallbacks
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void printGLString(const char *name, GLenum s) {
|
||||||
|
const char *v = (const char *) glGetString(s);
|
||||||
|
printf("%s = %s\n",name, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool sOpenGLVerbose = true;
|
||||||
|
|
||||||
|
|
||||||
SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, bool allowRetina)
|
SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, bool allowRetina)
|
||||||
{
|
{
|
||||||
gApp = this;
|
gApp = this;
|
||||||
@@ -308,8 +318,17 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, boo
|
|||||||
|
|
||||||
m_window->setWindowTitle(title);
|
m_window->setWindowTitle(title);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
b3Assert(glGetError() ==GL_NO_ERROR);
|
b3Assert(glGetError() ==GL_NO_ERROR);
|
||||||
|
|
||||||
|
{
|
||||||
|
printGLString("Version", GL_VERSION);
|
||||||
|
printGLString("Vendor", GL_VENDOR);
|
||||||
|
printGLString("Renderer", GL_RENDERER);
|
||||||
|
}
|
||||||
|
|
||||||
glClearColor( m_backgroundColorRGB[0],
|
glClearColor( m_backgroundColorRGB[0],
|
||||||
m_backgroundColorRGB[1],
|
m_backgroundColorRGB[1],
|
||||||
m_backgroundColorRGB[2],
|
m_backgroundColorRGB[2],
|
||||||
@@ -321,7 +340,10 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, boo
|
|||||||
|
|
||||||
b3Assert(glGetError() ==GL_NO_ERROR);
|
b3Assert(glGetError() ==GL_NO_ERROR);
|
||||||
|
|
||||||
#ifndef NO_GLEW
|
//gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_GLEW
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#ifndef B3_USE_GLFW
|
#ifndef B3_USE_GLFW
|
||||||
@@ -337,7 +359,8 @@ SimpleOpenGL3App::SimpleOpenGL3App( const char* title, int width,int height, boo
|
|||||||
exit(1); // or handle the error in a nicer way
|
exit(1); // or handle the error in a nicer way
|
||||||
#endif //B3_USE_GLFW
|
#endif //B3_USE_GLFW
|
||||||
#endif //__APPLE__
|
#endif //__APPLE__
|
||||||
#endif //NO_GLEW
|
#endif //USE_GLEW
|
||||||
|
|
||||||
glGetError();//don't remove this call, it is needed for Ubuntu
|
glGetError();//don't remove this call, it is needed for Ubuntu
|
||||||
|
|
||||||
b3Assert(glGetError() ==GL_NO_ERROR);
|
b3Assert(glGetError() ==GL_NO_ERROR);
|
||||||
|
|||||||
@@ -25,12 +25,6 @@ subject to the following restrictions:
|
|||||||
#include "Win32InternalWindowData.h"
|
#include "Win32InternalWindowData.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static void printGLString(const char *name, GLenum s) {
|
|
||||||
const char *v = (const char *) glGetString(s);
|
|
||||||
printf("%s = %s\n",name, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool sOpenGLVerbose = true;
|
|
||||||
|
|
||||||
void Win32OpenGLWindow::enableOpenGL()
|
void Win32OpenGLWindow::enableOpenGL()
|
||||||
{
|
{
|
||||||
@@ -63,12 +57,7 @@ void Win32OpenGLWindow::enableOpenGL()
|
|||||||
m_data->m_hRC = wglCreateContext( m_data->m_hDC );
|
m_data->m_hRC = wglCreateContext( m_data->m_hDC );
|
||||||
wglMakeCurrent( m_data->m_hDC, m_data->m_hRC );
|
wglMakeCurrent( m_data->m_hDC, m_data->m_hRC );
|
||||||
|
|
||||||
if (sOpenGLVerbose)
|
|
||||||
{
|
|
||||||
printGLString("Version", GL_VERSION);
|
|
||||||
printGLString("Vendor", GL_VENDOR);
|
|
||||||
printGLString("Renderer", GL_RENDERER);
|
|
||||||
}
|
|
||||||
//printGLString("Extensions", GL_EXTENSIONS);
|
//printGLString("Extensions", GL_EXTENSIONS);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -147,6 +136,7 @@ void Win32OpenGLWindow::endRendering()
|
|||||||
|
|
||||||
int Win32OpenGLWindow::fileOpenDialog(char* fileName, int maxFileNameLength)
|
int Win32OpenGLWindow::fileOpenDialog(char* fileName, int maxFileNameLength)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
//wchar_t wideChars[1024];
|
//wchar_t wideChars[1024];
|
||||||
|
|
||||||
OPENFILENAME ofn ;
|
OPENFILENAME ofn ;
|
||||||
@@ -176,9 +166,9 @@ int Win32OpenGLWindow::fileOpenDialog(char* fileName, int maxFileNameLength)
|
|||||||
ofn.Flags = OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST ;
|
ofn.Flags = OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST ;
|
||||||
GetOpenFileName( &ofn );
|
GetOpenFileName( &ofn );
|
||||||
return strlen(fileName);
|
return strlen(fileName);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
//return 0;
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int Win32OpenGLWindow::getWidth() const
|
int Win32OpenGLWindow::getWidth() const
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
sData->m_fullWindowHeight = wr.bottom-wr.top;//LOWORD (lParam) HIWORD (lParam);
|
sData->m_fullWindowHeight = wr.bottom-wr.top;//LOWORD (lParam) HIWORD (lParam);
|
||||||
sData->m_openglViewportWidth = clientRect.right;
|
sData->m_openglViewportWidth = clientRect.right;
|
||||||
sData->m_openglViewportHeight = clientRect.bottom;
|
sData->m_openglViewportHeight = clientRect.bottom;
|
||||||
glViewport(0, 0, sData->m_openglViewportWidth, sData->m_openglViewportHeight);
|
//glViewport(0, 0, sData->m_openglViewportWidth, sData->m_openglViewportHeight);
|
||||||
|
|
||||||
if (sData->m_resizeCallback)
|
if (sData->m_resizeCallback)
|
||||||
(*sData->m_resizeCallback)(sData->m_openglViewportWidth,sData->m_openglViewportHeight);
|
(*sData->m_resizeCallback)(sData->m_openglViewportWidth,sData->m_openglViewportHeight);
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
#include<stdio.h>
|
#include<stdio.h>
|
||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
#ifdef GLEW_STATIC
|
#ifdef GLEW_STATIC
|
||||||
#include "CustomGL/glew.h"
|
#include "glad/glad.h"
|
||||||
#else
|
#else
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#endif//GLEW_STATIC
|
#endif//GLEW_STATIC
|
||||||
|
|
||||||
#ifdef GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS
|
#ifdef GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS
|
||||||
#include "CustomGL/glxew.h"
|
#include "glad/glad_glx.h"
|
||||||
#else
|
#else
|
||||||
#include<GL/glx.h>
|
#include "GL/glx.h"
|
||||||
#endif // GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS
|
#endif // GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@@ -473,20 +473,12 @@ void X11OpenGLWindow::enableOpenGL()
|
|||||||
glXMakeCurrent(m_data->m_dpy, m_data->m_win, m_data->m_glc);
|
glXMakeCurrent(m_data->m_dpy, m_data->m_win, m_data->m_glc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GLEW_INIT_OPENGL11_FUNCTIONS
|
if(!gladLoadGL()) {
|
||||||
{
|
printf("gladLoadGL failed!\n");
|
||||||
GLboolean res = glewOpenGL11Init();
|
exit(-1);
|
||||||
if (res==0)
|
}
|
||||||
{
|
|
||||||
printf("glewOpenGL11Init OK!\n");
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: glewOpenGL11Init failed, exiting!\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //GLEW_INIT_OPENGL11_FUNCTIONS
|
|
||||||
|
|
||||||
const GLubyte* ven = glGetString(GL_VENDOR);
|
const GLubyte* ven = glGetString(GL_VENDOR);
|
||||||
printf("GL_VENDOR=%s\n", ven);
|
printf("GL_VENDOR=%s\n", ven);
|
||||||
@@ -530,18 +522,16 @@ void X11OpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
|
|||||||
|
|
||||||
m_data->m_root = DefaultRootWindow(m_data->m_dpy);
|
m_data->m_root = DefaultRootWindow(m_data->m_dpy);
|
||||||
|
|
||||||
|
|
||||||
#ifdef GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS
|
#ifdef GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS
|
||||||
GLboolean res = glewXInit();
|
|
||||||
if (res==0)
|
int res=gladLoadGLX(m_data->m_dpy,DefaultScreen(m_data->m_dpy));
|
||||||
{
|
if (!res)
|
||||||
printf("glewXInit OK\n");
|
{
|
||||||
} else
|
printf("Error in gladLoadGLX\n");
|
||||||
{
|
exit(0);
|
||||||
fprintf(stderr, "glewXInit failed, exit\n");
|
}
|
||||||
exit(EXIT_FAILURE);
|
#endif
|
||||||
}
|
|
||||||
#endif //GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS
|
|
||||||
|
|
||||||
|
|
||||||
if (ci.m_openglVersion < 3)
|
if (ci.m_openglVersion < 3)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ project ("App_RobotSimulator")
|
|||||||
|
|
||||||
includedirs {"../../src", "../../examples",
|
includedirs {"../../src", "../../examples",
|
||||||
"../../examples/ThirdPartyLibs"}
|
"../../examples/ThirdPartyLibs"}
|
||||||
defines {"PHYSICS_IN_PROCESS_EXAMPLE_BROWSER"}
|
defines {"B3_USE_ROBOTSIM_GUI", "PHYSICS_IN_PROCESS_EXAMPLE_BROWSER"}
|
||||||
|
|
||||||
hasCL = findOpenCL("clew")
|
hasCL = findOpenCL("clew")
|
||||||
|
|
||||||
|
|||||||
@@ -6587,7 +6587,10 @@ bool PhysicsServerCommandProcessor::processSendPhysicsParametersCommand(const st
|
|||||||
clientCmd.m_physSimParamArgs.m_gravityAcceleration[1],
|
clientCmd.m_physSimParamArgs.m_gravityAcceleration[1],
|
||||||
clientCmd.m_physSimParamArgs.m_gravityAcceleration[2]);
|
clientCmd.m_physSimParamArgs.m_gravityAcceleration[2]);
|
||||||
this->m_data->m_dynamicsWorld->setGravity(grav);
|
this->m_data->m_dynamicsWorld->setGravity(grav);
|
||||||
|
#ifndef SKIP_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD
|
||||||
m_data->m_dynamicsWorld->getWorldInfo().m_gravity=grav;
|
m_data->m_dynamicsWorld->getWorldInfo().m_gravity=grav;
|
||||||
|
|
||||||
|
#endif
|
||||||
if (m_data->m_verboseOutput)
|
if (m_data->m_verboseOutput)
|
||||||
{
|
{
|
||||||
b3Printf("Updated Gravity: %f,%f,%f",grav[0],grav[1],grav[2]);
|
b3Printf("Updated Gravity: %f,%f,%f",grav[0],grav[1],grav[2]);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ int main(int argc, char* argv[])
|
|||||||
b3CommandLineArgs myArgs(argc, argv);
|
b3CommandLineArgs myArgs(argc, argv);
|
||||||
|
|
||||||
|
|
||||||
SimpleOpenGLApp* app = new SimpleOpenGLApp("SimpleOpenGL3App", gWidth, gHeight);
|
SimpleOpenGLApp* app = new SimpleOpenGLApp("SimpleOpenGL3App", 1024, 768);
|
||||||
|
|
||||||
app->m_renderer->getActiveCamera()->setCameraDistance(13);
|
app->m_renderer->getActiveCamera()->setCameraDistance(13);
|
||||||
app->m_renderer->getActiveCamera()->setCameraPitch(0);
|
app->m_renderer->getActiveCamera()->setCameraPitch(0);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
|||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
#else
|
#else
|
||||||
#ifdef GLEW_STATIC
|
#ifdef GLEW_STATIC
|
||||||
#include "CustomGL/glew.h"
|
#include "glad/glad.h"
|
||||||
#else
|
#else
|
||||||
#ifdef NO_GLEW
|
#ifdef NO_GLEW
|
||||||
#define GL_GLEXT_LEGACY
|
#define GL_GLEXT_LEGACY
|
||||||
|
|||||||
@@ -1991,7 +1991,7 @@ static void load_GL_VERSION_3_2(GLADloadproc load) {
|
|||||||
glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski");
|
glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski");
|
||||||
}
|
}
|
||||||
static void load_GL_VERSION_3_3(GLADloadproc load) {
|
static void load_GL_VERSION_3_3(GLADloadproc load) {
|
||||||
if(!GLAD_GL_VERSION_3_3) return;
|
//if(!GLAD_GL_VERSION_3_3) return;
|
||||||
glad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)load("glBindFragDataLocationIndexed");
|
glad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)load("glBindFragDataLocationIndexed");
|
||||||
glad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)load("glGetFragDataIndex");
|
glad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)load("glGetFragDataIndex");
|
||||||
glad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load("glGenSamplers");
|
glad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load("glGenSamplers");
|
||||||
|
|||||||
@@ -355,9 +355,8 @@ int main()
|
|||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
//we need glewExperimental on Linux
|
//we need glewExperimental on Linux
|
||||||
glewExperimental = GL_TRUE;
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
glewInit();
|
gladLoadGL();
|
||||||
#endif
|
#endif
|
||||||
#endif //B3_USE_GLFW
|
#endif //B3_USE_GLFW
|
||||||
//we ned to call glGetError twice, because of some Ubuntu/Intel/OpenGL issue
|
//we ned to call glGetError twice, because of some Ubuntu/Intel/OpenGL issue
|
||||||
|
|||||||
Reference in New Issue
Block a user