public void OnSurfaceCreated(IGL10 unused, EGLConfig config) { int program = GLES20.GlCreateProgram(); addShaderTo(GLES20.GlVertexShader, VERTEX_SHADER_STRING, program); addShaderTo(GLES20.GlFragmentShader, FRAGMENT_SHADER_STRING, program); GLES20.GlLinkProgram(program); int[] result = new int[] { GLES20.GlFalse }; result[0] = GLES20.GlFalse; GLES20.GlGetProgramiv(program, GLES20.GlLinkStatus, result, 0); abortUnless(result[0] == GLES20.GlTrue, GLES20.GlGetProgramInfoLog(program)); GLES20.GlUseProgram(program); GLES20.GlUniform1i(GLES20.GlGetUniformLocation(program, "y_tex"), 0); GLES20.GlUniform1i(GLES20.GlGetUniformLocation(program, "u_tex"), 1); GLES20.GlUniform1i(GLES20.GlGetUniformLocation(program, "v_tex"), 2); // Actually set in drawRectangle(), but queried only once here. posLocation = GLES20.GlGetAttribLocation(program, "in_pos"); int tcLocation = GLES20.GlGetAttribLocation(program, "in_tc"); GLES20.GlEnableVertexAttribArray(tcLocation); GLES20.GlVertexAttribPointer(tcLocation, 2, GLES20.GlFloat, false, 0, textureCoords); GLES20.GlClearColor(0.0f, 0.0f, 0.0f, 1.0f); checkNoGLES2Error(); }
public void OnSurfaceCreated(IGL10 unused, EGLConfig config) { // Set the background frame color GLES20.GlClearColor(0.0f, 0.0f, 0.0f, 1.0f); mTriangle = new Triangle(); }
public void OnSurfaceCreated(IGL10 gl, EGLConfig config) { /* * By default, OpenGL enables features that improve quality * but reduce performance. One might want to tweak that * especially on software renderer. */ gl.GlDisable(GL10.GlDither); /* * Some one-time OpenGL initialization can be made here * probably based on features of this particular context */ gl.GlHint(GL10.GlPerspectiveCorrectionHint, GL10.GlFastest); if (mTranslucentBackground) { gl.GlClearColor(0, 0, 0, 0); } else { gl.GlClearColor(1, 1, 1, 1); } // FIXME: Mono.Android.dll misses this constant. Filed as #3531. gl.GlEnable(2884); //GL10.GlCullFace); gl.GlShadeModel(GL10.GlSmooth); gl.GlEnable(GL10.GlDepthTest); }
public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glMatrixMode(GL10_GL_PROJECTION); float size = .01f * (float)java.lang.Math.tan(java.lang.Math.toRadians(45.0) / 2); float ratio = _width / _height; // perspective: gl.glFrustumf(-size, size, -size / ratio, size / ratio, 0.01f, 100.0f); // orthographic: //gl.glOrthof(-1, 1, -1 / ratio, 1 / ratio, 0.01f, 100.0f); gl.glViewport(0, 0, (int)_width, (int)_height); gl.glMatrixMode(GL10_GL_MODELVIEW); gl.glEnable(GL10_GL_DEPTH_TEST); // define the color we want to be displayed as the "clipping wall" gl.glClearColor(0f, 0f, 0f, 1.0f); // enable the differentiation of which side may be visible gl.glEnable(GL10_GL_CULL_FACE); // which is the front? the one which is drawn counter clockwise gl.glFrontFace(GL10_GL_CCW); // which one should NOT be drawn gl.glCullFace(GL10_GL_BACK); gl.glEnableClientState(GL10_GL_VERTEX_ARRAY); gl.glEnableClientState(GL10_GL_COLOR_ARRAY); initTriangle(); }
public void onSurfaceCreated(GL10 gl, EGLConfig config) { // preparation gl.glEnableClientState(GL10_GL_VERTEX_ARRAY); initTriangle(); initStaticTriangle(); }
/** Called when the surface is created or recreated. * Reinitialize OpenGL related stuff here*/ public void OnSurfaceCreated(IGL10 gl, EGLConfig config) { gl.GlClearColor(1.0f, 1.0f, 1.0f, 1.0f); //Here we create the 3D object and initialize textures, shaders, etc. monkeyMesh = new Mesh(); monkeyMesh.InitMesh(context.Assets, "media/monkey.json", "media/texture.png"); }
public void onSurfaceCreated(GL10 unused, EGLConfig config) { // Set the background frame color gl.clearColor(0.5f, 0.5f, 0.5f, 1.0f); // initialize the triangle vertex array initShapes(); mProgram = gl.createProgram(); var vs = gl.createShader(new Shaders.TriangleVertexShader()); var fs = gl.createShader(new Shaders.TriangleFragmentShader()); gl.attachShader(mProgram, vs); gl.attachShader(mProgram, fs); gl.deleteShader(vs); gl.deleteShader(fs); gl.linkProgram(mProgram); // get handle to the vertex shader's vPosition member maPositionHandle = gl.getAttribLocation(mProgram, "vPosition"); }
// all setup and data loading goes here public void onSurfaceCreated(GL10 arg0, EGLConfig arg1) { var shaderProgram = gl.createProgram(); var vs = gl.createShader(new Shaders.GeometryVertexShader()); var fs = gl.createShader(new Shaders.GeometryVertexShader()); gl.attachShader(shaderProgram, vs); gl.attachShader(shaderProgram, fs); gl.linkProgram(shaderProgram); gl.useProgram(shaderProgram); positionAttribLocation = gl.getAttribLocation(shaderProgram, "position"); // setup geometry float[] verticesData = { 0.0f, 0.5f, 0.0f, -0.5f, -0.5f, 0.0f, 0.5f, -0.5f, 0.0f }; vertices = ByteBuffer .allocateDirect(verticesData.Length * 4) .order(ByteOrder.nativeOrder()).asFloatBuffer(); vertices.put(verticesData).position(0); }
/// <summary> /// </summary> /// <param name="glConfig"> </param> /// <param name="attribute"> </param> /// <param name="value"> </param> /// <returns> </returns> public bool GetGLConfigAttrib(EGLConfig glConfig, int attribute, int[] value) { bool status = false; status = Javax.Microedition.Khronos.Egl.EGLContext.EGL11.EglGetConfigAttrib(this._glDisplay, glConfig, attribute, value); return(status); }
public void OnSurfaceCreated(IGL10 gl, EGLConfig config) { FreeContext(); // get the config var egl = EGLContext.EGL.JavaCast <IEGL10>(); var disp = egl.EglGetCurrentDisplay(); // stencil buffers int[] stencilbuffers = new int[1]; egl.EglGetConfigAttrib(disp, config, EGL10.EglStencilSize, stencilbuffers); // samples int[] samples = new int[1]; egl.EglGetConfigAttrib(disp, config, EGL10.EglSamples, samples); // get the frame buffer int[] framebuffers = new int[1]; gl.GlGetIntegerv(GLES20.GlFramebufferBinding, framebuffers, 0); // create the render target renderTarget = new GRBackendRenderTargetDesc { Width = 0, // set later Height = 0, // set later Config = GRPixelConfig.Rgba8888, Origin = GRSurfaceOrigin.BottomLeft, SampleCount = samples[0], StencilBits = stencilbuffers[0], RenderTargetHandle = (IntPtr)framebuffers[0], }; CreateContext(); }
EGLConfig chooseEglConfig(EGLDisplay eglDisplay) { int[] configsCount = new int[] { 0 }; EGLConfig[] configs = new EGLConfig[1]; EGL14.EglChooseConfig(eglDisplay, config, 0, configs, 0, configs.Length, configsCount, 0); return configs[0]; }
private int findConfigAttrib(IEGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) { if (egl.EglGetConfigAttrib(display, config, attribute, mValue)) { return(mValue[0]); } return(defaultValue); }
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) { // Set the background clear color to black. gl.clearColor(1.0f, 1.0f, 1.0f, 0.0f); // Use culling to remove back faces. opengl.glEnable(opengl.GL_CULL_FACE); // Enable depth testing opengl.glEnable(opengl.GL_DEPTH_TEST); // Enable texture mapping opengl.glEnable(opengl.GL_TEXTURE_2D); // Position the eye in front of the origin. float eyeX = 0.0f; float eyeY = 0.0f; float eyeZ = -0.5f; // We are looking toward the distance float lookX = 0.0f; float lookY = 0.0f; float lookZ = -5.0f; // Set our up vector. This is where our head would be pointing were we holding the camera. float upX = 0.0f; float upY = 1.0f; float upZ = 0.0f; // Set the view matrix. This matrix can be said to represent the camera position. // NOTE: In OpenGL 1, a ModelView matrix is used, which is a combination of a model and // view matrix. In OpenGL 2, we can keep track of these matrices separately if we choose. Matrix.setLookAtM(mViewMatrix, 0, eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ); mProgramHandle = gl.createAndLinkProgram( new Shaders.per_pixelVertexShader(), new Shaders.per_pixelFragmentShader(), "a_Position", "a_Color", "a_Normal", "a_TexCoordinate" ); // Define a simple shader program for our point. mPointProgramHandle = gl.createAndLinkProgram( new Shaders.per_pixelVertexShader(), new Shaders.per_pixelFragmentShader(), "a_Position" ); // Load the texture mTextureDataHandle = TextureHelper.loadTexture(mActivityContext, R.drawable.jsc_24bit); mTextureDataHandle2 = TextureHelper.loadTexture(mActivityContext, R.drawable.jsc_black); }
public static EGLContext CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, int[] attrib_list) { IntPtr ptr = eglCreateContext(dpy, config, share_context, attrib_list); if (ptr == IntPtr.Zero) { throw new Exception(String.Format("Failed to create EGL context, error: {0}.", GetError())); } return(ptr); }
public void OnSurfaceCreated(IGL10 gl, EGLConfig config) { if (surfaceCreated) { surfaceCreated = false; return; } surfaceCreated = true; application.Shown(); }
int GetAttrib(IEGL10 egl, EGLDisplay display, EGLConfig config, int attrib) { int[] ret = new int [1]; try { egl.EglGetConfigAttrib(display, config, attrib, ret); } catch (Exception e) { Log.Warn("AndroidGraphicsMode", "EglGetConfigAttrib {0} threw exception {1}", attrib, e); } return(ret[0]); }
public EglBase14Impl(EGLContext sharedContext, int[] configAttributes) { _eglSurface = EGL14.EglNoSurface; _eglDisplay = GetEglDisplay(); _eglConfig = GetEglConfig(_eglDisplay, configAttributes); int openGlesVersion = GetOpenGlesVersionFromConfig(configAttributes); Logging.D("EglBase14Impl", "Using OpenGL ES version " + openGlesVersion); _eglContext = CreateEglContext(sharedContext, _eglDisplay, _eglConfig, openGlesVersion); }
protected EGLSurface CreatePBufferSurface(EGLConfig config, int[] attribList) { IEGL10 egl = EGLContext.EGL.JavaCast <IEGL10>(); EGLSurface result = egl.EglCreatePbufferSurface(eglDisplay, config, attribList); if (result == null || result == EGL10.EglNoSurface) { throw new Exception("EglCreatePBufferSurface"); } return(result); }
public EGLContext createContext(IEGL10 egl, EGLDisplay display, EGLConfig eglConfig) { EGLContext context; //Log.i("PikkartCore3","Creating OpenGL ES 2.0 context"); checkEglError("Before eglCreateContext", egl); int[] attrib_list_gl20 = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EglNone }; context = egl.EglCreateContext(display, eglConfig, EGL10.EglNoContext, attrib_list_gl20); checkEglError("After eglCreateContext", egl); return(context); }
public EGLSurface CreatePBufferSurface(EGLConfig config, int[] attribList) { IEGL10 egl = EGLContext.EGL.JavaCast <IEGL10> (); EGLSurface result = egl.EglCreatePbufferSurface(eglDisplay, config, attribList); if (result == null || result == EGL10.EglNoSurface) { throw EglException.GenerateException("EglCreatePBufferSurface", egl, null); } return(result); }
public static SurfaceConfig FromEGLConfig(EGLConfig config, IEGL10 egl, EGLDisplay eglDisplay) { return(new SurfaceConfig() { Red = GetAttribute(config, egl, eglDisplay, EGL11.EglRedSize), Green = GetAttribute(config, egl, eglDisplay, EGL11.EglGreenSize), Blue = GetAttribute(config, egl, eglDisplay, EGL11.EglBlueSize), Alpha = GetAttribute(config, egl, eglDisplay, EGL11.EglAlphaSize), Depth = GetAttribute(config, egl, eglDisplay, EGL11.EglDepthSize), Stencil = GetAttribute(config, egl, eglDisplay, EGL11.EglStencilSize), }); }
private bool ElgInitialize() { prevEglContext = EGL14.EglGetCurrentContext(); prevEglDisplay = EGL14.EglGetCurrentDisplay(); prevEglSurfaceRead = EGL14.EglGetCurrentSurface(EGL14.EglRead); prevEglSurfaceDraw = EGL14.EglGetCurrentSurface(EGL14.EglDraw); eglDisplay = EGL14.EglGetDisplay(EGL14.EglDefaultDisplay); if (eglDisplay == EGL14.EglNoDisplay) { return(false); } int[] version = new int[2]; if (!EGL14.EglInitialize(eglDisplay, version, 0, version, 1)) { return(false); } // Configure EGL for recording and OpenGL ES 2.0. int[] attribList = { EGL14.EglRedSize, 8, EGL14.EglGreenSize, 8, EGL14.EglBlueSize, 8, EGL14.EglAlphaSize, 8, EGL14.EglRenderableType, EGL14.EglOpenglEsBit, EGL_RECORDABLE_ANDROID, 1, EGL14.EglNone }; EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; EGL14.EglChooseConfig(eglDisplay, attribList, 0, configs, 0, configs.Length, numConfigs, 0); CheckEglError(); // Configure context for OpenGL ES 2.0. int[] attrib_list = { EGL14.EglContextClientVersion, 1, EGL14.EglNone }; eglContext = EGL14.EglCreateContext(eglDisplay, configs[0], EGL14.EglNoContext, attrib_list, 0); CheckEglError(); int[] surfaceAttribs = { EGL14.EglNone }; eglSurface = EGL14.EglCreateWindowSurface(eglDisplay, configs[0], surface, surfaceAttribs, 0); CheckEglError(); EGL14.EglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); CheckEglError(); return(true); }
public void Release() { CheckIsNotReleased(); ReleaseSurface(); DetachCurrent(); EGL14.EglDestroyContext(_eglDisplay, _eglContext); EGL14.EglReleaseThread(); EGL14.EglTerminate(_eglDisplay); _eglContext = EGL14.EglNoContext; _eglDisplay = EGL14.EglNoDisplay; _eglConfig = null; }
public Context(DRI.GBM.Device gbmDev) { dpy = GetDisplay(gbmDev.handle); if (dpy == IntPtr.Zero) { throw new NotSupportedException("[EGL] GetDisplay failed.: " + GetError()); } if (!Initialize(dpy, out major, out minor)) { throw new NotSupportedException("[EGL] Failed to initialize EGL display. Error code: " + GetError()); } if (!BindAPI(RenderApi.GL)) { throw new NotSupportedException("[EGL] Failed to bind EGL Api: " + GetError()); } int[] contextAttrib = new int[] { Egl.CONTEXT_CLIENT_VERSION, 2, Egl.NONE }; int[] desiredConfig = new int[] { Egl.SURFACE_TYPE, Egl.WINDOW_BIT, Egl.RENDERABLE_TYPE, Egl.OPENGL_BIT, Egl.RED_SIZE, 1, Egl.GREEN_SIZE, 1, Egl.BLUE_SIZE, 1, Egl.ALPHA_SIZE, 0, //Egl.DEPTH_SIZE, 24, //Egl.STENCIL_SIZE, 0, //Egl.SAMPLE_BUFFERS, 2, //Egl.SAMPLES, 0, Egl.NONE }; int num_configs; IntPtr[] configs = new IntPtr[1]; if (!ChooseConfig(dpy, desiredConfig, configs, 1, out num_configs)) { throw new NotSupportedException(String.Format("[EGL] Failed to retrieve GraphicsMode, error {0}", GetError())); } currentCfg = configs [0]; ctx = CreateContext(dpy, currentCfg, IntPtr.Zero, contextAttrib); if (ctx == IntPtr.Zero) { throw new NotSupportedException(String.Format("[EGL] Failed to create egl context, error {0}.", GetError())); } }
public void onSurfaceCreated(GL10 gl, EGLConfig config) { // preparation // enable the differentiation of which side may be visible gl.glEnable(GL10_GL_CULL_FACE); // which is the front? the one which is drawn counter clockwise gl.glFrontFace(GL10_GL_CCW); // which one should NOT be drawn gl.glCullFace(GL10_GL_BACK); gl.glEnableClientState(GL10_GL_VERTEX_ARRAY); gl.glEnableClientState(GL10_GL_COLOR_ARRAY); initTriangle(); }
public void CreateSurface(EGLConfig config) { if (refHolder == null) { CreatePBufferSurface(config); return; } IEGL10 egl = EGLContext.EGL.JavaCast <IEGL10> (); eglSurface = egl.EglCreateWindowSurface(eglDisplay, config, ((Java.Lang.Object)Holder), null); if (eglSurface == null || eglSurface == EGL10.EglNoSurface) { throw EglException.GenerateException("EglCreateWindowSurface", egl, null); } }
/// <summary> /// </summary> /// <param name="attribList"> </param> /// <param name="elements"> </param> /// <returns> </returns> public EGLConfig[] ChooseGLConfig(int[] attribList, int[] elements) { EGLConfig[] configs; if (Javax.Microedition.Khronos.Egl.EGLContext.EGL11.EglChooseConfig(this._glDisplay, attribList, null, 0, elements) == false) { throw new AxiomException("Failed to choose config"); } configs = new EGLConfig[Marshal.SizeOf(typeof(EGLConfig)) * elements.Length]; if (Javax.Microedition.Khronos.Egl.EGLContext.EGL11.EglChooseConfig(this._glDisplay, attribList, configs, configs.Length, elements) == false) { throw new AxiomException("Failed to choose config"); } return(configs); }
private EGLConfig getMatchingConfig(IEGL10 egl, EGLDisplay display, int[] configAttribs) { // Get the number of minimally matching EGL configurations int[] num_config = new int[1]; egl.EglChooseConfig(display, configAttribs, null, 0, num_config); int numConfigs = num_config[0]; if (numConfigs <= 0) { throw new Exception("No matching EGL configs"); } // Allocate then read the array of minimally matching EGL configs EGLConfig[] configs = new EGLConfig[numConfigs]; egl.EglChooseConfig(display, configAttribs, configs, numConfigs, num_config); // Now return the "best" one return(chooseConfig(egl, display, configs)); }
public void OnSurfaceCreated(IGL10 unused, EGLConfig config) { try { var vertexSource = LoadRawString(Resource.Raw.copy_oes_vs); var fragmentSource = LoadRawString(Resource.Raw.copy_oes_fs); _shaderCopyOes.SetProgram(vertexSource, fragmentSource); } catch (System.Exception ex) { showError(ex.Message.ToString()); } var vertexSourceFilter = LoadRawString(Resource.Raw.filter_vs); var fragmentSourceFilter = LoadRawString(Resource.Raw.filter_fs); _shaderFilterDefault.SetProgram(vertexSourceFilter, fragmentSourceFilter); _fboExternal.Reset(); _fboOffscreen.Reset(); }
public void OnSurfaceCreated(IGL10 gl, EGLConfig config) { // Set background color and enable depth testing GLES20.GlClearColor(1f, 1f, 1f, 1.0f); // TODO: Review is this GLES20.Glcle? GLES20.GlEnable(GLES20.GlDepthTest); // resetModelMatCalculator(); mCameraFrustum = new CameraFrustum(); mFloorGrid = new Grid(); mCameraFrustumAndAxis = new CameraFrustumAndAxis(); mTrajectory = new Trajectory(3); // Construct the initial view matrix Matrix.SetIdentityM(mViewMatrix, 0); Matrix.SetLookAtM(mViewMatrix, 0, 5f, 5f, 5f, 0f, 0f, 0f, 0f, 1f, 0f); mCameraFrustumAndAxis.ModelMatrix = ModelMatCalculator.ModelMatrix; mIsValid = true; }
public override void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glClearColor(0, 0, 0, 1); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode); int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode); mProgram = GLES20.glCreateProgram(); // create empty OpenGL ES // Program GLES20.glAttachShader(mProgram, vertexShader); // add the vertex // shader to program GLES20.glAttachShader(mProgram, fragmentShader); // add the fragment // shader to // program GLES20.glLinkProgram(mProgram); int positionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition"); int textureHandle = GLES20.glGetAttribLocation(mProgram, "aTextureCoord"); GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, COORDS_PER_VERTEX * 4, mVertexBuffer); GLES20.glEnableVertexAttribArray(positionHandle); GLES20.glVertexAttribPointer(textureHandle, TEXTURECOORDS_PER_VERTEX, GLES20.GL_FLOAT, false, TEXTURECOORDS_PER_VERTEX * 4, mTextureBuffer); GLES20.glEnableVertexAttribArray(textureHandle); GLES20.glUseProgram(mProgram); int i = GLES20.glGetUniformLocation(mProgram, "Ytex"); GLES20.glUniform1i(i, 0); // Bind Ytex to texture unit 0 i = GLES20.glGetUniformLocation(mProgram, "Utex"); GLES20.glUniform1i(i, 1); // Bind Utex to texture unit 1 i = GLES20.glGetUniformLocation(mProgram, "Vtex"); GLES20.glUniform1i(i, 2); // Bind Vtex to texture unit 2 mTextureWidth = 0; mTextureHeight = 0; }
public static bool eglGetConfigs(EGLDisplay dpy, EGLConfig[] configs, int config_size, out int num_config) { throw null; }
// called by AppThreadFunction public void ovrEgl_CreateContext(EGLContext shareEgl_Context) { // 152 ConsoleExtensions.trace("enter ovrEgl_CreateContext, eglGetDisplay"); if (this.Display != egl.EGL_NO_DISPLAY) { return; } this.Display = egl.eglGetDisplay(default(native_window.ANativeWindow)); egl.eglInitialize(this.Display, out this.MajorVersion, out this.MinorVersion); // Do NOT use eglChooseConfig, because the Android EGL code pushes in multisample // flags in eglChooseConfig if the user has selected the "force 4x MSAA" option in // settings, and that is completely wasted for our warp target. int numConfigs = 0; if (egl.eglGetConfigs(this.Display, configs, MAX_CONFIGS, out numConfigs) == false) { //ALOGE( " eglGetConfigs() failed: %s", EglErrorString( eglGetError() ) ); return; } ConsoleExtensions.tracei("ovrEgl_CreateContext numConfigs: ", numConfigs); // \VrCubeWorld.Egl.cs:95 ovrEgl_CreateContext numConfigs: 22 const int egl_EGL_OPENGL_ES3_BIT_KHR = 0x0040; this.Config = default(EGLConfig); #region numConfigs for (int i = 0; i < numConfigs; i++) { int value = 0; egl.eglGetConfigAttrib(this.Display, configs[i], egl.EGL_RENDERABLE_TYPE, out value); if ((value & egl_EGL_OPENGL_ES3_BIT_KHR) != egl_EGL_OPENGL_ES3_BIT_KHR) { continue; } // The pbuffer config also needs to be compatible with normal window rendering // so it can share textures with the window context. egl.eglGetConfigAttrib(this.Display, configs[i], egl.EGL_SURFACE_TYPE, out value); if ((value & (egl.EGL_WINDOW_BIT | egl.EGL_PBUFFER_BIT)) != (egl.EGL_WINDOW_BIT | egl.EGL_PBUFFER_BIT)) { continue; } int j = 0; for (; configAttribs[j] != egl.EGL_NONE; j += 2) { egl.eglGetConfigAttrib(this.Display, configs[i], configAttribs[j], out value); if (value != configAttribs[j + 1]) { break; } } if (configAttribs[j] == egl.EGL_NONE) { ConsoleExtensions.tracei("ovrEgl_CreateContext config found i: ", i); this.Config = configs[i]; break; } } #endregion if (this.Config == default(EGLConfig)) { ConsoleExtensions.tracei("ovrEgl_CreateContext eglChooseConfig failed"); //ALOGE( " eglChooseConfig() failed: %s", EglErrorString( eglGetError() ) ); return; } //ALOGV( " Context = eglCreateContext( Display, Config, EGL_NO_CONTEXT, contextAttribs )" ); //this.Context = egl.eglCreateContext(this.Display, this.Config, (shareEgl != NULL) ? shareEgl->Context : egl.EGL_NO_CONTEXT, contextAttribs); this.Context = egl.eglCreateContext(this.Display, this.Config, shareEgl_Context, contextAttribs); if (this.Context == egl.EGL_NO_CONTEXT) { //ALOGE( " eglCreateContext() failed: %s", EglErrorString( eglGetError() ) ); return; } //ALOGV( " TinySurface = eglCreatePbufferSurface( Display, Config, surfaceAttribs )" ); this.TinySurface = egl.eglCreatePbufferSurface(this.Display, this.Config, surfaceAttribs); if (this.TinySurface == egl.EGL_NO_SURFACE) { //ALOGE( " eglCreatePbufferSurface() failed: %s", EglErrorString( eglGetError() ) ); egl.eglDestroyContext(this.Display, this.Context); this.Context = egl.EGL_NO_CONTEXT; return; } //ALOGV( " eglMakeCurrent( Display, TinySurface, TinySurface, Context )" ); if (egl.eglMakeCurrent(this.Display, this.TinySurface, this.TinySurface, this.Context) == false) { //ALOGE( " eglMakeCurrent() failed: %s", EglErrorString( eglGetError() ) ); egl.eglDestroySurface(this.Display, this.TinySurface); egl.eglDestroyContext(this.Display, this.Context); this.Context = egl.EGL_NO_CONTEXT; return; } ConsoleExtensions.trace("exit ovrEgl_CreateContext"); }
public static extern EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, int[] attrib_list);
public static EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, int[] attrib_list) { throw null; }
/// <summary> /// Raises the surface created event. /// </summary> /// <param name="gl">Gl.</param> /// <param name="config">Config.</param> public void OnSurfaceCreated (IGL10 gl, EGLConfig config) { }
public static EGLContext CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, int[] attrib_list) { IntPtr ptr = eglCreateContext(dpy, config, share_context, attrib_list); if (ptr == IntPtr.Zero) throw new GraphicsContextException(String.Format("Failed to create EGL context, error: {0}.", Egl.GetError())); return ptr; }
public void OnSurfaceCreated(IGL10 gl, EGLConfig config) { this.engine.CreateSurface(); this.SetupPlanet(); }
public static extern EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, IntPtr win, int[] attrib_list);
static extern IntPtr eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, int[] attrib_list);
public void OnSurfaceCreated (IGL10 gl, EGLConfig config) { nativeInit (IntPtr.Zero); }
public void OnSurfaceCreated(IGL10 gl, EGLConfig config) { /* * By default, OpenGL enables features that improve quality * but reduce performance. One might want to tweak that * especially on software renderer. */ gl.GlDisable (GL10.GlDither); /* * Some one-time OpenGL initialization can be made here * probably based on features of this particular context */ gl.GlHint (GL10.GlPerspectiveCorrectionHint, GL10.GlFastest); if (mTranslucentBackground) gl.GlClearColor (0,0,0,0); else gl.GlClearColor (1,1,1,1); // FIXME: Mono.Android.dll misses this constant. Filed as #3531. gl.GlEnable(2884);//GL10.GlCullFace); gl.GlShadeModel(GL10.GlSmooth); gl.GlEnable(GL10.GlDepthTest); }
public virtual void onSurfaceCreated(GL10 gl, EGLConfig config) { }
public static bool eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, int attribute, out int value) { throw null; }
public void OnSurfaceCreated(IGL10 gl, EGLConfig config) { // GL configurations int bonenum = 48; GLES20.GlGetIntegerv(GLES20.GlMaxTextureSize, mTexSize, 0); ShellViewModel.MaxBone = bonenum; mNpot = hasExt("GL_OES_texture_npot"); // initialize GLES20.GlClearColor(0, 0, 0, 1); GLES20.GlEnable(GLES20.GlDepthTest); GLES20.GlEnable(GLES20.GlBlend); checkGlError ("GlEnable"); // GLUtils.texImage2D generates premultiplied-alpha texture. so we use GL_ONE instead of GL_ALPHA GLES20.GlBlendFunc(GL10.GlOne, GL10.GlOneMinusSrcAlpha); GLES20.GlDepthFunc(GLES20.GlLequal); GLES20.GlFrontFace(GLES20.GlCw); checkGlError ("GlMiscSettings"); // shader programs mGLSL = new Dictionary<String, GLSL>(); mGLSL.Add("builtin:default", new GLSL(String.Format(Util.ReadAssetString("shader/vs.vsh"), ShellViewModel.MaxBone), Util.ReadAssetString("shader/fs.fsh"))); mGLSL.Add("builtin:default_alpha", new GLSL(String.Format(Util.ReadAssetString("shader/vs.vsh"), ShellViewModel.MaxBone), Util.ReadAssetString("shader/fs_alpha.fsh"))); mGLSL.Add("builtin:nomotion", new GLSL(Util.ReadAssetString("shader/vs_nm.vsh"), Util.ReadAssetString("shader/fs.fsh"))); mGLSL.Add("builtin:nomotion_alpha", new GLSL(Util.ReadAssetString("shader/vs_nm.vsh"), Util.ReadAssetString("shader/fs_alpha.fsh"))); // render targets mRT = new Dictionary<String, RenderTarget>(); mRT.Add("screen", new RenderTarget()); GLES20.GlBindFramebuffer(GLES20.GlFramebuffer, 0); }
public static extern bool GetConfigAttrib(EGLDisplay dpy, EGLConfig config, int attribute, out int value);
public static extern EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, int buftype, EGLClientBuffer buffer, EGLConfig config, int[] attrib_list);
public static extern bool GetConfigs(EGLDisplay dpy, EGLConfig[] configs, int config_size, out int num_config);
public static extern EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, int[] attrib_list);
public static EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, ScriptCoreLibNative.SystemHeaders.android.native_window.ANativeWindow win, int[] attrib_list) { throw null; }
public static EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, int[] attrib_list) { throw null; }