#include "vtkOpenGLTexture.h"
#include "vtkBMPReader.h"
#include "vtkXMLImageDataReader.h"
-
#include "vtkImageData.h"
-#include "GL/glext.h"
+#include <GL/glext.h>
+#include <GL/glx.h>
#include <stdio.h>
-#include <stdio_ext.h>
#include <cmath>
#include <string>
#define GL_COORD_REPLACE_ARB 0x8862
#define GL_ARB_point_parameters 1
-GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat);
-GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *);
-
-GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint);
-GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *);
-GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint);
-GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *);
-GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *);
-GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+//GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat);
+//GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *);
#ifdef __cplusplus
}
#endif
+PFNGLGENPROGRAMSARBPROC glGenProgramsARB = NULL;
+PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB = NULL;
+PFNGLBINDPROGRAMARBPROC glBindProgramARB = NULL;
+PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = NULL;
+PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB = NULL;
+
unsigned int shaderId;
//-----------------------------------------------------------------------------
{
this->bmpReader = vtkBMPReader::New();
}
- this->DefaultPointSize = 10.0; //-1.0;
+ this->DefaultPointSize = 50.0; //-1.0;
this->MaximumSupportedSize = 0.0;
this->QuadraticPointDistanceAttenuation[0] = 1.0;
this->QuadraticPointDistanceAttenuation[1] = 0.0;
//-----------------------------------------------------------------------------
void initShader()
{
- std::string aResDir = std::string( getenv( "VISU_ROOT_DIR") ) +"/share/salome/resources/";
+ std::string fileName = std::string( getenv( "VISU_ROOT_DIR") ) +
+ "/share/salome/resources/Vertex_Program_ARB.txt";
-#ifdef ARB_PROGRAM
- unsigned char* shader = readShaderFile( aResDir + "Vertex_Program_ARB.txt" );
+ unsigned char* shader = readShaderFile( fileName );
int size = strlen( (char*)shader );
- /*
- cout << "Shader :" << endl;
- for( int i = 0; i < size; i++ )
- cout << shader[i];
- cout << endl;
- */
+
glGenProgramsARB( 1, &shaderId );
glBindProgramARB( GL_VERTEX_PROGRAM_ARB, shaderId );
glProgramStringARB( GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
size, shader );
-#else
- unsigned char* shader = readShaderFile( aResDir + "Vertex_Program_NV.txt" );
- int size = strlen( (char*)shader );
+
/*
cout << "Shader :" << endl;
for( int i = 0; i < size; i++ )
cout << shader[i];
cout << endl;
- */
- glGenProgramsNV( 1, &shaderId );
- glLoadProgramNV( GL_VERTEX_PROGRAM_NV, shaderId,
- size, ( const GLubyte* )shader );
-
- glBindProgramNV( GL_VERTEX_PROGRAM_NV, shaderId );
-#endif
- /*
if( glGetError() == GL_NO_ERROR )
cout << "Loading vertex program... ok" << endl << endl;
else
glRotatef( 0.0f, 1.0f, 0.0f, 0.0f );
glRotatef( 0.0f, 0.0f, 1.0f, 0.0f );
-#ifdef ARB_PROGRAM
- glProgramEnvParameter4fARB( GL_VERTEX_PROGRAM_ARB, 0, 1.0f, 1.0f, 1.0f, 1.0f );
- glProgramEnvParameter4fARB( GL_VERTEX_PROGRAM_ARB, 1, 1.0f, 10.0f, 100.0f, 1000.0f );
-#else
- glProgramParameter4fNV( GL_VERTEX_PROGRAM_NV, 0, 1.0f, 1.0f, 1.0f, 1.0f );
- glProgramParameter4fNV( GL_VERTEX_PROGRAM_NV, 1, 100.0f, 1.0f, 1.0f, 1.0f );
-#endif
+ glProgramEnvParameter4fARB( GL_VERTEX_PROGRAM_ARB, 0, 50.0f, 1.0f, 1.0f, 1.0f );
+ glProgramEnvParameter4fARB( GL_VERTEX_PROGRAM_ARB, 1, 1.0f, 1.0f, 1.0f, 1.0f );
+ glProgramEnvParameter4fARB( GL_VERTEX_PROGRAM_ARB, 2, 1.0f, 10.0f, 100.0f, 1000.0f );
}
//-----------------------------------------------------------------------------
// Release the graphics resources used by this mapper. In this case, release
return;
}
+ glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)glXGetProcAddressARB((const GLubyte*)"glGenProgramsARB");
+ glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)glXGetProcAddressARB((const GLubyte*)"glDeleteProgramsARB");
+ glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)glXGetProcAddressARB((const GLubyte*)"glBindProgramARB");
+ glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)glXGetProcAddressARB((const GLubyte*)"glProgramStringARB");
+ glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC)glXGetProcAddressARB((const GLubyte*)"glProgramEnvParameter4fARB");
+
initShader();
setShaderConstants();
initSprites();
-
-#ifdef ARB_PROGRAM
glEnable( GL_VERTEX_PROGRAM_ARB );
glColor4f( 1.0, 1.0, 1.0, 1.0 );
glBindProgramARB( GL_VERTEX_PROGRAM_ARB, shaderId );
-#else
- glEnable( GL_VERTEX_PROGRAM_NV );
-
- glColor4f( 1.0, 1.0, 1.0, 1.0 );
-
- glBindProgramARB( GL_VERTEX_PROGRAM_NV, shaderId );
-#endif
vtkIdType *pts = 0;
vtkIdType npts = 0;
p->GetPoint(pts[0])[0],
p->GetPoint(pts[0])[1],
p->GetPoint(pts[0])[2] );
-
+ /*
this->DrawTexture( TextureAlphaChannel,
p->GetPoint(pts[0])[0],
p->GetPoint(pts[0])[1],
}
glEnd();
-#ifdef ARB_PROGRAM
glDisable( GL_VERTEX_PROGRAM_ARB );
-#else
- glDisable( GL_VERTEX_PROGRAM_NV );
-#endif
}
}
//