Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  [FIXED] I think I'm doing something wrong with VBOs  (Read 796 times)
0 Members and 1 Guest are viewing this topic.
Offline halibut

Junior Newbie





« Posted 2010-01-03 18:43:57 »

I just started doing some development with JOGL. I am fairly experienced with OpenGL, but this is my first time using JOGL.

I can run the WebStart VBO demo, so I'm confident that my environment is not the issue.

I am trying to create multiple rendering paths for a game engine, but I'm stuck on my VBO implementation. The JVM exception is being thrown when I try to call glDrawElements, but I'm not sure if it's a setup error, or an error when I try to draw.  All of my code is Scala, so instead of posting the code, I'll post the DebugGL2 output (which is a fantastic feature by the way).

Creating my Vertex Array VBO. There is some logic in here to make sure my buffer got copied correctly to video memory (The line between glMapBuffer and glUnMappBuffer is a check to make sure all of the data is the same after I copy it over)
1  
2  
3  
4  
5  
6  
glGenBuffers(<int> 0x1, <[I>, <int> 0x0)
glBindBuffer(<int> 0x8892, <int> 0x1)
glBufferData(<int> 0x8892, <int> 0xC0, <java.nio.Buffer> java.nio.DirectFloatBufferU[pos=0 lim=48 cap=48], <int> 0x88E0)
glMapBuffer(<int> 0x8892, <int> 0x88B8) = java.nio.DirectByteBuffer[pos=0 lim=192 cap=192]
Float Buffer data: (0,true)(1,true)(2,true)(3,true)(4,true)(5,true)(6,true)(7,true)(8,true)(9,true)(10,true)(11,true)(12,true)(13,true)(14,true)(15,true)(16,true)(17,true)(18,true)(19,true)(20,true)(21,true)(22,true)(23,true)(24,true)(25,true)(26,true)(27,true)(28,true)(29,true)(30,true)(31,true)(32,true)(33,true)(34,true)(35,true)(36,true)(37,true)(38,true)(39,true)(40,true)(41,true)(42,true)(43,true)(44,true)(45,true)(46,true)(47,true)
glUnmapBuffer(<int> 0x8892) = true


Creating my Color Array VBO. This is the same exact logic as when I create the Vertex Array VBO
1  
2  
3  
4  
5  
6  
glGenBuffers(<int> 0x1, <[I>, <int> 0x0)
glBindBuffer(<int> 0x8892, <int> 0x2)
glBufferData(<int> 0x8892, <int> 0xC0, <java.nio.Buffer> java.nio.DirectFloatBufferU[pos=0 lim=48 cap=48], <int> 0x88E0)
glMapBuffer(<int> 0x8892, <int> 0x88B8) = java.nio.DirectByteBuffer[pos=0 lim=192 cap=192]
Float Buffer data: (0,true)(1,true)(2,true)(3,true)(4,true)(5,true)(6,true)(7,true)(8,true)(9,true)(10,true)(11,true)(12,true)(13,true)(14,true)(15,true)(16,true)(17,true)(18,true)(19,true)(20,true)(21,true)(22,true)(23,true)(24,true)(25,true)(26,true)(27,true)(28,true)(29,true)(30,true)(31,true)(32,true)(33,true)(34,true)(35,true)(36,true)(37,true)(38,true)(39,true)(40,true)(41,true)(42,true)(43,true)(44,true)(45,true)(46,true)(47,true)
glUnmapBuffer(<int> 0x8892) = true


Creating the VBO for my face indices.
1  
2  
3  
4  
5  
6  
glGenBuffers(<int> 0x1, <[I>, <int> 0x0)
glBindBuffer(<int> 0x8893, <int> 0x3)
glBufferData(<int> 0x8893, <int> 0x40, <java.nio.Buffer> java.nio.DirectIntBufferU[pos=0 lim=16 cap=16], <int> 0x88E0)
glMapBuffer(<int> 0x8893, <int> 0x88B8) = java.nio.DirectByteBuffer[pos=0 lim=64 cap=64]
Int Buffer data: (0,true)(1,true)(2,true)(3,true)(4,true)(5,true)(6,true)(7,true)(8,true)(9,true)(10,true)(11,true)(12,true)(13,true)(14,true)(15,true)
glUnmapBuffer(<int> 0x8893) = true


Disabling VBOs
1  
2  
glBindBuffer(<int> 0x8892, <int> 0x0)
glBindBuffer(<int> 0x8893, <int> 0x0)


Rendering
1  
2  
3  
4  
5  
6  
7  
8  
glBindBuffer(<int> 0x8892, <int> 0x1)
glEnableClientState(<int> 0x8074)
glVertexPointer(<int> 0x3, <int> 0x1406, <int> 0x0, <long> 0)
glBindBuffer(<int> 0x8892, <int> 0x2)
glEnableClientState(<int> 0x8076)
glVertexPointer(<int> 0x3, <int> 0x1406, <int> 0x0, <long> 0)
glBindBuffer(<int> 0x8893, <int> 0x3)
glDrawElements(<int> 0x0, <int> 0x10, <int> 0x1405, <long> 0)


The error occurs in the glDrawElements method, and it is a JVM error.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
# An unexpected error has been detected by Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x2c74fee9, pid=3352, tid=548
#
# Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode windows-x86)
# Problematic frame:
# C  0x2c74fee9
#
# An error report file with more information is saved as:
# C:\projects\scala\game\reborn\client\hs_err_pid3352.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#


JOGL 2.0 beta 10
OS: Windows XP
GFX Card: Geforce 6600GT with latest drivers
JRE: 1.6

Any help would be greatly appreciated.
Offline halibut

Junior Newbie





« Reply #1 - Posted 2010-01-03 20:16:00 »

Just found the bug.  Instead of calling glColorPointer to set up my color buffer for drawing, I was calling glVertexPointer again.

Everything seems to be working fine now.
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.

TehJavaDev (11 views)
2014-08-28 18:26:30

CopyableCougar4 (24 views)
2014-08-22 19:31:30

atombrot (37 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (29 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56
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!