Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (686)
Games in Android Showcase (198)
games submitted by our members
Games in WIP (758)
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] interleaved VBO (textured quad) (help with Indices)  (Read 808 times)
0 Members and 1 Guest are viewing this topic.
Offline orange451

JGO Kernel


Medals: 176
Projects: 4
Exp: 5 years


Your face. Your ass. What's the difference?


« Posted 2014-03-11 01:26:23 »

So I decided to try to update my method of using VBO's, as apparently I was using a deprecated method which doesn't work well on the core version of openGL (on this computer).

Upon looking at this example: http://www.lwjgl.org/wiki/index.php?title=The_Quad_textured which uses the updated method, I noticed something I hadn't used before. Indices. It's pretty well explained in that example, but what I haven't been able to understand, is why it seems to require a byteBuffer. When I change it to say an IntBuffer, or a FloatBuffer, the quad no longer renders.

Why is this?

Working on a nice FPS in lwjgl Smiley http://i.imgur.com/q4uFqBS.png
Feel free to message me if you're interested!
WEBSITE
Offline Longarmx
« Reply #1 - Posted 2014-03-11 01:33:29 »

1  
GL11.glDrawElements(GL11.GL_TRIANGLES, indicesCount, GL11.GL_UNSIGNED_BYTE, 0);


See the GL_UNSIGNED_BYTE? Change that to GL_UNSIGNED_INT to specify the indices data type. You can then change the type to a floatbuffer. Also, indices shouldn't be a floatbuffer. It is sort of hard to have half a vertex  Wink

Offline orange451

JGO Kernel


Medals: 176
Projects: 4
Exp: 5 years


Your face. Your ass. What's the difference?


« Reply #2 - Posted 2014-03-11 01:35:12 »

 I feel dumb... that should have been an easy catch xD

Thanks! Smiley

[edit]
The only reason I would ever think of a float buffer, is because they have a larger maximum value than an int (afaik). BUT, I forgot Java doesn't use the typical 4byte integer... so it's maximum value is fine Smiley

Working on a nice FPS in lwjgl Smiley http://i.imgur.com/q4uFqBS.png
Feel free to message me if you're interested!
WEBSITE
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
roseslayer (471 views)
2016-08-06 11:43:29

roseslayer (428 views)
2016-08-06 09:43:11

xTheGamerCodes (505 views)
2016-08-04 15:40:59

xTheGamerCodes (497 views)
2016-08-04 15:40:24

orrenravid (846 views)
2016-07-16 03:57:23

theagentd (923 views)
2016-07-11 14:28:54

Hydroque (1019 views)
2016-07-06 05:56:57

Hydroque (1017 views)
2016-07-03 08:52:54

GrandCastle (831 views)
2016-07-01 09:13:47

GrandCastle (640 views)
2016-07-01 09:09:45
Rendering resources
by Roquen
2016-08-08 05:55:21

Rendering resources
by Roquen
2016-08-08 05:52:42

Rendering resources
by Roquen
2016-08-08 05:50:38

Rendering resources
by Roquen
2016-08-08 05:49:53

Rendering resources
by Roquen
2016-08-08 05:32:39

Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42
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!