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
8c39739a
Kaydet (Commit)
8c39739a
authored
May 20, 2014
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add method for creating framebuffer objects to OpenGLHelper
Change-Id: I08bd2e58ee98a68accae256fcbcc288a8c56ae0b
üst
e634b0dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
OpenGLHelper.hxx
include/vcl/opengl/OpenGLHelper.hxx
+7
-0
OpenGLHelper.cxx
vcl/source/opengl/OpenGLHelper.cxx
+36
-0
No files found.
include/vcl/opengl/OpenGLHelper.hxx
Dosyayı görüntüle @
8c39739a
...
...
@@ -29,6 +29,13 @@ public:
static
void
renderToFile
(
long
nWidth
,
long
nHeight
,
const
OUString
&
rFileName
);
static
const
char
*
GLErrorString
(
GLenum
errorCode
);
/**
* The caller is responsible for deleting the buffer objects identified by
* nFramebufferId, nRenderbufferId and nTexturebufferId
*/
static
void
createFramebuffer
(
long
nWidth
,
long
nHeight
,
GLuint
&
nFramebufferId
,
GLuint
&
nRenderbufferId
,
GLuint
&
nTexturebufferId
);
};
VCLOPENGL_DLLPUBLIC
std
::
ostream
&
operator
<<
(
std
::
ostream
&
rStrm
,
const
glm
::
mat4
&
rMatrix
);
...
...
vcl/source/opengl/OpenGLHelper.cxx
Dosyayı görüntüle @
8c39739a
...
...
@@ -268,5 +268,41 @@ std::ostream& operator<<(std::ostream& rStrm, const glm::mat4& rMatrix)
return
rStrm
;
}
void
OpenGLHelper
::
createFramebuffer
(
long
nWidth
,
long
nHeight
,
GLuint
&
nFramebufferId
,
GLuint
&
nRenderbufferId
,
GLuint
&
nTexturebufferId
)
{
// create a renderbuffer
glGenRenderbuffers
(
1
,
&
nRenderbufferId
);
glBindRenderbuffer
(
GL_RENDERBUFFER
,
nRenderbufferId
);
glRenderbufferStorage
(
GL_RENDERBUFFER
,
GL_DEPTH_COMPONENT
,
nWidth
,
nHeight
);
glBindRenderbuffer
(
GL_RENDERBUFFER
,
0
);
// create a texture
glGenTextures
(
1
,
&
nTexturebufferId
);
glBindTexture
(
GL_TEXTURE_2D
,
nTexturebufferId
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_S
,
GL_CLAMP
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_T
,
GL_CLAMP
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_NEAREST
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_NEAREST
);
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
GL_RGBA
,
nWidth
,
nHeight
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
NULL
);
glBindTexture
(
GL_TEXTURE_2D
,
0
);
// create a framebuffer object and attach renderbuffer and texture
glGenFramebuffers
(
1
,
&
nFramebufferId
);
glCheckFramebufferStatus
(
GL_FRAMEBUFFER
);
glBindFramebuffer
(
GL_FRAMEBUFFER
,
nFramebufferId
);
glBindTexture
(
GL_TEXTURE_2D
,
nTexturebufferId
);
// attach a texture to FBO color attachement point
glFramebufferTexture2D
(
GL_FRAMEBUFFER
,
GL_COLOR_ATTACHMENT0
,
GL_TEXTURE_2D
,
nTexturebufferId
,
0
);
glCheckFramebufferStatus
(
GL_FRAMEBUFFER
);
glBindTexture
(
GL_TEXTURE_2D
,
0
);
// attach a renderbuffer to depth attachment point
glBindRenderbuffer
(
GL_RENDERBUFFER
,
nRenderbufferId
);
glFramebufferRenderbuffer
(
GL_FRAMEBUFFER
,
GL_DEPTH_ATTACHMENT
,
GL_RENDERBUFFER
,
nRenderbufferId
);
glCheckFramebufferStatus
(
GL_FRAMEBUFFER
);
glBindRenderbuffer
(
GL_RENDERBUFFER
,
0
);
glBindFramebuffer
(
GL_FRAMEBUFFER
,
0
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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