Jump to content

  • Log In with Google      Sign In   
  • Create Account

AhmedCoeia

Member Since 21 May 2012
Offline Last Active Apr 22 2013 01:19 AM
-----

Topics I've Started

I have been fired :(

21 April 2013 - 02:32 PM

My contract is not renewed as I was feeling, however I have been cheated by their words. They told me three weeks ago before my visa expires that they will give unlimited contract, they also talked with government about the extension,..etc. They made me sleep, and forget about it. Three days ago, They talked with me that they won't renew the contract because of financial problems. They took the key, ID, Immediately, with no respect at all, and I left the company at the same hour.

Recently, I have been asked to write a Server App in Java, to decode SOAP XML, the protocol had a lot of messages, many fields, didn't have previous experience with SOAP, Java Socket, Java Marasheller, and I had working version in 4 days.

The boss while telling my that I have to leave, he commented that I didn't care of CPU usage, which my colleague noticed it, and I immediately solved it!, he also said that I used the read() function, and that's wrong, what if there are missing packets, I told him I have a socket timeout!. I told him even before that meeting, to review my code, before delivering it, and give me comments, it seems that his feedback is to fire me!!.

I talked with the CEO on the phone and told him tell me the truth, he told me the major issue is financially, and we want to invest in sales. I'm totally depressed, don't trust myself anymore, I accepted very low salary and in the contract it is an entry position. I just want to leave the country, go to Egypt which is more worse, but I really can't forget how did they interact with me, however I helped them so much in a lot of things in their software.

I would like to hear from professionals how do they cope up with situations like that ?


Using EGL Pixel Buffer

26 February 2013 - 06:08 PM

I'm on embedded platform Mali400GPU, Ubuntu. I'm trying to use EGL
Pixel Buffer, to copy a texture that is rendered using fragment shader
to a pixel buffer so that I can do some processing on that buffer on
CPU. I have done the following code but when trying use the buffer
object and draw it on a quad, the quad has a distored texture, i don't
know why.

The main problem is I want to use EGL Pixel Buffer with glreadpixels in asynchronous manner to speed up reading from gpu to cpu

// EGL variables
EGLDisplay eglDisplay = 0;
EGLConfig eglConfigWindow = 0;
EGLConfig eglConfigPbuffer = 0;
EGLSurface eglSurfaceWindow = 0;
EGLSurface eglSurfacePbuffer = 0;
EGLContext eglContext = 0;


const EGLint attribListWindow[] =
{
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, 0,
EGL_NONE
};
const EGLint attribListPbuffer[] =
{
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, 0,
EGL_NONE
};
const EGLint srfPbufferAttr[] =
{
EGL_WIDTH, 1024,
EGL_HEIGHT, 1024,
EGL_COLORSPACE, GL_RGB,
EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB,
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
EGL_LARGEST_PBUFFER, EGL_TRUE,
EGL_NONE
};

EGLint iMajorVersion, iMinorVersion;
int iConfigs;
eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(eglDisplay, &iMajorVersion, &iMinorVersion);
eglChooseConfig(eglDisplay, attribListWindow,
&eglConfigWindow, 1, &iConfigs);
eglContext = eglCreateContext(eglDisplay,
eglConfigWindow, NULL, NULL);
eglSurfaceWindow = eglGetCurrentSurface(EGL_DRAW);
eglSurfacePbuffer = eglCreatePbufferSurface(eglDisplay,
eglConfigPbuffer,srfPbufferAttr);

eglMakeCurrent(eglDisplay, eglSurfacePbuffer, eglSurfacePbuffer, eglContext);

glGenTextures(1, &theSource);
glBindTexture(GL_TEXTURE_2D, theSource);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024,
1024, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexParameterf(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 

 

 

In Drawing:

UserData *userData = (UserData*)esContext->userData;
GLfloat vVertices[] = { -1.0f, -1.0f, 0.0f, // Position 0
0.0f, 0.0f, // TexCoord 0
-1.0f, 1.0f, 0.0f, // Position 1
0.0f, 1.0f, // TexCoord 1
1.0f, 1.0f, 0.0f, // Position 2
1.0f, 1.0f, // TexCoord 2
1.0f, -1.0f, 0.0f, // Position 3
1.0f, 0.0f // TexCoord 3
};
GLushort indices[] = { 0, 1, 2, 0, 2, 3 };

// Set the viewport
glViewport ( 0, 0, esContext->width, esContext->height );
// Clear the color buffer
glClear ( GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
// Use the program object
glUseProgram ( userData->programObject );

// Load the vertex position
glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
GL_FALSE, 5 * sizeof(GLfloat), vVertices );
// Load the texture coordinate
glVertexAttribPointer ( userData->texCoordLoc, 2, GL_FLOAT,
GL_FALSE, 5 * sizeof(GLfloat), &vVertices[3] );

glEnableVertexAttribArray ( userData->positionLoc );
glEnableVertexAttribArray ( userData->texCoordLoc );

// Bind the base map
glUniform1i ( userData->baseMapLoc, 0 );
glActiveTexture ( GL_TEXTURE0 );
glBindTexture ( GL_TEXTURE_2D, userData->baseMapTexId );
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
//glCopyTexImage2D(GL_TEXTURE_2D,0,0,0,0,0, 1024, 1024);
glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );

eglMakeCurrent(eglDisplay, eglSurfacePbuffer, eglSurfacePbuffer, eglContext);

eglBindTexImage(eglDisplay, eglSurfacePbuffer, EGL_BACK_BUFFER);

glBindTexture(GL_TEXTURE_2D, theSource);

glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1024, 1024, 0);
glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
 

 


Reading large texture using glreadpixels solution

22 February 2013 - 06:11 AM

I'm using Opengles on ubuntu on embedded platform. I'm trying to do some computer vision on a large texture 1024*1024. I have done some shaders on a larage texture that is coming from a camera, then I wanted to read back the pixels to do some manuiplations.

Using glreadpixels is slow to read the texture that is generated by the shader, so I proposed to copy the whole large texture from the camera to a small quad using an FBO, then use glreadpixesl to read the pixels from that quad, then do the processing on that quad. If I want to show the result, convert again that FBO to a large one.

Basically the idea is to reduce the 1k*1k texture to small quad, do the processing, then render it back to 1k*1k.

Would that solution work ?


Testing GPU to CPU bandwidth

20 February 2013 - 05:41 PM

Hi All,

I'm trying to do a simple test for my embedded board to test the GPU to CPU data rate, and is it fast enough for doing computer vision or not.

So Basically, I'm doing some fragment shader, then I'm copying the screen using glreadpixels, then I'm writing the screen to a file, and watching the FPS.. Is this test enough ?


glreadpixels don't work

20 February 2013 - 09:25 AM

Hi All,

 

I'm just trying to feed a cvMat a texture that is generated by
fragment shader, there is nothing appears on the screen, I don't know
where is the problem, is this in the driver or glreadPixels.. I just
loaded a TGA Image, to a fragment shader, then textured a quad, I wanted
to feed that texture to a cvMat, so I used glReadPixesl then genereated
a new texture, and drew it on the quad, but nothing appears.

 

The setup is on OpenGLES on Exynos, Mali400 GPU
 

Kindly note that the following code is executed at each frame.

 

glEnableVertexAttribArray( userData->positionloc);
glEnableVertexAttribArray( userData->texCoordLoc);

// use Fragment Shader Texture
glActivateTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE2D, userData->baseMapTexId);


// try to store it into cvMat or GLByte
cv::Mat pixels;
glPixelStorei(GL_PACK_ALIGNMENT, (pixels.step & 3) ? 1 : 4);
glReadPixels(0, 0, 1024, 1024, GL_RGB, GL_UNSIGNED_BYTE, pixels.data);

glEnable(GL_TEXTURE_2D);
GLuint textureID;
glGenTextures(1, &textureID);
 
// Create the texture
glTexImage2D(GL_TEXTURE_2D, // Type of texture
0, // Pyramid level (for mip-mapping) - 0 is the top level
GL_RGB, // Internal colour format to convert to
1024, // Image width i.e. 640 for Kinect in standard mode
1024, // Image height i.e. 480 for Kinect in standard mode
0, // Border width in pixels (can either be 1 or 0)
GL_RGB, // Input image format (i.e. GL_RGB, GL_RGBA, GL_BGR etc.)
GL_UNSIGNED_BYTE, // Image data type
pixels.data); // The actual image data itself

// try to draw that stored texture into a quad
glActiveTexture ( textureID );
glBindTexture ( GL_TEXTURE_2D,textureID );
glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices );
 

PARTNERS