I started learning OpenGL a two days ago and I’m getting the hang of it but why can’t the OpenGLView be used the the normal display list. This is a question out of curiosity because I’m making a game engine (Learning Purposes) and want to test the limits of my programming abilities. I mostly want to hear the technical answer but if I’m wrong and you can use openglview and display list together may I have an example of it. Thanks in advance
Try creating a copy of “SimpleOpenGLView”:
openfl create SimpleOpenGLView
Open it up, then in the new
function, try adding this:
var sprite = new Sprite ();
sprite.graphics.beginFill (0xFF0000);
sprite.graphics.drawRect (0, 0, 100, 100);
addChild (sprite);
It should work. The trick is that since the internal renderer has it’s own state management and such, you need to clean up after yourself in your OpenGLView render
so it doesn’t create a conflict
1 Like
Thank you so much !!! I added some “clean-up” to my code and now it works. Its going to be amazing to use these two rendering methods. Thanks Again (Wow you replied really fast this really helps)
//* The Cleanup *//
GL.disableVertexAttribArray(vertexPositionAttribute);
GL.disableVertexAttribArray(vertexColorAttribute);
GL.disableVertexAttribArray(texCoordAttribute);
GL.useProgram (null);
Awesome! So happy to help