Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Low priority: OpenGL error every frame in missions with a volumetric nebula

Open Beginner friendly
#7,901 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

Start in code/graphics/opengl/gropengldeferred.cpp at the emissive texture restore after the volumetric nebula pass, and inspect the surrounding OpenGL texture-state calls. Reproduce with a mission containing a volumetric nebula in a debug build, then verify that fs2_open.log no longer reports the per-frame GL_INVALID_OPERATION error and that the emissive texture filter is restored.

Written by the indexing model from the issue text.

Description

Low priority: nothing looks wrong on screen, it only shows up as an OpenGL error in debug logs. Found while testing another PR.

Problem

On OpenGL, a mission with a volumetric nebula logs GL_INVALID_OPERATION in glBindTexture(target mismatch) about once per frame in a debug build. Missions without a volumetric nebula don't log it, and it goes away with -no_deferred.

After the volumetric nebula draws, the code switches back to the emissive texture with the one-argument GL_state.Texture.Enable(Scene_emissive_texture) (code/graphics/opengl/gropengldeferred.cpp, line 656 on master). That binds to whichever texture unit was active last, which is the unit the nebula's 3D volume texture was just bound to. So OpenGL is asked to bind a 2D texture as a 3D one and refuses. The glTexParameteri on the next line, which is meant to put the emissive texture's filter back to GL_LINEAR, then doesn't reach the emissive texture either.

Steps to reproduce

  1. Build current master (I used 12a36dc1a, Debug, Linux).
  2. Use MediaVPs 5.0.2 and a mission with a volumetric nebula. I copied MediaVPs' SM1-01 and added a +Volumetric Nebula: block using volume_noise_sphere.pof from Beyond the Aftermath 2.2.0 (any volumetric nebula should do).
  3. Run it on OpenGL and fly for a few seconds.
  4. Open fs2_open.log.

Expected vs. actual behavior

Expected: no OpenGL errors.

Actual: OpenGL Debug: ... Type:Error ... GL_INVALID_OPERATION in glBindTexture(target mismatch) every frame (19 in the first 5 seconds). A debugger breakpoint on the error puts it in opengl_texture_state::Enable(GLuint) called from gr_opengl_deferred_lighting_finish. Seen on Mesa's software OpenGL; I haven't checked a hardware OpenGL driver.

Proposed fixes

  1. Name the unit and target on that line: GL_state.Texture.Enable(1, GL_TEXTURE_2D, Scene_emissive_texture). Unit 1 is where the emissive texture was bound for the nebula pass, so the filter reset after it lands on the right texture.
  2. Set the emissive texture's filter back without depending on which unit is active, for example by binding it explicitly first in its own small helper, so later edits to the nebula pass can't break it again.
  3. Make the one-argument Enable check that the active unit's target matches the texture it's asked to bind (and complain in debug builds), which would catch this pattern anywhere else in the OpenGL code.
Dominant language
C++
Stars
488
Forks
184
Avg merge
2d 9h
Merged PRs (30d)
40

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from scp-fs2open/fs2open.github.com

All issues in scp-fs2open/fs2open.github.com

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.