Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
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  
  [LWJGL Texture render order?] *solved*  (Read 1039 times)
0 Members and 1 Guest are viewing this topic.
Offline GabrielBailey74
« Posted 2013-01-28 23:57:33 »

Hey JGO, I've gotten a little more familiar with LWJGL since my last 3D render attempt, but I'm still trying to get the hang of it.

I've managed to setup:
Basic FPS like movement (Key movement & Mouse rotation)
A 20x20 Quad Grid, composed of 64x64 textured tiles. (All flat)
A few boxes stacked on top of each other in the corner.

What the issue is:
I'm a LWJGL Noob so I don't exactly know.
To explain this from my point of view, it look's as if there's something that I'm doing wrong relating to the order of Object rendering. (See below)

Here's a picture of the issue, this only occurs if I'm below the object:
(Could be explained better, I'm hoping the pictures will help. You can notice the textures look weird)


If I'm above the objects it doesn't happen:


I figured this problem was relating to the order of which I was rendering my objects, so I went in and rendered them backwards.
Now the issue is the same, just in the opposite direction.

If I'm below the object the issue doesn't occur:
(With rendering orders reversed)


But if I'm above the object the issue occurs:
(With rendering orders reversed)


Notes
:
This happens on all sided of the object.
At the moment I'm currently making several calls to glBegin(GL_QUADS), and I'm applying texture coordinates, everything works fine.
I do make alot of calls to OpenGL during Initialization of OpenGL, (glEnables, hints etc) I've tried removing all of them minus the bare minimum needed for the view port, still the same issue.
If anyone would like to see any code, please let me know what.
If this belongs in the 'Newbie and Debugging questions', please let me know.

Question:
Should I be rendering multiple quads within 1 single glBegin(GL_QUADS) call? (Not doing it like that at the moment)

Looking forward to some feedback JGO anything would be helpful thanks.


Offline Riven
« League of Dukes »

JGO Overlord


Medals: 817
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2013-01-29 00:00:39 »

Enable the depth-buffer.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline GabrielBailey74
« Reply #2 - Posted 2013-01-29 00:02:52 »

Enable the depth-buffer.

Wow Riven, thanks man works perfectly.
(Thought it was glEnable(GL_DEPTH)) persecutioncomplex persecutioncomplex persecutioncomplex
1  
glEnable(GL_DEPTH_TEST);


25 Lines of glEnables/hints and that one wasn't in there. Pointing

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 817
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2013-01-29 00:03:41 »

Don't forget to configure it properly using glDepthFunc

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline GabrielBailey74
« Reply #4 - Posted 2013-01-29 00:04:43 »

Don't forget to configure it properly using glDepthFunc

glDepthFunc at the moment is:
1  
glDepthFunc(GL_LEQUAL); 


I'll go look into that, thanks again.

Offline Vladiedoo
« Reply #5 - Posted 2013-01-29 00:55:14 »

In regards to your question, yes. The fewer times you can call glBegin and glEnd the better (for performance).
Offline PandaMoniumHUN

JGO Coder


Medals: 32
Exp: 3 years


White-bearded OGL wizard


« Reply #6 - Posted 2013-01-29 09:59:25 »

There's several OpenGL debugging functions out there, don't forget to put them in your main loop, so things like that won't occur.

My Blog | Jumpbutton Studio - INOP Programmer
Can't stress enough: Don't start game development until you haven't got the basics of programming down! Pointing
Offline theagentd
« Reply #7 - Posted 2013-01-29 17:12:32 »

There's several OpenGL debugging functions out there, don't forget to put them in your main loop, so things like that won't occur.
There are? Non that would help for this, I think.

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

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (43 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (38 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (68 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (86 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!