Warning: strpos() [function.strpos]: needle is not a string or an integer in /home/www/6c0b12205eaced73565c8eab34735279/web/jegx/index.php on line 41

Warning: strpos() [function.strpos]: needle is not a string or an integer in /home/www/6c0b12205eaced73565c8eab34735279/web/jegx/index.php on line 48
JeGX's DevBlog
O3TC Loader in Java 
Monday, May 29, 2006, 08:49 AM - News
Yeah great thing! The O3TC format is spreading all around the world. Check this post out. It shows an O3TC loader in Java. Really cool no :winkhappy:

You can get more info about o3tc format in this tutorial.

Here is the code:

public class TextureStreamLoaderO3TC implements TextureStreamLoader {

private static final int HEADER_ID = 0x4354334F;
private static final int O3_TC_RGB_S3TC_DXT1 = 1;
private static final int O3_TC_RGBA_S3TC_DXT5 = 4;
private static final int O3_TC_ATI3DC_ATI2N = 16;

/** Creates a new instance of TextureStreamLoaderO3TC */
public TextureStreamLoaderO3TC() {

public Texture loadTexture(InputStream in) throws IOException {
int dataSize = readLE32(in);
int header = readLE32(in);
int headerSize = readLE32(in);
int version = readLE32(in);

if(header != HEADER_ID || headerSize != 12 || version != 1 || dataSize < 12) {
return null;
dataSize -= 12;

int chunkHeaderSize = readLE32(in);
int reserved1 = readLE32(in);
int chunkDataSize = readLE32(in);
int reserved2 = readLE32(in);
int format = readLE32(in);
int width = readLE32(in);
int height = readLE32(in);
int depth = readLE32(in);
int numMipMaps = readLE32(in);
byte[] textureName = new byte[128];
readFully(in, textureName, 0, 128);
int textureId = readLE32(in);

if(chunkHeaderSize != 168 || width < 1 || height < 1 ||
width > 4096 || height > 4096 || depth < 0 ||
depth > 256 || numMipMaps < 1 || numMipMaps > 12 ||
dataSize < 168) {
return null;

dataSize -= 168;
if(chunkDataSize < dataSize) {
return null;

TextureShader.TextureFormat texFormat;
TextureShader.TextureFormatHint texFormatHint;
int blockSize;

switch (format) {
case O3_TC_RGB_S3TC_DXT1:
texFormat = TextureShader.TextureFormat.DXT1;
texFormatHint = TextureShader.TextureFormatHint.DXT1;
blockSize = 8;
case O3_TC_RGBA_S3TC_DXT5:
texFormat = TextureShader.TextureFormat.DXT5;
texFormatHint = TextureShader.TextureFormatHint.DXT5;
blockSize = 16;
return null;

if(depth == 0) {
Texture2D tex = new Texture2D(texFormat, width, height);
ByteBuffer[] data = new ByteBuffer[numMipMaps];

for(int k=0 ; k<numMipMaps ; ++k) {
int size = ((width+3)/4) * ((height+3)/4) * blockSize;
if(size > chunkDataSize) {
return null;
chunkDataSize -= size;

data[k] = BufferUtils.createByteBuffer(size);
readFully(in, data[k]);

width = Math.max(1, width >> 1);
height = Math.max(1, height >> 1);

if(chunkDataSize > 0) {
return null;

return tex;
} else {
throw new UnsupportedOperationException();

private void readFully(InputStream in, byte[] b, int off, int count) throws IOException {
while(count > 0) {
int read = in.read(b, off, count);
if(read <= 0) {
throw new EOFException();
off += read;
count -= read;

private int readLE32(InputStream in) throws IOException {
byte[] tmp = new byte[4];
readFully(in, tmp, 0, 4);
return ((tmp[3] & 255) << 24) |
((tmp[2] & 255) << 16) |
((tmp[1] & 255) << 8) |
((tmp[0] & 255));

private void readFully(InputStream in, ByteBuffer buf) throws IOException {
byte[] tmp = new byte[4096];
while(buf.remaining() > 0) {
int read = in.read(tmp, 0, Math.min(tmp.length, buf.remaining()));
if(read <= 0) {
throw new EOFException();
buf.put(tmp, 0, read);

view entry ( 1316 views )   |  0 trackbacks   |  permalink   |   ( 3 / 2130 )

Electric Kool-Aid 
Sunday, May 28, 2006, 11:39 AM - News
Just for the mind-rest, a little demo I saw on demoscene.tv, after the demo-report on Evoke2005 (which was very fun to see - with a french reporter I guess), with cool gfx and inspiriting zik. More screenshot are available on http://www.ozone3d.net/phpBB2/viewtopic.php?t=143

view entry ( 1235 views )   |  0 trackbacks   |  permalink   |  related link   |   ( 3 / 2003 )

Blue Screen of Death 
Thursday, May 25, 2006, 08:31 PM - News
The famous Blue Screen of Death is back:

It's a long time I didn't see it. I'm working on VBO in a new eXPerimental 3D engine and I
certainly must have passed a wrong face offset to the index buffer. Little bug in my side, no doubt.
Bug in nVidia Forceware side: I don't know how the drivers have to behave when wrong parameters
are sent to them, but I don't think they have to freeze your devstation!
More on this bug later...
view entry ( 1003 views )   |  0 trackbacks   |  permalink   |   ( 3 / 2049 )

ATI X1900XTX and VTF 
Saturday, May 20, 2006, 01:56 PM - News
I've just received an email from an user saying that he was'nt able to run the demos of the Vertex Displacement Mapping Tutorial on his brand new Radeon X1900XTX. VTF or Vertex Texture Fetching is a cool feature of high-end graphics chipsets and it's part of Shader Model 3.0. The X1900 series is based on the R500 chipset (R580) that is a SM3.0 complient GPU. But in OpenGL side and especially in GLSL, VTF is not supported. The OpenGL query done with GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB always returns 0. That means that no texture units are available in the vertex shader.

ATI confirms this fact in one of its whitepapers shipped with the ATI SDK (ATI OpenGL Programming and Optimization Guide.pdf). At the page 11, we can read this: "All ATI graphics HW have a few items that deserve special consideration when using GLSL. The first major item of note is the absence of vertex texture units. This means that vertex texturing is never available, and all shaders attempting to use texture functions in the vertex shader will fail to link.". I know, this is a rude reality. The R580 GPU is really powerful and it's a pity that ATI does not support VTF in his chipsets. I don't know how the R580 behaves in D3D side but I can suppose the GPU has the same limitations. VTF is currently supported by Geforce chipset from 6600 to 7900. Conclusion: if you wish to play with VTF, use a nVidia board.

Maybe, all these problems will be solved with the SM4.0. I hope! :winkhappy:

view entry ( 1132 views )   |  0 trackbacks   |  permalink   |   ( 3 / 2210 )

Hyperion 1.4.0 is out! 
Saturday, May 6, 2006, 02:52 AM - News
Ok, Hyperion 1.4.0 is finally out! This is a quite big release with many features mainly on LUA side. The new LUA 5.1 engine works very fine and that's a good thing. Today while I was releasing Hyperion,
I wasted some hours, trying to hack the Lua socket lib because I didn't manage to connect the HypTcpWin32 client to the Hyperion TCP server demo. Both appz were localized on different computers and I started to think there's a big trouble with lua lib. After some test I found the guilty: the inet_trybind() function in inet.c soket lib source code. Actually this function works fine but in my test demos I always bound the server with localhost address. In fact I wonder why... Anyway, I found the response having a look at inet_trybind() implementation and thanks to the windows socket page: www.sockets.com/winsock.htm . A little detail I have always skipped when implementing TCP servers since I always put INADDR_ANY in local.sin_addr.s_addr. But if you specify a particular host, the TCP server accepts incoming requests only from this particular host...
That's why during my tests, everything worked fine with localhost. But the real guilty is the sample-codes that come with the socket lib: localhost is always used with bind().

The tutorial www.ozone3d.net/tutorials/lua_socket_lib.php shows you a concret demo featuring a TCP server running in Hyperion. Using the HypTcpWin32 client you can control the torus rotation in a cool way. A real kick! That opens up new horizons with Hyperion programming.

The hyperion lua host-api has grown a lot again. Now you can create directly in lua materials, lights, meshes, debug primitives (disc, line, box, sphere), load models, navigate through materials, lights and cameras lists. The new vertex pool object for example, has no XML node. You can only create and use it in lua.

Anyway, don't forget to have a look at the changelog: www.ozone3d.net/hyperion_changelog.php

Now that Hyperion 1.4.0 is released, I'm going to try to get some rest (one day is enough, isn't it?) because after, I've planned to release a lot of new demos and tutorials that are waiting for that. It seems that a new version of LynX is also in the pipeline (the current version doesn't run as I want - both lite and pro).

Just another thing. Some codes samples available for downloading may not work with the new hyperion. Since it takes a lot of
time to test all code samples, I didn't start this check yet. I've planned to update code samples next week. But if you encounter
some problems, check the source code and look for the old lua require() function. If the demo uses it, replace this function
by the following instruction:

dofile( HYP_GetHyperionDir() .. "/hyperion_lua_host_api_defines.lua" );

of course in the case where the demo needs to load hyperion_lua_host_api_defines.lua...

Ok, it's time to stop. I'm fed up with these lines of codes and this blinding screen...
view entry ( 1140 views )   |  0 trackbacks   |  permalink   |  related link   |   ( 3 / 2145 )

Hyperion almost here! 
Thursday, May 4, 2006, 04:04 PM - News
A little news about hyperion. I'm still working hard on it and I hope to release the new version tomorrow. I've just finish to implement a vertex pool object in order you can make your own particle system. There're still the reference guide in english/french (texts and translations are done!) and the new tutorial on TCP/IP server with LUA to finalize. Honestly, this new version of hyperion is really cool and works very fine.

Just for fun, a little demo I've done to test the playlist and vertex pool. I'll release it with Hyperion tomorrow:

In the real demo, there is a kind of noise in the screen but for screenshots purposes I've had to remove this cool effect.

Ok, I leave you here.
See you soon with Hyperion 1.4.0!

view entry ( 1039 views )   |  0 trackbacks   |  permalink   |   ( 3 / 961 )

Lua 5.1 and require() 
Friday, April 28, 2006, 09:53 PM - News
Lua 5.1 has brought many changes and one of these changes concerns the require() function at
the user level (i.e in lua script). Up to lua < 5.1, I used in Hyperion lua scripts the require()
function to load external lua files such as declaration of constants. But now with
lua 5.1, require() does not work for loading lua files (besides, the reference manual
says it clearly : "There were substantial changes in function require due
to the new module system"). So the solution I've found is to use the dofile() function.
This function opens a file and executes its contents as a Lua chunk. Just what I need.
So where there was in hyperion demos:

require( HYP_GetBaseDir() .. "/hyperion_lua_host_api_defines.lua" );

you have to replace by:

dofile( HYP_GetBaseDir() .. "/hyperion_lua_host_api_defines.lua" );

or even better:

dofile( "hyperion_lua_host_api_defines.lua" );

This last line of code supposes that a file called hyperion_lua_host_api_defines.lua is
placed in the hyperion root directory, no matter where your demo is. This solution is cool
because there is now an unique file for the constants that needs to be updated.
hyperion_lua_host_api_defines.lua will be shipped with the new hyperion very very soon...

view entry ( 1297 views )   |  0 trackbacks   |  permalink   |   ( 3 / 1978 )

Hyperion News 
Wednesday, April 26, 2006, 01:28 PM - News
The new version of Hyperion is about to be released. It will be a very cool release since
the support of TCP-UDP/IP socket is done and the new LUA scripting engine (LUA 5.1)
is now operational. I've done some code samples showing how to set up a TCP server
in Hyperion using operating system threads (not lua ones) and coroutines.

Coroutines are a cool tool in the lua developer's toolbox. Coroutines are also called
collaborative threads. In short, your brain replaces the operating system scheduler and
it's up to you to perform thread yielding and resuming. In collaborative multithreading
each processus decides when it has to yield the CPU time to another processus
(collaborative multithreading was in the core of win 3.x if I''m not wrong).
LUA 5.1 comes with some examples of coroutines and a demo that shows how create
a TCP server in Hyperion using coroutines will be available with the new Hyperion.

The LuaSocket lib allows the (Hyperion) coder to easily create TCP/UDP server and
client or perform common ftp and http requests. Really cool!

Stay tuned! :winkhappy:
view entry ( 1116 views )   |  0 trackbacks   |  permalink   |   ( 3 / 983 )

Galaxy Explorer Contest 
Wednesday, April 26, 2006, 11:58 AM - General, News
CGIndia starts its first CG contest: Galaxy Explorer Contest.
From an existing .3DS model (see screenshot below), competitors may modify the 3d model in any ways
but the final output will look at least the derivative of the basis shape of the given 3d model:

Tri= 4582 - Vert=2315 - 3 materials

Cool, this kind of contest allows everyone to take part in.
Final Rendering should be submitted before 22nd May 2006: a little short, no?
Anyways, I think that just for fun, I'll try to do something. Keep an eye on.

view entry ( 1126 views )   |  0 trackbacks   |  permalink   |  related link   |   ( 3 / 2201 )

Want To Be A Game Programmer? 
Monday, April 24, 2006, 08:53 AM - News
Marc Mencher, the founder of www.GameRecruiter.com, has published an article that talks about the spirit and the skills you must have if you wanna be a game programmer:
- never give up when things get hard
- be curious
- have the team attitude
- be a self starter
- be a follow-through: the last 10% of a task can take 90% of the time (yes it's true!!!)

Check this article out!

view entry ( 1103 views )   |  0 trackbacks   |  permalink   |  related link   |   ( 3 / 1999 )

<<First <Back | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Next> Last>>