Hi,<div>I have for some time now tried to generate a texture through cairo and plaster onto an OpenGL surface via python, but I think I am missing some memory subtlety.</div><div><br> </div>
<div>I define a surface like this:</div><div>surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 1024, 1024)</div><div>ctx = cairo.Context(surface)</div><div>//I do some drawing//</div><div><div>surface.finish()</div><div>
<br>
</div><div>Then some OpenGL texture setup:</div><div><br> </div><div>glBindTexture(GL_TEXTURE_2D, 1)</div><div>glPixelStorei(GL_UNPACK_ALIGNMENT,1)</div><div> </div><div>glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
</div><div>glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)</div><div>glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)</div><div>glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
</div><div>glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)</div><div><br> </div><div>And now the call that leads to a segmentation fault:</div><div>glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, int(
surface.get_width()), int(surface.get_height()), 0, GL_BGRA, GL_UNSIGNED_BYTE, surface.get_data())</div><div><br> </div><div>Is there any of you who have had luck using PyCairo with OpenGL and can see what I do wrong?
</div><div><br> </div><div>Thanks,</div><div>Clemens</div></div>