1

I'm making mods for minecraft and I'm adding night vision but is there a way I can change the render of each model using filters?

GL11.glDisable(GL11.GL_TEXTURE_2D);
    Tessellator var7 = Tessellator.instance;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    var7.startDrawingQuads();
    var7.setTranslation(par1, par3, par5);
    var7.setNormal(0.0F, 0.0F, -1.0F);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
    var7.setNormal(0.0F, 0.0F, 1.0F);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
    var7.setNormal(0.0F, -1.0F, 0.0F);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
    var7.setNormal(0.0F, 1.0F, 0.0F);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
    var7.setNormal(-1.0F, 0.0F, 0.0F);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
    var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
    var7.setNormal(1.0F, 0.0F, 0.0F);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ);
    var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ);
    var7.setTranslation(0.0D, 0.0D, 0.0D);
    var7.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);

Within this code to allow OpenGL to filter the image and/or outline before it calls the drawing method.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • your best bet will be to use opengl 2.0 anyway so that you can actually use a shader to do these type of things, opengl 1.1 is very limited in functionality – Fonix Dec 06 '12 at 08:32

1 Answers1

0

OpenGL is not a scene graph, it's basically just some sophisticated "pen and paper". So you've get to get creative and figure out some drawing scheme that will give you the desired effect.

That Tesselator class is not part of OpenGL; if I had to make a guess, it's probably part of Minecraft's code. It's for sure possible to add such an effect like you desire, but it's not as simple as "throwing a few switches". I suggest you first to a bit of OpenGL coding "from scratch" yourself to get the idea how OpenGL works. This will give you a much better starting point for making modifications to a complex program.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Well, what filter should I use if OpenGL not gonna help me on this one? –  Dec 06 '12 at 01:12
  • @user1870398: Asking "what filter shall I use?" is still asking "what switch should I flip?". That's not how graphics programming works. And I did not say, that OpenGL won't help you with this task. Minecraft does its graphics using OpenGL, so you'll have to implement it using OpenGL. But it's not just as simple as just throwing in a new "filter", because that's not how these things work. You want a night vision effect? So you must implement a new illumination model, mimicing the look of night vision. You want outlines? So you need add an additional rendering pass that exctracts edges. – datenwolf Dec 06 '12 at 09:35
  • @user1870398: These tasks (new illumination model, or a edge shader), can be done using OpenGL, no problem there. But this is not just some few lines of code you insert, but adding a complete new render path. Hence my suggestion: "Work through some OpenGL tutorials to understand how it actually works." I also suggest you read [→GPU Gems]( http://developer.nvidia.com/object/gpu_gems_home.html) about how such effects like you want to have are done. – datenwolf Dec 06 '12 at 09:39