He isn't being lazy, you're compiling C code as C++. They are only errors in the sense that g++ is defaulting to flagging implicit type conversions between signed and unsigned types as errors. If you compile with gcc then you won't get them (or pass -fpermissive to g++, then they will be just given as warnings and not prevent compilation).edbird wrote:Okay so I tried putting that esUtil.c file in my main.cpp file's directory, and attempted to compile using:
g++ main.cpp esUtil.c -o main.out -I/opt/vc/include -L/opt/vc/lib
Get a lot of errors including invalid conversions of data-types, so I'm guessing the original author of the code was being lazy when he wrote the code as well as the post, but these are less critical than the fatal errors:
You need to pass -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux to gcc/g++edbird wrote:vchost_config.h No such file or directory
Code: Select all
g++ -DRPI_NO_X -fpermissive -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -o main.out main.cpp esUtil.c -lGLESv1_CM -lEGL -lbcm_host -L/opt/vc/lib Code: Select all
EGLBoolean WinCreate(ESContext *esContext, const char *title)
{
int32_t success = 0;In the spirit of completeness I've just re-read all your posts above.edbird wrote:Dude I don't see anything abrasive or not child friendly in that post, and I also don't see the pros of diluting this discussion with chatter about whether my posts meet the rules or not. If I was someone trying to fix this problem in the future I would want all the information presented to me clearly and quickly. At the moment this discussion is preventing that so I think it would be best if we stayed on topic.
Why are these in main? The first lot are related to things that should be in WinCreate(). The webpage didn't make it clear that that big chunk of code was the replacement for WinCreate. Have you looked at the code from the Raspi/Common directory of the source code? It already has all the modifications (more than what is given on the webpage) required.edbird wrote:Okay thanks, I feel like I'm getting some successes with this at last. Got some more errors... I'm guessing once 1 more step is completed these will be fixed. I will type them all out for you. (You already saw one of them.)
in main...
Yes, -fpermissive is only for C++, it basically relaxes some of C++'s strictness by downgrading certain errors into warnings.edbird wrote:some invalid conversion errors even though I passed -fpermissive??
warning: -fpermissive is valid for C++ but not C -- is this why the -fpermissive flag isn't working?
success is only referenced twice (three if you count where it's initialised),edbird wrote:success was not declared in this scope (again)
Code: Select all
int32_t success = 0;If you're compiling as C++ then -fpermissive should cover it. As C it shouldn't be complaining, or at most a warning (unless you have all warnings set as errors with the option -Wall or the specific warning that is triggering this -Wpointer-sign).edbird wrote:initializing arguments 2 and 3 of graphics_get_display_size - again strange since I passed -fpermissive??
That should be vc_dispmanx_update_start note the x at the end of dispman.edbird wrote:vc_dispman_update_start was not declared
esContext is used as the name of a variable in a lot of the function declarations, in the whole of esUtil.c these are the only places where it is declared. It should be of type ESContext *.edbird wrote:esContext, display, surface and config undeclared
Code: Select all
EGLDisplay display;
EGLSurface surface;
EGLConfig config;hWnd is the first parameter of CreateEGLContext and has the type of EGLNativeWindowType.edbird wrote:hWnd, context undeclared in this scope
The only places I can see FALSE and TRUE used is in the X11 version of WinCreate(), which it appears from what you've written that the stuff you added (referred to earlier as being in main) should have been used as the replacement for WinCreate(). Even so, they are #defined in esUtil.h to be 0 and 1.edbird wrote:in function WinCreate ...
error FALSE undeclared
same again for TRUE
Not sure about these, I assume it's complaining about the pointers to functions but the definitions look fine. That code hasn't changed from the X11 version to the RPi version.edbird wrote:in function esRegisterDrawFunc, and 2 other functions esRegisterUpdateFunc, esRegisterKeyFunc
warning: assignment for incompatible pointer type
That's okay.edbird wrote:Thanks for the help so far.
graphics_get_display_size() is declared in bcm_host.h which you should have #included.edbird wrote:Inside WinCreate() (Which I found was inside esUtil.c, by the way - managed to find that one at least...)
graphics_get_display_size was not declared in this scope
Anyone know how to fix this one??
Yes, you need to create and initialize the esContext, create the window, setup the Draw and Update functions, run the main loop, then shutdown.edbird wrote:Also I should probably ask sooner rather than later... What goes in main() ?? An intelligent guess might be a call to winCreate() after calling bcm_init().
Code: Select all
int main (int argc, char *argv[])
{
ESContext exContext;
UserData userData;
esInitContext(&esContext);
esContext.userData = &userData;
esCreateWindow(&esContext, "Simple Texture 2D", 320, 240, ES_WINDOW_RGB);
if (!Init(&esContext))
return 0;
esRegisterDrawFunc(&esContext, Draw);
esRegisterUpdateFunc(&esContext, Update);
esMainLoop(&esContext);
ShutDown(&esContext);
}Look at the chapter examples from https://github.com/benosteen/opengles-b ... ster/Raspi, they show you how to use the framework.edbird wrote:Interesting, so my guess is that all the opengl (opengl es) code for drawing stuff goes inside the draw function (pretty obvious) and then all the non-drawing specific code goes in the update function?
Does the main loop (esMainLoop) just call these 2 functions one after another continually? What should the function look like? IE: Does it return void and take no arguments?
Also I'm guessing I need to setup my variables "world objects or varaibles" to be global so that I can access them from all these functions.
Last few issues then...
- UserData was not declared in this scope (I have included bcm_host.h and esUtil.h)
- Issues with the Draw Init and ShutDown functions because I haven't written them yet. Guessing that they all return void and take no arguments? Except for ShutDown which should take a pointer to an ESContext type?
Then once those 2 are sorted, hopefully this thing will compile...
Code: Select all
void Draw( ESContext *esContext );
void Update( ESContext *esContext, float deltaTime );Those functions are called in userInterrupt in the X11 part, you should have a replacement for that functionedbird wrote:Good news, finally, it does compile, however bad news, it does not link...
In esUtil.c (.text + 0x344) - undefined references to:]
XNextEvent, XLookupString, XPending
So my guess would be that we need to link with the XWindow system... However we passed -DRPI_NO_X, which confuses me... Is there a different X which should be linked?
Code: Select all
GLboolean userInterrupt(ESContext *esContext)
{
// Ctrl-C for now to stop
return GL_FALSE;
}