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:
@@ -142,6 +142,8 @@ void RenderView::_InitGL(void)
|
|||||||
void
|
void
|
||||||
RenderView::_CreateScene()
|
RenderView::_CreateScene()
|
||||||
{
|
{
|
||||||
|
LockGL();
|
||||||
|
|
||||||
Texture* texture = new BitmapTexture(
|
Texture* texture = new BitmapTexture(
|
||||||
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "texture"));
|
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "texture"));
|
||||||
|
|
||||||
@@ -187,17 +189,23 @@ RenderView::_CreateScene()
|
|||||||
texture->ReleaseReference();
|
texture->ReleaseReference();
|
||||||
|
|
||||||
fMainCamera = new Camera(Vector3(0, 0, 0), Quaternion(0, 0, 0, 1), 50);
|
fMainCamera = new Camera(Vector3(0, 0, 0), Quaternion(0, 0, 0, 1), 50);
|
||||||
|
|
||||||
|
UnlockGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RenderView::_DeleteScene()
|
RenderView::_DeleteScene()
|
||||||
{
|
{
|
||||||
|
LockGL();
|
||||||
|
|
||||||
MeshInstanceList::iterator it = fMeshInstances.begin();
|
MeshInstanceList::iterator it = fMeshInstances.begin();
|
||||||
for (; it != fMeshInstances.end(); it++) {
|
for (; it != fMeshInstances.end(); it++) {
|
||||||
delete (*it);
|
delete (*it);
|
||||||
}
|
}
|
||||||
fMeshInstances.clear();
|
fMeshInstances.clear();
|
||||||
|
|
||||||
|
UnlockGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ BitmapTexture::_Load(BBitmap* bitmap) {
|
|||||||
glBindTexture(GL_TEXTURE_2D, fId);
|
glBindTexture(GL_TEXTURE_2D, fId);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_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().Width() + 1,
|
||||||
(int) bitmap->Bounds().Height() + 1,
|
(int) bitmap->Bounds().Height() + 1,
|
||||||
0, GL_BGRA, GL_UNSIGNED_BYTE,
|
0, GL_BGRA, GL_UNSIGNED_BYTE,
|
||||||
|
|||||||
Reference in New Issue
Block a user