and please paste back anything the print , prints to you.
thanks for your help.
PS: in case you wonder what the above code does, it just try to load the latest image you loaded in the image editor as opengl texture so that it can be used by the bgl library which can display it on top of blender windows. It prints the error that makes the load fail (it should return 0 if the load is successful). Bindcode is the code (just a number) that points to the image that is loaded in the opengl memory.
Thank you very much, yes it confirms my fear, this is not a blender bug but probably a strange interactiong between blender and my gpu. Bad news indeed
Anyway your code will not do what you want. IF you want to change the amount of sample for cycles you will have to do this instead
bpy.context.scene.cycles.preview_samples = 100
assuming you want to change the preview_samples
the object you accessing is just the object used bpy the scene object to store the sample setting, but it does not point to the scene object, so you dont actually affect the usage of cycles.
to give you an idea its like doing
samples = 100
instead of
blender_gui.render.cycles.samples = 100
so generally you should never need to access bpy.types besides defining your own custom types like properties. If you want to change a setting then you will have to find where that type is stored in blender and accessed by the gui or blender itself to be used .
img = bpy.data.images[0]
for i in range(1, 6): # Make up to 6 tries to load image
texture = img.gl_load()
print("Opengl Error value:", texture)
print("Bindcode : ",img.bindcode)
if img.bindcode != 0:
break
I had this problem with gl_load when adding the map function for the sun position addon. Before adding the retry code, I noticed that sometimes the image would go blank (this happened on different machines).
After investigating, I decided bindcode always needs to be checked when the draw callback portion of code is executed, even after gl_load was successful at some point. Sometimes it would take up to 3 retries of gl_load before bindcode was 0. Although I never saw more than 3 needed retries,I gave 6 as an upper limit just to be sure. Once I did this, I never had blank images again.
Is it a bug with gl_load? I don’t know. I remember reading in an online openGL manual that error codes need to be frequently checked and I reasoned that with textures being swapped in and out of the GPU, you couldn’t always be guaranteed that your image would remain without doing a little work, i.e. reloading the image with gl_load.
no it does not crash for me, most likely its your crappy (no offense) gpu, intel integrated are the worst ones and do not even provide proper support for opengl.
Yeah I am sure I am doing it right , because it used to work with 2.57 with no problems. Devs changed the behavior of gl loading of textures / images and made my life more difficult But I blame my lack of knowledge of Opengl which I need to study thoroughly.
Ya know, the error codes that gl_load returns should tell you what is going wrong…in theory at least, it just return the error from openGL so if that is less than helpful not much can be done.
When I ported over the image GL loading stuff to 2.5x I was (and still am) on a crappy intel gpu so I doubt that has anything to do with it, if your gpu can show icons in the UI then it can show images in the 3dview using bgl.
IDK, maybe it needs to throw an exception if the image fails to load instead of just returning the error code so it can be done in a try/except block?
----edit----
Just looked at the source and it looks like the same old code that has always been there from the initial port.
no it does not crash for me, most likely its your crappy (no offense) gpu, intel integrated are the worst ones and do not even provide proper support for opengl.
Yeah I am sure I am doing it right , because it used to work with 2.57 with no problems. Devs changed the behavior of gl loading of textures / images and made my life more difficult But I blame my lack of knowledge of Opengl which I need to study thoroughly.
anyway i leave you with a screenshot of texture morphs from my Morpheas new add ons gui Morpheas draws on top of Blender GUI and its goal is to not affect standard Blender gui behavior in any way.
Hey kilon,
did you see this message - it should solve your problem …
I tried it out myself and got:
Opengl Error value: 0
Bindcode : 40
But once i got an Error or something, but this surely was something else (as i got a value of 2012 or so … quite high at least).
By the way, i’m quite impressed of your project and of the Enepher - was this the virtual programming one? - i somehow forgot.
If this works, godness, this will be awesome, blender will become even more powerfull, although that’s hardly possible.
Keep going, citizens of earth! :eek: jon
until we realize Knight’s K.I.T.T. using higg’s field
oups I missed that reply , thanks for pointing out, that is what happens when you trust email notifications too much.
Anyway I will definetly try it out his solution tomorrow and keep you posted.
Yeah part of Ephestos is Proteas which has the goal of implementing visual coding. As you can see there is already a REPL implemented which is a bit like the python window console inside blender but I hope with advanced features in the not so far future (we look into ways to integrate Ipython in it) and with advantage that unlike the one offered by blender, this one can access your addon objects directly and manipulate its code. And I got loads of suprises on Morpheas side too which is the GUI side of things. My goal is not so much to make Blender more powerful though we introducing already a GUI which is way more powerful than what Blender offers and all pure python, but to make Blender and python a lot easier to use and handle. Hopefully I will release version 1 in 2013. But you can follow my thread for it, I will bump it each month with latest news and features added in.
I love KIT I love Transformer so yes that picture is awesome.
Well I am in the unfortunate position to report that sadly xaire solution did not work for me. I still get error 1281 and bindcode 0 with my work pc though my iMAC works fine with this. I even tried a loop with 10 trys , no luck.
PS : I dont know what has happened with post 11, I edited several times and it keeps going back to copying my previous post . Uncle Entity sorry I was trying to replying to you but it seems i Hit a bug with the forum , anyway I was saying that I agree with you that this problem I am getting is very weird for a GPU that might be old but it plays fine many MMORGS I have tried. So it may be a blender bug afterall.
and to you kastoria I was trying to reply that if a computer does it job , its a good computer and does not matter if it is not perfect. Thanks to all of you for helping me out , I really appreciate this.
I’m editing this post as it is out of order with a previous one that I submitted that hasn’t appeared.
Bugs were reported for gl_load for Macs which were supposedly fixed in April.
This was regarding bugtracker ( #31036). If my other post ever shows up, the link is in it which you can follow to get all the details. It may be there are still bugs in gl_load or new ones introduced. Even though you may not be getting crashes, try filling in the parameters for gl_load just to see what happens as in the following:
The only way I know of to figure this out (since it works for almost everyone else) is to step through the function in a debugger and check if it throws an error after every call to find out which value your gfx/drivers doesn’t like.