By Sheldon Wang

2019-01-11 10:07:22 8 Comments

I have a basic model to upload textures as shown in the following picture.enter image description here

I design this for several reasons:

  1. Only the primary thread owns the OpenGL context, so I choose to create buffers, map buffers and unmap buffers in the primary thread.
  2. I have many pictures to load and I don't want them to block the primary thread, so I use the subthread to load images and copy the memory.

Here are my questions:

  1. Is my model correct?
  2. Is my model the best practice?
  3. Should I create a PBO for each picture or create two PBO for all pictures and use them in turn?
  4. Should I use a shared context?

Thank you for helping me out


@ratchet freak 2019-01-11 11:56:01

Why would 3 need to wait on 2? As soon as you know the size of the image you can go ahead and create the buffer. So make sure you know the size early on (by putting it next to the other meta data that led you to load it in the first place or having a max size and using that always) and let the subthread load the image data directly into the PBO.

It is perfectly fine to create a few PBOs and cycle through them.

@Sheldon Wang 2019-01-23 07:10:16

Because I use FreeImagePlus to load the image, I don't know there is a function which could load image size first before loading the content. Appreciate for your answer.

Related Questions

Sponsored Content

0 Answered Questions

Element Buffer Object size for shared VAO

1 Answered Questions

2 Answered Questions

[SOLVED] OpenGL threaded loading

0 Answered Questions

1 Answered Questions

[SOLVED] Shared data in multithreaded pathfinding engine

2 Answered Questions

[SOLVED] RTS combat system

1 Answered Questions

[SOLVED] OpenGL poor performace with instanced drawing

  • 2015-07-01 12:45:36
  • RBasniak
  • 930 View
  • 2 Score
  • 1 Answer
  • Tags:   opengl instancing

1 Answered Questions

[SOLVED] Java Buffers and OpenGL ES 2.0 (Android)

3 Answered Questions

[SOLVED] What's the best way to organize small textures in OpenGL?

  • 2015-04-26 14:24:45
  • user3426575
  • 384 View
  • 3 Score
  • 3 Answer
  • Tags:   opengl textures

1 Answered Questions

[SOLVED] 3DS Max exporting too many vertexes for model

Sponsored Content