Port to Coin3d 4.x
This commit is contained in:
parent
26d1751aeb
commit
ab012f5bee
|
@ -45,6 +45,7 @@
|
|||
# include <Inventor/misc/SoState.h>
|
||||
#endif
|
||||
|
||||
#include <Inventor/C/basic.h>
|
||||
#include <Inventor/draggers/SoTranslate2Dragger.h>
|
||||
#include <Inventor/elements/SoFontNameElement.h>
|
||||
#include <Inventor/elements/SoFontSizeElement.h>
|
||||
|
@ -55,7 +56,11 @@
|
|||
#include <Inventor/elements/SoViewVolumeElement.h>
|
||||
#include <Inventor/elements/SoViewportRegionElement.h>
|
||||
#include <Inventor/elements/SoGLTextureEnabledElement.h>
|
||||
#if COIN_MAJOR_VERSION > 3
|
||||
#include <Inventor/elements/SoMultiTextureEnabledElement.h>
|
||||
#else
|
||||
#include <Inventor/elements/SoGLTexture3EnabledElement.h>
|
||||
#endif
|
||||
|
||||
#include "SoTextLabel.h"
|
||||
#include "SoFCInteractiveElement.h"
|
||||
|
@ -250,7 +255,11 @@ void SoTextLabel::GLRender(SoGLRenderAction *action)
|
|||
|
||||
// disable textures for all units
|
||||
SoGLTextureEnabledElement::set(state, this, FALSE);
|
||||
#if COIN_MAJOR_VERSION > 3
|
||||
SoMultiTextureEnabledElement::set(state, this, FALSE);
|
||||
#else
|
||||
SoGLTexture3EnabledElement::set(state, this, FALSE);
|
||||
#endif
|
||||
|
||||
glPushAttrib(GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
|
||||
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
||||
|
@ -285,40 +294,40 @@ void SoTextLabel::GLRender(SoGLRenderAction *action)
|
|||
|
||||
inherited::GLRender(action);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
SO_NODE_SOURCE(SoStringLabel);
|
||||
|
||||
void SoStringLabel::initClass()
|
||||
{
|
||||
SO_NODE_INIT_CLASS(SoStringLabel, SoNode, "Node");
|
||||
}
|
||||
|
||||
SoStringLabel::SoStringLabel()
|
||||
{
|
||||
SO_NODE_CONSTRUCTOR(SoStringLabel);
|
||||
SO_NODE_ADD_FIELD(string, (""));
|
||||
SO_NODE_ADD_FIELD(textColor, (SbVec3f(1.0f,1.0f,1.0f)));
|
||||
SO_NODE_ADD_FIELD(name, ("Helvetica"));
|
||||
SO_NODE_ADD_FIELD(size, (12));
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the open edges only.
|
||||
*/
|
||||
void SoStringLabel::GLRender(SoGLRenderAction *action)
|
||||
{
|
||||
QGLWidget* window;
|
||||
SoState * state = action->getState();
|
||||
state->push();
|
||||
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
|
||||
SoGLWidgetElement::get(state, window);
|
||||
if (!window) {
|
||||
state->pop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
SO_NODE_SOURCE(SoStringLabel);
|
||||
|
||||
void SoStringLabel::initClass()
|
||||
{
|
||||
SO_NODE_INIT_CLASS(SoStringLabel, SoNode, "Node");
|
||||
}
|
||||
|
||||
SoStringLabel::SoStringLabel()
|
||||
{
|
||||
SO_NODE_CONSTRUCTOR(SoStringLabel);
|
||||
SO_NODE_ADD_FIELD(string, (""));
|
||||
SO_NODE_ADD_FIELD(textColor, (SbVec3f(1.0f,1.0f,1.0f)));
|
||||
SO_NODE_ADD_FIELD(name, ("Helvetica"));
|
||||
SO_NODE_ADD_FIELD(size, (12));
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the open edges only.
|
||||
*/
|
||||
void SoStringLabel::GLRender(SoGLRenderAction *action)
|
||||
{
|
||||
QGLWidget* window;
|
||||
SoState * state = action->getState();
|
||||
state->push();
|
||||
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
|
||||
SoGLWidgetElement::get(state, window);
|
||||
if (!window) {
|
||||
state->pop();
|
||||
return;
|
||||
}
|
||||
|
||||
// Enter in 2D screen mode
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
|
@ -375,46 +384,46 @@ void SoStringLabel::GLRender(SoGLRenderAction *action)
|
|||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
state->pop();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
SO_NODE_SOURCE(SoFrameLabel);
|
||||
|
||||
void SoFrameLabel::initClass()
|
||||
{
|
||||
SO_NODE_INIT_CLASS(SoFrameLabel, SoImage, "Image");
|
||||
}
|
||||
|
||||
SoFrameLabel::SoFrameLabel()
|
||||
{
|
||||
SO_NODE_CONSTRUCTOR(SoFrameLabel);
|
||||
SO_NODE_ADD_FIELD(string, (""));
|
||||
SO_NODE_ADD_FIELD(textColor, (SbVec3f(1.0f,1.0f,1.0f)));
|
||||
SO_NODE_ADD_FIELD(backgroundColor, (SbVec3f(0.0f,0.333f,1.0f)));
|
||||
SO_NODE_ADD_FIELD(justification, (LEFT));
|
||||
SO_NODE_ADD_FIELD(name, ("Helvetica"));
|
||||
SO_NODE_ADD_FIELD(size, (12));
|
||||
SO_NODE_ADD_FIELD(frame, (TRUE));
|
||||
//SO_NODE_ADD_FIELD(image, (SbVec2s(0,0), 0, NULL));
|
||||
}
|
||||
|
||||
void SoFrameLabel::notify(SoNotList * list)
|
||||
{
|
||||
SoField *f = list->getLastField();
|
||||
if (f == &this->string ||
|
||||
f == &this->textColor ||
|
||||
f == &this->backgroundColor ||
|
||||
f == &this->justification ||
|
||||
f == &this->name ||
|
||||
f == &this->size ||
|
||||
f == &this->frame) {
|
||||
drawImage();
|
||||
}
|
||||
inherited::notify(list);
|
||||
}
|
||||
|
||||
state->pop();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
SO_NODE_SOURCE(SoFrameLabel);
|
||||
|
||||
void SoFrameLabel::initClass()
|
||||
{
|
||||
SO_NODE_INIT_CLASS(SoFrameLabel, SoImage, "Image");
|
||||
}
|
||||
|
||||
SoFrameLabel::SoFrameLabel()
|
||||
{
|
||||
SO_NODE_CONSTRUCTOR(SoFrameLabel);
|
||||
SO_NODE_ADD_FIELD(string, (""));
|
||||
SO_NODE_ADD_FIELD(textColor, (SbVec3f(1.0f,1.0f,1.0f)));
|
||||
SO_NODE_ADD_FIELD(backgroundColor, (SbVec3f(0.0f,0.333f,1.0f)));
|
||||
SO_NODE_ADD_FIELD(justification, (LEFT));
|
||||
SO_NODE_ADD_FIELD(name, ("Helvetica"));
|
||||
SO_NODE_ADD_FIELD(size, (12));
|
||||
SO_NODE_ADD_FIELD(frame, (TRUE));
|
||||
//SO_NODE_ADD_FIELD(image, (SbVec2s(0,0), 0, NULL));
|
||||
}
|
||||
|
||||
void SoFrameLabel::notify(SoNotList * list)
|
||||
{
|
||||
SoField *f = list->getLastField();
|
||||
if (f == &this->string ||
|
||||
f == &this->textColor ||
|
||||
f == &this->backgroundColor ||
|
||||
f == &this->justification ||
|
||||
f == &this->name ||
|
||||
f == &this->size ||
|
||||
f == &this->frame) {
|
||||
drawImage();
|
||||
}
|
||||
inherited::notify(list);
|
||||
}
|
||||
|
||||
void SoFrameLabel::drawImage()
|
||||
{
|
||||
|
@ -475,24 +484,24 @@ void SoFrameLabel::drawImage()
|
|||
Gui::BitmapFactory().convert(image, sfimage);
|
||||
this->image = sfimage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the open edges only.
|
||||
*/
|
||||
void SoFrameLabel::GLRender(SoGLRenderAction *action)
|
||||
{
|
||||
inherited::GLRender(action);
|
||||
#if 0
|
||||
QGLWidget* window;
|
||||
SoState * state = action->getState();
|
||||
state->push();
|
||||
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
|
||||
SoGLWidgetElement::get(state, window);
|
||||
if (!window) {
|
||||
state->pop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders the open edges only.
|
||||
*/
|
||||
void SoFrameLabel::GLRender(SoGLRenderAction *action)
|
||||
{
|
||||
inherited::GLRender(action);
|
||||
#if 0
|
||||
QGLWidget* window;
|
||||
SoState * state = action->getState();
|
||||
state->push();
|
||||
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
|
||||
SoGLWidgetElement::get(state, window);
|
||||
if (!window) {
|
||||
state->pop();
|
||||
return;
|
||||
}
|
||||
|
||||
// Enter in 2D screen mode
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
|
@ -549,12 +558,12 @@ void SoFrameLabel::GLRender(SoGLRenderAction *action)
|
|||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
state->pop();
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
state->pop();
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
SO_NODE_SOURCE(TranslateManip);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user