Jump to content

  • Log In with Google      Sign In   
  • Create Account

V-man

Member Since 02 Mar 2002
Offline Last Active Feb 06 2013 09:01 AM

#4781201 Depth bias clamping in opengl

Posted by V-man on 02 March 2011 - 05:29 PM

Isn't this something that you could put in your pixel shader? glPolygonOffset is deprecated now anyway, unless I'm misunderstanding what this "depth bias" function in directx does. Sounds like you could implement whatever you want in the pixel shader.


Where does it say that glPolygonOffset is deprecated?
In a pixel shader? Nope, you can't duplicate what glPolygonOffset. Read the description at http://www.opengl.org/sdk/docs/man3/


#4774967 VBO Text Rendering

Posted by V-man on 16 February 2011 - 08:20 AM

VBO makes a difference only when you render a lot of triangles. Perhaps >10,000 triangles.
I don't recommend triangle strips. just use triangles.


#4771429 Matrices

Posted by V-man on 08 February 2011 - 11:57 AM

There is also my library. See my signature.
The code would look something like
float mymatrix[16];
glhLoadIdentityf2(mymatrix);
glhTranslatef2(mymatrix, 0.0, 5.0, 6.0);
glhScalef2(mymatrix, 1.0, 1.0, 2.0);
glhPerspectivef2(mymatrix, 45.0, aspectRatio, 0.1, 1000.0);

and mymatrix is ready. You send it to GL
glUniformMatrix4fv(m_perspective_id, 1, FALSE, mymatrix);


#4770020 Texture rendering problems

Posted by V-man on 05 February 2011 - 10:17 AM

GL_CLAMP is not what you want. On nVidia, it might produce the right result since they treat it as GL_CLAMP_TO_EDGE but on all others, you will get a border.

http://www.opengl.org/wiki/Common_Mistakes#Texture_edge_color_problem


#4769877 Texture rendering problems

Posted by V-man on 04 February 2011 - 09:44 PM

Use GL_CLAMP_TO_EDGE

  • glGenTextures(1,&texture);
  • glBindTexture(GL_TEXTURE_2D,texture);
  • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  • glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  • glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  • glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  • glTexImage2D(GL_TEXTURE_2D, 0, Canvas.Surface->format, Canvas.Surface->w, Canvas.Surface->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, Canvas.Surface->PixData);
and also, I love the classics
http://www.opengl.or...32.2C_glTexEnvi


#4768499 OpenGL Lines Width bigger when resizing window

Posted by V-man on 02 February 2011 - 08:28 AM

Magic?


#4767312 Texturing with GLSL 1.2

Posted by V-man on 30 January 2011 - 09:57 PM

http://www.opengl.org/wiki/Common_Mistakes#Creating_a_Texture


#4764779 Proof God doesn't exist?

Posted by V-man on 25 January 2011 - 05:59 PM

Thought exercise - you live in the country and one night an alien spaceship lands in your yard, and an alien emerges and engages in telepathy with you. The ship departs, leaving evidence of its landing - dents in the ground, scorch marks, etc. Maybe your family even see it too. But it wasn't tracked conveniently by satellites.

Explain how you prove it happened.


In this case you saw the aliens and you know that it has happened. You don't need to prove it.
There is no need to believe in aliens either. Believing in something doesn't make it true or false.

You can explain your story to others. Perhaps people who are very interested in such matters. They will build instruments, better instruments, more instruments to detect alien vessels.
You can hope that they will come back and the instruments will detect them.
The story and photos will get printed. The information will be passed along. Other countries will join in on the effort of detecting them. etc etc.


#4763542 glGetAttribLocation

Posted by V-man on 23 January 2011 - 12:39 PM

http://www.opengl.or...UniformLocation
opengl.org/wiki/GLSL_:_common_mistakes#glGetUniformLocation


#4748119 First attempt at non-deprecated code

Posted by V-man on 19 December 2010 - 03:47 PM

It would be something like this http://www.opengl.org/wiki/Vertex_Arrays

except that your struct would be

struct MyVertex_2000
{
float x, y, z; //Vertex
float r, g, b, a; //Color
float padding;
};

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(MyVertex_2000), &vertex[0].x);
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_FLOAT, sizeof(MyVertex_2000), &vertex[0].r);



#4685113 problem with GLSL and arrays

Posted by V-man on 31 July 2010 - 01:21 AM

Here is another suggestion

//YOUR SHADER - let's declare a uniform
uniform float vMul[9];

//IN YOUR C++ CODE
float vMul[] = {0.05, 0.1, 0.25, 0.3, 0.1, 0.3, 0.25, 0.1, 0.05};
glUseProgram(myprogram);
glUniform1fv(uniformlocation, 9, vMul);

and you only need to do that once because GLSL shaders remember the uniform values. This should give you identical result and identical performance to that former method.


#4637927 normal matrices in current GL versions

Posted by V-man on 22 April 2010 - 06:34 AM

This may surprise you, but you probably don't need a "normal matrix".
As long as you don't use an uneven glScale, then you can just go ahead and use the modelview matrix.
This is what I do

//normal.w must be 0.0 to kill off translation
vec3 resultNormal;
resultNormal = vec3(ModelviewMatrix * vec4(InNormal, 0.0));



#4117003 glGetPixels problem

Posted by V-man on 09 December 2007 - 12:00 AM

You need to create a GL context before making any gl calls.




PARTNERS