Page MenuHome

OpenGL render broken in Blender2.8
Closed, ResolvedPublic

Description

The opengl render was broken.

To reproduce, just open default cube scene and press opengl render button. You will get a full gray screen.

I have been looking the commits and the error was created in commit 5d6e9f237be3.

I think is related to how the matrix are loaded, but I don't know how to fix it because I don't know new matrix API.

CC: @Mike Erwin (merwin), @Dalai Felinto (dfelinto)

Event Timeline

Apparently the gpu... functions are very similar to gl...
This solves the bug:

----------- source/blender/editors/space_view3d/view3d_draw_legacy.c -----------
index 27e4dec..9544898 100644
@@ -1778,8 +1778,10 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar)
 	glClear(GL_DEPTH_BUFFER_BIT);
 
 	glMatrixMode(GL_PROJECTION);
+	gpuPushMatrix();
 	gpuLoadIdentity();
 	glMatrixMode(GL_MODELVIEW);
+	gpuPushMatrix();
 	gpuLoadIdentity();
 
 	if (scene->world && (v3d->flag3 & V3D_SHOW_WORLD)) {
@@ -1788,6 +1790,11 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar)
 	else {
 		VP_view3d_draw_background_none();
 	}
 
+	glMatrixMode(GL_PROJECTION);
+	gpuPopMatrix();
+	glMatrixMode(GL_MODELVIEW);
+	gpuPopMatrix();
+
 	glEnable(GL_DEPTH_TEST);
 }

But I also do not know the new API well :\ ... I'll leave it for another ;)

Thanks for the report (and tentative fix)! I'll look closer at this today.

The legacy 3D viewport is just for comparison with the new drawing code, and will be removed before 2.8 ships. But yes we should keep it working as much as possible.

Mike Erwin (merwin) changed the task status from Unknown Status to Resolved.Mar 30 2017, 8:25 AM

After reading the manual, I understand the expected behavior better. Rendering the viewport into an image (or image sequence) will still be a feature in 2.8. It needs further design to work with new Clay, Eevee, etc. But I did get the old viewport working again.