Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
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  
  Question on GL_QUAD and compatibilty across GPU manufacturers  (Read 2184 times)
0 Members and 1 Guest are viewing this topic.
Offline theGINItheM

Senior Newbie





« Posted 2011-05-29 12:25:16 »

Hello Gentlemen,
I observed that my code runs fine on NVidia 8000 series and recent ATI cards. Due to an array of uniforms within my fragment shader it's not compatible to NVidia 7000 series and older, but that's not the question. Important is, it runs on both NVidia and ATI "state of the art" cards.

I stick to openGL 2.0 (and GLSL 1.2). Most objects I render are GL_QUADs (and some TRIANGLES, very few though (see the sphere below)). A friend of mine has problems showing the QUADS, the TRIANGLES however show correctly.

Let me start with some pictures:
It should look like this:

but with him, it looks like this:


He uses an Asus Nvidia ENGT 240.

It looks like the upper-right triangle of each quad is correct, the lower left however completely distorted. Does anybody have an idea whether this is a known problem with QUADs?


Thanks to all! Cheers, J
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #1 - Posted 2011-05-29 14:01:40 »

I've seen that happen on overclocked / overheating graphics cards before, presumably because of some kind of memory corruption.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline theGINItheM

Senior Newbie





« Reply #2 - Posted 2011-05-29 14:10:45 »

Update on what I claimed above:
I changed my code so I use two triangles instead of one quad. Still the same though.

@Tang: It's always the same triangle, for each "Quad", no flickering or anything. I was able to reproduce a similar behavior on my machine by messing around with the strides in my VBOs. Hence I expect the origin of the problem somewhere in my code. Maybe that specific card sets one of the openGL flags to another value than any other card? *shrug*

This is the main part to render my thingies, maybe there's an obvious mistake somewhere?
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  
      // PREPARE VERTICES AND TEXTURE COORDINATES
     FloatBuffer TexData = makeFloatBuffer(new float[4 * 2]);
      TexData.put(new float[] { 1, 1 });
      TexData.put(new float[] { 0, 1 });
      TexData.put(new float[] { 0, 0 });
      TexData.put(new float[] { 1, 0 });
      TexData.rewind();

      FloatBuffer VertexData = makeFloatBuffer(new float[4 * 2]);
      VertexData.put(new float[] { x, y });
      VertexData.put(new float[] { x + scale * width, y });
      VertexData.put(new float[] { x + scale * width, y + scale * height });
      VertexData.put(new float[] { x, y + scale * height });
      VertexData.rewind();

      // COPY THAT DATA TO VRAM
     glBindBuffer(GL_ARRAY_BUFFER, VOL_VBO1);
      glBufferData(GL_ARRAY_BUFFER, VertexData, GL_STATIC_DRAW);
      glBindBuffer(GL_ARRAY_BUFFER, 0);
      glBindBuffer(GL_ARRAY_BUFFER, VOL_VBO2);
      glBufferData(GL_ARRAY_BUFFER, TexData, GL_STATIC_DRAW);
      glBindBuffer(GL_ARRAY_BUFFER, 0);

      // LOAD THE VBO
     glBindBuffer(GL_ARRAY_BUFFER, VOL_VBO1);
      glVertexAttribPointer(saPositionHandle, 4, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);
     
      // LOAD THE TEXTURE POSITIONS
     glBindBuffer(GL_ARRAY_BUFFER, VOL_VBO2);
      glVertexAttribPointer(saTexturePosHandle, 4, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);

      // LOAD THE IBO AND DRAW
     glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, TWO_TRAINGLE_IBO);
      glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #3 - Posted 2011-05-30 13:31:36 »

I've seen that happen on overclocked / overheating graphics cards before, presumably because of some kind of memory corruption.
I agree with you, I got the same symptom when my former ATI X1950 Pro was really too hot.

Offline theGINItheM

Senior Newbie





« Reply #4 - Posted 2011-05-30 19:19:47 »

Orangy Tang and Goussej:
Thanks for your thoughts on this - and thanks for assuming the error is not in my code.

But as this is my first openGL app I think I'll stick with the assumption that I'm doing something wrong... for now.

There are a few things in my shaders that are incompatible with older cards (arrays of uniforms @ frag...). While those cards are unable to compile the shaders, I assume this might have negative effects on newer cards as well.

I'll let you know what it was once I found it.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 748
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #5 - Posted 2011-05-31 19:35:08 »

1  
2  
3  
      glVertexAttribPointer(saPositionHandle, 4, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);

      glVertexAttribPointer(saTexturePosHandle, 4, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);

You state your attributes are 4-dimensional, while they are 2-dimensional.

1  
2  
3  
      glVertexAttribPointer(saPositionHandle, 2, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);

      glVertexAttribPointer(saTexturePosHandle, 2, GL_FLOAT, false, 2 * FLOAT_SIZE_BYTES, 0);

That should do it.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline theGINItheM

Senior Newbie





« Reply #6 - Posted 2011-06-01 17:23:48 »

Hi Riven,
thanks a lot. Not only that you took the time to read through my code sample but also for pointing out what the second argument of "glVertexAttribPointer" really is for. I thought it was the "length" of the buffer to copy, not the length of a single coordinate.

Cool. I'm happy!

Added a "Star" named Riven to my Game:
1  
2  
3  
4  
5  
6  
mysql> select * from STARS where id = 50002;
+-------+------+------+------+--------+------+------------+-------+
| ID    | X    | Y    | SIZE | SPOKES | HALO | COLOR      | NAME  |
+-------+------+------+------+--------+------+------------+-------+
| 50002 |  -10 |  -10 |    1 |      9 |    0 | 2147483647 | Riven |
+-------+------+------+------+--------+------+------------+-------+


The big one in the middle:
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 748
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #7 - Posted 2011-06-01 18:25:19 »

Yay, seems to be near the center of the universe! Pointing

Glad I could help, parameters in OpenGL are sometimes surprisingly hard to decipher when you don't yet master the terminology.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
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.

CogWheelz (12 views)
2014-07-30 21:08:39

Riven (21 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (32 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (29 views)
2014-07-23 21:07:15

Riven (30 views)
2014-07-23 20:56:16
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!