Haiku3d: fix textures

Textures creation like other OpenGL calls must be inside LockGL/UnlockGL.

Fixes #15246.

Change-Id: Id1f3ae7c04548dba301e5c5ba75a89163c08d69d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2269
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
X512
2020-02-23 07:53:19 +00:00
committed by Adrien Destugues
parent 71680f7b7d
commit 9176b546e3
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -142,6 +142,8 @@ void RenderView::_InitGL(void)
void
RenderView::_CreateScene()
{
LockGL();
Texture* texture = new BitmapTexture(
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "texture"));
@@ -187,17 +189,23 @@ RenderView::_CreateScene()
texture->ReleaseReference();
fMainCamera = new Camera(Vector3(0, 0, 0), Quaternion(0, 0, 0, 1), 50);
UnlockGL();
}
void
RenderView::_DeleteScene()
{
LockGL();
MeshInstanceList::iterator it = fMeshInstances.begin();
for (; it != fMeshInstances.end(); it++) {
delete (*it);
}
fMeshInstances.clear();
UnlockGL();
}
+1 -1
View File
@@ -37,7 +37,7 @@ BitmapTexture::_Load(BBitmap* bitmap) {
glBindTexture(GL_TEXTURE_2D, fId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 4,
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8,
(int) bitmap->Bounds().Width() + 1,
(int) bitmap->Bounds().Height() + 1,
0, GL_BGRA, GL_UNSIGNED_BYTE,