Hello,
i basically have an OpenGL standalone application that works (let's say a simple shader). I would like to compile it as a library and call it from within the xcode image targets sample: this way, i can easily change the library behaviour and deploy it much faster in both ios and android.
That said, the first thing i did was to try to wrap my working code (so no library yet) and see if thing worked. So i'm trying to glue this ios sample ( http://www.ignaciosanchezgines.com/2009/08/27/iphone-and-c-opengl-programming/ ) with the imagetarget sample
void openglWrapper::Init(EAGLContext* pContext, GLuint renderBuffer, GLuint frameBuffer, GLuint depthBuffer){ m_pContext = pContext; m_uiViewRenderbuffer = renderBuffer; m_uiViewFramebuffer = frameBuffer; m_uiDepthRenderbuffer = depthBuffer;}
- (void) postInitQCAR{ openglWrapper::Instance().Init(context, colorRenderbuffer, defaultFramebuffer, depthRenderbuffer);}
so far, it seems so good. I then have a few functions taken from that sample, that basically draws on screen
void openglWrapper::Update(void){ BeginRender(); DrawSomething(); EndRender();}void openglWrapper::BeginRender(void){ [EAGLContext setCurrentContext:m_pContext]; glBindFramebufferOES(GL_FRAMEBUFFER_OES, m_uiViewFramebuffer); // glViewport(0, 0, 320, 480);}void openglWrapper::EndRender(void){ glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_uiViewRenderbuffer); [m_pContext presentRenderbuffer:GL_RENDERBUFFER_OES];}void openglWrapper::DrawSomething(void){ const GLfloat squareVertices[] = { -0.5f, -0.5f, 0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f, }; const GLubyte squareColors[] = { 255, 255, 0, 255, 0, 255, 255, 255, 0, 0, 0, 0, 255, 0, 255, 255, }; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glRotatef(3.0f, 0.0f, 0.0f, 1.0f); glClearColor(0.5f, 0.5f, 0.5f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glVertexPointer(2, GL_FLOAT, 0, squareVertices); glEnableClientState(GL_VERTEX_ARRAY); glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors); glEnableClientState(GL_COLOR_ARRAY); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); }
However, when i call the instance.Update() function (after the QCar Render)
QCAR::Renderer::getInstance().end(); [self presentFramebuffer]; openglWrapper::Instance().Update();
All i get is a white screen. It seems that the only function that is doing something is the glClear(). If i try to remove it (i don't wan't to clear the buffer, after all) all i get is a black screen, even just after the first glMatrixMode().
I need some guidance in how to glue these two projects togheter.
Thanks in advance!
Integration between vuforia's EAGLview and other opengl view
You need to think carefully before you try to link togetherother OpenGL code with Vuforia because traditionally it has not been an easy task.
Integration between vuforia's EAGLview and other opengl view
thanks, but using a third party engine is not really a viable solution for what i have to do.
as feedback, i'd say it would be nice to have an official sample that shows how to use another opengl view, in the meantime this documentation will have to do, thanks!
Integration between vuforia's EAGLview and other opengl view
a little update, for future users passing by:
Integration between vuforia's EAGLview and other opengl view
Thanks for the update!
Keep us posted.
N
Integration between vuforia's EAGLview and other opengl view
[quote=aa1984]
a little update, for future users passing by: