• Create Account

# Kepakiano

Member Since 27 Oct 2012
Offline Last Active Mar 09 2013 06:14 AM

### SSBO vs. Texture

06 February 2013 - 08:54 AM

Hey there,

I am writing a fragment shader, which needs two float values with some additional information for every fragment it calculates. These values will be calculated at the beginning of the program and won't change any time, so they could be stored in a 2D or 1D lookup table/array.

My first two choices for this would be:

1. rendering the values in a separate fragment shader to a 2D GL_RG32F texture or

2. calculating the values in a compute shader and store them in a vec2 array in a shader storage buffer object (the size of table is not known at compile time!).

What is the best/fastest way to store them and look them up? Is there another fast method?

### Mapping rectangular texture to arbitrary convex quadrilateral

22 January 2013 - 11:10 AM

Hi there,

after two days of research and trial and error, I give up and need help.
I'm trying to map a texture (not necessarily quadratic or a size of 2^x) to an arbitrary convex quadrilateral. However, since the OpenGL pipeline divides the quad into two triangles, there is an ugly seam
Original texture:

Texture, if the upper left point is set to (0, 0.5):

Currently, the texture coordinates are mapped in the most naive way:
`305             glTexCoord4f(0.0f, 1.0f, 0.0f, 1.0f);306             glVertex3f(_wall_properties.matrix[y][x].first, _wall_properties.matrix[y][x].second, 0.0f);307 308             glTexCoord4f(0.0f, 0.0f, 0.0f,  1.0f );309             glVertex3f(_wall_properties.matrix[y + 1][x].first, _wall_properties.matrix[y + 1][x].second, 0.0f);310 311             glTexCoord4f(1.0f, 0.0f, 0.0f, 1.0f);312             glVertex3f(_wall_properties.matrix[y + 1][x + 1].first, _wall_properties.matrix[y + 1][x + 1].second, 0.0f);313 314             glTexCoord4f(1.0f, 1.0f, 0.0f, 1.0f);315             glVertex3f(_wall_properties.matrix[y][x + 1].first, _wall_properties.matrix[y][x + 1].second, 0.0f);`
I have already read tons of stuff on the topic, including Cass' explanation at http://www.xyzw.us/~cass/qcoord/. Strangely, changing the q-coordinate of the textures does not have any effect on the texture. Besides, I wouldn't know, how to calculate the correct q.
I also tried changing the texture matrix following this post: http://www.gamedev.net/topic/419296-skewedsheared-texture-mapping-in-opengl/ with unsatisfying results.

Would a correct texture matrix solve the problem as this post http://blogs.agi.com/insight3d/index.php/2009/11/20/trapezoidal-texture-projection-with-opengl/ proposes?

PARTNERS