SoCallback and SoSelection

SoCallback and SoSelection

Post by Marc Eilhar » Tue, 29 Apr 2003 22:53:15



Hi,

Could anybody help me by following problem:

My goal is to create a Viewer which is able to read a Vrml-File with
Callbackfunctions in it!
The Viewer must catch the actions before they are applied and send them to
a Server (over Sockets).
After retrieving the action the Server just sends the actions back to the
Client which apply the action!

Dont worry I just wanted to know if

- i can make this with SoCallback in the Vrml-File (Are they really stored
in the Vrml-File??),
- catching the Actions with SoSelection->addSelectionCallback - and
applying the action with SoCallback->doAction()

or is there a better way?

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

 
 
 

1. OpenGL textures in SoCallback dont show up on SGI

Hi all,
I've tried to draw a textured rectangle with OpenGL in a callback func
registered to an SoCallback node. The rectangle itself shows up but the
texture doesn't. The thing is - it works on NT (with TGSs Inventor
Implementation) but it doesn't work on SGI.
Did anybody have the same problems ?

Thanks in advance,

Michael

Here is my source code :

The render func (registerd at SoCallback) :
--------------------------------------------

static void renderCBFunc(void *userData, SoAction *action)
{
// check if action is a render action
if (action->isOfType(SoGLRenderAction::getClassTypeId())) {
   glEnable(GL_TEXTURE_2D);
   glBindTexture(GL_TEXTURE_2D, texName[0]);
   glBegin(GL_QUADS);
   glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
   glTexCoord2f(0.0, 1.0); glVertex3f(-2.0, 1.0, 0.0);
   glTexCoord2f(1.0, 1.0); glVertex3f(0.0, 1.0, 0.0);
   glTexCoord2f(1.0, 0.0); glVertex3f(0.0, -1.0, 0.0);
   glEnd();
   glDisable(GL_TEXTURE_2D);
   SoCacheElement::invalidate(action->getState());
   }

The texture generation
-----------------------

static GLubyte checkImage[checkImageHeight][checkImageWidth][4];

static GLuint texName[1];

void makeCheckImages(void)
{
   int i, j, c;

   for (i = 0; i < checkImageHeight; i++) {
      for (j = 0; j < checkImageWidth; j++) {
         c = ((((i&0x8)==0)^((j&0x8))==0))*255;
         checkImage[i][j][0] = (GLubyte) c;
         checkImage[i][j][1] = (GLubyte) c;
         checkImage[i][j][2] = (GLubyte) c;
         checkImage[i][j][3] = (GLubyte) 255;
      }
   }

The initialization
-------------------
void init(void)
{
   makeCheckImages();
   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

   glGenTextures(1, texName);
   glBindTexture(GL_TEXTURE_2D, texName[0]);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
                   GL_NEAREST);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
                   GL_NEAREST);
   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth,
                checkImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
                checkImage);

Sent via Deja.com http://www.deja.com/
Before you buy.

2. I need a plugin or method to......

3. SoCallback and SoSwitch

4. PC 3D Graphics Accelerators FAQ (Part 1 of 2)

5. SoCallback and the bounding box

6. Histograms

7. SoCallback texture information

8. How to respond to SoGetBoundingBoxAction in SoCallback?

9. SoCallback

10. Problems with SoCallback/SoSearchAction

11. SoCallback (glClipPlane)

12. OpenInventor: Problems with SoSelection->setPickFilterCallback