Sprites not drawing

53 views
Skip to first unread message

Enerccio

unread,
Apr 15, 2011, 9:40:12 PM4/15/11
to cocos2d discuss
Hello.
I have trouble with cocos.
I am unable to get the sprite to show on the screen at all.
The director will run, it will show empty screen, then even transition
seems to be working (I get the pause for the duration), yet the screen
is black (with only FPS updating).

Here is my code, did I miss anything with the layer??

http://paste.pound-python.org/show/5272/


I also tried just this in the python idle:
http://paste.pound-python.org/show/5273/

Which didnt work too.

Thanks in advance.

claudio canepa

unread,
Apr 16, 2011, 1:37:24 AM4/16/11
to cocos-...@googlegroups.com
On Fri, Apr 15, 2011 at 10:40 PM, Enerccio <ener...@gmail.com> wrote:
Hello.
I have trouble with cocos.
I am unable to get the sprite to show on the screen at all.
The director will run, it will show empty screen, then even transition
seems to be working (I get the pause for the duration), yet the screen
is black (with only FPS updating).

Here is my code, did I miss anything with the layer??

http://paste.pound-python.org/show/5272/



Is hard to tell without a runable sample, I dont see how you are initializing the cocos director, or launching the first scene, or how you instantiate your custom scene. If you can provide a runnable sample it would help heaps to diagnose.

Also, how you launched your app ? from an operating system console, typing something like
$python script_name.py
?

Any traceback message in the console ?

Seems that the flow will go to the line
raw_input()

that is for console input, which generally dont mix well with windowed aplications.
 What happens if you remove that ?

Also I noticed you dont specify z when adding the background and the sprite to the scene. What if you specify z=0 for background and z=1 for sprite ?


 
I also tried just this in the python idle:
http://paste.pound-python.org/show/5273/

Which didnt work too.


Interactive interpreters are tricky to interact with other windowed applications, generally a fight between the repective events loop breaks all.

If you want some interactive exploration for cocos, you can try the built in InterpreterLayer:
start a script, give ctrl+i , this brings up a translucid layer with a working interpreter.
you could explore:

>>>director
< cocos.director.Director object at ....> #this is the current director instance

so
>>>director.scene
will bring the current scene, from there you can explore at will

--
claudio
 

Enerccio

unread,
Apr 20, 2011, 8:35:50 AM4/20/11
to cocos2d discuss
Nevermind, but thanks for the reply.
It was the fault of the open source radeon driver.
Now it work well!

On Apr 16, 5:37 am, claudio canepa <ccanep...@gmail.com> wrote:

Johnstein

unread,
Apr 17, 2012, 10:20:47 PM4/17/12
to cocos-...@googlegroups.com
I'm not sure if it's OK to resurrect a year old thread, but I have the same issue described above.

The code I am trying to run is the sample
samples/demo_sprites.py

When it runs, I only see the text, not the sprites. I can advance the tests, but I don't see anything:
screenshot-> http://i.imgur.com/fS8fJ.png

When I run the samples/demo_flag3d.py program, it all works.
screenshot->http://i.imgur.com/ls8qw.png

I just updated my video card driver, radeon 9650, but I didn't see any difference.

the tetrico demo seems to work. I can play it, though I don't see any boundaries at the sides, so I'm not sure if I'm missing something there.
screenshot->http://i.imgur.com/7sMFJ.png

I downloaded cocos2d less than a week ago and I haven't changed any of the source code.

Any thoughts on how to go about debugging this?

Thank You

claudio canepa

unread,
Apr 18, 2012, 8:28:04 AM4/18/12
to cocos-...@googlegroups.com
On Tue, Apr 17, 2012 at 11:20 PM, Johnstein <boy...@gmail.com> wrote:
I'm not sure if it's OK to resurrect a year old thread, but I have the same issue described above. 

The code I am trying to run is the sample
samples/demo_sprites.py

When it runs, I only see the text, not the sprites. I can advance the tests, but I don't see anything:
screenshot-> http://i.imgur.com/fS8fJ.png

When I run the samples/demo_flag3d.py program, it all works.
screenshot->http://i.imgur.com/ls8qw.png

I just updated my video card driver, radeon 9650, but I didn't see any difference.

the tetrico demo seems to work. I can play it, though I don't see any boundaries at the sides, so I'm not sure if I'm missing something there.
screenshot->http://i.imgur.com/7sMFJ.png

I downloaded cocos2d less than a week ago and I haven't changed any of the source code.

Any thoughts on how to go about debugging this?

Thank You


I would suspect a driver issue, like in this pyglet issue

or this cocos issue

If you are on windows, the catalyst 11.5 drivers worked well with radeon 4650 and 3200, and some later version worked bad.

Also, pyglet 1.2dev (from repo) had more troubles related to drivers than pyglet 1.1.4

Sugestions:
  if feasible, try other drivers. If on windows, try the 11.5
  run some pyglet samples, in particular
        (pyglet tarball unpacked)/noisy/noisy.py
        (pyglet tarball unpacked)/programming_guide/animation.py
 They work ?
 What is your environment ? OS, python version, pyglet version.

claudio

--




Johnstein

unread,
Apr 18, 2012, 11:20:36 AM4/18/12
to cocos-...@googlegroups.com
Thank you for the reply.

I installed catalyst 11.5 and ran some of the pyglet examples.
noisy.py, animation.py, and events.py all showed blank or black screens.

And I can't believe I left out these details:
Win 7, 64 bit
python: v 2.7.2, 32 bit
cocos2d: 0.5.0
pyglet: 1.1.4

I think what I'm going to do after work tonight (unless someone else other ideas for me to try) is to completely remove python and do a fresh install. In the process of trying to find a solid 2d python framework I installed a lot of packages and since I'm not yet a python master, perhaps I got something crossed up.

Thanks again for the help so far.

claudio canepa

unread,
Apr 18, 2012, 1:40:02 PM4/18/12
to cocos-...@googlegroups.com
On Wed, Apr 18, 2012 at 12:20 PM, Johnstein <boy...@gmail.com> wrote:
Thank you for the reply.

I installed catalyst 11.5 and ran some of the pyglet examples.
noisy.py, animation.py, and events.py all showed blank or black screens.


Just to eliminate obvious things: when you run those samples, you see some traceback or error message in the console window ? Sometimes it is easy to miss, because the pyglet window overlaps the console window ?
 
And I can't believe I left out these details:
Win 7, 64 bit
python: v 2.7.2, 32 bit
cocos2d: 0.5.0
pyglet: 1.1.4


Could you clarify what ati hardware have you ? The mail I answered mentioned an ATI 9650 (which should be fairly old), but a later mail states 6950 ( released dec 2010 I think )
 
I think what I'm going to do after work tonight (unless someone else other ideas for me to try) is to completely remove python and do a fresh install. In the process of trying to find a solid 2d python framework I installed a lot of packages and since I'm not yet a python master, perhaps I got something crossed up.


Seems unlikely, because pyglet graphics depends only on PIL (python image library) package, but who knows.  

I suggest you post to the pyglet list the problems with pyglet samples,  with al the relevant details.
That list has more subscriptors, hence you have better chances of more specific help.  

 
Thanks again for the help so far.


Glad to help,

claudio

--

John

unread,
Apr 19, 2012, 8:31:55 PM4/19/12
to cocos-...@googlegroups.com
Good News, I finally got pyglet (and thus, cocos2d) to work!

I think in the end it really was just the Graphics Drivers update. When I updated them the first time, I don't think I actually uninstalled the old one before installing the new one, so maybe that's why it didn't work. Or perhaps I didn't install the latest one like I thought.

After struggling with it more, I decided to start from scratch and used ATI's autodetect program to select the driver for me and I used that (and properly uninstalled the existing one, rebooting in between).  I'm on 12.3 and all of the pyglet and cocos2d examples now work.

Thanks again for the help!

For Posterity and completion's sake, here's more info:


>Just to eliminate obvious things: when you run those samples, you see some traceback or error message in the console window ? Sometimes it is easy to miss, because the pyglet window overlaps the console window ?

When it was erroring, noisy.py did not produce any traceback or error messages in the console window.  Just a black screen with "Press space to add a ball, backspace to remove" at the bottom. And I could hear the beeps everytime the invisible balls hit the walls.


>Could you clarify what ati hardware have you ? The mail I answered mentioned an ATI 9650 (which should be fairly old), but a later mail states 6950 ( released dec 2010 I think )

6950. Specifically: http://www.newegg.com/Product/Product.aspx?Item=N82E16814150524
I don't know why I keep transposing the first two digits.

Additionally, I found the following StackOverflow and pyglet issue that was able to help me get pyglet working on catalyst drivers 11.8 by replacing the v2i function calls in pyglet with v2f. 
http://stackoverflow.com/questions/9369357/pyglet-vertex-list-not-rendered-amd-driver
http://code.google.com/p/pyglet/issues/detail?id=544#c3

could come in handy in the future if AMD breaks the drivers again :/

Thanks again. Now that I can actually play with it, cocos2d is really impressing me. I'm very excited to start working with it!




claudio

--

--
You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.
To post to this group, send email to cocos-...@googlegroups.com.
To unsubscribe from this group, send email to cocos-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.

claudio canepa

unread,
Apr 19, 2012, 10:29:38 PM4/19/12
to cocos-...@googlegroups.com
On Thu, Apr 19, 2012 at 9:31 PM, John <boy...@gmail.com> wrote:
Good News, I finally got pyglet (and thus, cocos2d) to work!

I think in the end it really was just the Graphics Drivers update. When I updated them the first time, I don't think I actually uninstalled the old one before installing the new one, so maybe that's why it didn't work. Or perhaps I didn't install the latest one like I thought.

After struggling with it more, I decided to start from scratch and used ATI's autodetect program to select the driver for me and I used that (and properly uninstalled the existing one, rebooting in between).  I'm on 12.3 and all of the pyglet and cocos2d examples now work.

Thanks again for the help!

For Posterity and completion's sake, here's more info:


>Just to eliminate obvious things: when you run those samples, you see some traceback or error message in the console window ? Sometimes it is easy to miss, because the pyglet window overlaps the console window ?

When it was erroring, noisy.py did not produce any traceback or error messages in the console window.  Just a black screen with "Press space to add a ball, backspace to remove" at the bottom. And I could hear the beeps everytime the invisible balls hit the walls.


>Could you clarify what ati hardware have you ? The mail I answered mentioned an ATI 9650 (which should be fairly old), but a later mail states 6950 ( released dec 2010 I think )

6950. Specifically: http://www.newegg.com/Product/Product.aspx?Item=N82E16814150524
I don't know why I keep transposing the first two digits.

Additionally, I found the following StackOverflow and pyglet issue that was able to help me get pyglet working on catalyst drivers 11.8 by replacing the v2i function calls in pyglet with v2f. 
http://stackoverflow.com/questions/9369357/pyglet-vertex-list-not-rendered-amd-driver
http://code.google.com/p/pyglet/issues/detail?id=544#c3

could come in handy in the future if AMD breaks the drivers again :/

Thanks again. Now that I can actually play with it, cocos2d is really impressing me. I'm very excited to start working with it

Thanks for the update.
Have a nice cocos2d !

claudio

--


david weil

unread,
Nov 11, 2012, 9:30:54 AM11/11/12
to cocos-...@googlegroups.com
On Wed, Apr 18, 2012 at 9:28 AM, claudio canepa <ccan...@gmail.com> wrote:
Sugestions:
  if feasible, try other drivers. If on windows, try the 11.5
  run some pyglet samples, in particular
        (pyglet tarball unpacked)/noisy/noisy.py
        (pyglet tarball unpacked)/programming_guide/animation.py
 They work ?
 What is your environment ? OS, python version, pyglet version.

Hi!

I've just installed cocos & pyglet and found this issue too and a solution.

For your information, the system is:

OS: Linux patashnik 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
GPU: 01:05.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI RS780M/RS780MN [Mobility Radeon HD 3200 Graphics]
GPU driver: 
[    47.378] (II) LoadModule: "fglrx"
[    47.379] (II) Loading /usr/lib/x86_64-linux-gnu/xorg/extra-modules/extra-modules.dpkg-tmp/modules/drivers/fglrx_drv.so
[    47.480] (II) Module fglrx: vendor="FireGL - ATI Technologies Inc."
[    47.480]    compiled for 1.4.99.906, module version = 8.96.4
[    47.480]    Module class: X.Org Video Driver
[    47.480] (II) Loading sub module "fglrxdrm"
[    47.480] (II) LoadModule: "fglrxdrm"
[    47.481] (II) Loading /usr/lib/x86_64-linux-gnu/xorg/extra-modules/extra-modules.dpkg-tmp/modules/linux/libfglrxdrm.so
[    47.481] (II) Module fglrxdrm: vendor="FireGL - ATI Technologies Inc."
[    47.481]    compiled for 1.4.99.906, module version = 8.96.4
[    47.481] (II) ATI Proprietary Linux Driver Version Identifier:8.96.4
[    47.481] (II) ATI Proprietary Linux Driver Release Identifier: 8.96.7                               
[    47.481] (II) ATI Proprietary Linux Driver Build Date: Mar 12 2012 13:06:50
(yes, it is somewhat old..)

From Ubuntu packages:
ii  fglrx                     2:8.960-0ubuntu1.1                         Video driver for the AMD graphics accelerators
ii  fglrx-amdcccle      2:8.960-0ubuntu1.1                         Catalyst Control Center for the AMD graphics accelerators

Python: 2.7
>>> cocos.version
'0.5.5'
>>> pyglet.version
'1.2alpha1'

>        (pyglet tarball unpacked)/noisy/noisy.py
No balls. Everything else seems to work.
>        (pyglet tarball unpacked)/programming_guide/animation.py
No animation, just blank little windows.


In my case, as I can't upgrade the system right now, the fix was:

aweil@patashnik:~/tmp/cocopres/lib/python2.7/site-packages/pyglet$ diff sprite.py.orig sprite.py
369c369
<                 'v2i/%s' % self._usage, 
---
>                 'v2f/%s' % self._usage, 
373c373
<                 'v2i/%s' % self._usage, 
---
>                 'v2f/%s' % self._usage, 


Maybe this help someone or fits in FAQ or something..

Thanks for the pointers in the original thread :-) !
david
--
 There is no dark side of the moon really. Matter of fact it's all dark.
Reply all
Reply to author
Forward
0 new messages