Change all OpenGL extension constants to be const. Fix OpenGL ES and mobile.

* OpenGL ES wasn't compiling because there's no `GL_R16`, `GL_RG16`, `GL_RGB16`,
  `GL_RGBA16`. Replaced by their `_EXT` versions, but it wasn't compiling
  because they're defined as `var` instead of `const` and they were being used
  in a `func`.
* The GL API files were changed to fix that.
* After loading the scene, mobile platforms were throwing an error because the
  renderer was not initialized yet. That's been fixed.
* Remove unsed `gl-basic.nim`.
This commit is contained in:
Alberto Torres 2024-08-24 19:22:01 +02:00
parent f1768275f4
commit 6e60d806e7
5 changed files with 7772 additions and 10940 deletions

View file

@ -156,10 +156,10 @@ func toInternalFormat*(format: TextureFormat): GLenum =
of RG_u8: GL_RG8 of RG_u8: GL_RG8
of RGB_u8: GL_RGB8 of RGB_u8: GL_RGB8
of RGBA_u8: GL_RGBA8 of RGBA_u8: GL_RGBA8
of R_u16: GL_R16 of R_u16: GL_R16_EXT
of RG_u16: GL_RG16 of RG_u16: GL_RG16_EXT
of RGB_u16: GL_RGB16 of RGB_u16: GL_RGB16_EXT
of RGBA_u16: GL_RGBA16 of RGBA_u16: GL_RGBA16_EXT
of R_f16: GL_R16F of R_f16: GL_R16F
of RG_f16: GL_RG16F of RG_f16: GL_RG16F
of RGB_f16: GL_RGB16F of RGB_f16: GL_RGB16F
@ -567,7 +567,6 @@ proc getDimensionsFormat(p: pointer, len: int): (int, int, TextureFormat) =
const toHDR = when myouConvertHdrToFloat16: (R_f16.int-R_u8.int) else: (R_f32.int-R_u8.int) const toHDR = when myouConvertHdrToFloat16: (R_f16.int-R_u8.int) else: (R_f32.int-R_u8.int)
let format = (R_u8.int - 1 + channels + let format = (R_u8.int - 1 + channels +
hdr.int * toHDR + is16.int * (R_u16.int-R_u8.int)).TextureFormat hdr.int * toHDR + is16.int * (R_u16.int-R_u8.int)).TextureFormat
dump format
return (width, height, format) return (width, height, format)
func to_sRGB*(format: TextureFormat): TextureFormat = func to_sRGB*(format: TextureFormat): TextureFormat =

View file

@ -593,7 +593,8 @@ method loadScene*(self: BlendLoader, name: string="", scene: Scene=nil, callback
# finished # finished
if was_first_scene and not scene.enabled: if was_first_scene and not scene.enabled:
echo "Warning: Your scene is not enabled, use 'scene.enable_render()' or 'scene.enable_all()'" echo "Warning: Your scene is not enabled, use 'scene.enable_render()' or 'scene.enable_all()'"
scene.render_all_cubemaps(true) self.engine.renderer.enqueue proc() =
scene.render_all_cubemaps(true)
return return
assert false, &"Scene {name} not found" assert false, &"Scene {name} not found"

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff