![]() |
||||||
|
|
||||||
|
Welcome to the first Lumina tutorial.
This tutorial is only Lumina specific. It gives a small overview about the GUI and scripting. 1. Start Lumina Start Lumina from a shell. This is important to see the shadercompilers debugging messages. In the Mainwindow you see two widgets: A tree and a "Cam". If you expand the tree the "Cam" is shown as item. 2. Create a node To clean up the GUI, the most actions are moved to context menus. Open the "World" contextmenu and select "Add Node" This action will create a new node item. This items type is a container. 3. Create objects Open the "Node" contextmenu and create a Script, Vertexshader, Fragmentshader, Texture and a Testobject. The last action will open a dialog. Select the Torus and select 6 for the resolution and click on "Create". After that drag the new widgets on top of each other. 4. Load a Textures Load an image via Textures contextmenu. The image should have a power of 2 resolution. JPG PNG and DDS images are supported. 5. Vertexshader code Copy this code to the vertex shader texteditor: void main(void){
6. Fragmentshader code Copy this code to the fragment shader texteditor:
7. Script code Copy following code to the "Script":
Edit: With Lumina-0.3.0 it isn't required to unbind shaders or mesh components anymore The most Opengl wrapping functions are simplified and looking more than pseudo code. In most cases the postfixes like 1f 2f 3f 4f are drooped. Uniformi is a exception to prevent against ambiguousness. The gl_ (functions) od GL_ (constants) prefixes are dropped too, they are replaced by their corresponding objects. Any items from the tree could be accessed by their names relative from the "Script"s Node or absolute to the "World" node. This script code shouldn't be hard to understand. The fist line compiles and links the shader. The second sets the fragment shader uniform sampler2D variable to 0. The third line caches only the vertex shader "Tangent" attribute location if it exists. All this three lines would be executing one time at starting the script. The "render" function will be executed for every new frame: Texture.Bind(0); This binds the texture tu the first TMU (Texture Mapping Unit). Textures didn't need to be unbind after use. gl.Rotate(60 * World.getTime(), 0,1,0); This is a simplified Opengl rotate like gl_rotate4f(). World.getTime() is a function that returns the the "Timebars" time in seconds, multiplied with 60.0 it'll result in a 360 degrees rotation after 6 seconds (the default timebar length) shader.Bind(); This binds the shader it's equal to glUseProgramObjectARB(shader) in C/C++ Torus.???.Bind(); This binds the single VBO (Vertexbufferobject) streams. The default attribute can be overwritting by passing the location as argument (Vertex,Color,Normal and UvCoords have defaults) Torus.Index.Draw(); The index stream has it own Draw method. The type (gl.QUADS gl.TRIANGLES) is already stored internally. 8. Run the script Select "Run Script" from the "Script" contextmenu. You should see something like: |
||||||
|
|
|
|
|
|
|
|