Reset shader id in OpenGl aspects.
Setup/retrieve shader program within getters/setters of Graphic3d_Group/Graphic3d_Structure (add missing ones).
Aspect_TypeOfDisplayText ADisplayType;
Quantity_Color AColorSubTitle;
- if (MyCGroup.ContextLine.IsSet) {
- R = Standard_Real (MyCGroup.ContextLine.Color.r);
- G = Standard_Real (MyCGroup.ContextLine.Color.g);
- B = Standard_Real (MyCGroup.ContextLine.Color.b);
- ALType = Aspect_TypeOfLine (MyCGroup.ContextLine.LineType);
- AWidth = Standard_Real (MyCGroup.ContextLine.Width);
+ if (MyCGroup.ContextLine.IsSet)
+ {
+ R = Standard_Real (MyCGroup.ContextLine.Color.r);
+ G = Standard_Real (MyCGroup.ContextLine.Color.g);
+ B = Standard_Real (MyCGroup.ContextLine.Color.b);
+ ALType = Aspect_TypeOfLine (MyCGroup.ContextLine.LineType);
+ AWidth = Standard_Real (MyCGroup.ContextLine.Width);
+ CTXL->SetShaderProgram (MyCGroup.ContextLine.ShaderProgram);
}
- else {
- R = Standard_Real (MyCGroup.Struct->ContextLine.Color.r);
- G = Standard_Real (MyCGroup.Struct->ContextLine.Color.g);
- B = Standard_Real (MyCGroup.Struct->ContextLine.Color.b);
- ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextLine.LineType);
- AWidth = Standard_Real (MyCGroup.Struct->ContextLine.Width);
+ else
+ {
+ R = Standard_Real (MyCGroup.Struct->ContextLine.Color.r);
+ G = Standard_Real (MyCGroup.Struct->ContextLine.Color.g);
+ B = Standard_Real (MyCGroup.Struct->ContextLine.Color.b);
+ ALType = Aspect_TypeOfLine (MyCGroup.Struct->ContextLine.LineType);
+ AWidth = Standard_Real (MyCGroup.Struct->ContextLine.Width);
+ CTXL->SetShaderProgram (MyCGroup.Struct->ContextLine.ShaderProgram);
}
AColor.SetValues (R, G, B, Quantity_TOC_RGB);
CTXL->SetColor (AColor);
CTXL->SetType (ALType);
CTXL->SetWidth (AWidth);
- if (MyCGroup.ContextText.IsSet) {
+ if (MyCGroup.ContextText.IsSet)
+ {
R = Standard_Real (MyCGroup.ContextText.Color.r);
G = Standard_Real (MyCGroup.ContextText.Color.g);
B = Standard_Real (MyCGroup.ContextText.Color.b);
ASpace = Standard_Real (MyCGroup.ContextText.Space);
AStyleT = Aspect_TypeOfStyleText (MyCGroup.ContextText.Style);
ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.ContextText.DisplayType);
+ CTXT->SetShaderProgram (MyCGroup.ContextText.ShaderProgram);
}
- else {
+ else
+ {
R = Standard_Real (MyCGroup.Struct->ContextText.Color.r);
G = Standard_Real (MyCGroup.Struct->ContextText.Color.g);
B = Standard_Real (MyCGroup.Struct->ContextText.Color.b);
Rs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.r);
Gs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.g);
Bs = Standard_Real (MyCGroup.Struct->ContextText.ColorSubTitle.b);
- AFont = Standard_CString (MyCGroup.Struct->ContextText.Font);
- AnExpansion = Standard_Real (MyCGroup.Struct->ContextText.Expan);
- ASpace = Standard_Real (MyCGroup.Struct->ContextText.Space);
- AStyleT = Aspect_TypeOfStyleText (MyCGroup.Struct->ContextText.Style);
- ADisplayType= Aspect_TypeOfDisplayText (MyCGroup.Struct->ContextText.DisplayType);
+ AFont = Standard_CString (MyCGroup.Struct->ContextText.Font);
+ AnExpansion = Standard_Real (MyCGroup.Struct->ContextText.Expan);
+ ASpace = Standard_Real (MyCGroup.Struct->ContextText.Space);
+ AStyleT = Aspect_TypeOfStyleText (MyCGroup.Struct->ContextText.Style);
+ ADisplayType = Aspect_TypeOfDisplayText (MyCGroup.Struct->ContextText.DisplayType);
+ CTXT->SetShaderProgram (MyCGroup.Struct->ContextText.ShaderProgram);
}
AColor.SetValues (R, G, B, Quantity_TOC_RGB);
AColorSubTitle.SetValues (Rs, Gs, Bs, Quantity_TOC_RGB);
CTXT->SetDisplayType (ADisplayType);
CTXT->SetColorSubTitle (AColorSubTitle);
- if (MyCGroup.ContextMarker.IsSet) {
- R = Standard_Real (MyCGroup.ContextMarker.Color.r);
- G = Standard_Real (MyCGroup.ContextMarker.Color.g);
- B = Standard_Real (MyCGroup.ContextMarker.Color.b);
- AMType = MyCGroup.ContextMarker.MarkerType;
- AScale = Standard_Real (MyCGroup.ContextMarker.Scale);
- if( AMType == Aspect_TOM_USERDEFINED )
- {
+ if (MyCGroup.ContextMarker.IsSet)
+ {
+ R = Standard_Real (MyCGroup.ContextMarker.Color.r);
+ G = Standard_Real (MyCGroup.ContextMarker.Color.g);
+ B = Standard_Real (MyCGroup.ContextMarker.Color.b);
+ AMType = MyCGroup.ContextMarker.MarkerType;
+ AScale = Standard_Real (MyCGroup.ContextMarker.Scale);
+ CTXT->SetShaderProgram (MyCGroup.ContextMarker.ShaderProgram);
- CTXM->SetBitMap( MyMarkWidth, MyMarkHeight, MyMarkArray );
+ if (AMType == Aspect_TOM_USERDEFINED)
+ {
+ CTXM->SetBitMap (MyMarkWidth, MyMarkHeight, MyMarkArray);
}
}
- else {
- R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r);
- G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g);
- B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b);
- AMType = MyCGroup.Struct->ContextMarker.MarkerType;
- AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale);
+ else
+ {
+ R = Standard_Real (MyCGroup.Struct->ContextMarker.Color.r);
+ G = Standard_Real (MyCGroup.Struct->ContextMarker.Color.g);
+ B = Standard_Real (MyCGroup.Struct->ContextMarker.Color.b);
+ AMType = MyCGroup.Struct->ContextMarker.MarkerType;
+ AScale = Standard_Real (MyCGroup.Struct->ContextMarker.Scale);
+ CTXT->SetShaderProgram (MyCGroup.Struct->ContextMarker.ShaderProgram);
}
AColor.SetValues (R, G, B, Quantity_TOC_RGB);
CTXM->SetColor (AColor);
CTXM->SetType (AMType);
CTXM->SetScale (AScale);
- if (MyCGroup.ContextFillArea.IsSet) {
+ if (MyCGroup.ContextFillArea.IsSet)
+ {
// Interior
AStyle = Aspect_InteriorStyle (MyCGroup.ContextFillArea.Style);
R = Standard_Real (MyCGroup.ContextFillArea.IntColor.r);
{
CTXF->SetTextureMapOff();
}
+ CTXF->SetShaderProgram (MyCGroup.ContextFillArea.ShaderProgram);
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
CTXF->SetPolygonOffsets(MyCGroup.ContextFillArea.PolygonOffsetMode,
MyCGroup.ContextFillArea.PolygonOffsetUnits);
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
}
- else {
+ else
+ {
// Interior
AStyle = Aspect_InteriorStyle (MyCGroup.Struct->ContextFillArea.Style);
R = Standard_Real (MyCGroup.Struct->ContextFillArea.IntColor.r);
{
CTXF->SetTextureMapOff();
}
+ CTXF->SetShaderProgram (MyCGroup.Struct->ContextFillArea.ShaderProgram);
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
CTXF->SetPolygonOffsets(MyCGroup.Struct->ContextFillArea.PolygonOffsetMode,
ALType = Aspect_TypeOfLine (MyCStructure.ContextLine.LineType);
AWidth = Standard_Real (MyCStructure.ContextLine.Width);
- Handle(Graphic3d_AspectLine3d) CTXL =
- new Graphic3d_AspectLine3d (AColor, ALType, AWidth);
+ Handle(Graphic3d_AspectLine3d) CTXL = new Graphic3d_AspectLine3d (AColor, ALType, AWidth);
+ CTXL->SetShaderProgram (MyCStructure.ContextLine.ShaderProgram);
return CTXL;
AStyle = Aspect_TypeOfStyleText (MyCStructure.ContextText.Style);
ADisplayType = Aspect_TypeOfDisplayText (MyCStructure.ContextText.DisplayType);
- Handle(Graphic3d_AspectText3d) CTXT =
- new Graphic3d_AspectText3d (AColor, AFont, AnExpansion, ASpace,AStyle,ADisplayType);
+ Handle(Graphic3d_AspectText3d) CTXT = new Graphic3d_AspectText3d (AColor, AFont, AnExpansion, ASpace,AStyle,ADisplayType);
+ CTXT->SetShaderProgram (MyCStructure.ContextText.ShaderProgram);
return CTXT;
AMType = MyCStructure.ContextMarker.MarkerType;
AScale = Standard_Real (MyCStructure.ContextMarker.Scale);
- Handle(Graphic3d_AspectMarker3d) CTXM =
- new Graphic3d_AspectMarker3d (AMType, AColor, AScale);
+ Handle(Graphic3d_AspectMarker3d) CTXM = new Graphic3d_AspectMarker3d (AMType, AColor, AScale);
+ CTXM->SetShaderProgram (MyCStructure.ContextMarker.ShaderProgram);
return CTXM;
{
CTXF->SetTextureMapOff();
}
+ CTXF->SetShaderProgram (MyCStructure.ContextFillArea.ShaderProgram);
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
CTXF->SetPolygonOffsets(MyCStructure.ContextFillArea.PolygonOffsetMode,
MyCStructure.ContextLine.Color.b = float (B);
MyCStructure.ContextLine.LineType = int (ALType);
MyCStructure.ContextLine.Width = float (AWidth);
+ MyCStructure.ContextLine.ShaderProgram = CTX->ShaderProgram();
MyCStructure.ContextLine.IsDef = 1;
MyGraphicDriver->ContextStructure (MyCStructure);
MyCStructure.ContextFillArea.Texture.TextureMap = CTX->TextureMap();
MyCStructure.ContextFillArea.Texture.doTextureMap = CTX->TextureMapState() ? 1 : 0;
+ MyCStructure.ContextFillArea.ShaderProgram = CTX->ShaderProgram();
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
Standard_Integer aPolyMode;
MyCStructure.ContextText.TextZoomable = ATextZoomable;
MyCStructure.ContextText.TextAngle = float (ATextAngle);
MyCStructure.ContextText.TextFontAspect = int (ATextFontAspect);
+ MyCStructure.ContextText.ShaderProgram = CTX->ShaderProgram();
MyCStructure.ContextText.IsDef = 1;
MyCStructure.ContextMarker.Color.b = float (B);
MyCStructure.ContextMarker.MarkerType = AMType;
MyCStructure.ContextMarker.Scale = float (AScale);
+ MyCStructure.ContextMarker.ShaderProgram = CTX->ShaderProgram();
MyCStructure.ContextMarker.IsDef = 1;
MyGraphicDriver->ContextStructure (MyCStructure);
MyCStructure.ContextLine.Color.b = float (B);
MyCStructure.ContextLine.LineType = int (ALType);
MyCStructure.ContextLine.Width = float (AWidth);
+ MyCStructure.ContextLine.ShaderProgram = CTXL->ShaderProgram();
CTXM->Values (AColor, AMType, AScale);
AColor.Values (R, G, B, Quantity_TOC_RGB);
MyCStructure.ContextMarker.Color.b = float (B);
MyCStructure.ContextMarker.MarkerType = AMType;
MyCStructure.ContextMarker.Scale = float (AScale);
+ MyCStructure.ContextMarker.ShaderProgram = CTXM->ShaderProgram();
CTXT->Values (AColor, AFont, AnExpansion, ASpace,AStyleT,ADisplayType,AColorSubTitle,ATextZoomable,ATextAngle,ATextFontAspect);
AColor.Values (R, G, B, Quantity_TOC_RGB);
MyCStructure.ContextText.TextZoomable = ATextZoomable;
MyCStructure.ContextText.TextAngle = float (ATextAngle);
MyCStructure.ContextText.TextFontAspect = int (ATextFontAspect);
+ MyCStructure.ContextText.ShaderProgram = CTXT->ShaderProgram();
MyCStructure.ContextFillArea.Texture.TextureMap = CTXF->TextureMap();
MyCStructure.ContextFillArea.Texture.doTextureMap = CTXF->TextureMapState() ? 1 : 0;
+ MyCStructure.ContextFillArea.ShaderProgram = CTXF->ShaderProgram();
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
Standard_Integer aPolyMode;
const TCollection_AsciiString& aTextureKey = myTexture.IsNull() ? THE_EMPTY_KEY : myTexture->GetId();
if (aTextureKey.IsEmpty() || myResources.TextureId != aTextureKey)
{
- myResources.ResetTexture();
+ myResources.ResetTextureReadiness();
}
// update shader program binding
const TCollection_AsciiString& aShaderKey = myShaderProgram.IsNull() ? THE_EMPTY_KEY : myShaderProgram->GetId();
if (aShaderKey.IsEmpty() || myResources.ShaderProgramId != aShaderKey)
{
- myResources.ResetShader();
+ myResources.ResetShaderReadiness();
}
}
myResources.Texture.Nullify();
}
myResources.TextureId.Clear();
- myResources.ResetTexture();
+ myResources.ResetTextureReadiness();
if (!myResources.ShaderProgram.IsNull()
&& !theContext.IsNull())
myResources.ShaderProgram);
}
myResources.ShaderProgramId.Clear();
- myResources.ResetShader();
+ myResources.ResetShaderReadiness();
}
// =======================================================================
if (!ShaderProgram.IsNull())
{
aContext->ShaderManager()->Unregister (ShaderProgramId, ShaderProgram);
+ ShaderProgramId.Clear();
+ ShaderProgram.Nullify();
}
if (theShader.IsNull())
{
Standard_Boolean IsShaderReady () const { return myIsShaderReady; }
void SetTextureReady() { myIsTextureReady = Standard_True; }
void SetShaderReady () { myIsShaderReady = Standard_True; }
- void ResetTexture() { myIsTextureReady = Standard_False; }
- void ResetShader () { myIsShaderReady = Standard_False; }
+ void ResetTextureReadiness() { myIsTextureReady = Standard_False; }
+ void ResetShaderReadiness () { myIsShaderReady = Standard_False; }
void BuildTexture (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_TextureMap)& theTexture);
void BuildShader (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_ShaderProgram)& theShader);
const TCollection_AsciiString& aShaderKey = myShaderProgram.IsNull() ? THE_EMPTY_KEY : myShaderProgram->GetId();
if (aShaderKey.IsEmpty() || myResources.ShaderProgramId != aShaderKey)
{
- myResources.ResetShader();
+ myResources.ResetShaderReadiness();
}
}
myResources.ShaderProgram);
}
myResources.ShaderProgramId.Clear();
- myResources.ResetShader();
+ myResources.ResetShaderReadiness();
}
// =======================================================================
if (!ShaderProgram.IsNull())
{
aContext->ShaderManager()->Unregister (ShaderProgramId, ShaderProgram);
+ ShaderProgramId.Clear();
+ ShaderProgram.Nullify();
}
if (theShader.IsNull())
{
Resources() : myIsShaderReady (Standard_False) {}
Standard_Boolean IsShaderReady() const { return myIsShaderReady; }
- void SetShaderReady() { myIsShaderReady = Standard_True; }
- void ResetShader () { myIsShaderReady = Standard_False; }
+ void SetShaderReady() { myIsShaderReady = Standard_True; }
+ void ResetShaderReadiness() { myIsShaderReady = Standard_False; }
void BuildShader (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_ShaderProgram)& theShader);
if (aSpriteKey.IsEmpty() || myResources.SpriteKey != aSpriteKey)
{
- myResources.ResetSprite();
+ myResources.ResetSpriteReadiness();
}
if (aSpriteAKey.IsEmpty() || myResources.SpriteAKey != aSpriteAKey)
{
- myResources.ResetSprite();
+ myResources.ResetSpriteReadiness();
}
// update shader program resource bindings
if (aShaderKey.IsEmpty() || myResources.ShaderProgramId != aShaderKey)
{
- myResources.ResetShader();
+ myResources.ResetShaderReadiness();
}
}
}
myResources.SpriteKey.Clear();
myResources.SpriteAKey.Clear();
- myResources.ResetSprite();
+ myResources.ResetSpriteReadiness();
if (!myResources.ShaderProgram.IsNull() && !theCtx.IsNull())
{
myResources.ShaderProgram);
}
myResources.ShaderProgramId.Clear();
- myResources.ResetShader();
+ myResources.ResetShaderReadiness();
}
// =======================================================================
if (!ShaderProgram.IsNull())
{
aContext->ShaderManager()->Unregister (ShaderProgramId, ShaderProgram);
+ ShaderProgramId.Clear();
+ ShaderProgram.Nullify();
}
if (theShader.IsNull())
{
Standard_Boolean IsShaderReady() const { return myIsShaderReady; }
void SetSpriteReady() { myIsSpriteReady = Standard_True; }
void SetShaderReady() { myIsShaderReady = Standard_True; }
- void ResetSprite () { myIsSpriteReady = Standard_False; }
- void ResetShader () { myIsShaderReady = Standard_False; }
+ void ResetSpriteReadiness() { myIsSpriteReady = Standard_False; }
+ void ResetShaderReadiness() { myIsShaderReady = Standard_False; }
void BuildSprites (const Handle(OpenGl_Workspace)& theWS,
const Handle(Graphic3d_MarkerImage)& theMarkerImage,
if (aShaderKey.IsEmpty() || myResources.ShaderProgramId != aShaderKey)
{
- myResources.ResetShader();
+ myResources.ResetShaderReadiness();
}
}
myResources.ShaderProgram);
}
myResources.ShaderProgramId.Clear();
- myResources.ResetShader();
+ myResources.ResetShaderReadiness();
}
// =======================================================================
if (!ShaderProgram.IsNull())
{
aContext->ShaderManager()->Unregister (ShaderProgramId, ShaderProgram);
+ ShaderProgramId.Clear();
+ ShaderProgram.Nullify();
}
if (theShader.IsNull())
{
Resources() : myIsShaderReady (Standard_False) {}
Standard_Boolean IsShaderReady() const { return myIsShaderReady; }
- void SetShaderReady() { myIsShaderReady = Standard_True; }
- void ResetShader () { myIsShaderReady = Standard_False; }
+ void SetShaderReady() { myIsShaderReady = Standard_True; }
+ void ResetShaderReadiness() { myIsShaderReady = Standard_False; }
void BuildShader (const Handle(OpenGl_Workspace)& theWS, const Handle(Graphic3d_ShaderProgram)& theShader);