Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files. make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type. This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
@@ -15,10 +15,8 @@ subject to the following restrictions:
|
||||
*/
|
||||
//Originally written by Erwin Coumans
|
||||
|
||||
|
||||
#include "Win32OpenGLWindow.h"
|
||||
|
||||
|
||||
#include "OpenGLInclude.h"
|
||||
|
||||
//#include "Bullet3Common/b3Vector3.h"
|
||||
@@ -29,116 +27,91 @@ subject to the following restrictions:
|
||||
|
||||
void Win32OpenGLWindow::enableOpenGL()
|
||||
{
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
int format;
|
||||
|
||||
|
||||
// get the device context (DC)
|
||||
m_data->m_hDC = GetDC( m_data->m_hWnd );
|
||||
|
||||
m_data->m_hDC = GetDC(m_data->m_hWnd);
|
||||
|
||||
// set the pixel format for the DC
|
||||
ZeroMemory( &pfd, sizeof( pfd ) );
|
||||
pfd.nSize = sizeof( pfd );
|
||||
ZeroMemory(&pfd, sizeof(pfd));
|
||||
pfd.nSize = sizeof(pfd);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 32;
|
||||
pfd.cRedBits = 8;
|
||||
pfd.cGreenBits = 8;
|
||||
pfd.cBlueBits = 8;
|
||||
pfd.cAlphaBits = 8;
|
||||
pfd.cGreenBits = 8;
|
||||
pfd.cBlueBits = 8;
|
||||
pfd.cAlphaBits = 8;
|
||||
|
||||
pfd.cDepthBits = 24;
|
||||
pfd.cStencilBits = 8;//1;
|
||||
pfd.cStencilBits = 8; //1;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
format = ChoosePixelFormat( m_data->m_hDC, &pfd );
|
||||
SetPixelFormat( m_data->m_hDC, format, &pfd );
|
||||
|
||||
format = ChoosePixelFormat(m_data->m_hDC, &pfd);
|
||||
SetPixelFormat(m_data->m_hDC, format, &pfd);
|
||||
|
||||
// create and enable the render context (RC)
|
||||
m_data->m_hRC = wglCreateContext( m_data->m_hDC );
|
||||
wglMakeCurrent( m_data->m_hDC, m_data->m_hRC );
|
||||
|
||||
|
||||
//printGLString("Extensions", GL_EXTENSIONS);
|
||||
m_data->m_hRC = wglCreateContext(m_data->m_hDC);
|
||||
wglMakeCurrent(m_data->m_hDC, m_data->m_hRC);
|
||||
|
||||
//printGLString("Extensions", GL_EXTENSIONS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Win32OpenGLWindow::disableOpenGL()
|
||||
{
|
||||
wglMakeCurrent( NULL, NULL );
|
||||
wglDeleteContext( m_data->m_hRC );
|
||||
// ReleaseDC( m_data->m_hWnd, m_data->m_hDC );
|
||||
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglDeleteContext(m_data->m_hRC);
|
||||
// ReleaseDC( m_data->m_hWnd, m_data->m_hDC );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Win32OpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
|
||||
void Win32OpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
|
||||
{
|
||||
Win32Window::createWindow(ci);
|
||||
|
||||
//VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
|
||||
enableOpenGL();
|
||||
|
||||
if(!gladLoaderLoadGL()) {
|
||||
printf("gladLoaderLoadGL failed!\n");
|
||||
if (!gladLoaderLoadGL())
|
||||
{
|
||||
printf("gladLoaderLoadGL failed!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Win32OpenGLWindow::Win32OpenGLWindow()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
Win32OpenGLWindow::~Win32OpenGLWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Win32OpenGLWindow::closeWindow()
|
||||
void Win32OpenGLWindow::closeWindow()
|
||||
{
|
||||
disableOpenGL();
|
||||
|
||||
Win32Window::closeWindow();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Win32OpenGLWindow::startRendering()
|
||||
void Win32OpenGLWindow::startRendering()
|
||||
{
|
||||
pumpMessage();
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
|
||||
pumpMessage();
|
||||
|
||||
//glCullFace(GL_BACK);
|
||||
//glFrontFace(GL_CCW);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
//glCullFace(GL_BACK);
|
||||
//glFrontFace(GL_CCW);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
|
||||
void Win32OpenGLWindow::renderAllObjects()
|
||||
void Win32OpenGLWindow::renderAllObjects()
|
||||
{
|
||||
}
|
||||
|
||||
void Win32OpenGLWindow::endRendering()
|
||||
{
|
||||
SwapBuffers( m_data->m_hDC );
|
||||
|
||||
void Win32OpenGLWindow::endRendering()
|
||||
{
|
||||
SwapBuffers(m_data->m_hDC);
|
||||
}
|
||||
|
||||
int Win32OpenGLWindow::fileOpenDialog(char* fileName, int maxFileNameLength)
|
||||
@@ -163,7 +136,7 @@ int Win32OpenGLWindow::fileOpenDialog(char* fileName, int maxFileNameLength)
|
||||
ofn.nMaxFile = 1023;
|
||||
//ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
|
||||
ofn.lpstrFilter = "All Files\0*.*\0URDF\0*.urdf\0.bullet\0*.bullet\0";
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
ofn.nFilterIndex =1;
|
||||
@@ -189,10 +162,9 @@ int Win32OpenGLWindow::getHeight() const
|
||||
{
|
||||
if (m_data)
|
||||
return m_data->m_openglViewportHeight;
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif //B3_USE_GLFW
|
||||
|
||||
#endif //B3_USE_GLFW
|
||||
|
||||
Reference in New Issue
Block a user