Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdirectfbglcontext.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
7#include <directfbgl.h>
8#include <dlfcn.h>
9
10#include <QDebug>
11
12QT_BEGIN_NAMESPACE
13
14QDirectFbGLContext::QDirectFbGLContext(IDirectFBGL *glContext)
15 : m_dfbGlContext(glContext)
16{
17 DFBResult result;
18 DFBGLAttributes glAttribs;
19 result = m_dfbGlContext->GetAttributes(glContext, &glAttribs);
20 if (result == DFB_OK) {
21 m_windowFormat.setDepthBufferSize(glAttribs.depth_size);
22 m_windowFormat.setStencilBufferSize(glAttribs.stencil_size);
23
24 m_windowFormat.setRedBufferSize(glAttribs.red_size);
25 m_windowFormat.setGreenBufferSize(glAttribs.green_size);
26 m_windowFormat.setBlueBufferSize(glAttribs.blue_size);
27 m_windowFormat.setAlphaBufferSize(glAttribs.alpha_size);
28
29 m_windowFormat.setAccumBufferSize(glAttribs.accum_red_size);
30 m_windowFormat.setAlpha(glAttribs.accum_alpha_size);
31
32 m_windowFormat.setDoubleBuffer(glAttribs.double_buffer);
33 m_windowFormat.setStereo(glAttribs.stereo);
34 }
35}
36
37void QDirectFbGLContext::makeCurrent()
38{
39 QPlatformOpenGLContext::makeCurrent();
40 m_dfbGlContext->Lock(m_dfbGlContext);
41}
42
43void QDirectFbGLContext::doneCurrent()
44{
45 QPlatformOpenGLContext::doneCurrent();
46 m_dfbGlContext->Unlock(m_dfbGlContext);
47}
48
49QFunctionPointer QDirectFbGLContext::getProcAddress(const char *procName)
50{
51 void *proc;
52 DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext, procName, &proc);
53 if (result == DFB_OK)
54 return (QFunctionPointer) proc;
55 return dlsym(RTLD_DEFAULT, procName);
56}
57
58void QDirectFbGLContext::swapBuffers()
59{
60// m_dfbGlContext->Unlock(m_dfbGlContext); //maybe not in doneCurrent()
61 qDebug("Swap buffers");
62}
63
64QPlatformWindowFormat QDirectFbGLContext::platformWindowFormat() const
65{
66 return m_windowFormat;
67}
68
69QT_END_NAMESPACE