Jump to content

  • Log In with Google      Sign In   
  • Create Account


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

#4786029 reading data from a buffer and display a texture

Posted by on 15 March 2011 - 08:15 AM

The questions are: can anyone suggest about the reason of this problem?

A crash happens if you try to access a memory location that you are not suppose to or if you have caused a memory corruption and it has caused a crash at some other instruction.

What is the buffer that holds the RGB data of the image displayed on the screen?

The back buffer. Also called the framebuffer.

Any function for screenshot ?

Use glReadPixels.
Use the GL documentation. http://www.opengl.org/sdk/docs/man3/

#4781201 Depth bias clamping in opengl

Posted by 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 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 on 08 February 2011 - 11:57 AM

There is also my library. See my signature.
The code would look something like
float mymatrix[16];
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 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.


#4769877 Texture rendering problems

Posted by on 04 February 2011 - 09:44 PM


  • glGenTextures(1,&texture);
  • glBindTexture(GL_TEXTURE_2D,texture);
  • 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

#4768499 OpenGL Lines Width bigger when resizing window

Posted by on 02 February 2011 - 08:28 AM


#4767312 Texturing with GLSL 1.2

Posted by on 30 January 2011 - 09:57 PM


#4764779 Proof God doesn't exist?

Posted by 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 on 23 January 2011 - 12:39 PM


#4748119 First attempt at non-deprecated code

Posted by 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;

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

#4685113 problem with GLSL and arrays

Posted by on 31 July 2010 - 01:21 AM

Here is another suggestion

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

float vMul[] = {0.05, 0.1, 0.25, 0.3, 0.1, 0.3, 0.25, 0.1, 0.05};
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 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 on 09 December 2007 - 12:00 AM

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