Help end child hunger

The JSON format is an easy and simple way to get 3D models uploaded into a WebGL application. Lighthouse3D provides a tool (source code and visual studio project available) that uses Assim to read standard 3D model files (OBJ, Collada, 3ds, among many others) and produces a JSON formatted file containing the vertex information (positions, normals and tex coords) as well as material description.

An example of a WebGL page where such content is used is available in here.

vslSampleThe Very Simple * Libs pages have been updated, merging the information into less pages and adding a few relevant updates. The lib is now compatible with Assimp 3.0, and a bug which appeared with recent nvidia drivers when using multiple shaders with uniform blocks has been fixed.

The sample code has been updated to reflect these changes and a Visual Studio 2012 project is included.

OpenGL, unlike Direct3D, is operating system independent. While this eases the portability among different OS, it implies that we have to resort to external libraries for a number of tasks, loading images being one of the most used.

There are many libraries to load images, DevIL being one of them. It loads a large number of image formats and it is cross platform.

A short tutorial for loading an image, getting its data and attributes, and finally creating an OpenGL texture is available in here.

Notepad++ is a great text editor and I keep using over and over. I found some GLSL syntax highlight UDL files in the site but they were not up to date and most importantly they we’re not prepared to work with dark themes. So I made two UDLs for GLSL 4.3. One for the default theme and another to use with dark themes. The extensions supported are: vert frag geom tesc tese v f g.

The zip file contains both. To install the themes go to “Language”->”Define your  language”. In the “User Defined Language” dialog select import to load the files into notepad++.

Here are some screenshots. Light version with default theme:

notepad1

 

 

 

 

 

 

 

 

 

Dark version with Monokai theme:

notepad2

Both FreeGLUT and GLUT allow us to define an OpenGL context with multisampling. However the number of samples is fixed (4) and I’ve not found a way to change it using the API.

In here we’re going to see how to hack FreeGLUT so that we can change the default number of samples. This can be achieved either by changing the default value, or by adding a new function to set this value.

Note: This hack should be used only for testing purposes, not for redistribution, as FreeGLUT has a large base of users which already have the official version installed.

Continue reading »

I’ve been working for some time with wxWidgets. The only thing I’ve missed, regarding OpenGL, is the ability to define my own OpenGL context, in particular Core profile and Debug contexts.

To be able to set a context we, or the toolkit we’re using, must use the wglCreateContextAttribsARB function, as defined in the WGL_ARB_create_context extension. As it happens, wxWidgets uses wglCreateContext, hence no OpenGL context can be explicitly defined using the provided source code for the current release (2.9.4).

As OpenGL context setting is not yet in the roadmap for future releases of wxWidgets, nor is it in its Todo List, I’m sharing a solution for this issue.

The solution is for the Windows platform, but other platforms should be as easy to change as well.

Note: I make no claim regarding the quality of the solution, it worked for me, and that’s all I claim. If anyone knows of a better way of doing this comments are most welcome, as they may prove useful for other readers (and me as well :-) ).

Continue reading »

Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it’s compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.

Here is a short tutorial that was pointed to me to setup Dev C++ with OpenGL. The tutorial  is from the collection of Programming Tutorials and Lecture Notes from the Computer Science Department of Central Connecticut State University.

Very Simple OpenGL Information Lib – OpenGL has a rich set of functions to query its state. It is possible to get information on just about anything, from which shaders are attached to a program, to the values of uniforms, or the properties of the textures currently bound.

However, it is also true, that to get some of this information a lot of code is required. When debugging, we end up writing code to access this and that information over and over again.

This lib attempts to provide all the information with a minimal effort to the developer, for textures, buffers, GLSL programs, shaders, and variables, and a few more items.

Two more libs are available in the VS*L framework. With these new additions it is possible to use Assimp to load 3D models, and render them with core OpenGL. The libs store the meshes in VAOs, and use VSShaderLib and VSMathLib to simplify the rendering with shaders with almost any uniform variable configuration.

Shaders are the core of the rendering process. OpenGL core profile requires us to provide our own shaders, no more fixed function.

Using shaders means more flexibility, but it also implies more work. This is where this lib steps in.

VSShaderLib was designed to make our life easier. It allows to create programs, load shaders from files, associate vertex attribute names with locations, and work with uniforms, including uniforms in named blocks. It also provides access to the info logs.

© 2014 Lighthouse3d.com Suffusion theme by Sayontan Sinha