Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (804)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
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] I'm VBO'ing wrong...  (Read 3390 times)
0 Members and 1 Guest are viewing this topic.
Offline JonnyGingerKid

Junior Devvie


Medals: 1
Exp: 3 years



« Posted 2014-10-25 22:56:26 »

Hi! My problem is hopefully pretty straightforward. I'm starting to move away from immediate mode rendering and getting my feet wet with VBO's! I've seen a couple of tutorials, but when I try to write it out myself, it just won't render. I'm trying to render this 64x64 texture I made, which works fine in immediate mode, but when I try to use a VBO, nothing renders.

Here it is: http://pastebin.com/mc4yvdvK

Any idea why it doesn't render? (like I said, immediate mode works just fine)
Offline CopyableCougar4
« Reply #1 - Posted 2014-10-25 22:58:10 »

Do you make sure to bind the texture?

CopyableCougar4

Either wandering the forum or programming. Most likely the latter Smiley

Github: http://github.com/CopyableCougar4
Offline Longarmx
« Reply #2 - Posted 2014-10-25 23:38:04 »

Do you make sure to bind the texture?
Yep, he is.

@OP: Does glGetError print out anything other than 0?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CopyableCougar4
« Reply #3 - Posted 2014-10-25 23:43:10 »

Shouldn't there be something in the third argument, similar to
2 << 2
? I'm not an expert, but that's what it's like in my VBO helper class.

1  
glVertexPointer(2, GL_FLOAT, 0, 0);


CopyableCougar4

Either wandering the forum or programming. Most likely the latter Smiley

Github: http://github.com/CopyableCougar4
Offline JonnyGingerKid

Junior Devvie


Medals: 1
Exp: 3 years



« Reply #4 - Posted 2014-10-26 04:02:59 »

Shouldn't there be something in the third argument, similar to
2 << 2
? I'm not an expert, but that's what it's like in my VBO helper class.

1  
glVertexPointer(2, GL_FLOAT, 0, 0);


CopyableCougar4

You mean to put 2 << 2 as the third argument? Well in that case I tried it, and it still doesn't work. I swear I'm just missing one line somewhere, or I need to rearrange a couple of lines, but I just can't find which. Anyone else?
Offline thedanisaur

JGO Knight


Medals: 59



« Reply #5 - Posted 2014-10-26 04:24:09 »

No your array is tightly pack that looks fine, have you tried rendering without texture coords? You're positive your quad is built the same way(same vert order)? Maybe you're rendering the back face?

Why are you dividing your vertex size by two? Does RenderUtils.createFlippedBuffer expect to have the size halved? You still need a buffer to fit all the data... edit: I can read I promise....

Also, you aren't using the right buffers for your binds.
glVertexPointer(2, GL_FLOAT, 0, 0);
glTexCoordPointer(2, GL_FLOAT, 0, 0);

should be

glVertexPointer(2, GL_FLOAT, 0, vboVertices);
glTexCoordPointer(2, GL_FLOAT, 0, vboTexCoords);

Every village needs an idiot Cool
Offline SHC
« Reply #6 - Posted 2014-10-26 08:29:29 »

glVertexPointer(2, GL_FLOAT, 0, vboVertices);
glTexCoordPointer(2, GL_FLOAT, 0, vboTexCoords);

Nope, what you are saying is vertex arrays. That is not vbo.

Offline thedanisaur

JGO Knight


Medals: 59



« Reply #7 - Posted 2014-10-26 08:55:02 »

...those are the variables for his buffers? I don't know what you mean

Every village needs an idiot Cool
Offline Riven
Administrator

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2014-10-26 10:59:14 »

Check out my article:
http://www.java-gaming.org/topics/introduction-to-vertex-arrays-and-vertex-buffer-objects-opengl/24272/view.html

@thedanisaur: like SHC said, you are suggesting the way it works for VAs when the OP needs VBOs. If you're not familiar with the difference you could read up on how to use VBOs in OpenGL.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline SHC
« Reply #9 - Posted 2014-10-26 11:09:06 »

@Riven

I don't mean any offence, but I think your article needs more text, at least that's what I think. I've stumbled upon your article so many times when I was learning, but the amount of code always confused me, until I got to OpenGL Documentation to understand some (stride and offset, especially). I don't mean any offence, if it sounds as such, I'm sorry  Wink

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

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2014-10-26 11:16:08 »

I could improve it - the bit shifting (n << 2) seems to be too confusing for some, but then again, OpenGL is not a library for newbies. You are bound to have to read the documentation, so duplicating this effort seemed like a waste. I could add some links to docs in strategic places though.

If anything, the tutorial provides a lot of handholding already, and working code that you can tinker with, discovering what works and what crashes the JVM.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (581 views)
2019-09-04 15:33:17

hadezbladez (5510 views)
2018-11-16 13:46:03

hadezbladez (2402 views)
2018-11-16 13:41:33

hadezbladez (5772 views)
2018-11-16 13:35:35

hadezbladez (1223 views)
2018-11-16 13:32:03

EgonOlsen (4661 views)
2018-06-10 19:43:48

EgonOlsen (5682 views)
2018-06-10 19:43:44

EgonOlsen (3198 views)
2018-06-10 19:43:20

DesertCoockie (4095 views)
2018-05-13 18:23:11

nelsongames (5115 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04: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!