Skip to content

Commit

Permalink
Add a way to get access to OpenGL texture index
Browse files Browse the repository at this point in the history
  • Loading branch information
rdb committed Oct 5, 2017
1 parent b71ee44 commit 85a9cdd
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
21 changes: 21 additions & 0 deletions panda/src/glstuff/glTextureContext_src.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,27 @@ reset_data() {
#endif
}

/**
* Returns an implementation-defined handle or pointer that can be used
* to interface directly with the underlying API.
* Returns 0 if the underlying implementation does not support this.
*/
uint64_t CLP(TextureContext)::
get_native_id() const {
return _index;
}

/**
* Similar to get_native_id, but some implementations use a separate
* identifier for the buffer object associated with buffer textures.
* Returns 0 if the underlying implementation does not support this, or
* if this is not a buffer texture.
*/
uint64_t CLP(TextureContext)::
get_native_buffer_id() const {
return _buffer;
}

/**
*
*/
Expand Down
3 changes: 3 additions & 0 deletions panda/src/glstuff/glTextureContext_src.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class EXPCL_GL CLP(TextureContext) : public TextureContext {
virtual void evict_lru();
void reset_data();

virtual uint64_t get_native_id() const;
virtual uint64_t get_native_buffer_id() const;

#ifndef OPENGLES
void make_handle_resident();
GLuint64 get_handle();
Expand Down
21 changes: 21 additions & 0 deletions panda/src/gobj/textureContext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@

TypeHandle TextureContext::_type_handle;

/**
* Returns an implementation-defined handle or pointer that can be used
* to interface directly with the underlying API.
* Returns 0 if the underlying implementation does not support this.
*/
uint64_t TextureContext::
get_native_id() const {
return 0;
}

/**
* Similar to get_native_id, but some implementations use a separate
* identifier for the buffer object associated with buffer textures.
* Returns 0 if the underlying implementation does not support this, or
* if this is not a buffer texture.
*/
uint64_t TextureContext::
get_native_buffer_id() const {
return 0;
}

/**
*
*/
Expand Down
2 changes: 2 additions & 0 deletions panda/src/gobj/textureContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class EXPCL_PANDA_GOBJ TextureContext : public BufferContext, public AdaptiveLru
PUBLISHED:
INLINE Texture *get_texture() const;
INLINE int get_view() const;
virtual uint64_t get_native_id() const;
virtual uint64_t get_native_buffer_id() const;

INLINE bool was_modified() const;
INLINE bool was_properties_modified() const;
Expand Down

0 comments on commit 85a9cdd

Please sign in to comment.