Jump to content

  • Log In with Google      Sign In   
  • Create Account


floatingwoods

Member Since 09 Jun 2008
Offline Last Active Jul 09 2014 03:52 PM
-----

Topics I've Started

glDrawElements without indices?

06 July 2014 - 10:00 AM

Hello,

 

I am using VBO's together with glDrawElements to quickly render a bunch of triangles. In my case, since each triangle has exactly 3 vertices, 3 normals and 3 texture coordinates, I could get rid of the indices and avoid having another VBO taking memory on the GPU.

My indices are always starting at zero and continuous.

 

Is there a way to avoid having to upload those indices?

 

Another option would be to have one single index buffer on the GPU that serves all the geometries that I need to render, but that is still taking some memory on the GPU.

 

Finally, and linked to the VBO's: how do people usually handle situations where there is no more free memory on the GPU for VBOs:

 

- how to notice that?

- how to overcome that?

 

Thanks!


OBJ format and texture coordinates

13 May 2014 - 03:47 PM

Hello,

 

I have been reading through various documentations of the OBJ (i.e. Wavefront) fileformat, and all mention for the vt tag:

vt u v [w]
Texture coordinates, in (u ,v [,w]) coordinates, these will vary between 0 and 1, w is optional and default to 0.

It says that u and v should have values between 0 and 1, which makes sense.

 

But many OBJ files contain entries like:

vt -13.7390 -7.9255 0.0000

How should I interpret those? Currently, I am simply doing a fmod so that I finally obtain values between 0 and 1. But that doesn't look correct. Applications like meshlab correctly interpret those values.

 

 


Per pixel lighting with GLSL

27 February 2014 - 09:24 AM

Hello,

 

I am very new to GLSL and trying to implement a simple per-pixel lighting. I found a lot of resources on the internet that even propose pixel shader and fragment shader code for this, but something is always wrong: the "default" pixel and fragment shader code is missing it seems (I get pixels that are individually lit, but everything is very dark, only one light supported, colors are strange). So it seems that a shader is just a piece of a puzzle, and should be combined with other components. But how? Or where can I find the code for a per pixel lighting shader, that supports my 8 lights and will basically render my scene as previously (except for nicer per-pixel lighting)?

Is it that difficult to have a simple per-pixel shading in openGL?

 


Adjacent camera display slightly different colors for same view patch

25 February 2014 - 10:44 AM

Hello,

 

I have 6 cameras, each with a view angle of 90 degrees, arranged orthogonaly. That allows me to create a spherical camera view, once a mapping between the 6 views to a texture has been decided.

 

That all works well, but depending on the camera orientations, I can sometimes notice that adjacent cameras can display slightly different colors when rendering a same scene patch. How can that be? My 6 cameras have exactly the same settings.

 

Following is a picture that shows the 6 views, and the resulting spherical view. In red the color differences. It has to be noted that the color differences do not depend on the camera, but on the orientation of the 6 cameras.

 

Thanks for any insight!

 

 


conditional statement + automatic clean-up in preprocessor command

17 December 2013 - 12:31 PM

Hello,

 

I wish to have a conditional statement, followed immediately by an object instanciation that will automatic clean-up at the end of a scope, a little bit similar to following example:

if (conditionRealized)
{
    // do something
}

which effectively would translate into something like:

if (conditionRealized)
{
    DummyObject dummy(initializationType);
    // do something
}

in above example, the destructor of dummy can automatically clean-up various things.

I have to place such a construct into several hundreds of functions, and I wish to simplify the task with a preprocessor command, so that I will be able to write:

IF_CONDITION_REALIZED_THEN
{
    // do something
}

but above construct does obviously not work, since the scope comes after the preprocessor command.

I could use a preprocessor like:

#define IF_CONDITION_REALIZED_THEN if(conditionRealized) { DummyObject dummy(initializationType);

in order to write my code like:

IF_CONDITION_REALIZED_THEN
    // do something
}

but my code editor doesn't like this (puts wrong indents), and it looks ugly.

 

Any idea?

 

Or, to present my problem in a different light:

 

I have a condition, that if passed, needs to make sure something is executed at the end of the scope, similar to this example:

if (canLockOtherThreads())
{
    // do something
    unlockOtherThreads();
}

PARTNERS