Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6111149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:35:50+00:00 2026-05-23T14:35:50+00:00

I am tring to draw an object from an array of vertices. The method

  • 0

I am tring to draw an object from an array of vertices. The method for this requires a FloatBuffer instead of an array. I make a float buffer from the array but why i run the code i get an error. Btw all of the required attributes are enabled(openGL).

Code:

float vertices[] ={
        -1, -1, -1,   -1, -1,  1,   -1,  1,  1,   -1,  1, -1,
        1, -1, -1,    1, -1,  1,    1,  1,  1,    1,  1, -1,
        -1, -1, -1,   -1, -1,  1,    1, -1,  1,    1, -1, -1,
        -1,  1, -1,   -1,  1,  1,    1,  1,  1,    1,  1, -1,
        -1, -1, -1,   -1,  1, -1,    1,  1, -1,    1, -1, -1,
        -1, -1,  1,   -1,  1,  1,    1,  1,  1,    1, -1,  1
};

FloatBuffer temp = FloatBuffer.allocate(vertices.length);
temp.put(vertices);
GL11.glVertexPointer(3, GL11.GL_FLOAT, temp);

Error:

java.lang.IllegalArgumentException: FloatBuffer is not direct
    at org.lwjgl.BufferChecks.checkDirect(BufferChecks.java:139)
    at org.lwjgl.opengl.GL11.glVertexPointer(GL11.java:2622)
    at XLesson01.render(XLesson01.java:95)
    at XLesson01.run(XLesson01.java:51)
    at XLesson01.main(XLesson01.java:42)

New Code:

ByteBuffer temp = ByteBuffer.allocateDirect(vertices.length*8);
    temp.order(ByteOrder.nativeOrder());
    FloatBuffer buffer = temp.asFloatBuffer();
    buffer.put(vertices);
    GL11.glVertexPointer(3, GL11.GL_FLOAT, buffer);

New Error:

 A fatal error has been detected by the Java Runtime Environment:

  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x69aa9410, pid=3524, tid=1032

 JRE version: 6.0_22-b04# Java VM: Java HotSpot(TM) Client VM (17.1-b03 mixed mode, sharing windows-x86 )
 Problematic frame:
 C  [nvoglv32.DLL+0x5a9410]

 An error report file with more information is saved as:
 E:\java\workspace4\opengltest\hs_err_pid3524.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.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:35:51+00:00Added an answer on May 23, 2026 at 2:35 pm

    Obviously because it is not direct. You can allocate a direct FloatBuffer by creating a ByteBuffer with allocateDirect and then getting a FloatBuffer view of it with asFloatBuffer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am drawing one object using multi-texturing. That comes fine but when I draw
This is yet another Unit Testing question. I'm trying to draw knowledge from a
I am trying to use BitmapData.draw() on a video object, but using the OSMF
I am trying to draw a series of rectangles using OpenGL but some of
I'm trying to draw a vertical scrollbar for my G15 applet, but am having
I am trying to draw a textured cube using just 8 vertices and one
I want to draw directly on the desktop in C#. From searching a bit,
I'm trying to implement the following method: void Ball::DrawOn(Graphics g); The method should draw
In C++, I have an Object class, from which a number of other classes
So I have this array list that is populated using a csv file. Once

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.