Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 31 Aug 2009
Offline Last Active Private

Topics I've Started

OpenGL to WebGL ?

18 April 2013 - 08:07 AM

Hi there,


Imagine I have a C++ application, this one generate an image (in C++, CUDA, OpenCL) and then I would like to transfer this image to a specific browser that support WebGL.


The current version of the C++ software simply render into a FBO...


Is it possible to do ? how ?


Thanks for your help

Merge PBO with multi gpu

05 March 2013 - 12:53 PM


I m work ing on a OpenCL / Cuda application and for each gpu I generate an image.

I would like to create à PBO for each GPU and be sure that each PBO is located on a specific GPU.
1) question 1: how to create à PBO on a specific GPU ? Is it possible ?

Once done I would like to merge the PBO (do a simple average of the pixel color) and display them.
2) question 2: how can I merge all the PBOs and display them... What is the best solution ? Using GLSL ?

Thanks a lot for your help

SetPixelFormat failed....

18 May 2012 - 01:25 AM


I have an application that was working for a long time and suddenly the SetPixelFormat method failed !
I have search the reason for a long time, but no way, I can't find the reason !
The GetLastError return 2000 (Mean that SetPixelFormat failed !!!)

I have a good Video card (gtx 590), but anyway I have the software on a lot of computer and always have the same problem !

What I have notice is the the method failed when I use the following flag : PFD_DOUBLEBUFFER

Of course, I need the double buffer !

How can I debug this problem ? I'm searching for a long time and of course it is a critical problem !

Compute best zNear and zFar for a specific scene

10 May 2012 - 10:49 AM


I'm currently working on a 3D editor and we can load very very small models or very very big ones...
The problem I have is during display, due to bad zNear and zFar... I got a lot of undesired effects.
I have search the web for a solution, but found nothing....

What I would like is to compute the zNear and zFar to use depending of my scene. By example by looking at the scene bounding box and the camera position & camera target...

I have try the following, but I can't acheive very good results... if someone can help ?

float viewportWidth = (float)surface->GetWidth();
float viewportHeight = (float)surface->GetHeight();
glViewport(0, 0, (GLsizei)viewportWidth, (GLsizei)viewportHeight); // Default
float aspectRatio = viewportWidth / viewportHeight;
//---- Set up the view
glMatrixMode(GL_PROJECTION); // Set up the projection
if (!camera)
  gluPerspective(45, aspectRatio, 0.1f, 1000.f);

// reference : http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html
// delta = z * z / ( zNear * (1<<N) - z )
// Where:
// N	 = number of bits of Z precision
// zNear = distance from eye to near clip plane
// z	 = distance from the eye to the object
// delta = the smallest resolvable Z separation at this range.
// Also see : http://sightations.wordpress.com/tag/opengl/
//---- Calculate optimal near and far Z clipping planes 
float sceneRadius;
sceneRadius = (camera->GetEye() - camera->GetEyeAt()).Length() * 2.f;  // Based on the current target BB
// Get buffer properties
GLint mDepthBufferResolution = 16;
glGetIntegerv(GL_DEPTH_BITS, &mDepthBufferResolution);
float zFar = 2.f * sceneRadius + (camera->GetEye() - camera->GetEyeAt()).Length();
if (zFar < 1e-20f)
  zFar = 1e-20f;
float zNear;
if (mDepthBufferResolution >= 24)
  zNear = 0.00001f * zFar;
  zNear = 0.01f * zFar;
if (zNear < 1e-20f)
  zNear = 1e-20f;
float Zoom = 1.f;
VNFilm* film = surface->GetScene()->GetFilm();
if (film && !film->GetAutoSize())
  float filmHeight = (float)film->GetHeight();
  Zoom = viewportHeight / filmHeight;
// Reference : http://www.opengl.org/resources/faq/technical/transformations.htm
float fov = camera->GetFOV() * 0.5f * (M_PI_F/180.f);
float top = tan(fov) * zNear;
float bottom = -top;
float left = aspectRatio * bottom;
float right = aspectRatio * top;
glFrustum(Zoom * left, Zoom * right, Zoom * bottom, Zoom * top, zNear, zFar);

Support of scene with millions of triangles in 3D Softwares

10 April 2012 - 02:45 AM


I'm working on a 3D Software where I should be able to display a scene/model with several millions of elements, some models are 100 GB on hard drive.

So, I would like to know how softwares like 3DS/Maya/... support this kind of models ?
Do they play with a kind of LOD model, out of core system, simplified models etc... ?

Do you know all the way to do ?

If you know algorithms etc... it is great too :-)