Hi guys im new to java and opengl and im in the middle of a making a system to load and render bitmaps mainly for fonts. I got all the loading stuff working (at least i think it is) but i cant render the bitmap to my screen.
heres the code i use to load the bitmap
bytebuffer = ByteBuffer.allocateDirect(256);
FileInputStream in = null;
int c;
int i = 0;
try{
//create the file input stream
in = new FileInputStream(“fonts.bmp”);
//read the file and put it into the byte buffer
while((c = in.read()) != -1){
bytebuffer.put((byte)c);
i++;
}
//catch any errors
} catch(Exception e){
System.out.println(e);
e.printStackTrace();
}
//make sure stream is closed.
if (in != null) {
try{
in.close();
}catch(IOException e){
System.out.println(“Close error”);
}
}
The above code reads from a file called fonts.bmp, its a bitmap image of a word (made in MS paint, monochrome).
Im just practising how to load bitmaps.
Any way i have this in my render loop
GL11.glRasterPos2i (20, 20);
GL11.glColor3f (1.0f, 1.0f, 1.0f);
GL11.glBitmap (32, 8, 0.0f, 0.0f, 11.0f, 0.0f, bytebuffer);
and this in my init method
GL11.glPixelStorei (GL11.GL_UNPACK_ALIGNMENT, 1);
I get no fonts on the screen, while evrything else renders fine.