2018-02-21 11:05 EST


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0002396FSSCPOpenGLpublic2012-11-29 14:11
Reportercasual pilot 
Assigned ToZacam 
PrioritynormalSeverityminorReproducibilityalways
StatusfeedbackResolutionreopened 
Product Version3.6.12 
Target VersionFixed in Version 
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.
Attached Files
  • patch file icon fso-jumpy.patch (510 bytes) 2011-02-09 15:10 -
    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 ) {
    
    patch file icon fso-jumpy.patch (510 bytes) 2011-02-09 15:10 +
  • patch file icon 2396_jumpnode.cpp.patch (426 bytes) 2012-07-02 12:58 -
    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 ) {
    
    patch file icon 2396_jumpnode.cpp.patch (426 bytes) 2012-07-02 12:58 +
  • patch file icon vajumpnodes.patch (4,097 bytes) 2012-11-29 14:08 -
    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);
     	}
     
     }
    
    patch file icon vajumpnodes.patch (4,097 bytes) 2012-11-29 14:08 +

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

-Notes

~0012632

Echelon9 (developer)

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

~0012633

casual pilot (reporter)

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.

~0012634

casual pilot (reporter)

Last edited: 2011-02-28 05: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.

~0013787

Goober5000 (administrator)

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?

~0013802

Zacam (administrator)

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.

~0013806

Goober5000 (administrator)

Fix committed to trunk@8975.

~0013822

Zacam (administrator)

Fix committed to fs2_open_3_6_14@8987.

~0013844

Goober5000 (administrator)

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.

~0014230

Valathil (developer)

Last edited: 2012-11-29 14:11

View 2 revisions

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.

+Notes

+Related Changesets

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