Category Archives: 3D

Alice – 3D educational programming environment – installation .

What is Alice?

The www.alice.org – official website provides a quick introduction.

Using an innovative 3D programming environment that makes it easy to create animations or games, the Alice Project seeks to provide tools and materials for a conceptual core of computational thinking, problem solving, and computer programming.
The Alice Suite of educational tools is designed to support teaching and learning across a spectrum of ages, grade levels, and classes in K-12 and in college or university courses.

You need to install jdk and jre from http://www.oracle.com.

Download from official website the installer: www.alice.org.

Make it executable.

See the content of the folder.

Run the script:

This is the first GUI window of installation program.

alice3 educational install linux

Select Alice application and press Next button.

alice3 educational install linux

Accept License Agreement.

alice3 educational install linux

The next step is : select folder for application.

alice3 educational install linux

Press Install button.

alice3 educational install linux

You will see progress of instalation.

alice3 educational install linux

After you can see the logs and details. Press Finish button.

alice3 educational install linux

Accept End User License Agreement.

alice3 educational install linux

This is first IDE for your to Select Project and allow you to select one template.

alice3 educational install linux

The IDE for develop your first project.

alice3 educational install linux

This is first tutorial to install Alice.

I will write more in the future. See you later.

Posted in 3D, Linux, Programming. Tagged with , , , .

Simple WebGL example

WebGL is a software library and cross-platform API that extends the capability of the JavaScript programming language.
That brings OpenGL to the web as a 3D drawing context within HTML
Today we present a simple example of using WebGL.
Here, there is an html content, java script and content of WebGL content.
The three main sections are combined.
In section WebGL enter and the fragment shader and vertex shader.
For those who have worked with OpenGL will be easy to recognize specific functions.
Also the source code written for OpenGL format file.

<script type=”text/javascript”>
function shaderProgram(gl, vs, fs) ;
{

var prog = gl.createProgram(); var addshader = function(type, source) ;
{
var s = gl.createShader((type == ‘vertex’) ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER); gl.shaderSource(s, source); gl.compileShader(s); if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) ;
{
throw “Could not compile “+type+ ” shader:\n\n”+gl.getShaderInfoLog(s); } gl.attachShader(prog, s); }; addshader(‘vertex’, vs); addshader(‘fragment’, fs); gl.linkProgram(prog); if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) ;
{
throw “Could not link the shader program!”; } return prog; } function attributeSetFloats(gl, prog, attr_name, rsize, arr) ;
{
gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer()); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(arr),gl.STATIC_DRAW); var attr = gl.getAttribLocation(prog, attr_name); gl.enableVertexAttribArray(attr); gl.vertexAttribPointer(attr, rsize, gl.FLOAT, false, 0, 0); } function draw() ;
{
try ;
{
var gl = document.getElementById(“webgl”) .getContext(“experimental-webgl”); if (!gl) ;
{
throw “x”; } } catch (err) ;
{
throw “Your web browser does not support WebGL!”; } gl.clearColor(0.0, 1.0, 0.0, 1); gl.clear(gl.COLOR_BUFFER_BIT); var prog = shaderProgram(gl, “attribute vec3 pos; “+ “void main() ;
{
“+” gl_Position = vec4(pos, 2.0);”+ “}”, “void main() ;
{
“+”gl_FragColor = vec4(0.0, 0.5, 0.1, 1.0);”+ “}” ); gl.useProgram(prog); attributeSetFloats(gl, prog, “pos”, 3, [ -1, 1, 0, 0, 1, 0, 0, -1, 0,1, 0, 0 ]); gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); } function init() ;
{
try ;
{
draw();} catch (e) ;
{
alert(“Error: “+e); } } setTimeout(init, 100);

</script>

<canvas id=”webgl” width=”340″ height=”280″></canvas>

 

The result is this:

Posted in 3D, Programming, WebGL. Tagged with , , .

Ogre 3D and Code::Blocks – first part unfinished

My son has 2 years old.

I had to make a little game to keep him busy.

Little known to push so I used the arrow keys to make it more interesting.

This is the source code.

When you run the project, you will see the following picture:

ogre 3d
The result is :
First Ogre 3D tutorial from Catalin Festila on Vimeo.

Is first try to use Ogre 3D …

Posted in 3D, Game engine, Programming. Tagged with , , .

How to create an executable in Linux using OpenGL.

I will try to show you briefly how to create a Linux OpenGL applications.

We check if the graphics card and settings are done correctly, using the command:

As freeglut devel package provides libraries for OpenGL. Let’s install that package.

Then we see if we have the necessary files.

Let’s try a simple opengl example. This example use glut functions.

The code source is show below with with explanations…

We run the application now.

opengl example tutorial

I wait your opinion and possibly more complex example.

Posted in 3D, Linux, OpenGL, Programming. Tagged with , , , .

Writing a basic game with C++ and OpenGL libs – part 1 .

This is a first part tutorial about linux game using C++ and OpenGL libs.

Writing a C++ game can be difficult.

You will need to focus on program structure and then to know how to create the necessary classes.

Let’s see the files I used:

The main.cpp file is the main program.

This file will make the window program and will deal with the user.

Also this file use OpenGL libs.

Let’s see the source code:

The next two files : display.cpp and display.hpp is used to display the game objects.

I use just one class : Display.

Let’s see the header file display.hpp

… and display.cpp.

You can see the OpenGL source code to make a rectangle.

The next files game.cpp and game.hpp is used to make all game engine working.

The header file game.hpp is:

… and also game.cpp.

Let’s make the Makefile.

This can done well if you know how working g++ compiler.

Use the command to make the binary file:

The resul is this:

simplegame tutorial c++

Posted in 3D, C++, Game engine, OpenGL, Programming. Tagged with , , , , .