dmurdoch/rgl

RGL: GLU Library Error : invalid enumerant

mwtoews opened this issue · 3 comments

Issue

Reporting a warning (or error?) shown running two commands:

library(rgl)
demo(regression)

output:



        demo(regression)
        ---- ~~~~~~~~~~

Type  <Return>   to start : 

> # demo: regression
> # author: Daniel Adler
> 
> rgl.demo.regression <- function(n=100,xa=3,za=8,xb=0.02,zb=0.01,xlim=c(0,100),zlim=c(0,100)) {
...
> rgl.open()

> rgl.demo.regression()
Warning message:
In rgl.spheres(x, esty, z, color = "gray", radius = 1.5, specular = "green",  :
  RGL: GLU Library Error : invalid enumerant

The result displays a new window with the 3D visualization. There does not appear to be any errors, and the visualization appears normal (based on my memory of this demo). The only issue is the message shown in the terminal. Is this of any concern?

System info

  • rgl Version: 0.109.6
  • R Version: 4.2.1 (2022-06-23 ucrt) -- "Funny-Looking Kid"
  • Platform: x86_64-w64-mingw32/x64 (64-bit)

I don't see that warning, but I'm not running on Windows. This makes it quite hard to track down: the rgl.spheres function calls a C++ function rgl_spheres, and that function does a lot of work to create the spheres. So I can say "that shouldn't happen", but I can't say how serious it is.

Here is a better minimal example:

> library(rgl)
> rgl.spheres(1, texture=system.file("textures/bump_dust.png", package="rgl"))
Warning message:
In rgl.spheres(1, texture = system.file("textures/bump_dust.png",  :
  RGL: GLU Library Error : invalid enumerant
> file.exists(system.file("textures/bump_dust.png", package="rgl"))
[1] TRUE

the rendered sphere does not show any texture, just a plain white sphere:
2022-08-22 12_35_17-RGL device 2  Focus

For what it's worth, I've just installed rgl on a Ubuntu Focal laptop, and I see an identical error/warning and a similar textureless rendered sphere.

There appears to be an issue with the texture argument. Some similar problems: here, here and here. But I'll admit this is way out of my field!

Thanks for taking a look! (And thanks for maintaining this package, I've been using it for 15 years or so!)

I have tracked this down. The reason I wasn't seeing it is that MacOS uses the glGenerateMipmap function from OpenGL 3+, but that function is not available in Windows or Ubuntu, and the workaround code has a bug in it. I should be able to fix it.