CEF OpenGL Implementation

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Re: CEF OpenGL Implementation

Postby xDennis0811 » Wed Feb 13, 2019 1:39 pm

Ah Okay I tried to use the OpenGL Implementation example from this link too for easier use: https://github.com/if1live/cef-gl-example
But I got the following error,What this could be ? I used the latest version of CEF.

Code: Select all
C:\Users\Dennis\Downloads\cef-gl-example-master>cmake -G "Visual Studio 15 2017 Win64"
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.16.27027.1
-- The CXX compiler identification is MSVC 19.16.27027.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at libcef_dll/CMakeLists.txt:608 (SET_LIBRARY_TARGET_PROPERTIES):
  Unknown CMake command "SET_LIBRARY_TARGET_PROPERTIES".


-- Configuring incomplete, errors occurred!
See also "C:/Users/Dennis/Downloads/cef-gl-example-master/CMakeFiles/CMakeOutput.log".
xDennis0811
Techie
 
Posts: 29
Joined: Wed Feb 13, 2019 11:28 am

Re: CEF OpenGL Implementation

Postby magreenblatt » Wed Feb 13, 2019 1:42 pm

That example looks to be quite outdated (it requires 2526 branch).
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF OpenGL Implementation

Postby xDennis0811 » Wed Feb 13, 2019 1:54 pm

Oh okay because that's exactly what I need.Can I also implement the following 2 classes into the cefSimple project and work with that ?

render_handler.h:
Code: Select all
// Ŭnicode please
#include <GL/glew.h>
#include <include/cef_render_handler.h>

class RenderHandler : public CefRenderHandler
{
public:
   RenderHandler();

public:
   void init();
   void resize(int w, int h);

   // CefRenderHandler interface
public:
   bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect);
   void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects, const void *buffer, int width, int height);

   // CefBase interface
public:
   IMPLEMENT_REFCOUNTING(RenderHandler);

public:
   GLuint tex() const { return tex_; }

private:
   int width_;
   int height_;

   GLuint tex_;
};



render_handler.cpp:
Code: Select all
// Ŭnicode please
#include "render_handler.h"

RenderHandler::RenderHandler()
   : width_(2), height_(2), tex_(0)
{
}

void RenderHandler::init()
{
   glGenTextures(1, &tex_);
   glBindTexture(GL_TEXTURE_2D, tex_);

   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

   // dummy texture data - for debugging
   const unsigned char data[] = {
      255, 0, 0, 255,
      0, 255, 0, 255,
      0, 0, 255, 255,
      255, 255, 255, 255,
   };
   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);

   glBindTexture(GL_TEXTURE_2D, 0);
}
void RenderHandler::resize(int w, int h)
{
   width_ = w;
   height_ = h;
}

bool RenderHandler::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect)
{
   rect = CefRect(0, 0, width_, height_);
   return true;
}

void RenderHandler::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects, const void *buffer, int width, int height)
{
   glBindTexture(GL_TEXTURE_2D, tex_);
   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, (unsigned char*)buffer);
   glBindTexture(GL_TEXTURE_2D, 0);
}



And if yes how can I call the onPaint method or does CEF even got an update method ? And where should I call init then ? :)
xDennis0811
Techie
 
Posts: 29
Joined: Wed Feb 13, 2019 11:28 am

Re: CEF OpenGL Implementation

Postby magreenblatt » Wed Feb 13, 2019 2:20 pm

Sorry, I don't have time to write the code for you. You'll have to look at the examples and figure it out.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF OpenGL Implementation

Postby xDennis0811 » Wed Feb 13, 2019 2:52 pm

Okay no problem thank you :)
xDennis0811
Techie
 
Posts: 29
Joined: Wed Feb 13, 2019 11:28 am

Re: CEF OpenGL Implementation

Postby xDennis0811 » Sun Feb 17, 2019 4:49 am

I successfully implemented everything and the application runs like it should.Now another question: Is it possible to share the texture or the pixels with another application ? So I thought that I can share the pixels or better the texture from this application and then in the another application I can fetch the texture and draw it :) Is this possible ? :)
xDennis0811
Techie
 
Posts: 29
Joined: Wed Feb 13, 2019 11:28 am

Previous

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 90 guests

cron