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 8379131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:05:47+00:00 2026-06-09T16:05:47+00:00

After allocating a VBO using OpenGL I create an OpenCL buffer from it using

  • 0

After allocating a VBO using OpenGL I create an OpenCL buffer from it using clCreateFromGLBuffer.

I use the VBO as an array of GLfloat and the OpenCL buffer as an array of cl_float. It works perfectly on my machine. Indeed, GLfloat and cl_float (and float) have the same size.

I am wondering if this would work anywhere flawlessly. In other words, is sizeof(GLfloat) == sizeof(cl_float) always true?* And if not, how does one usually deal with this?

* and is there documentation proving this

  • 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-09T16:05:48+00:00Added an answer on June 9, 2026 at 4:05 pm

    Yes, if you check out the CL and GL headers, you get:

    typedef float cl_float;          // @cl_platform.h
    typedef float GLfloat;           // @gl.h
    

    Note in some GL implementations you get intermediary typedef’s like khronos_float_t but ultimately it all boils down to the float type. So both types are identical to your native float type. Furthermore, the equivalent data types in OpenCL kernels and OpenGL shaders are both guaranteed to be IEEE754-conformant.

    Links to relevant headers: cl_platform.h, and the GL header depends on where you got it (they are slightly different from OS to OS and from vendor to vendor), have a look at yours. Examples: gl.h (GLES version), gl.h (FreeBSD nVidia version), gl.h (some random version).

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

Sidebar

Related Questions

Is it necessary to check for nullptr after allocating an object using gcnew?
Instead of using try/catch blocks everytime I need to construct any objects after allocating
There is a performance issue when using a system call after pre-allocating big amount
Is it possible to create an .npy file without allocating the corresponding array in
What happens if I didn't call delete operator after allocating data using new. I
i implemented a bloom filter(bit table) using three dimension char array it works well
The book I am reading says that after allocating an object I need to
After I click update in the grid view, the code works successfully. But when
I'm allocating memory using new as and when I receive data in one of
I've been using this code to create my UIWindow UIMyWindow* win = [[UIMyWindow alloc]

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.