mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-23 00:10:07 +00:00
Moving some member variables of OsdGlDrawContext from public to protected
and adding the requisite accessors Note : all our example code goes through the same boiler-plate texture binding code - we might want to move it as a member function of the DrawContext.
This commit is contained in:
parent
bcc31df715
commit
21b9fbbb95
@ -126,7 +126,7 @@ MyDrawDelegate::Bind(OpenSubdiv::OsdUtilMeshBatchBase<MyDrawContext> *batch, Eff
|
||||
// bind vbo state
|
||||
// glBindVertexArray(batch->vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, batch->BindVertexBuffer());
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, drawContext->patchIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, drawContext->GetPatchIndexBuffer());
|
||||
|
||||
// vertex attrib
|
||||
glEnableVertexAttribArray(0);
|
||||
@ -134,13 +134,13 @@ MyDrawDelegate::Bind(OpenSubdiv::OsdUtilMeshBatchBase<MyDrawContext> *batch, Eff
|
||||
|
||||
// bind other builtin texture buffers
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->vertexTextureBuffer);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->GetVertexTextureBuffer());
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->vertexValenceTextureBuffer);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->GetVertexValenceTextureBuffer());
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->quadOffsetTextureBuffer);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->GetQuadOffsetsTextureBuffer());
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->ptexCoordinateTextureBuffer);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, drawContext->GetPatchParamTextureBuffer());
|
||||
}
|
||||
if (effect != _currentEffect) {
|
||||
_currentEffect = effect;
|
||||
|
@ -745,7 +745,7 @@ createOsdMesh( const std::string &shape, int level, int kernel, Scheme scheme=kC
|
||||
// -------- VAO
|
||||
glBindVertexArray(g_vao);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_mesh->GetDrawContext()->patchIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_mesh->GetDrawContext()->GetPatchIndexBuffer());
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_mesh->BindVertexBuffer());
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
@ -1151,25 +1151,25 @@ bindProgram(Effect effect, OpenSubdiv::OsdDrawContext::PatchArray const & patch)
|
||||
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, g_lightingBinding, g_lightingUB);
|
||||
|
||||
if (g_mesh->GetDrawContext()->vertexTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetVertexTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->vertexTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetVertexTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->vertexValenceTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetVertexValenceTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->vertexValenceTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetVertexValenceTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->quadOffsetTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetQuadOffsetsTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->quadOffsetTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetQuadOffsetsTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->ptexCoordinateTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetPatchParamTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->ptexCoordinateTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetPatchParamTextureBuffer());
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
|
@ -274,8 +274,6 @@ initializeShapes( ) {
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
OsdCpuVertexBuffer * g_samplesVB=0;
|
||||
|
||||
int g_nsamples=1000,
|
||||
g_nsamplesFound=0;
|
||||
|
||||
@ -349,6 +347,9 @@ getNumPtexFaces( OsdHbrMesh const * hmesh, int nfaces ) {
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
OsdCpuVertexBuffer * g_vertexData=0,
|
||||
* g_varyingData=0;
|
||||
|
||||
OsdCpuComputeContext * g_computeCtx = 0;
|
||||
|
||||
OsdCpuComputeController g_computeCtrl;
|
||||
@ -392,9 +393,9 @@ updateGeom() {
|
||||
Stopwatch s;
|
||||
s.Start();
|
||||
|
||||
g_samplesVB->UpdateData( &g_positions[0], 0, nverts);
|
||||
g_vertexData->UpdateData( &g_positions[0], 0, nverts);
|
||||
|
||||
g_computeCtrl.Refine( g_computeCtx, g_fmesh->GetKernelBatches(), g_samplesVB );
|
||||
g_computeCtrl.Refine( g_computeCtx, g_fmesh->GetKernelBatches(), g_vertexData );
|
||||
|
||||
s.Stop();
|
||||
g_computeTime = float(s.GetElapsed() * 1000.0f);
|
||||
@ -412,7 +413,7 @@ updateGeom() {
|
||||
|
||||
// Bind/Unbind of the vertex buffers to the context needs to happen
|
||||
// outside of the parallel loop
|
||||
g_evalCtx->BindVertexBuffers( g_idesc, g_samplesVB, g_odesc, g_Q, g_dQu, g_dQv );
|
||||
g_evalCtx->BindVertexBuffers( g_idesc, g_vertexData, g_odesc, g_Q, g_dQu, g_dQv );
|
||||
|
||||
#define USE_OPENMP
|
||||
#if defined(OPENSUBDIV_HAS_OPENMP) and defined(USE_OPENMP)
|
||||
@ -477,8 +478,12 @@ createOsdMesh( const std::string &shape, int level, Scheme scheme=kCatmark ) {
|
||||
|
||||
|
||||
// Create v-buffer & populate w/ positions
|
||||
delete g_samplesVB;
|
||||
g_samplesVB = OsdCpuVertexBuffer::Create(3, nverts);
|
||||
delete g_vertexData;
|
||||
g_vertexData = OsdCpuVertexBuffer::Create(3, nverts);
|
||||
|
||||
// Create v-buffer & populate w/ colors
|
||||
delete g_varyingData;
|
||||
g_varyingData = OsdCpuVertexBuffer::Create(3, nverts);
|
||||
|
||||
|
||||
|
||||
@ -486,7 +491,7 @@ createOsdMesh( const std::string &shape, int level, Scheme scheme=kCatmark ) {
|
||||
delete g_computeCtx;
|
||||
g_computeCtx = OsdCpuComputeContext::Create(g_fmesh);
|
||||
|
||||
g_computeCtrl.Refine( g_computeCtx, g_fmesh->GetKernelBatches(), g_samplesVB );
|
||||
g_computeCtrl.Refine( g_computeCtx, g_fmesh->GetKernelBatches(), g_vertexData );
|
||||
|
||||
|
||||
|
||||
|
@ -421,7 +421,7 @@ createOsdMesh() {
|
||||
// -------- VAO
|
||||
glBindVertexArray(g_vao);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_mesh->GetDrawContext()->patchIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_mesh->GetDrawContext()->GetPatchIndexBuffer());
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_mesh->BindVertexBuffer());
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
@ -758,25 +758,25 @@ display() {
|
||||
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, g_lightingBinding, g_lightingUB);
|
||||
|
||||
if (g_mesh->GetDrawContext()->vertexTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetVertexTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->vertexTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetVertexTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->vertexValenceTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetVertexValenceTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->vertexValenceTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetVertexValenceTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->quadOffsetTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetQuadOffsetsTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->quadOffsetTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetQuadOffsetsTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->ptexCoordinateTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetPatchParamTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->ptexCoordinateTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetPatchParamTextureBuffer());
|
||||
}
|
||||
|
||||
|
||||
@ -926,25 +926,25 @@ drawStroke(int x, int y)
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, g_tessellationBinding, g_tessellationUB);
|
||||
|
||||
|
||||
if (g_mesh->GetDrawContext()->vertexTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetVertexTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->vertexTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetVertexTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->vertexValenceTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetVertexValenceTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->vertexValenceTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetVertexValenceTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->quadOffsetTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetQuadOffsetsTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->quadOffsetTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetQuadOffsetsTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->ptexCoordinateTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetPatchParamTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->ptexCoordinateTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetPatchParamTextureBuffer());
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
@ -1004,7 +1004,7 @@ createOsdMesh(int level, int kernel) {
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof (GLfloat) * 6, 0);
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof (GLfloat) * 6, (float*)12);
|
||||
}
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_mesh->GetDrawContext()->patchIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_mesh->GetDrawContext()->GetPatchIndexBuffer());
|
||||
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
@ -1409,28 +1409,26 @@ drawModel() {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (g_mesh->GetDrawContext()->vertexTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetVertexTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->vertexTextureBuffer);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->GetVertexTextureBuffer());
|
||||
glTexBuffer(GL_TEXTURE_BUFFER, GL_R32F, bVertex);
|
||||
}
|
||||
|
||||
if (g_mesh->GetDrawContext()->vertexValenceTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetVertexValenceTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->vertexValenceTextureBuffer);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->GetVertexValenceTextureBuffer());
|
||||
}
|
||||
|
||||
if (g_mesh->GetDrawContext()->quadOffsetTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetQuadOffsetsTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->quadOffsetTextureBuffer);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->GetQuadOffsetsTextureBuffer());
|
||||
}
|
||||
if (g_mesh->GetDrawContext()->ptexCoordinateTextureBuffer) {
|
||||
if (g_mesh->GetDrawContext()->GetPatchParamTextureBuffer()) {
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glBindTexture(GL_TEXTURE_BUFFER,
|
||||
g_mesh->GetDrawContext()->ptexCoordinateTextureBuffer);
|
||||
g_mesh->GetDrawContext()->GetPatchParamTextureBuffer());
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
|
@ -413,7 +413,7 @@ createOsdContext(int level)
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof (GLfloat) * 6, 0);
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof (GLfloat) * 6, (float*)12);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_drawContext->patchIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_drawContext->GetPatchIndexBuffer());
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
|
@ -74,19 +74,19 @@ namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
|
||||
OsdGLDrawContext::OsdGLDrawContext() :
|
||||
patchIndexBuffer(0), ptexCoordinateTextureBuffer(0), fvarDataTextureBuffer(0),
|
||||
vertexTextureBuffer(0), vertexValenceTextureBuffer(0), quadOffsetTextureBuffer(0)
|
||||
_patchIndexBuffer(0), _patchParamTextureBuffer(0), _fvarDataTextureBuffer(0),
|
||||
_vertexTextureBuffer(0), _vertexValenceTextureBuffer(0), _quadOffsetsTextureBuffer(0)
|
||||
{
|
||||
}
|
||||
|
||||
OsdGLDrawContext::~OsdGLDrawContext()
|
||||
{
|
||||
glDeleteBuffers(1, &patchIndexBuffer);
|
||||
glDeleteTextures(1, &vertexTextureBuffer);
|
||||
glDeleteTextures(1, &vertexValenceTextureBuffer);
|
||||
glDeleteTextures(1, &quadOffsetTextureBuffer);
|
||||
glDeleteTextures(1, &ptexCoordinateTextureBuffer);
|
||||
glDeleteTextures(1, &fvarDataTextureBuffer);
|
||||
glDeleteBuffers(1, &_patchIndexBuffer);
|
||||
glDeleteTextures(1, &_vertexTextureBuffer);
|
||||
glDeleteTextures(1, &_vertexValenceTextureBuffer);
|
||||
glDeleteTextures(1, &_quadOffsetsTextureBuffer);
|
||||
glDeleteTextures(1, &_patchParamTextureBuffer);
|
||||
glDeleteTextures(1, &_fvarDataTextureBuffer);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -149,8 +149,8 @@ OsdGLDrawContext::create(FarPatchTables const * patchTables, bool requireFVarDat
|
||||
// Process PTable
|
||||
FarPatchTables::PTable const & ptables = patchTables->GetPatchTable();
|
||||
|
||||
glGenBuffers(1, &patchIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, patchIndexBuffer);
|
||||
glGenBuffers(1, &_patchIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _patchIndexBuffer);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER,
|
||||
ptables.size() * sizeof(unsigned int), &ptables[0], GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
@ -169,8 +169,8 @@ OsdGLDrawContext::create(FarPatchTables const * patchTables, bool requireFVarDat
|
||||
int numIndices = (int)indices.size();
|
||||
|
||||
// Allocate and fill index buffer.
|
||||
glGenBuffers(1, &patchIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, patchIndexBuffer);
|
||||
glGenBuffers(1, &_patchIndexBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _patchIndexBuffer);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER,
|
||||
numIndices * sizeof(unsigned int), &(indices[0]), GL_STATIC_DRAW);
|
||||
|
||||
@ -210,10 +210,10 @@ OsdGLDrawContext::create(FarPatchTables const * patchTables, bool requireFVarDat
|
||||
valenceTable = patchTables->GetVertexValenceTable();
|
||||
|
||||
if (not valenceTable.empty()) {
|
||||
vertexValenceTextureBuffer = createTextureBuffer(valenceTable, GL_R32I);
|
||||
_vertexValenceTextureBuffer = createTextureBuffer(valenceTable, GL_R32I);
|
||||
|
||||
// also create vertex texture buffer (will be updated in UpdateVertexTexture())
|
||||
glGenTextures(1, &vertexTextureBuffer);
|
||||
glGenTextures(1, &_vertexTextureBuffer);
|
||||
}
|
||||
|
||||
|
||||
@ -222,15 +222,15 @@ OsdGLDrawContext::create(FarPatchTables const * patchTables, bool requireFVarDat
|
||||
quadOffsetTable = patchTables->GetQuadOffsetTable();
|
||||
|
||||
if (not quadOffsetTable.empty())
|
||||
quadOffsetTextureBuffer = createTextureBuffer(quadOffsetTable, GL_R32I);
|
||||
_quadOffsetsTextureBuffer = createTextureBuffer(quadOffsetTable, GL_R32I);
|
||||
|
||||
|
||||
// create ptex coordinate buffer
|
||||
FarPatchTables::PatchParamTable const &
|
||||
ptexCoordTables = patchTables->GetPatchParamTable();
|
||||
patchParamTables = patchTables->GetPatchParamTable();
|
||||
|
||||
if (not ptexCoordTables.empty())
|
||||
ptexCoordinateTextureBuffer = createTextureBuffer(ptexCoordTables, GL_RG32I);
|
||||
if (not patchParamTables.empty())
|
||||
_patchParamTextureBuffer = createTextureBuffer(patchParamTables, GL_RG32I);
|
||||
|
||||
|
||||
// create fvar data buffer if requested
|
||||
@ -238,7 +238,7 @@ OsdGLDrawContext::create(FarPatchTables const * patchTables, bool requireFVarDat
|
||||
fvarTables = patchTables->GetFVarDataTable();
|
||||
|
||||
if (requireFVarData and not fvarTables.empty())
|
||||
fvarDataTextureBuffer = createTextureBuffer(fvarTables, GL_R32F);
|
||||
_fvarDataTextureBuffer = createTextureBuffer(fvarTables, GL_R32F);
|
||||
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||
|
||||
@ -248,7 +248,7 @@ OsdGLDrawContext::create(FarPatchTables const * patchTables, bool requireFVarDat
|
||||
void
|
||||
OsdGLDrawContext::updateVertexTexture(GLuint vbo, int numVertexElements)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_BUFFER, vertexTextureBuffer);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, _vertexTextureBuffer);
|
||||
glTexBuffer(GL_TEXTURE_BUFFER, GL_R32F, vbo);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, 0);
|
||||
|
||||
|
@ -122,20 +122,55 @@ public:
|
||||
/// true if the GL version detected supports shader tessellation
|
||||
static bool SupportsAdaptiveTessellation();
|
||||
|
||||
GLuint patchIndexBuffer;
|
||||
/// Returns the GL texture buffer containing the patch control vertices array
|
||||
GLuint GetPatchIndexBuffer() const {
|
||||
return _patchIndexBuffer;
|
||||
}
|
||||
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
GLuint patchTrianglesIndexBuffer;
|
||||
/// Returns the GL a VBO containing a triangulated version of the mesh
|
||||
GLuint GetPatchTrianglesIndexBUffer() const {
|
||||
return _patchTrianglesIndexBuffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
GLuint ptexCoordinateTextureBuffer;
|
||||
GLuint fvarDataTextureBuffer;
|
||||
/// Returns the GL texture buffer containing the patch local parameterization
|
||||
/// data
|
||||
GLuint GetPatchParamTextureBuffer() const {
|
||||
return _patchParamTextureBuffer;
|
||||
}
|
||||
|
||||
GLuint vertexTextureBuffer;
|
||||
GLuint vertexValenceTextureBuffer;
|
||||
GLuint quadOffsetTextureBuffer;
|
||||
/// Returns the GL texture buffer containing the vertex data
|
||||
GLuint GetVertexTextureBuffer() const {
|
||||
return _vertexTextureBuffer;
|
||||
}
|
||||
|
||||
/// Returns the GL texture buffer containing patch vertex valence data (only
|
||||
/// used by Gregory patches)
|
||||
GLuint GetVertexValenceTextureBuffer() const {
|
||||
return _vertexValenceTextureBuffer;
|
||||
}
|
||||
|
||||
/// Returns the GL texture buffer containing patch quad offsets data (only
|
||||
/// used by Gregory patches)
|
||||
GLuint GetQuadOffsetsTextureBuffer() const {
|
||||
return _quadOffsetsTextureBuffer;
|
||||
}
|
||||
|
||||
protected:
|
||||
GLuint _patchIndexBuffer;
|
||||
|
||||
#if defined(GL_ES_VERSION_2_0)
|
||||
GLuint _patchTrianglesIndexBuffer;
|
||||
#endif
|
||||
|
||||
GLuint _patchParamTextureBuffer;
|
||||
GLuint _fvarDataTextureBuffer;
|
||||
|
||||
GLuint _vertexTextureBuffer;
|
||||
GLuint _vertexValenceTextureBuffer;
|
||||
GLuint _quadOffsetsTextureBuffer;
|
||||
|
||||
OsdGLDrawContext();
|
||||
|
||||
// allocate buffers from patchTables
|
||||
|
Loading…
Reference in New Issue
Block a user