Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (672)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (727)
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  
  General queries about LWJGL  (Read 1211 times)
0 Members and 1 Guest are viewing this topic.
Offline Stickjesus

Junior Newbie

« Posted 2013-09-23 15:31:42 »

Hey guys. I'm quite new to working with lwjgl (and game dev in 3d in general) and I was wondering if anyone could help me out with a few problems I'm having. Below is the project I'm working on to try and get some of the core concepts of lwjgl and 3d collisions and stuff so it will be a bit buggy but it will work for what I'm asking (I think).

Here's a list of questions that I would like answered.
1. How do I do 2d graphics for the player to act as a HUD. I've tried a few things I've seen online but it just blacks out my screen.
2. How do I get rid of the lines appearing on my skybox. Again I've tried a few things but it only made it marginally better instead of getting rid of it.
3. Is this the best way to do the skybox. It seems a little inefficient to me.
4. Is there anything that would be recommended for me to know that would come in handy?

Thanks in advance Smiley
Offline davedes
« Reply #1 - Posted 2013-09-23 16:07:03 »

You need to give more details and code, and not in RAR format. Just paste the relevant bits that are causing problems. We have no way of knowing how to fix your problem when all you say is "it just blacks out my screen." Tongue

To render HUD, you typically use two triangles in orthographic projection to make up a textured quad. Each quad may represent an icon (such as a button background) or even individual font glyphs. Ideally you should batch these into a single VBO (or vertex array) to reduce bandwidth.

For skyboxes, a common issue with seams appearing has to do with texture clamping. Use a different clamp mode, or use something like texture arrays. Better yet, you could use cube maps or another technique to texture your skybox. Another popular solution is to texture a sphere with an equirectangular sky map:

Offline Jeremy
« Reply #2 - Posted 2013-09-23 16:59:23 »

Why triangles? Why not quads using GL_QUADS?
Also why to batch in first place? Thats a lot of work to handle batching correctly. And using a UI with 100 elements shouldn't make a huge performance drop, right?
GL_QUADS is deprecated.

JevaEngine, Latest Playthrough (This demo is networked with a centralized server model)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline davedes
« Reply #3 - Posted 2013-09-23 19:28:52 »

Why triangles? Why not quads using GL_QUADS?
Also why to batch in first place? Thats a lot of work to handle batching correctly. And using a UI with 100 elements shouldn't make a huge performance drop, right?
Like Jeremy said, GL_QUADS is deprecated.

If you think batching is a lot of work, you shouldn't be working with pure OpenGL. Tongue Instead, use a library like LibGDX, jME, or whatever.

A single UI element might be made up of many quads. Imagine a typical checkbox: a nine-patch for the background, a quad for the checkbox icon, and N quads for each character in the text. That's already well over a dozen quads just for one UI element. You're looking at potentially hundreds of quads that need to be rendered.

And if you aren't using sprite sheets, then not only are you calling GL for every quad, but you are also incurring texture switches.

Besides; you don't have immediate mode in modern OpenGL, so you're going to be writing VBOs anyways...

On desktop it probably won't be too bad, but on mobile those things can definitely add up and slow down your game.

Offline Stickjesus

Junior Newbie

« Reply #4 - Posted 2013-09-24 08:07:35 »

Ok thanks a lot for the help guys.

Sorry for the vagueness of the code but I had a few questions and thought it would be easier to see the mistakes with the whole project.

I'm going to be working on some of the other problems I have but for now its more of a curiosity.
Here's everything in my game loop.
The 2d stuff in there is just temporary to get used to it.

I can't figure out why the box being drawn in 2d is all in black even though I have glColor3f(1,1,1); just before it.

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

IanParcs (49 views)
2016-04-18 14:18:53

KaiHH (47 views)
2016-04-18 08:35:41

KaiHH (77 views)
2016-04-15 12:43:58

theagentd (80 views)
2016-04-14 02:16:17

theagentd (95 views)
2016-04-14 02:15:43

IanParcs (107 views)
2016-04-12 03:51:16

IanParcs (49 views)
2016-04-12 03:50:03

IanParcs (45 views)
2016-04-12 03:49:54

IanParcs (42 views)
2016-04-12 03:49:52

IanParcs (50 views)
2016-04-12 03:49:52
Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30 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‑
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!