View Issue Details

IDProjectCategoryView StatusLast Update
0002396FSSCPOpenGLpublic2021-01-09 21:32
Reportercasual pilot Assigned ToZacam  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionsuspended 
Product Version3.6.12 
Summary0002396: Jump node rendering very slow
DescriptionThe jump node wireframe model renders very slowly, dropping the frame rate to approximately 1 fps.
Additional InformationLinux, r200 DRI driver (Radeon 9250)

I tried setting the MR_SHOW_OUTLINE_HTL flag (see patch). That fixes the speed issue but causes incorrect rendering when the jump node activates.
TagsNo tags attached.

Relationships

related to 0002676 resolvedZacam FRED "Show Outlines" rendering mode exceptionally slow. 

Activities

2011-02-09 20:10

 

fso-jumpy.patch (510 bytes)   
diff --git a/code/jumpnode/jumpnode.cpp b/code/jumpnode/jumpnode.cpp
index 0065416..0605c78 100644
--- a/code/jumpnode/jumpnode.cpp
+++ b/code/jumpnode/jumpnode.cpp
@@ -45,7 +45,8 @@ void jump_node::render(vec3d *pos, vec3d *view_pos)
 
 	int mr_flags = MR_NO_LIGHTING | MR_LOCK_DETAIL;
 	if(!(m_flags & JN_SHOW_POLYS)) {
-		mr_flags |= MR_NO_CULL | MR_NO_POLYS | MR_SHOW_OUTLINE_PRESET;
+		mr_flags |= MR_NO_CULL | MR_NO_POLYS | MR_SHOW_OUTLINE_PRESET
+			| MR_SHOW_OUTLINE_HTL;
 	}
 
 	if ( Fred_running ) {
fso-jumpy.patch (510 bytes)   

Echelon9

2011-02-26 03:27

developer   ~0012632

Can we confirm that this isn't a driver specific issue on Linux?

casual pilot

2011-02-26 09:45

reporter   ~0012633

I don't have other platforms to test on, and there are no alternative drivers for this video card. However, if this were not a platform specific issue, surely it would have been detected long ago. For some reason the original rendering method is extremely slow on this platform and changing it with the flag causes a remarkable speedup. The speedup is probably less noticable on other platforms.

The rendering errors manifest themselves as flashing brown lines, typically from the center of the screen outwards. They appear also when the node is inactive - I haven't been able to pin down the exact conditions. The green jump node wireframe disappears when the brown lines appear. I am not sure if the rendering errors are platform-specific. Also, because the rendering errors are not easily reproducible and the game is totally unplayable with the original rendering method, I am not sure whether the errors are specific to HTL rendering.

casual pilot

2011-02-27 12:35

reporter   ~0012634

Last edited: 2011-02-28 10:00

Another case of horribly slow rendering that may be related: if -ship_choice_3d is enabled, on the weapon selection screen the lines connecting the selected weapon icon to the weapon locations in the ship model are rendered very slowly.

Goober5000

2012-07-02 06:31

administrator   ~0013787

The jump nodes are rendered in non-HTL because nobody could get the wireframe HTL rendering to work properly. So this just recapitulates an old, unresolved bug.

Anyone know how to do proper wireframes in HTL?

Zacam

2012-07-02 16:58

administrator   ~0013802

The supplied patch is -close- but not quite. Instead of adding MR_SHOW_OUTLINE_HTL in addition to the options, it should be used as a replacement for MR_SHOW_OTLINE_PRESET.

Newer patch attached.

Zacam

2012-07-02 16:58

administrator  

2396_jumpnode.cpp.patch (426 bytes)   
Index: jumpnode.cpp
===================================================================
--- jumpnode.cpp	(revision 8973)
+++ jumpnode.cpp	(working copy)
@@ -260,7 +260,7 @@
 	
 	int mr_flags = MR_NO_LIGHTING | MR_LOCK_DETAIL;
 	if(!(m_flags & JN_SHOW_POLYS)) {
-		mr_flags |= MR_NO_CULL | MR_NO_POLYS | MR_SHOW_OUTLINE_PRESET;
+		mr_flags |= MR_NO_CULL | MR_NO_POLYS | MR_SHOW_OUTLINE_HTL;
 	}
 	
 	if ( Fred_running ) {
2396_jumpnode.cpp.patch (426 bytes)   

Goober5000

2012-07-03 05:00

administrator   ~0013806

Fix committed to trunk@8975.

Zacam

2012-07-04 19:49

administrator   ~0013822

Fix committed to fs2_open_3_6_14@8987.

Goober5000

2012-07-07 21:00

administrator   ~0013844

Reopening this bug because the proposed fix adds diagonal lines to the jump node model. :-/

Hoping casual pilot or another rendering person might be able to assist.

Valathil

2012-11-29 19:08

developer  

vajumpnodes.patch (4,097 bytes)   
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h	(revision 9384)
+++ code/graphics/2d.h	(working copy)
@@ -515,6 +515,8 @@
 	void (*gf_disable_team_color)();
 
 	void (*gf_update_texture)(int bitmap_handle, int bpp, ubyte* data, int width, int height);
+
+	void (*gf_draw_line_strip)(vertex **verts, int nv);
 } screen;
 
 // handy macro
@@ -822,6 +824,8 @@
 
 #define gr_update_texture				GR_CALL(*gr_screen.gf_update_texture)
 
+#define gr_draw_line_strip				GR_CALL(*gr_screen.gf_draw_line_strip)
+
 // color functions
 void gr_get_color( int *r, int *g, int  b );
 void gr_init_color(color *c, int r, int g, int b);
@@ -843,6 +847,9 @@
 ubyte* gr_opengl_get_texture_update_pointer(int bitmap_handle);
 void gr_opengl_update_texture(int bitmap_handle, int bpp, ubyte* data, int width, int height);
 
+// line strip drawing for jumpnodes
+void gr_opengl_draw_line_strip(vertex **verts, int nv);
+
 // special function for drawing polylines. this function is specifically intended for
 // polylines where each section is no more than 90 degrees away from a previous section.
 // Moreover, it is _really_ intended for use with 45 degree angles. 
Index: code/graphics/gropengl.cpp
===================================================================
--- code/graphics/gropengl.cpp	(revision 9384)
+++ code/graphics/gropengl.cpp	(working copy)
@@ -1917,6 +1917,8 @@
 	gr_screen.gf_disable_team_color = gr_opengl_disable_team_color;
 
 	gr_screen.gf_update_texture = gr_opengl_update_texture;
+
+	gr_screen.gf_draw_line_strip = gr_opengl_draw_line_strip;
 	// NOTE: All function pointers here should have a Cmdline_nohtl check at the top
 	//       if they shouldn't be run in non-HTL mode, Don't keep separate entries.
 	// *****************************************************************************
Index: code/graphics/gropengldraw.cpp
===================================================================
--- code/graphics/gropengldraw.cpp	(revision 9384)
+++ code/graphics/gropengldraw.cpp	(working copy)
@@ -2610,3 +2610,27 @@
 	GL_state.Blend(blend);
 	GL_state.CullFace(cull);
 }
+
+void gr_opengl_draw_line_strip(vertex **verts, int nv)
+{
+	SCP_vector<GLfloat> vert_buffer;
+	vert_buffer.reserve((nv + 1) * 3);
+	for(int i = 0; i < nv; i++) {
+		g3_project_vertex(verts[i]);
+		vert_buffer.push_back(verts[i]->screen.xyw.x);
+		vert_buffer.push_back(verts[i]->screen.xyw.y);
+		vert_buffer.push_back(-0.99f);
+	}
+	vert_buffer.push_back(verts[0]->screen.xyw.x);
+	vert_buffer.push_back(verts[0]->screen.xyw.y);
+	vert_buffer.push_back(-0.99f);
+	gr_opengl_set_2d_matrix();
+	GL_state.Color(gr_screen.current_color.red, gr_screen.current_color.green, gr_screen.current_color.blue, gr_screen.current_color.alpha); 
+	GL_state.Array.BindArrayBuffer(0);
+
+	GL_state.Array.EnableClientVertex();
+	GL_state.Array.VertexPointer(3, GL_FLOAT, 0, vert_buffer.data());
+	glDrawArrays(GL_LINE_STRIP, 0, nv + 1);
+	GL_state.Array.DisableClientVertex();
+	gr_opengl_end_2d_matrix();
+}
Index: code/graphics/grstub.cpp
===================================================================
--- code/graphics/grstub.cpp	(revision 9384)
+++ code/graphics/grstub.cpp	(working copy)
@@ -706,6 +706,9 @@
 void gr_stub_disable_team_color() {
 }
 
+void gr_stub_draw_line_strip(vertex **verts, int nv){
+}
+
 bool gr_stub_init() 
 {
 	if (gr_screen.res != GR_640) {
@@ -892,5 +895,7 @@
 	gr_screen.gf_disable_team_color = gr_stub_disable_team_color;
 
 	gr_screen.gf_update_texture = gr_stub_update_texture;
+
+	gr_screen.gf_draw_line_strip = gr_stub_draw_line_strip;
 	return true;
 }
Index: code/model/modelinterp.cpp
===================================================================
--- code/model/modelinterp.cpp	(revision 9384)
+++ code/model/modelinterp.cpp	(working copy)
@@ -1037,10 +1037,7 @@
 			gr_set_color_fast( &Interp_outline_color );
 		}
 
-		for (i=0; i<nv; i++ )	{
-			int j = (i + 1) % nv;
-	   		g3_draw_line(Interp_list[i], Interp_list[j]);
-		}
+		gr_draw_line_strip(Interp_list, nv);
 	}
 
 }
vajumpnodes.patch (4,097 bytes)   

Valathil

2012-11-29 19:08

developer   ~0014230

Last edited: 2012-11-29 19:11

Attached a patch that might speed up rendering by drawing the nodes with vertex arrays instead of seperate lines. Not a final version, might require some cleanup and additional parameters to not interfere with nohtl, just a quick test to see if its faster.

MjnMixael

2021-01-09 21:32

manager   ~0017072

Issue migrated to GitHub

Related Changesets

fs2open: trunk r8975

2012-07-03 01:01

Goober5000


Ported: N/A

Details Diff
Zacam's fix for Mantis 0002396 Affected Issues
0002396
mod - /trunk/fs2_open/code/jumpnode/jumpnode.cpp Diff File

fs2open: fs2_open_3_6_14 r8987

2012-07-04 15:50

Zacam


Ported: N/A

Details Diff
Backport: Trunk r8975; Zacam's fix for Mantis 0002396 Affected Issues
0002396
mod - /branches/fs2_open_3_6_14/code/jumpnode/jumpnode.cpp Diff File

fs2open: trunk r9001

2012-07-07 17:00

Goober5000


Ported: N/A

Details Diff
revert r8975 because this fix adds unwanted diagonal lines to the jump node model (Mantis 0002396) Affected Issues
0002396
mod - /trunk/fs2_open/code/jumpnode/jumpnode.cpp Diff File

fs2open: fs2_open_3_6_14 r9036

2012-07-23 22:14

Zacam


Ported: N/A

Details Diff
Backport: Trunk r9001; revert r8975 because this fix adds unwanted diagonal lines to the jump node model (Mantis 0002396) Affected Issues
0002396
mod - /branches/fs2_open_3_6_14/code/jumpnode/jumpnode.cpp Diff File

Issue History

Date Modified Username Field Change
2011-02-09 20:10 casual pilot New Issue
2011-02-09 20:10 casual pilot File Added: fso-jumpy.patch
2011-02-26 03:27 Echelon9 Note Added: 0012632
2011-02-26 03:27 Echelon9 Status new => feedback
2011-02-26 09:45 casual pilot Note Added: 0012633
2011-02-27 12:35 casual pilot Note Added: 0012634
2011-02-28 10:00 casual pilot Note Edited: 0012634
2012-07-02 06:31 Goober5000 Note Added: 0013787
2012-07-02 16:58 Zacam Note Added: 0013802
2012-07-02 16:58 Zacam File Added: 2396_jumpnode.cpp.patch
2012-07-02 16:58 Zacam Assigned To => Zacam
2012-07-02 16:58 Zacam Status feedback => assigned
2012-07-02 16:59 Zacam Status assigned => feedback
2012-07-02 19:10 Zacam Status feedback => code review
2012-07-03 05:00 Goober5000 Changeset attached => fs2open trunk r8975
2012-07-03 05:00 Goober5000 Note Added: 0013806
2012-07-03 05:00 Goober5000 Status code review => resolved
2012-07-03 05:00 Goober5000 Resolution open => fixed
2012-07-04 19:49 Zacam Changeset attached => fs2open fs2_open_3_6_14 r8987
2012-07-04 19:49 Zacam Note Added: 0013822
2012-07-07 20:53 Goober5000 Relationship added related to 0002676
2012-07-07 20:58 Goober5000 Changeset attached => fs2open trunk r9001
2012-07-07 21:00 Goober5000 Note Added: 0013844
2012-07-07 21:00 Goober5000 Status resolved => feedback
2012-07-07 21:00 Goober5000 Resolution fixed => reopened
2012-07-24 02:09 Zacam Changeset attached => fs2open fs2_open_3_6_14 r9036
2012-11-29 19:08 Valathil File Added: vajumpnodes.patch
2012-11-29 19:08 Valathil Note Added: 0014230
2012-11-29 19:11 Valathil Note Edited: 0014230
2021-01-09 21:32 MjnMixael Status feedback => closed
2021-01-09 21:32 MjnMixael Resolution reopened => suspended
2021-01-09 21:32 MjnMixael Note Added: 0017072