Giter VIP home page Giter VIP logo

gls3d's Introduction

OpenGL For Stage3D

This project provides an experimental implementation of the OpenGL API for use in the Flash Player. Behind the scenes all of the OpenGL APIs are implemented ontop of the Flash Player's GPU accelerated Stage3D rendering API. The implementation is intended to be used by existing C/C++ code compiled with flascc to target the Flash Player.

Demos

  • Neverball: (http://neverball.org/) is currently the showcase application for this project as it renders well and has good performance
  • Quake2: renders almost perfectly, but due to its use of old-school immediate mode OpenGL it doesn't map very well onto Stage3D so the performance isn't great at this time (Might be a good test case for VBO support if there are patches to the Q2 code to support them).
  • Quake3: renders correctly if lightmaps are disabled as they require multi-texturing to work correctly. Performance is better than Quake2 due to the use of vertex arrays)
  • cube2: (http://sauerbraten.org/) Not yet rendering correctly as the engine requires multi-texturing at the very least.

TODO

The project should be considered experimental at this point and still has many features that need to be implemented. In descending priority order I would say that the next things that need to be done are:

  • implement multitexturing.
  • implement support for VBOs.
  • integrate the glsl2agal project so we can support GLSL.
  • migrate more of libGL.as into the C code.

License

The Adobe written portion of this project is provided under the MIT license. The headers for OpenGL come from the Mesa project. The examples are all licensed differently, please check carefully before reusing any of their code.

gls3d's People

Contributors

alexmac avatar fungos avatar tepgithub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gls3d's Issues

GLS3D design

Hi,
The more I get to know FlasCC and GLS3D, the more I found that we can actually write GLS3D in C++. When implementing the shaders, I thought I can't create Stage3D objects in C++. However, it turns out that there's AS3++ header file, so that we can create Stage3D objects in C++.

So, the question becomes:

  1. Do we actually need the action script code to translate from GL calls to Stage3D calls?
  2. What is the initial design of GLS3D? Is it to provide GL layers to both AS code and C++ code? If yes, then it makes sense to have AS code. If not, we can probably write the library entirely in C++ (which can be more efficient). Is there any gotcha's when doing that?

Another advantage of doing everything in C++ is that we can include OpenGL library and thus we don't need to create GL constants for action script code.

Thanks.

-tep

Logging/Trace

Hi Alex,
As I'm implementing more and more stubbed functions, I felt there's a need to do a better logging/error reporting. I know in libGL.as you have TraceLog() class to do just this (through trace()).

However, I don't have Flash IDE when implementing this. I use Visual Studio for typing and cygwin to run my test code. Hence, I couldn't see trace() output. Do you know any solution for this?

In addition, we may need to separate code to do tracing and error reporting. I'm thinking to have couple helper functions in TraceLog class:

  • trace() - to trace code flow/execution, this will replace send()
  • error() - to report any error - will be saved into a string (I can display in a TextField)
  • log() - to do misc logging - will be saved into a string (I can display it in a TextField)

What do you think?

Thanks.

-tep

N.B: Which one is better, should I communicate thorugh github or do you prefer this kind of dicussion by emeail?

Adding VBO support for GL_ARRAY_BUFFER

Hi i want to add VBO support for type GL_ARRAY_BUFFER and after analyzing the code i have a couple of points i want to discuss. I found that is Stage3D the equivalent of a VBO of type GL_ARRAY_BUFFER is VertexBuffer3D.

There is two places where VertexBuffer3D are used:

  • GLS3D.as defines glEndVertexData() which is used by the older glEnd() mechanism to build a VertexBuffer3D. I can't reuse it since its assuming a structure of Positions, Color, Normals and Tex coords. We cannot assume anything when creating a VBO since the structure is defined by the user.
  • There is also a VertexBufferPool class, also assuming the same vertex data structure.

My problem:
I am in the process of adding support for glGenBuffer(), glBufferData().

  • glGenBuffer(GLsizei n, GLuint *buffers)
    This function creates an id (or many if size > 1) and assign it to buffers. The id will be used later on by the user to bind to a specific VBO. I thought it would be ideal to create a list of VertexBuffer3D and the id created by glGenBuffer() would be the index position in the vector, I would also flag it as "Created". When deleting a VBO we will set the it to null in the vector and flag it as "recycled" for the next glGenBuffer() call.

  • glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
    Here is my main issue, this function only accepts an simple pointer to data and the data size. We don't know anything on the actual data array. This is a problem with Stage3D since the VertexBuffer3D constructor requires that we specify the number of vertex provided and the stride of each vertex data. I would see to solutions to this :

    -> Create glBufferData() with 2 new params but that will break the OpenGL API and will require the user to add #ifdef FLASCC to add 2 extra params...its kinda bad

    -> Lazy create the VertexBuffer3D at render time, when we specify the glVertexAttribPointer(). This is actually where we specify to opengl how the VBO is constructed...

  • Keeping track of the vbos :
    My idea would be to add a new structure for storing VBO allocated by glGenBuffer().

  • I would create a Dictionnary keyed on the VBO type , for now i will add only GL_ARRAY_BUFFER but GL_ELEMENT_ARRAY_BUFFER will be another one to add in a near future.

  • The value of the dictionnary will be a vector containing VertexBuffer3D and a flag to specify its current state (Ex: Created, Uploaded, Recycled)

So this is it...if someone started to work on this or think there is a better solution let me know. Thx!

KHR/khrplatform.h

No KHR/khrplatform.h in source tree and no information given in readme where to get it.

Is this project still active?

Hello @alexmac, @tepGithub,
My name is Fil and I’m from Adobe’s Open Source Office. I see this project has been inactive for a long time. Just wondering: is there still value in keeping this project around? Do we foresee community usage/activity happening around this project?

If yes, can I send some pull requests to update the documentation? At a minimum we need contribution guidelines that reference requiring the signing of Adobe’s CLA.

If no, is it OK if we archive this project? Or even remove it altogether?

Thanks for any info.

-Fil

glClearDepthf

Hi,
We need the implementation of glClearDepthf when porting. I think this might be useful for others too. In libGL.as, I saw this

    public function glClearDepth(depth:Number):void
    {
        // if (log) log.send( "[IMPLEMENTED] glClearDepthf " + depth + "\n")   
        contextClearDepth = depth          
    }

in the function signature, it's glClearDepth, however, in the comment, it's glClearDepthf. Is this a typo?

Thanks.

-tep

Loading Shaders

Hi Alex,
I'm currently working on loading the shaders with GLS3D. In theory GLS3D should take GLSL and convert it to AGAL under the hood.

I just want to confirm with you the steps I needed to do:

  1. Run glsl2agal to get JSON output file (done offline, through glsl2agal)
  2. Load JSON file
  3. Extract information regarding uniforms
  4. Extract agal asm code
  5. Run AGALMiniAssembler on agal asm code
  6. Create Program3D and upload the AGAL asm code

In your todo list, you wrote about integrating glsl2agal, were you thinking to run the conversion process at run-time? How easy is it to integrate it (how many files I need to integrate)? I can try doing it if it's not that hard.

-tep

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.