Hi all,

Did any of you try to build the rosseta code opengl example for webasm?
    
    
    nim c -d:useRealtimeGC -d:release -d:emscripten --out=index.html 
src/test.nim
    Hint: used config file '/home/xyz/personal/devel/nim/Nim/config/nim.cfg' 
[Conf]
    Hint: used config file '/home/xyz/projects/test/nim.cfg' [Conf]
    Hint: used config file '/home/xyz/projects/test/src/test.nim.cfg' [Conf]
    Hint: system [Processing]
    Hint: test [Processing]
    Hint: opengl [Processing]
    Hint: macros [Processing]
    Hint: sequtils [Processing]
    Hint: glut [Processing]
    test.nim(36, 3) Error: undeclared identifier: 'loadExtensions'
    

This is the code I am talking about.
    
    
    #? braces
    
    import opengl, glut
    
    proc paint() {.cdecl.} {
      glClearColor(0.3,0.3,0.3,0.0);
      glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
      
      glShadeModel(GL_SMOOTH);
      
      glLoadIdentity();
      glTranslatef(-15.0, -15.0, 0.0);
      
      glBegin(GL_TRIANGLES);
      glColor3f(1.0, 0.0, 0.0);
      glVertex2f(0.0, 0.0);
      glColor3f(0.0, 1.0, 0.0);
      glVertex2f(30.0, 0.0);
      glColor3f(0.0, 0.0, 1.0);
      glVertex2f(0.0, 30.0);
      glEnd();
      
      glFlush();
    }
    
    proc reshape(width, height: GLint) {.cdecl.} {
      glViewport(0, 0, width, height);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(-30.0, 30.0, -30.0, 30.0, -30.0, 30.0);
      glMatrixMode(GL_MODELVIEW);
    }
    
    when (isMainModule) {
      enableAutoGlErrorCheck(false);
      loadExtensions();
      glutInit();
      glutInitWindowSize(640, 480);
      discard glutCreateWindow("Triangle");
      
      glutDisplayFunc(paint);
      glutReshapeFunc(reshape);
      
      glutMainLoop();
    }
    

Thanks.

Reply via email to