Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
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  
  Vertexbuffer not working an amd graphics (hd 5400)  (Read 863 times)
0 Members and 1 Guest are viewing this topic.
Offline RobinB

JGO Ninja


Medals: 44
Projects: 1
Exp: 3 years


Spacegame in progress


« Posted 2013-10-17 18:58:48 »

Hello everyone,

Im working at some game quite a time now, and everything is working perfect so far (maybe an wip soon).

However when i try the game on a pc with a hd5400 graphics card (drivers are up to date), all vbo draws simply dont draw anything.
I have rewritten stuff several times, without any progress, while it always works perfectly on my nvidia card.
Im getting kinda deperate now, does anyone have an clue what im doing wrong?


Code to draw the buffers:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
    public void InitDrawing(){
        glBindBuffer(GL_ARRAY_BUFFER, pointbufferid);
        if(updatepointbuffer){
            glBufferData(GL_ARRAY_BUFFER, pointbufferdata, type);
            updatepointbuffer = false;
        }
       
        glEnableClientState(GL_VERTEX_ARRAY);
        glVertexPointer(3, GL_FLOAT, stride, 0);
        int pointerloc = 12;
        for(int i = 0; i < attribs.size(); i++){
            pointerloc = attribs.get(i).Enable(stride, pointerloc);
        }
       
       
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexbufferid);
        if(updateindexbuffer){
            FillTriangleData();
            glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexbuferdata, type);
            updateindexbuffer = false;
        }
    }
   
    public void Draw(){      
        InitDrawing();

        glDrawElements(GL_TRIANGLES, indexsize, GL_UNSIGNED_INT, 0);
       
        FinishDrawing();
    }
   
    public void DrawPartial(int start, int count){
        glDrawElements(GL_TRIANGLES, count*3, GL_UNSIGNED_INT, start*3);
    }
   
    public void FinishDrawing(){
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
        glBindBuffer(GL_ARRAY_BUFFER, 0);
       
        glDisableClientState(GL_VERTEX_ARRAY);
       
        for(int i = 0; i < attribs.size(); i++){
            attribs.get(i).Disable();
        }
    }


The attribs beinig bound:
1  
2  
3  
4  
5  
6  
    public int Enable(int stride, int pointerloc){
        glEnableVertexAttribArray(loc);
        glVertexAttribPointer(loc, amount, type, false, stride, pointerloc);
       
        return pointerloc + getSize();
    }


Any help / comments is welcome.
Thanks in advance.
Offline gouessej
« Reply #1 - Posted 2013-10-18 17:05:57 »

Hi

Are you sure you need to call glVertexPointer? I would just use a VAO for that like here:
http://www.swiftless.com/tutorials/opengl4/4-opengl-4-vao.html

Offline quew8

JGO Coder


Medals: 32



« Reply #2 - Posted 2013-10-19 09:41:33 »

I'm sorry to say that some OpenGL drivers have "unexpected behaviour" (they aren't bugs since they don't violate the OpenGL specification) which can sometimes cause very annoying results. For example, one old NVidia graphics card I have requires me to have a shader in use before I can update any uniform variables.

I expect you've already done a thorough Google search but I think that's the way to go. Please bear in mind that in may not be the HD 5400 but rather the NVidia which has the problem ie it allows you to do something that other's don't. In fact, this may be completely wrong but I think NVidia tends to have more of these "unexpected behaviour"s than other cards. That may be complete slander but I think.

@Gouessej Yes that's what you would do, but he is not using VAOs.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #3 - Posted 2013-10-19 10:13:30 »

@Gouessej Yes that's what you would do, but he is not using VAOs.
He uses vertex attributes, you can see that he calls glEnableVertexAttribArray and glVertexAttribPointer. He should call glGetAttribLocation instead of assuming that the next location is pointerloc + getSize(). Moreover, glVertexAttribPointer should be enough, glVertexPointer is not required even without VAOs. I advise you to look at JMonkeyEngine 3 renderers, especially the one based on LWJGL:
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglRenderer.java?r=8283#2191

Offline quew8

JGO Coder


Medals: 32



« Reply #4 - Posted 2013-10-19 10:40:00 »

@Gouessej: Actually, now you mention it I think that is the problem. I just skimmed that bit.

@RobinB: glEnableVertexAttribArray() http://www.opengl.org/sdk/docs/man2/xhtml/glEnableVertexAttribArray.xml takes the index of the attribute not its location in memory. You bind an attribute to an index with glBindAttribLocation() http://www.opengl.org/sdk/docs/man2/xhtml/glBindAttribLocation.xml. Maybe your code is fine, but from the look of it I very much doubt it.

@Gouessej: It is perfectly okay to use both generic vertex attribs and the old fixed function vertex position attribute together.
Offline gouessej
« Reply #5 - Posted 2013-10-19 11:11:47 »

@Gouessej: It is perfectly okay to use both generic vertex attribs and the old fixed function vertex position attribute together.
Maybe it's in the gray zone, you know, the kind of thing that should be supported but sometimes it's not.

Offline RobinB

JGO Ninja


Medals: 44
Projects: 1
Exp: 3 years


Spacegame in progress


« Reply #6 - Posted 2013-10-19 14:21:48 »

Thanks for the comments.

Hi

Are you sure you need to call glVertexPointer? I would just use a VAO for that like here:
http://www.swiftless.com/tutorials/opengl4/4-opengl-4-vao.html
Thank you very much i removed glVertexPointer now Smiley, didnt know i could replace it.

@Gouessej: Actually, now you mention it I think that is the problem. I just skimmed that bit.

@RobinB: glEnableVertexAttribArray() http://www.opengl.org/sdk/docs/man2/xhtml/glEnableVertexAttribArray.xml takes the index of the attribute not its location in memory. You bind an attribute to an index with glBindAttribLocation() http://www.opengl.org/sdk/docs/man2/xhtml/glBindAttribLocation.xml. Maybe your code is fine, but from the look of it I very much doubt it.

@Gouessej: It is perfectly okay to use both generic vertex attribs and the old fixed function vertex position attribute together.
Maybe my code causes some confusion.
Written out it does this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
bindShader(shader);
//Get atribute location (inside the shader)
int loc = glGetAttribLocation(shader, name);

//Enable attribute
glEnableVertexAttribArray(loc);

//Bind attribute to pointer
//amount = number of variables
//type = GL_FLOAT and others
//stride is total size of attributes.
glVertexAttribPointer(loc, amount, type, false, stride, pointerloc);


Is this right, or am i understanding this wrongly?
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.

rwatson462 (28 views)
2014-12-15 09:26:44

Mr.CodeIt (19 views)
2014-12-14 19:50:38

BurntPizza (35 views)
2014-12-09 22:41:13

BurntPizza (70 views)
2014-12-08 04:46:31

JscottyBieshaar (32 views)
2014-12-05 12:39:02

SHC (44 views)
2014-12-03 16:27:13

CopyableCougar4 (40 views)
2014-11-29 21:32:03

toopeicgaming1999 (108 views)
2014-11-26 15:22:04

toopeicgaming1999 (94 views)
2014-11-26 15:20:36

toopeicgaming1999 (29 views)
2014-11-26 15:20:08
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!