Forums
Can't see my image?(Lenna) - Printable Version

+- Forums (http://www.scratchpadgames.net/forums)
+-- Forum: Main Forums (http://www.scratchpadgames.net/forums/forumdisplay.php?fid=1)
+--- Forum: Fundamentals Errata/Questions (http://www.scratchpadgames.net/forums/forumdisplay.php?fid=3)
+--- Thread: Can't see my image?(Lenna) (/showthread.php?tid=358)



Can't see my image?(Lenna) - Brian Beuken - 03-01-2019

I've covered this before but its a common error as its one of the 1st things people are getting stuck on. It only applies to Raspberry

If you are having trouble getting Lenna to come up there's 2 possible issues.
1st the formatting in the book for RectVertices is terrible, making it easy to misread, it should look like this

GLfloat RectVertices[] = { 
                                     -0.5f, 0.5f, 0.0f, // Position 0.
                                     0.0f, 0.0f, // texcoord 0.
                                    -0.5f,-0.5f,0.0f, // Position 1.
                                     0.0f,1.0f, // texcoord 1.
                                     0.5f, -0.5,0.0f, // Position 2.
                                     1.0f, 1.0f, // texCoord 2.
                                     0.5f, 0.5f, 0.0f, // Position 3.
                                     1.0f, 0.0f // texCoord 3.
                                     };

Be careful to enter the data correctly, I see a lot of people mistyping that. (cut and paste this)

2nd, this one is my fault, there's a couple of lines missing in init_ogl which didn't cause any issues on older Raspbian GPU drivers but do on the current version if you are setting up a full screen display (windowed displays are "usually" ok)

Where you create an EGL window like this
//Create an EGL window surface
                 state->width = width;
                 state->height = height;

                 dest_rect.x = 0;
                 dest_rect.y = 0;
                 dest_rect.width = state->width; //it needs to know our window size
                 dest_rect.height = state->height;

                 src_rect.x = 0;
                 src_rect.y = 0;

you should add these 2 lines just after

                  src_rect.width = state->width<<16;
                  src_rect.height = state->height<<16;

If its not done the results of your set up are unpredictable, it may well work fine but best to add it as it should have been there in the 1st place.


RE: Can't see my image?(Lenna) - Brian Beuken - 03-01-2019

I better make this sticky its an early issue