Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7800891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:46:59+00:00 2026-06-02T00:46:59+00:00

Edit: A minimal failing test case is now on github here: https://github.com/shadowmint/Panda-setRamImage-problem — I

  • 0

Edit:
A minimal failing test case is now on github here:
https://github.com/shadowmint/Panda-setRamImage-problem

—

I have a C library that passes an unsigned char * pointer back to python with RGB pixel data in it.

The python api to do this is:

# unsigned char *ar_get_rgb(void *handle);
libar.ar_get_rgb.argtypes = [ c_void_p ]
libar.ar_get_rgb.restype = POINTER(c_char)

In panda3d I’m trying to render this data as a texture. There’s a blog post here about how to that:
http://www.panda3d.org/blog/?p=96

However, I found that doing this has some pretty serious limitations, which I’ve discussed here: http://www.panda3d.org/forums/viewtopic.php?t=13183, and as I result I’m now trying to use the setRamImage() api to set texture memory.

There seems like there must be a way to do this, but the only way I’m able to at the moment is using a pixel-by-pixel set call on the texture, as follows:

  def updateTextureTask(self, t):
    expectedSize = self.getExpectedRamImageSize()
    print("Expected length: " + str(expectedSize))
    (rgb, depth) = self.__vision.next()
    p = PTAUchar.emptyArray(expectedSize)
    for i in range(0, self.__vision.width * self.__vision.height * 3):
      p.setElement(i, ord(rgb[i]))
    print("PTAU length: " + str(p.size()))
    self.setRamImage(CPTAUchar(p))
    return Task.cont

This works…but it runs at a stunning 1 frame every 2 seconds.

If I call p.setData(rgb) to set the data of the PTAUchar (hint: http://www.panda3d.org/dox/python/html/classpanda3d_1_1core_1_1PTAUchar.html) I get:

Expected length: 921600
RGB buffer size: 921600 <-- C debugging data
PTAU length: 4
Assertion failed: compression != CM_off || image.size() == do_get_expected_ram_image_size() at line 833 of panda/src/gobj/texture.cxx
Traceback (most recent call last):

I’m puzzled as to where this ‘4’ length comes from, because of a dump of the first 20 odd values in the RGB array is like:

0: 163, 1: 151, 2: 162, 3: 85, 4: 83, 5: 190, 6: 241, 7: 252, 8: 249, 9: 121, 10: 107, 11: 82, 12: 20, 13: 19, 14: 233, 15: 226, 16: 45, 17: 81, 18: 142, 19: 31
PTAU length: 4

There must be a way to convert my unsigned char * array into something that can feed into PTAUchar.setData or PTAUchar.setSubdata, but I can’t figure it out.

help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:47:02+00:00Added an answer on June 2, 2026 at 12:47 am

    The definition for the setData function is:

    PTAUchar.setData(string data)
    

    You’re not passing a string. You’re passing a pointer to a string. I think what you want to do is have your C library pass a python byte string back to your python code, and then pass that to setData.

    PS: Coming to #panda3d on freenode is a great place to get real-time help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written up a minimal example of this. The code is posted here: https://gist.github.com/1524725
Here is a minimal code that shows the problem: template<typename To, typename From> To
Edit: a minimal project that exhibits the crash can be downloaded from crashTest .
EDIT I isolated a real minimal example which does not work (it is a
EDIT: Here's my call stack. System.ServiceModel.dll!System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(System.ServiceModel.Channels.Message reply, System.ServiceModel.Channels.MessageFault fault, string action, System.ServiceModel.Channels.MessageVersion version, System.ServiceModel.Channels.FaultConverter
Edit: This is currenty kinda resolved, Instead of struggling with the problem, I started
EDIT: I have been using Postgres with PostGIS for a few months now, and
Here's a minimal version of the code that took me a lot of time
I'm trying to extract tcp payload from a packet , and here's a minimal
I have reduced my problem to finding the minimal spanning tree in the graph.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.