Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
4bf891db
Kaydet (Commit)
4bf891db
authored
Kas 18, 2014
tarafından
Jan Holesovsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
windows opengl: Share the contexts as we do on Linux.
Change-Id: Ic58cca612cdf8f73170c18573917465bf34a187c
üst
e6592aaa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
6 deletions
+41
-6
OpenGLContext.hxx
include/vcl/opengl/OpenGLContext.hxx
+1
-0
OpenGLContext.cxx
vcl/source/opengl/OpenGLContext.cxx
+40
-6
No files found.
include/vcl/opengl/OpenGLContext.hxx
Dosyayı görüntüle @
4bf891db
...
...
@@ -31,6 +31,7 @@
#if defined( _WIN32 )
#include <GL/glext.h>
#include <GL/wglew.h>
#include <GL/wglext.h>
#elif defined( MACOSX )
#include <OpenGL/OpenGL.h>
...
...
vcl/source/opengl/OpenGLContext.cxx
Dosyayı görüntüle @
4bf891db
...
...
@@ -29,8 +29,11 @@
using
namespace
com
::
sun
::
star
;
// TODO use rtl::Static instead of 'static'
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
static
std
::
vector
<
GLXContext
>
vShareList
;
static
std
::
vector
<
GLXContext
>
vShareList
;
#elif defined(WNT)
static
std
::
vector
<
HGLRC
>
vShareList
;
#endif
GLWindow
::~
GLWindow
()
...
...
@@ -58,6 +61,8 @@ OpenGLContext::~OpenGLContext()
#if defined( WNT )
if
(
m_aGLWin
.
hRC
)
{
vShareList
.
erase
(
std
::
remove
(
vShareList
.
begin
(),
vShareList
.
end
(),
m_aGLWin
.
hRC
));
wglMakeCurrent
(
m_aGLWin
.
hDC
,
0
);
wglDeleteContext
(
m_aGLWin
.
hRC
);
ReleaseDC
(
m_aGLWin
.
hWnd
,
m_aGLWin
.
hDC
);
...
...
@@ -655,13 +660,13 @@ bool OpenGLContext::ImplInit()
if
(
best_fbc
!=
-
1
)
{
int
n
ContextAttribs
[]
=
int
p
ContextAttribs
[]
=
{
GLX_CONTEXT_MAJOR_VERSION_ARB
,
3
,
GLX_CONTEXT_MINOR_VERSION_ARB
,
2
,
None
};
m_aGLWin
.
ctx
=
glXCreateContextAttribsARB
(
m_aGLWin
.
dpy
,
pFBC
[
best_fbc
],
pSharedCtx
,
GL_TRUE
,
n
ContextAttribs
);
m_aGLWin
.
ctx
=
glXCreateContextAttribsARB
(
m_aGLWin
.
dpy
,
pFBC
[
best_fbc
],
pSharedCtx
,
GL_TRUE
,
p
ContextAttribs
);
SAL_INFO_IF
(
m_aGLWin
.
ctx
,
"vcl.opengl"
,
"created a 3.2 core context"
);
}
else
...
...
@@ -825,7 +830,7 @@ bool OpenGLContext::ImplInit()
return
false
;
}
m_aGLWin
.
h
RC
=
wglCreateContext
(
m_aGLWin
.
hDC
);
HGLRC
hTemp
RC
=
wglCreateContext
(
m_aGLWin
.
hDC
);
if
(
m_aGLWin
.
hRC
==
NULL
)
{
ImplWriteLastError
(
GetLastError
(),
"wglCreateContext in OpenGLContext::ImplInit"
);
...
...
@@ -833,19 +838,48 @@ bool OpenGLContext::ImplInit()
return
false
;
}
if
(
!
wglMakeCurrent
(
m_aGLWin
.
hDC
,
m_aGLWin
.
h
RC
))
if
(
!
wglMakeCurrent
(
m_aGLWin
.
hDC
,
hTemp
RC
))
{
ImplWriteLastError
(
GetLastError
(),
"wglMakeCurrent in OpenGLContext::ImplInit"
);
SAL_WARN
(
"vcl.opengl"
,
"wglMakeCurrent failed"
);
return
false
;
}
if
(
!
InitGLEW
())
return
false
;
HGLRC
hSharedCtx
=
0
;
if
(
!
vShareList
.
empty
())
hSharedCtx
=
vShareList
.
front
();
// now setup the shared context; this needs a temporary context already
// set up in order to work
m_aGLWin
.
hRC
=
wglCreateContextAttribsARB
(
m_aGLWin
.
hDC
,
hSharedCtx
,
NULL
);
if
(
m_aGLWin
.
hRC
==
0
)
{
ImplWriteLastError
(
GetLastError
(),
"wglCreateContextAttribsARB in OpenGLContext::ImplInit"
);
SAL_WARN
(
"vcl.opengl"
,
"wglCreateContextAttribsARB failed"
);
return
false
;
}
wglMakeCurrent
(
NULL
,
NULL
);
wglDeleteContext
(
hTempRC
);
if
(
!
wglMakeCurrent
(
m_aGLWin
.
hDC
,
m_aGLWin
.
hRC
))
{
ImplWriteLastError
(
GetLastError
(),
"wglMakeCurrent (with shared context) in OpenGLContext::ImplInit"
);
SAL_WARN
(
"vcl.opengl"
,
"wglMakeCurrent failed"
);
return
false
;
}
vShareList
.
push_back
(
m_aGLWin
.
hRC
);
RECT
clientRect
;
GetClientRect
(
WindowFromDC
(
m_aGLWin
.
hDC
),
&
clientRect
);
m_aGLWin
.
Width
=
clientRect
.
right
-
clientRect
.
left
;
m_aGLWin
.
Height
=
clientRect
.
bottom
-
clientRect
.
top
;
return
InitGLEW
()
;
return
true
;
}
#elif defined( MACOSX )
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment