How do you render 2D text in lwjgl?

Before you go off on me for "not searching", I've searched around a LOT and found a lot of answers, but none of them worked for me.

Hi, I'm making a 3D java lwjgl game, and I'm trying to render some simple 2D text on my screen in the middle, but no matter what I try, I never see any text rendered onto my screen anywhere. Here's my Text2D.java class:

package com.gmail.br45entei.base.engine.rendering;

import java.awt.Font;
import java.awt.FontFormatException;
import java.io.IOException;

import org.newdawn.slick.Color;

import org.newdawn.slick.UnicodeFont;

import com.gmail.br45entei.base.engine.core.Vector2f;
import com.gmail.br45entei.base.game.Game;
import com.gmail.br45entei.base.game.MainComponent;
import com.gmail.br45entei.file.FileMgmt;

/**
 * @author Brian_Entei
 *
 */
public class Text3D {

    private Camera camera;

    private UnicodeFont font;
    private Color color;
    private Vector2f position;
    private String text = "New string";
    private int size = 12;

    public int getSize() {
        return this.size;
    }

    public void setSize(int size) {
        this.size = size;
        updateFont();
    }

    private void updateFont() {
        try {
            this.font = new UnicodeFont(Font.createFont(Font.TRUETYPE_FONT, FileMgmt.getFile(MainComponent.resourceFolder, "/fonts/BrianOwenReidBold.ttf", false)), size, false, false);
        } catch (FontFormatException e) {
            FileMgmt.LogException(e, "updateFont()", "Failed to create font from file!", false);
        } catch (IOException e) {
            FileMgmt.LogException(e, "Text3D()", "Failed to load file to create font!", false);
        }
    }

    public Text3D(String text, Camera camera) {
        this.camera = camera;
        this.color = Color.black;
        this.position = new Vector2f(0, 0);
        this.text = text;
        updateFont();
    }

    public void drawHudString() {
        //org.lwjgl.opengl.GL11.glPushMatrix();// This gets called right before here.
        org.lwjgl.opengl.GL11.glRotatef(camera.getForward().getX(), -1.0f, 0.0f, 0.0f);
        org.lwjgl.opengl.GL11.glRotatef(camera.getForward().getY(), 0.0f, -1.0f, 0.0f);
        org.lwjgl.opengl.GL11.glRotatef(camera.getForward().getZ(), 0.0f, 0.0f, -1.0f);
        org.lwjgl.opengl.GL11.glTranslatef(-camera.getPos().getX(), -camera.getPos().getY(), -camera.getPos().getZ() + 20);

        this.font.drawString(this.position.getX(), this.position.getY(), this.text, this.color);
        //org.lwjgl.opengl.GL11.glPopMatrix();// This gets called right after here.
    }

    public void render() {
        Game.print("Text render!");
        org.lwjgl.opengl.GL11.glMatrixMode(org.lwjgl.opengl.GL11.GL_PROJECTION);
        org.lwjgl.opengl.GL11.glPushMatrix();
        org.lwjgl.opengl.GL11.glLoadIdentity();
        org.lwjgl.opengl.GL11.glOrtho(0, 800, 600, 0, 1, -1);
        org.lwjgl.opengl.GL11.glMatrixMode(org.lwjgl.opengl.GL11.GL_MODELVIEW);
        org.lwjgl.opengl.GL11.glDisable(org.lwjgl.opengl.GL11.GL_CULL_FACE);
        org.lwjgl.opengl.GL11.glDisable(org.lwjgl.opengl.GL11.GL_DEPTH_TEST); 
        org.lwjgl.opengl.GL11.glClear(org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT);
        org.lwjgl.opengl.GL11.glLoadIdentity();

        // render font
        this.drawHudString();

        org.lwjgl.opengl.GL11.glEnable(org.lwjgl.opengl.GL11.GL_DEPTH_TEST);
        org.lwjgl.opengl.GL11.glEnable(org.lwjgl.opengl.GL11.GL_CULL_FACE);
        org.lwjgl.opengl.GL11.glMatrixMode(org.lwjgl.opengl.GL11.GL_PROJECTION);
        org.lwjgl.opengl.GL11.glPopMatrix();
        org.lwjgl.opengl.GL11.glMatrixMode(org.lwjgl.opengl.GL11.GL_MODELVIEW);
    }
}

The render function in this class is called after my 3D objects are rendered. I hope someone can help me out with this!

Answers


I have created a text class that renders text. It is written in java with LWJGL. Just do drawString("text", positionX, positionY, scale, width);

package text;

import org.lwjgl.opengl.GL11;

public class Text {

 public static void drawString(String s, float x, float y, float scale, float width) {
      float startX = x;
      scale = scale * 0.25f;
      GL11.glLineWidth(width);
      GL11.glBegin(GL11.GL_LINES);
      GL11.glEnable(GL11.GL_LINE_WIDTH);
      GL11.glColor3f(1, 1, 1);
      boolean space = false;
      int charNum = 1, spaceNum = 0;
      for (char c : s.toLowerCase().toCharArray()) {
          switch(c){
          case ' ':
              space = true;
              break;
          case '\n':
              y -= 2;
              startX -= charNum * (scale * 5);
              startX -= spaceNum * (scale * 3);
              spaceNum = 0;
              charNum = 0;
              break;
          case 'a':
            GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
            GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + -1));
            GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + -1));
            GL11.glVertex2f(scale * startX, scale * (y + -1));
            GL11.glVertex2f(scale * startX, scale * (y + -1));
            GL11.glVertex2f(scale * startX, scale * y);
            GL11.glVertex2f(scale * startX, scale * y);
            GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
            GL11.glVertex2f(scale * startX, scale * y);
            GL11.glVertex2f(scale * startX, scale * (y + 0.5f));
            GL11.glVertex2f(scale * startX, scale * (y + 0.5f));
            GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.5f));
              break;
          case 'b':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              break;
          case 'd':
              GL11.glVertex2f(scale * startX, scale * (y - 1));
              GL11.glVertex2f(scale * startX, scale * (y + 0.8f));
          case 'c':
              GL11.glVertex2f(scale * startX, scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * startX, scale * (y - 1));
              break;
          case 'e':
              GL11.glVertex2f(scale * startX, scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * startX, scale * y);
              GL11.glVertex2f(scale * startX, scale * (y - 0.5f));
              GL11.glVertex2f(scale * startX, scale * (y - 0.5f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 0.5f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 0.5f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 0.5f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              break;
          case 'f':
              GL11.glVertex2f(scale * (startX + 0.25f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.25f));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.25f));
              break;
          case 'g':
              GL11.glVertex2f(scale * (startX), scale * y);
              GL11.glVertex2f(scale * (startX), scale * (y - 1.5f));
              GL11.glVertex2f(scale * (startX), scale * (y - 1.5f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1.5f));
              GL11.glVertex2f(scale * (startX), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1f));
              break;
          case 'h':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              break;
          case 'i':
              GL11.glVertex2f(scale * (startX - 0.25f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1));
              GL11.glEnd();
              GL11.glPointSize(width);
              GL11.glBegin(GL11.GL_POINTS);
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y + 0.25f));
              GL11.glEnd();
              GL11.glBegin(GL11.GL_LINES);
              break;
          case 'j':
              GL11.glVertex2f(scale * (startX - 0.25f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1.5f));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1.5f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1.5f));
              GL11.glEnd();
              GL11.glPointSize(width);
              GL11.glBegin(GL11.GL_POINTS);
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y + 0.25f));
              GL11.glEnd();
              GL11.glBegin(GL11.GL_LINES);
              break;
          case 'k':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.25f));
              break;
          case 't':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.15f));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.15f));
          case 'l':
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1));
              break;
          case 'm':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.25f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.25f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * y);
              GL11.glVertex2f(scale * (startX), scale * y);
              GL11.glVertex2f(scale * (startX), scale * y);
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              break;
          case 'p':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1.5f));
          case 'o':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
          case 'n':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX), scale * y);
              GL11.glVertex2f(scale * (startX), scale * y);
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              break;
          case 'q':
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1.5f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX), scale * y);
              GL11.glVertex2f(scale * (startX), scale * y);
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              break;
          case 'r':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 0.15f));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y - 0.1f));
              break;
          case 's':
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 0.5f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 0.5f));
              GL11.glVertex2f(scale * (startX), scale * (y - 0.5f));
              GL11.glVertex2f(scale * (startX), scale * (y - 0.5f));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              break;
          case 'u':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * y);
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * y);
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              break;
          case 'w':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.125f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.125f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX + 0.125f), scale * (y));
              break;
          case 'v':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y));
              break;
          case 'x':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              break;
          case 'y':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.33f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1.5f));
              break;
          case 'z':
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              break;
          case '1':
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.25f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              break;
          case '2':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.65f));
              GL11.glVertex2f(scale * (startX - 0.3f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.3f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.15f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.15f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.35f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              break;
          case '3':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              break;
          case '4':
              GL11.glVertex2f(scale * startX, scale * (y + 0.8f));
              GL11.glVertex2f(scale * startX, scale * (y - 1));
              GL11.glVertex2f(scale * startX, scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              break;
          case '8':
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
          case '6':
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
          case '5':
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              break;
          case '7':
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              break;
          case '9':
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              break;
          case '0':
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y - 1));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX - 0.5f), scale * (y + 0.8f));
              GL11.glVertex2f(scale * (startX), scale * (y + 0.8f));
              break;
          }
          if(!space){
              startX += scale * 5;
              charNum++;
          }else{
              startX += scale * 3;
              spaceNum++;
          }
          space = false;
      }
      GL11.glEnd();
      GL11.glDisable(GL11.GL_LINE_WIDTH);
   }

}

You have already selected the answer above as solution but you said it doesn't work. The solution is scaling it by 0.01f or something like that depending on your setup. To scale use simply glScale(x,y,z). Also you habe to enable Blending like this:

glEnable(GL11.GL_BLEND);
glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

Need Your Help

Why does jProfiler show Unsafe.park/unpark as using CPU cycles?

java multithreading sun jprofiler

We're running a service using quite a lot of ExecutorServices.

Why doesn't winform open without Application.Run()?

c# .net winforms main

I tried to show a winform with the code below but it opens and immediately closes.