MineCraft-One-Week-Challenge icon indicating copy to clipboard operation
MineCraft-One-Week-Challenge copied to clipboard

OpenGL Invalid operation

Open Hideman85 opened this issue 7 years ago • 9 comments
trafficstars

Hi @Hopson97,

First of all this version of Minecraft in one week seems very very good, I congratulate you for this! I just tried Minetest «mature» version of Minecraft c++ and I'm really disappointed ...

So I really want to explore your code and maybe add features. I tried to compile your version (branch master) and I had an link error but I found solution (-ldl at the end compile command in CMakeLists to like the missing library).

Now when I 'm able to launch the game and noooooo the current OpenGL state disallowed all operations, I think it cause by initialization state

Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 3.3 ; depth bits = 24 ; stencil bits = 8 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
Created: version = 4.5 ; depth bits = 24 ; stencil bits = 8 ; AA level = 0 ; core = true ; debug = false ; sRGB = false
Seed: 154385
making noise
Searching for spawn...
Spawn found! Attempts: 3 Time Taken: 0.010565 seconds
An internal OpenGL call failed in RenderTextureImplFBO.cpp(192).
Expression:
   GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, 0)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(447).
Expression:
   glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(448).
Expression:
   glPushAttrib(GL_ALL_ATTRIB_BITS)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(450).
Expression:
   glMatrixMode(GL_MODELVIEW)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(451).
Expression:
   glPushMatrix()
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(452).
Expression:
   glMatrixMode(GL_PROJECTION)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.
[...]

Hideman85 avatar Aug 02 '18 08:08 Hideman85

Hi,

After some search I found why producing this issue, I can't use core OpenGL profile on my Linux with AMD card and opensource driver because is unstable.

So I was looking your sf::ContextSettings and seems correct so I continue with your GLAD files and it seems you used source file for core profile only.

I tried to generate new one with compatibility mode Glad generation but same results:

Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 3.3 ; depth bits = 24 ; stencil bits = 8 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
Created: version = 4.5 ; depth bits = 24 ; stencil bits = 8 ; AA level = 0 ; core = true ; debug = false ; sRGB = false

Hideman85 avatar Aug 03 '18 14:08 Hideman85

Hi,

I found a way to correct this, steps:

  • Use OpenGL 3.0 (the version that I can use without core profile)
  • Update GLAD files
  • Update all your shaders to downgrade #version 330 to #version 130
  • Add extensions to shaders files
#extension GL_ARB_explicit_attrib_location : require
#extension GL_ARB_explicit_uniform_location : require
  • Temporary disable and comment MBlur shadder in PostProcessRender (some functions used cannot be used in #version 130
  • Update Context with OpenGL 3.0

Now all right, compile step and game can be launch with no error.

But now I just have black window.

I try different things like make OpenGL output capture (also full black and some times with some white lines) I also print position of Camera in update function and it seems to be good I can move and collide.

But no visualization and no way to find why.

Could you help me to find a solution?

System: Linux Debian 9 (last version)

Hideman85 avatar Aug 04 '18 13:08 Hideman85

The black window seems to be a common problem :(

I'm not entirely sure why this happens though. Hopefully someone works this out eventually, but I cannot as I don't get this use myself

Hopson97 avatar Aug 04 '18 13:08 Hopson97

The sfml-graphics module requires a compatibility context or a OpenGL 2.1 Core context (if that's even a thing). As such if you use the sfml-graphics module, you can't use a OpenGL 3.x/4.x Core context, but you need to resort to a compatibility context and well it needs to be supported by your GPU driver.

eXpl0it3r avatar Aug 04 '18 13:08 eXpl0it3r

https://github.com/HopsonCommunity/MCWeekMyOwn

Could you try this one if that's ok? It's a older version of the game, I don't recall people having black screen issues with this build

Hopson97 avatar Aug 04 '18 13:08 Hopson97

I have reverted the code base to an older version, it could be possible it works now :)

Hopson97 avatar Aug 04 '18 14:08 Hopson97

I tried your https://github.com/HopsonCommunity/MCWeekMyOwn

  • cmake mode failed link library (mkdir build && cmake .. && make -j4)
  • Makefile version done

Launching game -> black screen I viewed in log it use OpenGL 3.3 core (and usually not work for me) So I tried with OpenGL 3.0 (I modified Context.cpp and change shaders version find Shaders/ -exec sed -i 's/#version 330/#version 130\n#extension GL_ARB_explicit_attrib_location : require\n#extension GL_ARB_explicit_uniform_location : require/g' '{}' \; not work too I've got Seg Fault :(

Hideman85 avatar Aug 04 '18 15:08 Hideman85

I'm thinking about Vulkan do you think it's better to use Vulkan instead of OpenGL ?

Hideman85 avatar Aug 15 '18 15:08 Hideman85

Vulkan will allow to do the exact same thing OpenGL can do, except you will need a lot more code to do it. The difference is, if you are a proper mad expert at Vulkan and programming in general, you MIGHT be able to squeeze out a bit extra FPS (and maybe lower CPU usage), but that is very hard. I would stick with OpenGL :stuck_out_tongue:

Sorry for the really late reply, I have no idea why I did not reply sooner. The black screen issue should be resolved now btw (for this repositoary). Turned out to be an issue with GLM changing how things worked :S

Hopson97 avatar Dec 14 '18 09:12 Hopson97