Qt 4.8
qdirectfbglcontext.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qdirectfbglcontext.h"
43 
44 #include <directfbgl.h>
45 
46 #include <QDebug>
47 
49 
51  : m_dfbGlContext(glContext)
52 {
53  DFBResult result;
54  DFBGLAttributes glAttribs;
55  result = m_dfbGlContext->GetAttributes(glContext, &glAttribs);
56  if (result == DFB_OK) {
57  m_windowFormat.setDepthBufferSize(glAttribs.depth_size);
58  m_windowFormat.setStencilBufferSize(glAttribs.stencil_size);
59 
60  m_windowFormat.setRedBufferSize(glAttribs.red_size);
61  m_windowFormat.setGreenBufferSize(glAttribs.green_size);
62  m_windowFormat.setBlueBufferSize(glAttribs.blue_size);
63  m_windowFormat.setAlphaBufferSize(glAttribs.alpha_size);
64 
65  m_windowFormat.setAccumBufferSize(glAttribs.accum_red_size);
66  m_windowFormat.setAlpha(glAttribs.accum_alpha_size);
67 
68  m_windowFormat.setDoubleBuffer(glAttribs.double_buffer);
69  m_windowFormat.setStereo(glAttribs.stereo);
70  }
71 }
72 
74 {
77 }
78 
80 {
83 }
84 
86 {
87  void *proc;
88  DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext,qPrintable(procName),&proc);
89  if (result == DFB_OK)
90  return proc;
91  return 0;
92 }
93 
95 {
96 // m_dfbGlContext->Unlock(m_dfbGlContext); //maybe not in doneCurrent()
97  qDebug() << "Swap buffers";
98 }
99 
101 {
102  return m_windowFormat;
103 }
104 
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void swapBuffers()
Reimplement in subclass to native swap buffers calls.
void setDepthBufferSize(int size)
Set the minimum depth buffer size to size.
void setStereo(bool enable)
If enable is true enables stereo buffering; otherwise disables stereo buffering.
virtual void doneCurrent()
Reimplement in subclass to release current context.
The QPlatformWindowFormat class specifies the display format of an OpenGL rendering context and if po...
void setBlueBufferSize(int size)
Set the preferred blue buffer size to size.
void setStencilBufferSize(int size)
Set the preferred stencil buffer size to size.
The QString class provides a Unicode character string.
Definition: qstring.h:83
void * getProcAddress(const QString &procName)
Reimplement in subclass to native getProcAddr calls.
Q_CORE_EXPORT void qDebug(const char *,...)
void doneCurrent()
Reimplement in subclass to release current context.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void setAccumBufferSize(int size)
Set the preferred accumulation buffer size, where size is the bit depth for each RGBA component...
void setAlphaBufferSize(int size)
Set the preferred alpha buffer size to size.
QPlatformWindowFormat m_windowFormat
virtual void makeCurrent()
Reimplement in subclass to do makeCurrent on native GL context.
void setDoubleBuffer(bool enable)
If enable is true sets double buffering; otherwise sets single buffering.
void makeCurrent()
Reimplement in subclass to do makeCurrent on native GL context.
void setAlpha(bool enable)
If enable is true enables the alpha buffer; otherwise disables the alpha buffer.
void setRedBufferSize(int size)
Set the preferred red buffer size to size.
QPlatformWindowFormat platformWindowFormat() const
QWidget has the function qplatformWindowFormat().
IDirectFBGL * m_dfbGlContext
#define qPrintable(string)
Definition: qglobal.h:1750
void setGreenBufferSize(int size)
Set the preferred green buffer size to size.
QDirectFbGLContext(IDirectFBGL *glContext)