diff --git a/NOMADVRLib/CompileGLShader.h b/NOMADVRLib/CompileGLShader.h index 61a2e10d0df1ee21cb1070232fd9169533e0da6c..654c9260dc773467f0620b6089623a68d6ac1415 100644 --- a/NOMADVRLib/CompileGLShader.h +++ b/NOMADVRLib/CompileGLShader.h @@ -1,5 +1,10 @@ #include "MyGL.h" +#define SHADERNAME 0 +#define SHADERVERTEX 1 +#define SHADERFRAGMENT 2 +#define SHADERTESSEVAL 3 + //----------------------------------------------------------------------------- // Purpose: Compiles a GL shader program and returns the handle. Returns 0 if // the shader couldn't be compiled for some reason. diff --git a/NOMADVRLib/ConfigFile.cpp b/NOMADVRLib/ConfigFile.cpp index 596eadad61f3c3ca27bf930a97fa9f923c677507..9cb80e3eb1e1373605d83c68031a92e38ccc6fe0 100644 --- a/NOMADVRLib/ConfigFile.cpp +++ b/NOMADVRLib/ConfigFile.cpp @@ -113,7 +113,7 @@ while (*file!='\0') { int loadConfigFile(const char * f) { //default values - eprintf ("load config file start"); + //eprintf ("load config file start"); bool nonperiodic=false; char base_url[1024]="http://enc-testing-nomad.esc.rzg.mpg.de/v1.0/materials/"; char material[1024]=""; @@ -313,9 +313,9 @@ int loadConfigFile(const char * f) char url[2048]; sprintf (url, "%s%s", base_url, material); //rgh fixme, we know only one - eprintf ("load config file start, before readAtomsJsonURL"); + //eprintf ("load config file start, before readAtomsJsonURL"); e = readAtomsJsonURL (url, &numAtoms, ×teps, &atoms, abc, &clonedAtoms, token); - eprintf ("load config file start, after readAtomsJsonURL"); + //eprintf ("load config file start, after readAtomsJsonURL"); if (e<0) return e-300; numClonedAtoms=clonedAtoms[0].size()/4; diff --git a/NOMADVRLib/IsoShaders.cpp b/NOMADVRLib/IsoShaders.cpp index 41a32ff159e3de789aa82250a19ced27addb80f4..5148a004449afb4056a7f711d74182ae03a826ae 100644 --- a/NOMADVRLib/IsoShaders.cpp +++ b/NOMADVRLib/IsoShaders.cpp @@ -1,5 +1,7 @@ #include "IsoShaders.h" +#define GRIDSTR "1" + const char * const IsoShaders [] = {"Iso Renderer", //vertex #if defined(WIN32) || defined(CAVE) @@ -41,3 +43,61 @@ const char * const IsoShaders [] = {"Iso Renderer", //tess nullptr }; + +const char *const IsoTransparentShaders [] = {"Iso Transparent Renderer", + //vertex +#if defined(WIN32) || defined(CAVE) + "#version 410\n" +#else + "#version 300 es\n" +#endif + "uniform mat4 matrix;\n" + "layout(location = 0) in vec4 position;\n" + "layout(location = 1) in vec3 normalsIn;\n" + "layout(location = 2) in vec4 colorIn;\n" + // "layout(location = 3) in vec2 uvIn;\n" + "out vec4 color;\n" + "out vec3 n;\n" + "out highp vec4 pos;\n" + // "out vec2 uv;\n" + "void main()\n" + "{\n" + " color = vec4(colorIn.rgba);\n" + " n=normalize(normalsIn);\n" + // " uv=uvIn;\n" + "int i=gl_InstanceID / " GRIDSTR ";\n" + "int j=gl_InstanceID % " GRIDSTR ";\n" + " pos = matrix * (position + vec4 (float(i)*0.15*101.0, 0, float(j)*0.15*101.0, 0));\n" + " gl_Position = pos;\n" + //" gl_Position = matrix * position;\n" + "}\n", + + // Fragment Shader +#if defined(WIN32) || defined(CAVE) + "#version 410 core\n" +#else + "#version 300 es\n" +#endif + "uniform sampler2D diffuse;\n" //now extra depth texture for peeling + "in vec4 color;\n" + "in vec3 n;\n" + "in highp vec4 pos;\n" + "out vec4 outputColor;\n" + "void main()\n" + "{\n" + "vec4 mytex=texture(diffuse, vec2(pos.x/pos.w*0.5+0.5, pos.y/pos.w*0.5+0.5));\n" + //http://www.gamedev.net/topic/556521-glsl-manual-shadow-map-biasscale/ + //"vec2 d=vec2(dFdx(pos.z), dFdy(pos.z));\n" + //"highp float m=sqrt(d.x*d.x + d.y*d.y);\n" + "if ((pos.z/pos.w+1)/2 <= mytex.r+0.0001 ) discard;\n" + + "lowp vec3 nn=normalize(n);" + "lowp float a=max(0.0, dot(nn, vec3(0,sqrt(2.0)/2.0,sqrt(2.0)/2.0)));\n" + "lowp float b=max(0.0, dot(nn, vec3(0,0,1)));\n" + "highp vec4 res=color;\n" + //"outputColor = vec4(pos.x/pos.w*0.5+0.5, pos.y/pos.w*0.5+0.5, 0,1);\n" + " outputColor = vec4 ((res.rgb) * (0.2 + 0.2*a + 0.3*b), color.a);\n" + + "}\n", + nullptr +}; \ No newline at end of file diff --git a/NOMADVRLib/IsoShaders.h b/NOMADVRLib/IsoShaders.h index 2b0c54befbce7b9193761e1f7f4dd7f8d00b2bec..8e5e2bc9cf857080c5900109069f87da43658060 100644 --- a/NOMADVRLib/IsoShaders.h +++ b/NOMADVRLib/IsoShaders.h @@ -1 +1,3 @@ extern const char * const IsoShaders[]; +extern const char *const IsoTransparentShaders []; + diff --git a/NOMADVRLib/IsosurfacesGL.cpp b/NOMADVRLib/IsosurfacesGL.cpp index 93f43a344cf12838726428facfa0689225360da2..3187a34db92daa7d07cc793e1f4617421f830f62 100644 --- a/NOMADVRLib/IsosurfacesGL.cpp +++ b/NOMADVRLib/IsosurfacesGL.cpp @@ -1,4 +1,4 @@ -//#if 0 +//#if 0 #include <vector> #include <math.h> @@ -177,28 +177,25 @@ GLenum PrepareGLiso (GLuint vao, GLuint vertbuffer, const std::vector<float> &ve glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertdata.size(), &vertdata[0], GL_STATIC_DRAW); if ((e = glGetError()) != GL_NO_ERROR) eprintf("opengl error %d, glBufferData, l %d\n", e, __LINE__); - int offset = 0; //now pos[3], normal[3], color[4] //pos glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, (const void *)offset); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, (const void *)(0)); if (glGetError() != GL_NO_ERROR) eprintf("opengl error attrib pointer 0\n"); //normal - offset += 3 * sizeof(GLfloat); //3 floats glEnableVertexAttribArray(1); - glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, stride, (const void *)offset); + glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, stride, (const void *)(3 * sizeof(float))); if ((e=glGetError()) != GL_NO_ERROR) eprintf("opengl error attrib pointer 1\n"); //color - offset += 3 * sizeof(GLfloat); //6 floats glEnableVertexAttribArray(2); - glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, stride, (const void *)offset); + glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, stride, (const void *)(6 * sizeof(float))); if (glGetError() != GL_NO_ERROR) eprintf("opengl error attrib pointer 2\n"); @@ -239,3 +236,80 @@ GLenum PrepareISOShader (GLuint *p, GLint *mat) { } return glGetError(); } + +GLenum PrepareISOTransShader (GLuint *p, GLint *mat) { + *p= CompileGLShader( + IsoTransparentShaders[SHADERNAME], + IsoTransparentShaders[SHADERVERTEX], + IsoTransparentShaders[SHADERFRAGMENT], + IsoTransparentShaders[SHADERTESSEVAL] + ); + *mat=glGetUniformLocation(*p, "matrix"); + if( *mat == -1 ) + { + eprintf( "Unable to find matrix uniform in ISO shader\n" ); + + } +return glGetError(); +} + +//code not opengl es ready yet +#if defined(WIN32) || defined (CAVE) +bool SetupDepthPeeling(int renderWidth, int renderHeight, int zlayers, GLuint *textures /*[zlayers+2 (2 depth, zlayers colour)]*/, + GLuint *peelingFramebuffer) +{ + //https://www.opengl.org/wiki/Common_Mistakes + //Until this is resolved in NVIDIA's drivers, it is advised to make sure that all textures have mipmap levels, and that all glTexParameteri + //values are properly set up for the format of the texture. For example, integral textures are not complete if the mag and min filters have any LINEAR fields. + + GLenum e; + if ((e = glGetError()) != GL_NO_ERROR) + eprintf("opengl error %d, start SetupDepthPeeling\n", e); + GLuint clearColor = 0; + for (int i = 0; i < 2; i++) { + glBindTexture(GL_TEXTURE_2D, textures[i]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + if ((e = glGetError()) != GL_NO_ERROR) + eprintf("opengl error %d, SetupDepthPeeling a\n", e); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, renderWidth, renderHeight, 0, + GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0); + + if ((e = glGetError()) != GL_NO_ERROR) + eprintf("opengl error %d, SetupDepthPeeling b\n", e); + + glClearTexImage(textures[i], 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, &clearColor); + + if ((e = glGetError()) != GL_NO_ERROR) + eprintf("opengl error %d, SetupDepthPeeling c\n", e); + } + + for (int i = 0; i < zlayers; i++) { + glBindTexture(GL_TEXTURE_2D, textures[2+i]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, renderWidth, renderHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + } + + if ((e = glGetError()) != GL_NO_ERROR) + eprintf("opengl error %d, SetupDepthPeeling textures end\n", e); + + //now create framebuffer + GLint dfb; + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &dfb); + glGenFramebuffers(1, peelingFramebuffer); + glBindFramebuffer(GL_FRAMEBUFFER, *peelingFramebuffer); + if ((e = glGetError()) != GL_NO_ERROR) + eprintf("Gl error: %d, l %d\n", e, __LINE__); + + glBindFramebuffer(GL_FRAMEBUFFER, dfb); + + + + return (e == GL_NO_ERROR); +} +#endif \ No newline at end of file diff --git a/NOMADVRLib/IsosurfacesGL.h b/NOMADVRLib/IsosurfacesGL.h index 0b738dbcf3ee4c79779cf6236fe1e072b6be6cc2..1a1669b8c0dabbfe000358a86d451fbd8d9cfacd 100644 --- a/NOMADVRLib/IsosurfacesGL.h +++ b/NOMADVRLib/IsosurfacesGL.h @@ -23,6 +23,9 @@ GLenum PrepareGLiso (GLuint vao, GLuint vertbuffer, const std::vector<float> &ve ); GLenum PrepareISOShader (GLuint *p, GLint *mat); - - +GLenum PrepareISOTransShader (GLuint *p, GLint *mat); +#if defined(WIN32) || defined (CAVE) +bool SetupDepthPeeling(int renderWidth, int renderHeight, int zlayers, GLuint *textures /*[zlayers+2 (2 depth, zlayers colour)]*/, + GLuint *peelingFramebuffer); +#endif #endif // __ISOSURFACESGL_H diff --git a/NOMADVRLib/MyGL.h b/NOMADVRLib/MyGL.h index fcd3a8cf0ba79ae3bf36c5684d1d840ebd36a400..5811a1818ad8d31754ff190f929d79f66e47af15 100644 --- a/NOMADVRLib/MyGL.h +++ b/NOMADVRLib/MyGL.h @@ -16,6 +16,9 @@ #ifndef GL_TESS_EVALUATION_SHADER #define GL_TESS_EVALUATION_SHADER GL_TESS_EVALUATION_SHADER_EXT #endif //GL_TESS_EVALUATION_SHADER + #ifndef GL_DEPTH_COMPONENT32 + #define GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT32_OES + #endif #endif //WIN32 #endif //__MYGL_H diff --git a/NOMADVRLib/TessShaders.h b/NOMADVRLib/TessShaders.h index 4f49d32826750148c44e09ceac2ced7dd39005bd..6c584ec7e007e1f349663a99da401ac3b56234e4 100644 --- a/NOMADVRLib/TessShaders.h +++ b/NOMADVRLib/TessShaders.h @@ -1,7 +1,2 @@ -#define SHADERNAME 0 -#define SHADERVERTEX 1 -#define SHADERFRAGMENT 2 -#define SHADERTESSEVAL 3 - extern const char * const AtomShaders[]; extern const char * const AtomShadersNoTess []; diff --git a/NOMADVRLib/atoms.cpp b/NOMADVRLib/atoms.cpp index 2adca796b3e08c4a6ab8503130f67ddbf43fc7f7..fce10b0deb62dfc260724cd5b8d2f6aa1b3538de 100644 --- a/NOMADVRLib/atoms.cpp +++ b/NOMADVRLib/atoms.cpp @@ -314,7 +314,7 @@ const char * readAtomsJsonErrors[] = { int readAtomsJsonURL (const char *const f, int **numatoms, int *timesteps, float ***pos, float abc[3][3], std::vector<float>** clonedAtoms, const char *const token) { -eprintf ("readAtomsJsonURL start"); +//eprintf ("readAtomsJsonURL start"); try { char host[2048], page[2048], url[2048], file[2048]; @@ -399,7 +399,7 @@ fclose(out); //system(cmd); char file [2048]; sprintf (file, "%s%s", TMPDIR, "material"); -eprintf ("readAtomsJsonURL before return"); +//eprintf ("readAtomsJsonURL before return"); return readAtomsJson (file, numatoms, timesteps, pos, abc, clonedAtoms, token); } @@ -444,7 +444,7 @@ void add (std::vector<float> *v, float x, float y, float z, float a) int readAtomsJson (const char *const f, int **numatoms, int *timesteps, float ***pos, float abc[3][3], std::vector<float>** clonedAtoms, const char *const token) { - eprintf ("readAtomsJson start"); +// eprintf ("readAtomsJson start"); char file[512]; int r; sprintf (file, "%s_cells.json", f); @@ -540,7 +540,7 @@ int readAtomsJson (const char *const f, int **numatoms, int *timesteps, float ** } TransformAtoms(*clonedAtoms, abc); -eprintf ("readAtomsJson, end"); +//eprintf ("readAtomsJson, end"); return 0; } diff --git a/OpenVR/TimestepData/hellovr_opengl.vcxproj b/OpenVR/TimestepData/hellovr_opengl.vcxproj index ad7f7e0463ebe54155f6b5f623968f5639708723..eb1e7d4608c8dd86845345f24a8e635666940d40 100644 --- a/OpenVR/TimestepData/hellovr_opengl.vcxproj +++ b/OpenVR/TimestepData/hellovr_opengl.vcxproj @@ -197,6 +197,7 @@ <ClInclude Include="NOMADVRLib\CompileGLShader.h" /> <ClInclude Include="NOMADVRLib\ConfigFile.h" /> <ClInclude Include="NOMADVRLib\eprintf.h" /> + <ClInclude Include="NOMADVRLib\IsoShaders.h" /> <ClInclude Include="NOMADVRLib\IsosurfacesGL.h" /> <ClInclude Include="NOMADVRLib\MyGL.h" /> <ClInclude Include="NOMADVRLib\polyhedron.h" /> diff --git a/OpenVR/TimestepData/hellovr_opengl_main.cpp b/OpenVR/TimestepData/hellovr_opengl_main.cpp index e0a251e32e20979f0485110a9742e8fed2bb0c23..95a895f406fff12f487c0fca8ce9ab817bc79748 100644 --- a/OpenVR/TimestepData/hellovr_opengl_main.cpp +++ b/OpenVR/TimestepData/hellovr_opengl_main.cpp @@ -35,7 +35,7 @@ #include "NOMADVRLib/TessShaders.h" #include "NOMADVRLib/UnitCellShaders.h" - +#include "NOMADVRLib/IsoShaders.h" #include "NOMADVRLib/CompileGLShader.h" #include "NOMADVRLib/polyhedron.h" @@ -64,7 +64,7 @@ //shown on https://www.vbw-bayern.de/vbw/Aktionsfelder/Innovation-F-T/Forschung-und-Technologie/Zukunft-digital-Big-Data.jsp #define GRID 1 -#define GRIDSTR "1" + #define NUMLODS 1 @@ -1089,61 +1089,9 @@ void CMainApplication::RenderFrame() //----------------------------------------------------------------------------- bool CMainApplication::CreateAllShaders() { - m_unSceneProgramID = CompileGLShader( - "Scene", - - //rgh FIXME, multiply normals by modelview!! - // Vertex Shader - "#version 410\n" - "uniform mat4 matrix;\n" - "layout(location = 0) in vec4 position;\n" - "layout(location = 1) in vec3 normalsIn;\n" - "layout(location = 2) in vec4 colorIn;\n" - // "layout(location = 3) in vec2 uvIn;\n" - "out vec4 color;\n" - "out vec3 n;\n" - "out highp vec4 pos;\n" - // "out vec2 uv;\n" - "void main()\n" - "{\n" - " color = vec4(colorIn.rgba);\n" - " n=normalize(normalsIn);\n" - // " uv=uvIn;\n" - "int i=gl_InstanceID / " GRIDSTR ";\n" - "int j=gl_InstanceID % " GRIDSTR ";\n" - " pos = matrix * (position + vec4 (float(i)*0.15*101.0, 0, float(j)*0.15*101.0, 0));\n" - " gl_Position = pos;\n" - //" gl_Position = matrix * position;\n" - "}\n", - - // Fragment Shader - "#version 410 core\n" - "uniform sampler2D diffuse;\n" //now extra depth texture for peeling - "in vec4 color;\n" - "in vec3 n;\n" - "in highp vec4 pos;\n" - "out vec4 outputColor;\n" - "void main()\n" - "{\n" - "vec4 mytex=texture(diffuse, vec2(pos.x/pos.w*0.5+0.5, pos.y/pos.w*0.5+0.5));\n" - //http://www.gamedev.net/topic/556521-glsl-manual-shadow-map-biasscale/ - //"vec2 d=vec2(dFdx(pos.z), dFdy(pos.z));\n" - //"highp float m=sqrt(d.x*d.x + d.y*d.y);\n" - "if ((pos.z/pos.w+1)/2 <= mytex.r+0.0001 ) discard;\n" - - "lowp vec3 nn=normalize(n);" - "lowp float a=max(0.0, dot(nn, vec3(0,sqrt(2.0)/2.0,sqrt(2.0)/2.0)));\n" - "lowp float b=max(0.0, dot(nn, vec3(0,0,1)));\n" - "highp vec4 res=color;\n" - //"outputColor = vec4(pos.x/pos.w*0.5+0.5, pos.y/pos.w*0.5+0.5, 0,1);\n" - " outputColor = vec4 ((res.rgb) * (0.2 + 0.2*a + 0.3*b), color.a);\n" - - "}\n" - ); - m_nSceneMatrixLocation = glGetUniformLocation( m_unSceneProgramID, "matrix" ); - if( m_nSceneMatrixLocation == -1 ) + if (GL_NO_ERROR!=PrepareISOTransShader (&m_unSceneProgramID, &m_nSceneMatrixLocation)) { - dprintf( "Unable to find matrix uniform in scene shader\n" ); + dprintf( "Error Preparing Transparency shader\n" ); return false; } /*m_nBlendingIntLocation = glGetUniformLocation(m_unSceneProgramID, "blending"); @@ -1328,59 +1276,12 @@ bool CMainApplication::SetupTexturemaps() bool CMainApplication::SetupDepthPeeling() { - //https://www.opengl.org/wiki/Common_Mistakes - //Until this is resolved in NVIDIA's drivers, it is advised to make sure that all textures have mipmap levels, and that all glTexParameteri - //values are properly set up for the format of the texture. For example, integral textures are not complete if the mag and min filters have any LINEAR fields. - - GLenum e; - if ((e = glGetError()) != GL_NO_ERROR) - dprintf("opengl error %d, start SetupDepthPeeling\n", e); - GLuint clearColor = 0; - for (int i = 0; i < 2; i++) { - glBindTexture(GL_TEXTURE_2D, m_iTexture[1 + i]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - if ((e = glGetError()) != GL_NO_ERROR) - dprintf("opengl error %d, %s SetupDepthPeeling a\n", e, gluErrorString(e)); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, m_nRenderWidth, m_nRenderHeight, 0, - GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0); - - if ((e = glGetError()) != GL_NO_ERROR) - dprintf("opengl error %d, %s SetupDepthPeeling b\n", e, gluErrorString(e)); - - glClearTexImage(m_iTexture[1], 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, &clearColor); - - if ((e = glGetError()) != GL_NO_ERROR) - dprintf("opengl error %d, SetupDepthPeeling c\n", e); - } - - for (int i = 0; i < ZLAYERS; i++) { - glBindTexture(GL_TEXTURE_2D, m_iTexture[3+i]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_nRenderWidth, m_nRenderHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - } + bool e; + e=::SetupDepthPeeling(m_nRenderWidth, m_nRenderHeight, ZLAYERS, m_iTexture+1, &peelingFramebuffer); + if (!e) + dprintf("Errir setting up DepthPeeling\n"); - if ((e = glGetError()) != GL_NO_ERROR) - dprintf("opengl error %d, %s SetupDepthPeeling textures end\n", e, gluErrorString(e)); - - //now create framebuffer - GLint dfb; - glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &dfb); - glGenFramebuffers(1, &peelingFramebuffer); - glBindFramebuffer(GL_FRAMEBUFFER, peelingFramebuffer); - if ((e = glGetError()) != GL_NO_ERROR) - dprintf("Gl error: %d, %s l %d\n", e, gluErrorString(e), __LINE__); - - glBindFramebuffer(GL_FRAMEBUFFER, dfb); - - - - return (e == GL_NO_ERROR); + return (e); } //----------------------------------------------------------------------------- @@ -2069,16 +1970,6 @@ void CMainApplication::RenderUnitCell(const vr::Hmd_Eye &nEye) } } -/* -Vector3 CMainApplication::GetDisplacement(int p[3]) -{ -Vector3 delta[3]; -for (int ss=0;ss<3;ss++) - delta[ss]=static_cast<float>(p[ss])*Vector3(abc[ss][0], abc[ss][1], abc[ss][2]); -Vector3 f=delta[0]+delta[1]+delta[2]; -return (f); -}*/ - void CMainApplication::RenderAtomsUnitCell(const vr::Hmd_Eye &nEye, int p[3]) { int e;