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

  • SEARCH
  • Home
  • 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 7535243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:15:40+00:00 2026-05-30T06:15:40+00:00

I am creating an OpenGL texture like this: glGenTextures( 1, &boardTex ); glBindTexture( GL_TEXTURE_2D,

  • 0

I am creating an OpenGL texture like this:

glGenTextures( 1, &boardTex );
glBindTexture( GL_TEXTURE_2D, boardTex );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA, GL_FLOAT, NULL);

I get a handle at board so I assume the texture’s been successfully created. I want to share this texture with CUDA so I register and map the resource:

cudaGLSetGLDevice(0);
cudaGraphicsGLRegisterImage( &boardImage, boardTex, GL_TEXTURE_2D, cudaGraphicsMapFlagsNone );
cudaGraphicsMapResources( 1, &boardImage, 0 );

Then I try to get the mapped pointer like this:

float4* mappedPointer;
size_t mappedSize;
cudaGraphicsResourceGetMappedPointer( (void**)&mappedPointer, &mappedSize, boardImage );

Unfortunately this call returns an error and refuses to work. I made sure the texture wasn’t bound in OpenGL context just in case. Still not working. cudaGetErrorString yields “unknown error” so I’m pretty stuck here. I’d appreciate any ideas.

  • 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-05-30T06:15:41+00:00Added an answer on May 30, 2026 at 6:15 am

    Okay, I found this out myself:

    cudaGraphicsSubResourceGetMappedArray (&array, resource, 0, 0); returns a cudaArray to work with. I have yet to wrap my mind around how cudaArrays work (and I might end up using PBOs) but at least it’s not crashing.

    Edit:

    From the CUDA Reference Guide entry for cudaGraphicsResourceGetMappedPointer():

    If resource is not a buffer then it cannot be accessed via a pointer
    and cudaErrorUnknown is returned.

    From the CUDA Reference Guide entry for cudaGraphicsSubResourceGetMappedArray():

    If resource is not a texture then it cannot be accessed via an array
    and cudaErrorUnknown is returned.

    In other words, use GetMappedPointer for mapped buffer objects. Use GetMappedArray for mapped texture objects.

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

Sidebar

Related Questions

Creating Traversals for Binary Search Tree with Recursion. void inOrder(void (*inOrderPtr)(T&)) { if(this->left !=
I'm having a problem with texturing objects in OpenGL using texture atlases, I'm creating
I am creating a point sprite texture program in opengl es 2.0 I remember
I am creating a polygon filled with texture using opengl in cocos2d framework. I
I'm creating a game in c++ and OpenGL and want an enemy to move
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
I'm creating an Android app utilising OpenGL ES, and need some help with the
I'm creating a drawing application with OpenGL. I'v created an algorithm that generates gradient
I'm creating an OpenGL application on windows. I can't use GLUT, because I would
I'm creating a drawing application that renders OpenGL when it gets a WM_SCROLL or

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.