Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Why doesnt it render anything!  (Read 704 times)
0 Members and 1 Guest are viewing this topic.
Offline Ging3rtoby
« Posted 2014-01-15 19:41:32 »

I have this code here https://www.dropbox.com/s/eo3ramkukk71ahu/src.rar and i was wandering why doesnt it render anything, can someone please help me thanks!
Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #1 - Posted 2014-01-15 19:52:49 »

No. Explain your issue and what you have done to fix it. Post code samples on the website, not through links. Show effort and we will provide knowledge. Its just how it works on forums.

Offline lcass
« Reply #2 - Posted 2014-01-15 21:38:41 »

Not that hard to copy code and post it in code tabs infact its easier. Show us the render code and but first check you are calling the render method.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline zFollette

Junior Member


Exp: 2 years


I like jokes


« Reply #3 - Posted 2014-01-15 21:59:09 »

inb4 virus. But no, seriously, post code.

Humor will keep you alive.
Offline Ging3rtoby
« Reply #4 - Posted 2014-01-16 16:30:15 »

Core Class - http://pastebin.com/8WN7jSYi
Cube Class - http://pastebin.com/enjSxxi0
Frustum - http://pastebin.com/ehTdy3rZ
Simplex Noise - http://pastebin.com/4L4icJMG
Chunk - http://pastebin.com/6XCFG7Ch
Chunk Manager - http://pastebin.com/etXbZQNn
Chunk Protocol - http://pastebin.com/2BmfXKjv
Camera - http://pastebin.com/WbnhYcaD
FPCameraController - http://pastebin.com/L5cEVcLK
Block - http://pastebin.com/8rZwhL3q

It didnt let me paste the code directly into the post so heres the paste bin instead
Offline Dxu1994
« Reply #5 - Posted 2014-01-16 16:34:34 »

Can't tell if joke or not.

Post the parts of the code that are relevant, don't post the whole f**king program.

Offline Ging3rtoby
« Reply #6 - Posted 2014-01-16 16:40:52 »

Well the whole program goes together fine here the main class

package com.voxel.engine.core;

import com.voxel.engine.core.Block.Block;
import com.voxel.engine.core.Camera.FPCameraController;
import com.voxel.engine.core.Chunk.ChunkManager;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.*;
import org.lwjgl.util.glu.GLU;

import java.util.Random;

import static org.lwjgl.opengl.GL11.*;

/**
 * Created with IntelliJ IDEA.
 * User: Toby's PC
 * Date: 06/01/14
 * Time: 15:47
 */
public class Core {

    public static final int WORLD_WIDTH = 8;
    public static final int WORLD_HEIGHT = 1;
    public static final int BLOCK_WIDTH = 16;
    public static final int BLOCK_HEIGHT = 16;

    private Cube cube = new Cube();
    private Block.BlockType blockType = Block.BlockType.BLOCK_TYPE_STONE;

    FPCameraController camera = FPCameraController.getInstance();

    public static final int SCREEN_WIDTH = 640;
    public static final int SCREEN_HEIGHT = 480;
    public static final String TITLE = "Voxel Engine V0.01";

    private float playerX, playerY, playerZ;

    /**
     * Method that is run at the start
     */
    public void start(){
        try{
            createWindow(SCREEN_WIDTH, SCREEN_HEIGHT, TITLE);

            PixelFormat pixelFormat = new PixelFormat();
            ContextAttribs contextAttribs = new ContextAttribs(3, 0);

            Display.create(pixelFormat, contextAttribs);
            glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());

            if(GLContext.getCapabilities().OpenGL21){
                System.out.println("OpenGL21 Supported");
            }

            Random random = new Random();
            for(int x = 0;x < 16;x++){
                for (int z = 0;z < 16;z++){
                    ChunkManager.getInstance().addChunk(ChunkManager.ChunkType.CHUNK_TYPE_RANDOM, x, 0, z);
                }
            }

            initGL();
            run();
        }catch(Exception e){
            e.printStackTrace();
        }
    }

    /**
     * Creates our window based on values given
     *
     * @param width, Width of our screen
     * @param height, Height of our screen
     * @param title, The title of the game
     */
    public void createWindow(int width, int height, String title){
        try {
            Display.setFullscreen(false);
            Display.setDisplayMode(new DisplayMode(width, height));
            Display.setTitle(title);
            Display.setVSyncEnabled(true);
        } catch (LWJGLException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }

    /**
     * Init all the graphics components
     */
    public void initGL(){
        GL11.glMatrixMode(GL_PROJECTION);
        GL11.glLoadIdentity();
        GLU.gluPerspective(45.0f, (float) Display.getDisplayMode().getWidth() / (float) Display.getDisplayMode().getHeight(), 0.1f, 300.0f);
        GL11.glEnable(GL11.GL_FOG);

        GL11.glTranslatef(0, -1f, 0f);
        GL11.glRotatef(180.0f, 0, 1.0f, 0);
        GL11.glMatrixMode(GL_MODELVIEW);
        GL11.glLoadIdentity();
        GL11.glShadeModel(GL_LINE_SMOOTH);
        GL11.glClearColor(0.1f, 0.5f, 0.7f, 0.0f);
        GL11.glClearDepth(1.0);
        GL11.glEnable(GL_DEPTH_TEST);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
        GL11.glCullFace(GL11.GL_BACK);
        GL11.glEnable(GL11.GL_CULL_FACE);
    }



    public void run(){
        float rotateYaw = 1;
        while(!Display.isCloseRequested()){
            try{
                inputManager();
                GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
                GL11.glLoadIdentity();
                GL11.glTranslatef(-30f + playerX, -40f + playerY, -160f + playerZ);
                GL11.glRotatef(45f, 0.4f, 1.0f, 0.1f);
                GL11.glRotatef(45f, 0f, 1.0f, 0f);
                rotateYaw += 1;
                render();

                Display.update();
                Display.sync(60);
            }catch(Exception e){
                e.printStackTrace();
            }
        }
        Display.destroy();
    }

    public void inputManager() {
        if(Keyboard.isKeyDown(Keyboard.KEY_W)){
            playerY--;
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_S)){
            playerY++;
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_A)){
            playerX++;
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_D)){
            playerX--;
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_E)){
            playerZ--;
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_Q)){
            playerZ++;
        }
    }

    public void render(){
        ChunkManager.getInstance().render();
    }

    public static void main(String[] args){
        Core core = new Core();
        core.start();
    }
}
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (41 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!