Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17119

A problem with sprite shaders

$
0
0

@Jugival wrote:

A problem with sprite shaders.

I was trying to use shaders in the following way:

  1. I have created global GLProgram objects using GLProgram::createWithFilenames function.
  2. When a sprite needs a shader I create a GLProgramState with a global GLProgram object and assign it to the sprite (or use setGLProgram for existing GLProgramState objects).

The problem I encountered is that these GLProgram objects can not exists on its own. If they are not assigned to sprite they get deleted automatically and I am left with dangling pointers.

How can I preserve these GLProgram objects in a way that they would be used when needed?
Or is there another way to store shaders?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17119

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>