Re: gl debugging help requested

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom "spot" Callaway wrote:
On Fri, 2007-06-29 at 10:14 +0200, Hans de Goede wrote:

I've seen many glGenTextures crashes in games I've packaged, esp. on 64 bit. Usually the problem is that glGenTextures gets called before a glContext has been created. All proprietary GL implementations are fine with this, but Mesa will crash, esp on 64 bit (but I've seen this on 32 bit too).

Let me know if you need more help.

The code in question looks like this:

      unsigned char* data = read_png_file (m_file_name);

      GLuint texture_id;
      glGenTextures (1, &texture_id);
      glBindTexture (GL_TEXTURE_2D, texture_id);
      set_gl_parameters (data, smooth, mip_map, texture_wrap);
      m_texture_name = texture_id;
      delete [] data;
      ms_image_cache [m_file_name] =
        Cached_Image (m_texture_name, m_width_pixels, m_height_pixels);

All of the reference code I could find on google seemed to be similar,
declare the GLuint variable, then initialize it with glGenTextures.

Is there something obviously wrong here?


Not obviously no, let me try to rephrase my earlier hint.

No (none whatsover) libGL functions (including glGenTextures) may be called before an OpenGL context has been created, iow before a window suitable for openGL rendering has been created. So if this apps tries to loads the textures above before creating its window, then that will crash with Mesa.

The trick is to look at the sequence in which window creation (for example SDL
_setVideoMode() with OPENGL flag, and the glGenTextures get called. 99% of all crashes which in the BT point to glGenTextures() are because of glGenTextures getting called before the window + openGL context is created.

I hope that helps, if not please repost the URL to the srpm and I'll take a look as time permits.

Regards,

Hans

--
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux