Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (496)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 647 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).

https://www.dropbox.com/s/n1fq5cdi4r7qwmi/lwjglTester.rar

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:
http://mrdoob.github.io/three.js/examples/webgl_panorama_equirectangular.html

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)

http://www.youtube.com/watch?v=rWA8bajpVXg
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. http://pastebin.com/1WVN7NBr
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.

Thanks
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.

BurntPizza (14 views)
2014-09-19 03:14:18

Dwinin (32 views)
2014-09-12 09:08:26

Norakomi (58 views)
2014-09-10 13:57:51

TehJavaDev (80 views)
2014-09-10 06:39:09

Tekkerue (40 views)
2014-09-09 02:24:56

mitcheeb (62 views)
2014-09-08 06:06:29

BurntPizza (46 views)
2014-09-07 01:13:42

Longarmx (33 views)
2014-09-07 01:12:14

Longarmx (37 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
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!