Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't see my image?(Lenna)
#1
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.
Brian Beuken
Lecturer in Game Programming at Breda University of Applied Sciences.
Author of The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's 



Reply


Messages In This Thread
Can't see my image?(Lenna) - by Brian Beuken - 03-01-2019, 12:15 PM
RE: Can't see my image?(Lenna) - by Brian Beuken - 03-01-2019, 12:16 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)