Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  OpenGL from Erlang on Ubuntu

Mojito Sorbet
Posted: Tue Jul 20, 2010 8:52 pm Reply with quote
Joined: 20 Jul 2010 Posts: 5
I am on Ubuntu 9.10, where I installed OTP R14B04 myself, including wx. The wx:demo() works fine, including the "gl" demo with the 3D graphics.

I copied the ex_gl.erl source file, and it's two image files, from otp_src_R13B04/lib/wx/examples/demo into my project, compiled it unchanged, and invoked it with an appropriate environment, passing in a parent window for it to use. But I get this error:

Code:
exception exit: {no_gl_context,{gl,viewport,0}}


Using the debugger, it seems to fail on the first line of 'load_texture_by_image' where it calls wxImage:getWidth.

The documentation talks about wxGLContext, but there are no definitions for those routines in the Erlang binding, and the example code does not use it anyway, and works fine in the demo version in the library. What is different?
View user's profile Send private message
Mojito Sorbet
Posted: Wed Jul 21, 2010 12:10 pm Reply with quote
Joined: 20 Jul 2010 Posts: 5
I put in a call to wxGLCanvas:getContext to see what had been set up by wxGLCanvas:new. The value returned was
Code:
{wx_ref,0,wxGLContext,[]}


This looks odd because of the zero in there. I observe through the trace output that those handles get created in increasing numerical order and the value for the Canvas itself is
Code:
{wx_ref,50,wxGLCanvas,[]}
View user's profile Send private message
Mojito Sorbet
Posted: Thu Jul 22, 2010 1:40 pm Reply with quote
Joined: 20 Jul 2010 Posts: 5
Dan provided the answer: the window has to have been displayed before you initialize the OpenGL context.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum