Browse Source

Whitespace

pull/83/head
falkTX 6 years ago
parent
commit
d2c6e7df2a
2 changed files with 76 additions and 76 deletions
  1. +6
    -6
      dgl/src/pugl/pugl_win.cpp
  2. +70
    -70
      dgl/src/pugl/pugl_x11.c

+ 6
- 6
dgl/src/pugl/pugl_win.cpp View File

@@ -76,17 +76,17 @@ puglInitInternals()
void void
puglEnterContext(PuglView* view) puglEnterContext(PuglView* view)
{ {
wglMakeCurrent(view->impl->hdc, view->impl->hglrc);
wglMakeCurrent(view->impl->hdc, view->impl->hglrc);
} }


void void
puglLeaveContext(PuglView* view, bool flush) puglLeaveContext(PuglView* view, bool flush)
{ {
if (flush) {
glFlush();
SwapBuffers(view->impl->hdc);
}
wglMakeCurrent(NULL, NULL);
if (flush) {
glFlush();
SwapBuffers(view->impl->hdc);
}
wglMakeCurrent(NULL, NULL);
} }


int int


+ 70
- 70
dgl/src/pugl/pugl_x11.c View File

@@ -62,66 +62,66 @@ getVisual(PuglView* view)
PuglInternals* const impl = view->impl; PuglInternals* const impl = view->impl;
XVisualInfo* vi = NULL; XVisualInfo* vi = NULL;


/**
Attributes for single-buffered RGBA with at least
4 bits per color and a 16 bit depth buffer.
*/
int attrListSgl[] = {
GLX_RGBA,
GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4,
GLX_DEPTH_SIZE, 16,
GLX_ARB_multisample, 1,
None
};
/**
Attributes for double-buffered RGBA with at least
4 bits per color and a 16 bit depth buffer.
*/
int attrListDbl[] = {
GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4,
GLX_DEPTH_SIZE, 16,
GLX_ARB_multisample, 1,
None
};
/**
Attributes for double-buffered RGBA with multi-sampling
(antialiasing)
*/
int attrListDblMS[] = {
GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4,
GLX_ALPHA_SIZE, 4,
GLX_DEPTH_SIZE, 16,
GLX_SAMPLE_BUFFERS, 1,
GLX_SAMPLES, 4,
None
};
impl->doubleBuffered = True;
vi = glXChooseVisual(impl->display, impl->screen, attrListDblMS);
if (vi == NULL) {
vi = glXChooseVisual(impl->display, impl->screen, attrListDbl);
PUGL_LOG("multisampling (antialiasing) is not available\n");
}
/**
Attributes for single-buffered RGBA with at least
4 bits per color and a 16 bit depth buffer.
*/
int attrListSgl[] = {
GLX_RGBA,
GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4,
GLX_DEPTH_SIZE, 16,
GLX_ARB_multisample, 1,
None
};
/**
Attributes for double-buffered RGBA with at least
4 bits per color and a 16 bit depth buffer.
*/
int attrListDbl[] = {
GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4,
GLX_DEPTH_SIZE, 16,
GLX_ARB_multisample, 1,
None
};
/**
Attributes for double-buffered RGBA with multi-sampling
(antialiasing)
*/
int attrListDblMS[] = {
GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4,
GLX_ALPHA_SIZE, 4,
GLX_DEPTH_SIZE, 16,
GLX_SAMPLE_BUFFERS, 1,
GLX_SAMPLES, 4,
None
};
impl->doubleBuffered = True;
vi = glXChooseVisual(impl->display, impl->screen, attrListDblMS);
if (vi == NULL) {
vi = glXChooseVisual(impl->display, impl->screen, attrListDbl);
PUGL_LOG("multisampling (antialiasing) is not available\n");
}


if (vi == NULL) {
vi = glXChooseVisual(impl->display, impl->screen, attrListSgl);
impl->doubleBuffered = False;
PUGL_LOG("singlebuffered rendering will be used, no doublebuffering available\n");
}
if (vi == NULL) {
vi = glXChooseVisual(impl->display, impl->screen, attrListSgl);
impl->doubleBuffered = False;
PUGL_LOG("singlebuffered rendering will be used, no doublebuffering available\n");
}


return vi; return vi;
} }
@@ -131,8 +131,8 @@ createContext(PuglView* view, XVisualInfo* vi)
{ {
PuglInternals* const impl = view->impl; PuglInternals* const impl = view->impl;


impl->ctx = glXCreateContext(impl->display, vi, 0, GL_TRUE);
return (impl->ctx != NULL);
impl->ctx = glXCreateContext(impl->display, vi, 0, GL_TRUE);
return (impl->ctx != NULL);
} }


static void static void
@@ -140,26 +140,26 @@ destroyContext(PuglView* view)
{ {
PuglInternals* const impl = view->impl; PuglInternals* const impl = view->impl;


glXDestroyContext(impl->display, impl->ctx);
impl->ctx = NULL;
glXDestroyContext(impl->display, impl->ctx);
impl->ctx = NULL;
} }


void void
puglEnterContext(PuglView* view) puglEnterContext(PuglView* view)
{ {
glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx);
glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx);
} }


void void
puglLeaveContext(PuglView* view, bool flush) puglLeaveContext(PuglView* view, bool flush)
{ {
if (flush) {
glFlush();
if (view->impl->doubleBuffered) {
glXSwapBuffers(view->impl->display, view->impl->win);
}
if (flush) {
glFlush();
if (view->impl->doubleBuffered) {
glXSwapBuffers(view->impl->display, view->impl->win);
} }
glXMakeCurrent(view->impl->display, None, NULL);
}
glXMakeCurrent(view->impl->display, None, NULL);
} }


int int


Loading…
Cancel
Save